Skip to content

Commit

Permalink
* support audio api, add to_jpeg for image
Browse files Browse the repository at this point in the history
  • Loading branch information
lxowalle committed May 10, 2024
1 parent bcc8a45 commit f44f2a0
Show file tree
Hide file tree
Showing 155 changed files with 23,892 additions and 13 deletions.
1 change: 1 addition & 0 deletions components/3rd_party/alsa_lib/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
!*
38 changes: 38 additions & 0 deletions components/3rd_party/alsa_lib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@

# sophgo-alsa_lib
# set(alsa_lib_version_str "${CONFIG_SOPHGO_alsa_lib_VERSION_MAJOR}.${CONFIG_SOPHGO_alsa_lib_VERSION_MINOR}.${CONFIG_SOPHGO_alsa_lib_VERSION_PATCH}")
# set(alsa_lib_filename "sophgo-alsa_lib-${alsa_lib_version_str}.tar.xz")
# set(alsa_lib_unzip_path "${DL_EXTRACTED_PATH}/sophgo-alsa_lib")
# set(alsa_lib_src_path "${alsa_lib_unzip_path}/sophgo-alsa_lib-${alsa_lib_version_str}")
# if(${alsa_lib_version_str} VERSION_EQUAL "0.0.1")
# set(alsa_lib_url "https://files.catbox.moe/bq5duu.xz")
# set(alsa_lib_file_sha256sum "524021c333d9c601bd1e3a962dce02711269cc7bc342679ff317aa038e9679bd")
# else()
# message(FATAL_ERROR "No sophgo alsa_lib version ${version_str} support, please edit to add sophgo alsa_lib support for this version")
# endif()

# list(APPEND ADD_FILE_DOWNLOADS "{
# 'url': '${alsa_lib_url}',
# 'urls': [],
# 'sites': [],
# 'sha256sum': '${alsa_lib_file_sha256sum}',
# 'filename': '${alsa_lib_filename}',
# 'path': 'sophgo-alsa_lib',
# 'check_files': ['sophgo-alsa_lib-${alsa_lib_version_str}']
# }"
# )

set(alsa_lib_dir "lib")

# include
set(alsa_lib_include_dir "include")
list(APPEND ADD_INCLUDE ${alsa_lib_include_dir})
set_property(SOURCE ${alsa_lib_include_dir} PROPERTY GENERATED 1)

# lib
set(alsa_lib_dynamic_lib_file ${alsa_lib_dir}/libasound.so
${alsa_lib_dir}/libatopology.so)
list(APPEND ADD_DYNAMIC_LIB ${alsa_lib_dynamic_lib_file})
set_property(SOURCE ${alsa_lib_dynamic_lib_file} PROPERTY GENERATED 1)

register_component()
Binary file added components/3rd_party/alsa_lib/bin/aserver
Binary file not shown.
346 changes: 346 additions & 0 deletions components/3rd_party/alsa_lib/include/alsa/asoundef.h

Large diffs are not rendered by default.

68 changes: 68 additions & 0 deletions components/3rd_party/alsa_lib/include/alsa/asoundlib.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/**
* \file include/asoundlib.h
* \brief Application interface library for the ALSA driver
* \author Jaroslav Kysela <[email protected]>
* \author Abramo Bagnara <[email protected]>
* \author Takashi Iwai <[email protected]>
* \date 1998-2001
*
* Application interface library for the ALSA driver
*/
/*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/

#ifndef __ASOUNDLIB_H
#define __ASOUNDLIB_H

#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <string.h>
#include <fcntl.h>
#include <assert.h>
#include <poll.h>
#include <errno.h>
#include <stdarg.h>
#include <endian.h>

#ifndef DOC_HIDDEN
#ifndef __GNUC__
#define __inline__ inline
#endif
#endif /* DOC_HIDDEN */

#include <alsa/asoundef.h>
#include <alsa/version.h>
#include <alsa/global.h>
#include <alsa/input.h>
#include <alsa/output.h>
#include <alsa/error.h>
#include <alsa/conf.h>
#include <alsa/pcm.h>
#include <alsa/rawmidi.h>
#include <alsa/ump.h>
#include <alsa/timer.h>
#include <alsa/hwdep.h>
#include <alsa/control.h>
#include <alsa/mixer.h>
#include <alsa/seq_event.h>
#include <alsa/seq.h>
#include <alsa/seqmid.h>
#include <alsa/seq_midi_event.h>

