Path: blob/master/thirdparty/linuxbsd_headers/alsa/conf.h
9898 views
/**1* \file include/conf.h2* \brief Application interface library for the ALSA driver3* \author Jaroslav Kysela <[email protected]>4* \author Abramo Bagnara <[email protected]>5* \author Takashi Iwai <[email protected]>6* \date 1998-20017*8* Application interface library for the ALSA driver9*/10/*11* This library is free software; you can redistribute it and/or modify12* it under the terms of the GNU Lesser General Public License as13* published by the Free Software Foundation; either version 2.1 of14* the License, or (at your option) any later version.15*16* This program is distributed in the hope that it will be useful,17* but WITHOUT ANY WARRANTY; without even the implied warranty of18* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the19* GNU Lesser General Public License for more details.20*21* You should have received a copy of the GNU Lesser General Public22* License along with this library; if not, write to the Free Software23* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA24*25*/2627#ifndef __ALSA_CONF_H28#define __ALSA_CONF_H2930#ifdef __cplusplus31extern "C" {32#endif3334/**35* \defgroup Config Configuration Interface36* The configuration functions and types allow you to read, enumerate,37* modify and write the contents of ALSA configuration files.38* \{39*/4041/** \brief \c dlsym version for the config evaluate callback. */42#define SND_CONFIG_DLSYM_VERSION_EVALUATE _dlsym_config_evaluate_00143/** \brief \c dlsym version for the config hook callback. */44#define SND_CONFIG_DLSYM_VERSION_HOOK _dlsym_config_hook_0014546/** \brief Configuration node type. */47typedef enum _snd_config_type {48/** Integer number. */49SND_CONFIG_TYPE_INTEGER,50/** 64-bit integer number. */51SND_CONFIG_TYPE_INTEGER64,52/** Real number. */53SND_CONFIG_TYPE_REAL,54/** Character string. */55SND_CONFIG_TYPE_STRING,56/** Pointer (runtime only, cannot be saved). */57SND_CONFIG_TYPE_POINTER,58/** Compound node. */59SND_CONFIG_TYPE_COMPOUND = 102460} snd_config_type_t;6162/**63* \brief Internal structure for a configuration node object.64*65* The ALSA library uses a pointer to this structure as a handle to a66* configuration node. Applications don't access its contents directly.67*/68typedef struct _snd_config snd_config_t;69/**70* \brief Type for a configuration compound iterator.71*72* The ALSA library uses this pointer type as a handle to a configuration73* compound iterator. Applications don't directly access the contents of74* the structure pointed to by this type.75*/76typedef struct _snd_config_iterator *snd_config_iterator_t;77/**78* \brief Internal structure for a configuration private update object.79*80* The ALSA library uses this structure to save private update information.81*/82typedef struct _snd_config_update snd_config_update_t;8384extern snd_config_t *snd_config;8586int snd_config_top(snd_config_t **config);8788int snd_config_load(snd_config_t *config, snd_input_t *in);89int snd_config_load_override(snd_config_t *config, snd_input_t *in);90int snd_config_save(snd_config_t *config, snd_output_t *out);91int snd_config_update(void);92int snd_config_update_r(snd_config_t **top, snd_config_update_t **update, const char *path);93int snd_config_update_free(snd_config_update_t *update);94int snd_config_update_free_global(void);9596int snd_config_update_ref(snd_config_t **top);97void snd_config_ref(snd_config_t *top);98void snd_config_unref(snd_config_t *top);99100int snd_config_search(snd_config_t *config, const char *key,101snd_config_t **result);102int snd_config_searchv(snd_config_t *config,103snd_config_t **result, ...);104int snd_config_search_definition(snd_config_t *config,105const char *base, const char *key,106snd_config_t **result);107108int snd_config_expand(snd_config_t *config, snd_config_t *root,109const char *args, snd_config_t *private_data,110snd_config_t **result);111int snd_config_evaluate(snd_config_t *config, snd_config_t *root,112snd_config_t *private_data, snd_config_t **result);113114int snd_config_add(snd_config_t *config, snd_config_t *leaf);115int snd_config_delete(snd_config_t *config);116int snd_config_delete_compound_members(const snd_config_t *config);117int snd_config_copy(snd_config_t **dst, snd_config_t *src);118119int snd_config_make(snd_config_t **config, const char *key,120snd_config_type_t type);121int snd_config_make_integer(snd_config_t **config, const char *key);122int snd_config_make_integer64(snd_config_t **config, const char *key);123int snd_config_make_real(snd_config_t **config, const char *key);124int snd_config_make_string(snd_config_t **config, const char *key);125int snd_config_make_pointer(snd_config_t **config, const char *key);126int snd_config_make_compound(snd_config_t **config, const char *key, int join);127128int snd_config_imake_integer(snd_config_t **config, const char *key, const long value);129int snd_config_imake_integer64(snd_config_t **config, const char *key, const long long value);130int snd_config_imake_real(snd_config_t **config, const char *key, const double value);131int snd_config_imake_string(snd_config_t **config, const char *key, const char *ascii);132int snd_config_imake_safe_string(snd_config_t **config, const char *key, const char *ascii);133int snd_config_imake_pointer(snd_config_t **config, const char *key, const void *ptr);134135snd_config_type_t snd_config_get_type(const snd_config_t *config);136137int snd_config_set_id(snd_config_t *config, const char *id);138int snd_config_set_integer(snd_config_t *config, long value);139int snd_config_set_integer64(snd_config_t *config, long long value);140int snd_config_set_real(snd_config_t *config, double value);141int snd_config_set_string(snd_config_t *config, const char *value);142int snd_config_set_ascii(snd_config_t *config, const char *ascii);143int snd_config_set_pointer(snd_config_t *config, const void *ptr);144int snd_config_get_id(const snd_config_t *config, const char **value);145int snd_config_get_integer(const snd_config_t *config, long *value);146int snd_config_get_integer64(const snd_config_t *config, long long *value);147int snd_config_get_real(const snd_config_t *config, double *value);148int snd_config_get_ireal(const snd_config_t *config, double *value);149int snd_config_get_string(const snd_config_t *config, const char **value);150int snd_config_get_ascii(const snd_config_t *config, char **value);151int snd_config_get_pointer(const snd_config_t *config, const void **value);152int snd_config_test_id(const snd_config_t *config, const char *id);153154snd_config_iterator_t snd_config_iterator_first(const snd_config_t *node);155snd_config_iterator_t snd_config_iterator_next(const snd_config_iterator_t iterator);156snd_config_iterator_t snd_config_iterator_end(const snd_config_t *node);157snd_config_t *snd_config_iterator_entry(const snd_config_iterator_t iterator);158159/**160* \brief Helper macro to iterate over the children of a compound node.161* \param[in,out] pos Iterator variable for the current node.162* \param[in,out] next Temporary iterator variable for the next node.163* \param[in] node Handle to the compound configuration node to iterate over.164*165* Use this macro like a \c for statement, e.g.:166* \code167* snd_config_iterator_t pos, next;168* snd_config_for_each(pos, next, node) {169* snd_config_t *entry = snd_config_iterator_entry(pos);170* ...171* }172* \endcode173*174* This macro allows deleting or removing the current node.175*/176#define snd_config_for_each(pos, next, node) \177for (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))178179/* Misc functions */180181int snd_config_get_bool_ascii(const char *ascii);182int snd_config_get_bool(const snd_config_t *conf);183int snd_config_get_ctl_iface_ascii(const char *ascii);184int snd_config_get_ctl_iface(const snd_config_t *conf);185186/* Names functions */187188/**189* Device-name list element190*/191typedef struct snd_devname snd_devname_t;192193/**194* Device-name list element (definition)195*/196struct snd_devname {197char *name; /**< Device name string */198char *comment; /**< Comments */199snd_devname_t *next; /**< Next pointer */200};201202int snd_names_list(const char *iface, snd_devname_t **list);203void snd_names_list_free(snd_devname_t *list);204205/** \} */206207#ifdef __cplusplus208}209#endif210211#endif /* __ALSA_CONF_H */212213214