#endif /* __ASOUNDLIB_H */
242 changes: 242 additions & 0 deletions components/3rd_party/alsa_lib/include/alsa/conf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,242 @@
/**
* \file include/conf.h
* \brief Application interface library for the ALSA driver
* \author Jaroslav Kysela <[email protected]>
* \author Abramo Bagnara <[email protected]>
* \author Takashi Iwai <[email protected]>
* \date 1998-2001
*
* Application interface library for the ALSA driver
*/
/*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/

#ifndef __ALSA_CONF_H
#define __ALSA_CONF_H

#ifdef __cplusplus
extern "C" {
#endif

/**
* \defgroup Configuration Configuration Interface
* The configuration functions and types allow you to read, enumerate,
* modify and write the contents of ALSA configuration files.
* \{
*/

/** \brief \c dlsym version for the config evaluate callback. */
#define SND_CONFIG_DLSYM_VERSION_EVALUATE _dlsym_config_evaluate_001
/** \brief \c dlsym version for the config hook callback. */
#define SND_CONFIG_DLSYM_VERSION_HOOK _dlsym_config_hook_001

/** \brief Configuration node type. */
typedef enum _snd_config_type {
/** Integer number. */
SND_CONFIG_TYPE_INTEGER,
/** 64-bit integer number. */
SND_CONFIG_TYPE_INTEGER64,
/** Real number. */
SND_CONFIG_TYPE_REAL,
/** Character string. */
SND_CONFIG_TYPE_STRING,
/** Pointer (runtime only, cannot be saved). */
SND_CONFIG_TYPE_POINTER,
/** Compound node. */
SND_CONFIG_TYPE_COMPOUND = 1024
} snd_config_type_t;

/**
* \brief Internal structure for a configuration node object.
*
* The ALSA library uses a pointer to this structure as a handle to a
* configuration node. Applications don't access its contents directly.
*/
typedef struct _snd_config snd_config_t;
/**
* \brief Type for a configuration compound iterator.
*
* The ALSA library uses this pointer type as a handle to a configuration
* compound iterator. Applications don't directly access the contents of
* the structure pointed to by this type.
*/
typedef struct _snd_config_iterator *snd_config_iterator_t;
/**
* \brief Internal structure for a configuration private update object.
*
* The ALSA library uses this structure to save private update information.
*/
typedef struct _snd_config_update snd_config_update_t;

extern snd_config_t *snd_config;

const char *snd_config_topdir(void);

int snd_config_top(snd_config_t **config);

int snd_config_load(snd_config_t *config, snd_input_t *in);
int snd_config_load_string(snd_config_t **config, const char *s, size_t size);
int snd_config_load_override(snd_config_t *config, snd_input_t *in);
int snd_config_save(snd_config_t *config, snd_output_t *out);
int snd_config_update(void);
int snd_config_update_r(snd_config_t **top, snd_config_update_t **update, const char *path);
int snd_config_update_free(snd_config_update_t *update);
int snd_config_update_free_global(void);

int snd_config_update_ref(snd_config_t **top);
void snd_config_ref(snd_config_t *top);
void snd_config_unref(snd_config_t *top);

int snd_config_search(snd_config_t *config, const char *key,
snd_config_t **result);
int snd_config_searchv(snd_config_t *config,
snd_config_t **result, ...);
int snd_config_search_definition(snd_config_t *config,
const char *base, const char *key,
snd_config_t **result);

/**
* \brief custom expansion callback
* \param[out] dst The function puts the handle to the new configuration
* node at the address specified by \a dst.
* \param[in] s string the string to be expanded
* \param[in] private_data Handle to the \c private_data node.
* \return A non-negative value if successful, otherwise a negative error code.
*
* Use a function of this type to define a custom expansion
*/
typedef int (*snd_config_expand_fcn_t)(snd_config_t **dst, const char *s, void *private_data);

int snd_config_expand_custom(snd_config_t *config, snd_config_t *root,
snd_config_expand_fcn_t fcn, void *private_data,
snd_config_t **result);
int snd_config_expand(snd_config_t *config, snd_config_t *root,
const char *args, snd_config_t *private_data,
snd_config_t **result);
int snd_config_evaluate(snd_config_t *config, snd_config_t *root,
snd_config_t *private_data, snd_config_t **result);
int snd_config_evaluate_string(snd_config_t **dst, const char *s,
snd_config_expand_fcn_t fcn, void *private_data);

int snd_config_add(snd_config_t *config, snd_config_t *child);
int snd_config_add_before(snd_config_t *before, snd_config_t *child);
int snd_config_add_after(snd_config_t *after, snd_config_t *child);
int snd_config_remove(snd_config_t *config);
int snd_config_delete(snd_config_t *config);
int snd_config_delete_compound_members(const snd_config_t *config);
int snd_config_copy(snd_config_t **dst, snd_config_t *src);
int snd_config_substitute(snd_config_t *dst, snd_config_t *src);
int snd_config_merge(snd_config_t *dst, snd_config_t *src, int override);

int snd_config_make(snd_config_t **config, const char *key,
snd_config_type_t type);
int snd_config_make_integer(snd_config_t **config, const char *key);
int snd_config_make_integer64(snd_config_t **config, const char *key);
int snd_config_make_real(snd_config_t **config, const char *key);
int snd_config_make_string(snd_config_t **config, const char *key);
int snd_config_make_pointer(snd_config_t **config, const char *key);
int snd_config_make_compound(snd_config_t **config, const char *key, int join);
int snd_config_make_path(snd_config_t **config, snd_config_t *root, const char *key,
int join, int override);

int snd_config_imake_integer(snd_config_t **config, const char *key, const long value);
int snd_config_imake_integer64(snd_config_t **config, const char *key, const long long value);
int snd_config_imake_real(snd_config_t **config, const char *key, const double value);
int snd_config_imake_string(snd_config_t **config, const char *key, const char *ascii);
int snd_config_imake_safe_string(snd_config_t **config, const char *key, const char *ascii);
int snd_config_imake_pointer(snd_config_t **config, const char *key, const void *ptr);

snd_config_type_t snd_config_get_type(const snd_config_t *config);
int snd_config_is_array(const snd_config_t *config);
int snd_config_is_empty(const snd_config_t *config);

int snd_config_set_id(snd_config_t *config, const char *id);
int snd_config_set_integer(snd_config_t *config, long value);
int snd_config_set_integer64(snd_config_t *config, long long value);
int snd_config_set_real(snd_config_t *config, double value);
int snd_config_set_string(snd_config_t *config, const char *value);
int snd_config_set_ascii(snd_config_t *config, const char *ascii);
int snd_config_set_pointer(snd_config_t *config, const void *ptr);
int snd_config_get_id(const snd_config_t *config, const char **value);
int snd_config_get_integer(const snd_config_t *config, long *value);
int snd_config_get_integer64(const snd_config_t *config, long long *value);
int snd_config_get_real(const snd_config_t *config, double *value);
int snd_config_get_ireal(const snd_config_t *config, double *value);
int snd_config_get_string(const snd_config_t *config, const char **value);
int snd_config_get_ascii(const snd_config_t *config, char **value);
int snd_config_get_pointer(const snd_config_t *config, const void **value);
int snd_config_test_id(const snd_config_t *config, const char *id);

snd_config_iterator_t snd_config_iterator_first(const snd_config_t *node);
snd_config_iterator_t snd_config_iterator_next(const snd_config_iterator_t iterator);
snd_config_iterator_t snd_config_iterator_end(const snd_config_t *node);
snd_config_t *snd_config_iterator_entry(const snd_config_iterator_t iterator);

/**
* \brief Helper macro to iterate over the children of a compound node.
* \param[in,out] pos Iterator variable for the current node.
* \param[in,out] next Temporary iterator variable for the next node.
* \param[in] node Handle to the compound configuration node to iterate over.
*
* Use this macro like a \c for statement, e.g.:
* \code
* snd_config_iterator_t pos, next;
* snd_config_for_each(pos, next, node) {
* snd_config_t *entry = snd_config_iterator_entry(pos);
* ...
* }
* \endcode
*
* This macro allows deleting or removing the current node.
*/
#define snd_config_for_each(pos, next, node) \
for (pos = snd_config_iterator_first(node), next = snd_config_iterator_next(pos); pos != snd_config_iterator_end(node); pos = next, next = snd_config_iterator_next(pos))

/* Misc functions */

int snd_config_get_bool_ascii(const char *ascii);
int snd_config_get_bool(const snd_config_t *conf);
int snd_config_get_card(const snd_config_t *conf);
int snd_config_get_ctl_iface_ascii(const char *ascii);
int snd_config_get_ctl_iface(const snd_config_t *conf);

/* Names functions */

/**
* Device-name list element
*/
typedef struct snd_devname snd_devname_t;

/**
* Device-name list element (definition)
*/
struct snd_devname {
char *name; /**< Device name string */
char *comment; /**< Comments */
snd_devname_t *next; /**< Next pointer */
};

int snd_names_list(const char *iface, snd_devname_t **list);
void snd_names_list_free(snd_devname_t *list);

/** \} */

#ifdef __cplusplus
}
#endif

#endif /* __ALSA_CONF_H */
Loading

0 comments on commit f44f2a0

Please sign in to comment.