ALSA project - the C library reference

Loading...
Searching...
No Matches
conf.h
Go to the documentation of this file.
1
11/*
12 * This library is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License as
14 * published by the Free Software Foundation; either version 2.1 of
15 * the License, or (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU Lesser General Public License for more details.
21 *
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this library; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
25 *
26 */
27
28#if !defined(__ASOUNDLIB_H) && !defined(ALSA_LIBRARY_BUILD)
29/* don't use ALSA_LIBRARY_BUILD define in sources outside alsa-lib */
30#include <alsa/asoundlib.h>
31#endif
32
33#ifndef __ALSA_CONF_H
34#define __ALSA_CONF_H
36#ifdef __cplusplus
37 extern "C" {
38#endif
39
48#define SND_CONFIG_DLSYM_VERSION_EVALUATE _dlsym_config_evaluate_001
50#define SND_CONFIG_DLSYM_VERSION_HOOK _dlsym_config_hook_001
51
53 typedef enum _snd_config_type {
55 SND_CONFIG_TYPE_INTEGER,
57 SND_CONFIG_TYPE_INTEGER64,
59 SND_CONFIG_TYPE_REAL,
61 SND_CONFIG_TYPE_STRING,
63 SND_CONFIG_TYPE_POINTER,
65 SND_CONFIG_TYPE_COMPOUND = 1024
66} snd_config_type_t;
67
74 typedef struct _snd_config snd_config_t;
82 typedef struct _snd_config_iterator *snd_config_iterator_t;
88 typedef struct _snd_config_update snd_config_update_t;
89
90 extern snd_config_t *snd_config;
91
92 const char *snd_config_topdir(void);
93
94 int snd_config_top(snd_config_t **config);
95
96 int snd_config_load(snd_config_t *config, snd_input_t *in);
97 int snd_config_load_string(snd_config_t **config, const char *s, size_t size);
98 int snd_config_load_override(snd_config_t *config, snd_input_t *in);
99 int snd_config_save(snd_config_t *config, snd_output_t *out);
100 int snd_config_update(void);
101 int snd_config_update_r(snd_config_t **top, snd_config_update_t **update, const char *path);
102 int snd_config_update_free(snd_config_update_t *update);
103 int snd_config_update_free_global(void);
104
105 int snd_config_update_ref(snd_config_t **top);
106 void snd_config_ref(snd_config_t *top);
107 void snd_config_unref(snd_config_t *top);
108
109 int snd_config_search(snd_config_t *config, const char *key,
110 snd_config_t **result);
111 int snd_config_searchv(snd_config_t *config,
112 snd_config_t **result, ...);
113 int snd_config_search_definition(snd_config_t *config,
114 const char *base, const char *key,
115 snd_config_t **result);
116
127 typedef int (*snd_config_expand_fcn_t)(snd_config_t **dst, const char *s, void *private_data);
128
129 int snd_config_expand_custom(snd_config_t *config, snd_config_t *root,
130 snd_config_expand_fcn_t fcn, void *private_data,
131 snd_config_t **result);
132 int snd_config_expand(snd_config_t *config, snd_config_t *root,
133 const char *args, snd_config_t *private_data,
134 snd_config_t **result);
135 int snd_config_evaluate(snd_config_t *config, snd_config_t *root,
136 snd_config_t *private_data, snd_config_t **result);
137 int snd_config_evaluate_string(snd_config_t **dst, const char *s,
138 snd_config_expand_fcn_t fcn, void *private_data);
139
140 int snd_config_add(snd_config_t *config, snd_config_t *child);
141 int snd_config_add_before(snd_config_t *before, snd_config_t *child);
142 int snd_config_add_after(snd_config_t *after, snd_config_t *child);
143 int snd_config_remove(snd_config_t *config);
144 int snd_config_delete(snd_config_t *config);
145 int snd_config_delete_compound_members(const snd_config_t *config);
146 int snd_config_copy(snd_config_t **dst, snd_config_t *src);
147 int snd_config_substitute(snd_config_t *dst, snd_config_t *src);
148 int snd_config_merge(snd_config_t *dst, snd_config_t *src, int override);
149
150 int snd_config_make(snd_config_t **config, const char *key,
151 snd_config_type_t type);
152 int snd_config_make_integer(snd_config_t **config, const char *key);
153 int snd_config_make_integer64(snd_config_t **config, const char *key);
154 int snd_config_make_real(snd_config_t **config, const char *key);
155 int snd_config_make_string(snd_config_t **config, const char *key);
156 int snd_config_make_pointer(snd_config_t **config, const char *key);
157 int snd_config_make_compound(snd_config_t **config, const char *key, int join);
158 int snd_config_make_path(snd_config_t **config, snd_config_t *root, const char *key,
159 int join, int override);
160
161 int snd_config_imake_integer(snd_config_t **config, const char *key, const long value);
162 int snd_config_imake_integer64(snd_config_t **config, const char *key, const long long value);
163 int snd_config_imake_real(snd_config_t **config, const char *key, const double value);
164 int snd_config_imake_string(snd_config_t **config, const char *key, const char *ascii);
165 int snd_config_imake_safe_string(snd_config_t **config, const char *key, const char *ascii);
166 int snd_config_imake_pointer(snd_config_t **config, const char *key, const void *ptr);
167
168 snd_config_type_t snd_config_get_type(const snd_config_t *config);
169 int snd_config_is_array(const snd_config_t *config);
170 int snd_config_is_empty(const snd_config_t *config);
171
172 int snd_config_set_id(snd_config_t *config, const char *id);
173 int snd_config_set_integer(snd_config_t *config, long value);
174 int snd_config_set_integer64(snd_config_t *config, long long value);
175 int snd_config_set_real(snd_config_t *config, double value);
176 int snd_config_set_string(snd_config_t *config, const char *value);
177 int snd_config_set_ascii(snd_config_t *config, const char *ascii);
178 int snd_config_set_pointer(snd_config_t *config, const void *ptr);
179 int snd_config_get_id(const snd_config_t *config, const char **value);
180 int snd_config_get_integer(const snd_config_t *config, long *value);
181 int snd_config_get_integer64(const snd_config_t *config, long long *value);
182 int snd_config_get_real(const snd_config_t *config, double *value);
183 int snd_config_get_ireal(const snd_config_t *config, double *value);
184 int snd_config_get_string(const snd_config_t *config, const char **value);
185 int snd_config_get_ascii(const snd_config_t *config, char **value);
186 int snd_config_get_pointer(const snd_config_t *config, const void **value);
187 int snd_config_test_id(const snd_config_t *config, const char *id);
188
189 snd_config_iterator_t snd_config_iterator_first(const snd_config_t *node);
190 snd_config_iterator_t snd_config_iterator_next(const snd_config_iterator_t iterator);
191 snd_config_iterator_t snd_config_iterator_end(const snd_config_t *node);
192 snd_config_t *snd_config_iterator_entry(const snd_config_iterator_t iterator);
193
211#define snd_config_for_each(pos, next, node) \
212 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))
213
214/* Misc functions */
215
216 int snd_config_get_bool_ascii(const char *ascii);
217 int snd_config_get_bool(const snd_config_t *conf);
218 int snd_config_get_card(const snd_config_t *conf);
219 int snd_config_get_ctl_iface_ascii(const char *ascii);
220 int snd_config_get_ctl_iface(const snd_config_t *conf);
221
222/* Names functions */
223
227 typedef struct snd_devname snd_devname_t;
228
232 struct snd_devname {
233 char *name;
234 char *comment;
235 snd_devname_t *next;
236};
237
238 int snd_names_list(const char *iface, snd_devname_t **list);
239 void snd_names_list_free(snd_devname_t *list);
240
243#ifdef __cplusplus
244}
245#endif
246
247#endif /* __ALSA_CONF_H */
snd_config_set_pointer
int snd_config_set_pointer(snd_config_t *config, const void *ptr)
Changes the value of a pointer configuration node.
Definition conf.c:3079
snd_config_imake_integer64
int snd_config_imake_integer64(snd_config_t **config, const char *key, const long long value)
Creates a 64-bit-integer configuration node with the given initial value.
Definition conf.c:2808
snd_config_update_r
int snd_config_update_r(snd_config_t **top, snd_config_update_t **update, const char *path)
Updates a configuration tree by rereading the configuration files (if needed).
Definition conf.c:4505
snd_config_substitute
int snd_config_substitute(snd_config_t *dst, snd_config_t *src)
Substitutes one configuration node to another.
Definition conf.c:1735
snd_config_make_path
int snd_config_make_path(snd_config_t **config, snd_config_t *root, const char *key, int join, int override)
Creates an empty compound configuration node in the path.
Definition conf.c:2703
snd_config_set_string
int snd_config_set_string(snd_config_t *config, const char *value)
Changes the value of a string configuration node.
Definition conf.c:3048
snd_config_iterator_next
snd_config_iterator_t snd_config_iterator_next(const snd_config_iterator_t iterator)
Returns an iterator pointing to the next sibling.
Definition conf.c:4830
snd_config_get_bool_ascii
int snd_config_get_bool_ascii(const char *ascii)
Gets the boolean value from the given ASCII string.
Definition confmisc.c:89
snd_config_evaluate
int snd_config_evaluate(snd_config_t *config, snd_config_t *root, snd_config_t *private_data, snd_config_t **result)
Evaluates a configuration node at runtime.
Definition conf.c:5229
snd_config_t
struct _snd_config snd_config_t
Internal structure for a configuration node object.
Definition conf.h:74
snd_config_load_override
int snd_config_load_override(snd_config_t *config, snd_input_t *in)
Loads a configuration tree and overrides existing configuration nodes.
Definition conf.c:2120
snd_config_delete
int snd_config_delete(snd_config_t *config)
Frees a configuration node.
Definition conf.c:2387
snd_config_make_integer64
int snd_config_make_integer64(snd_config_t **config, const char *key)
Creates a 64-bit-integer configuration node.
Definition conf.c:2539
snd_config_make_compound
int snd_config_make_compound(snd_config_t **config, const char *key, int join)
Creates an empty compound configuration node.
Definition conf.c:2651
snd_config_copy
int snd_config_copy(snd_config_t **dst, snd_config_t *src)
Creates a copy of a configuration node.
Definition conf.c:5012
snd_config_iterator_entry
snd_config_t * snd_config_iterator_entry(const snd_config_iterator_t iterator)
Returns the configuration node handle pointed to by an iterator.
Definition conf.c:4862
snd_config_evaluate_string
int snd_config_evaluate_string(snd_config_t **dst, const char *s, snd_config_expand_fcn_t fcn, void *private_data)
Evaluate an math expression in the string.
Definition confeval.c:261
snd_config_load_string
int snd_config_load_string(snd_config_t **config, const char *s, size_t size)
Loads a configuration tree from a string.
Definition conf.c:2083
snd_config_add_before
int snd_config_add_before(snd_config_t *before, snd_config_t *child)
Adds a child before another child configuration node.
Definition conf.c:2228
snd_config_update
int snd_config_update(void)
Updates snd_config by rereading the global configuration files (if needed).
Definition conf.c:4673
snd_config_expand_custom
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)
Expands a configuration node, applying arguments and functions.
Definition conf.c:5653
snd_config_set_real
int snd_config_set_real(snd_config_t *config, double value)
Changes the value of a real-number configuration node.
Definition conf.c:3022
snd_config_update_free_global
int snd_config_update_free_global(void)
Frees the global configuration tree in snd_config.
Definition conf.c:4778
snd_config_load
int snd_config_load(snd_config_t *config, snd_input_t *in)
Loads a configuration tree.
Definition conf.c:2062
snd_config_get_pointer
int snd_config_get_pointer(const snd_config_t *config, const void **value)
Returns the value of a pointer configuration node.
Definition conf.c:3295
snd_config_set_id
int snd_config_set_id(snd_config_t *config, const char *id)
Sets the id of a configuration node.
Definition conf.c:1915
snd_config_update_ref
int snd_config_update_ref(snd_config_t **top)
Updates snd_config and takes its reference.
Definition conf.c:4694
snd_config_get_ctl_iface_ascii
int snd_config_get_ctl_iface_ascii(const char *ascii)
Gets the control interface index from the given ASCII string.
Definition confmisc.c:180
snd_config_get_string
int snd_config_get_string(const snd_config_t *config, const char **value)
Returns the value of a string configuration node.
Definition conf.c:3274
snd_config_imake_safe_string
int snd_config_imake_safe_string(snd_config_t **config, const char *key, const char *ascii)
Creates a string configuration node with the given initial value.
Definition conf.c:2906
snd_config_topdir
const char * snd_config_topdir(void)
Returns the default top-level config directory.
Definition conf.c:595
snd_names_list_free
void snd_names_list_free(snd_devname_t *list)
This function is unimplemented.
Definition names.c:53
snd_config_make_string
int snd_config_make_string(snd_config_t **config, const char *key)
Creates a string configuration node.
Definition conf.c:2586
snd_config_iterator_t
struct _snd_config_iterator * snd_config_iterator_t
Type for a configuration compound iterator.
Definition conf.h:82
snd_config
snd_config_t * snd_config
Configuration top-level node (the global configuration).
Definition conf.c:3948
snd_config_get_type
snd_config_type_t snd_config_get_type(const snd_config_t *config)
Returns the type of a configuration node.
Definition conf.c:1819
snd_config_add
int snd_config_add(snd_config_t *config, snd_config_t *child)
Adds a child to a compound configuration node.
Definition conf.c:2149
snd_config_set_integer
int snd_config_set_integer(snd_config_t *config, long value)
Changes the value of an integer configuration node.
Definition conf.c:2979
snd_config_expand
int snd_config_expand(snd_config_t *config, snd_config_t *root, const char *args, snd_config_t *private_data, snd_config_t **result)
Expands a configuration node, applying arguments and functions.
Definition conf.c:5686
snd_config_get_ireal
int snd_config_get_ireal(const snd_config_t *config, double *value)
Returns the value of a real or integer configuration node.
Definition conf.c:3239
snd_config_searchv
int snd_config_searchv(snd_config_t *config, snd_config_t **result,...)
Searches for a node in a configuration tree.
Definition conf.c:3724
snd_config_make_integer
int snd_config_make_integer(snd_config_t **config, const char *key)
Creates an integer configuration node.
Definition conf.c:2514
snd_config_merge
int snd_config_merge(snd_config_t *dst, snd_config_t *src, int override)
In-place merge of two config handles.
Definition conf.c:2297
snd_config_make_real
int snd_config_make_real(snd_config_t **config, const char *key)
Creates a real number configuration node.
Definition conf.c:2561
snd_config_update_free
int snd_config_update_free(snd_config_update_t *update)
Frees a private update structure.
Definition conf.c:4756
snd_config_get_card
int snd_config_get_card(const snd_config_t *conf)
Gets the card number from a configuration node.
Definition confmisc.c:151
snd_config_imake_real
int snd_config_imake_real(snd_config_t **config, const char *key, const double value)
Creates a real number configuration node with the given initial value.
Definition conf.c:2835
snd_config_get_ascii
int snd_config_get_ascii(const snd_config_t *config, char **value)
Returns the value of a configuration node as a string.
Definition conf.c:3331
snd_config_type_t
snd_config_type_t
Configuration node type.
Definition conf.h:53
snd_config_imake_string
int snd_config_imake_string(snd_config_t **config, const char *key, const char *ascii)
Creates a string configuration node with the given initial value.
Definition conf.c:2865
snd_config_get_ctl_iface
int snd_config_get_ctl_iface(const snd_config_t *conf)
Gets the control interface index from a configuration node.
Definition confmisc.c:203
snd_config_update_t
struct _snd_config_update snd_config_update_t
Internal structure for a configuration private update object.
Definition conf.h:88
snd_config_search
int snd_config_search(snd_config_t *config, const char *key, snd_config_t **result)
Searches for a node in a configuration tree.
Definition conf.c:3633
snd_config_get_integer
int snd_config_get_integer(const snd_config_t *config, long *value)
Returns the value of an integer configuration node.
Definition conf.c:3173
snd_config_iterator_end
snd_config_iterator_t snd_config_iterator_end(const snd_config_t *node)
Returns an iterator that ends a node's children list.
Definition conf.c:4848
snd_config_set_ascii
int snd_config_set_ascii(snd_config_t *config, const char *ascii)
Changes the value of a configuration node.
Definition conf.c:3113
snd_config_is_empty
int snd_config_is_empty(const snd_config_t *config)
Returns if the compound has no fields (is empty).
Definition conf.c:1869
snd_config_make
int snd_config_make(snd_config_t **config, const char *key, snd_config_type_t type)
Creates a configuration node.
Definition conf.c:2480
snd_config_imake_pointer
int snd_config_imake_pointer(snd_config_t **config, const char *key, const void *ptr)
Creates a pointer configuration node with the given initial value.
Definition conf.c:2954
snd_config_unref
void snd_config_unref(snd_config_t *top)
Unreference the config tree.
Definition conf.c:4743
snd_config_iterator_first
snd_config_iterator_t snd_config_iterator_first(const snd_config_t *node)
Returns an iterator pointing to a node's first child.
Definition conf.c:4810
snd_config_get_real
int snd_config_get_real(const snd_config_t *config, double *value)
Returns the value of a real-number configuration node.
Definition conf.c:3216
snd_config_remove
int snd_config_remove(snd_config_t *config)
Removes a configuration node from its tree.
Definition conf.c:2356
snd_config_search_definition
int snd_config_search_definition(snd_config_t *config, const char *base, const char *key, snd_config_t **result)
Searches for a definition in a configuration tree, using aliases and expanding hooks and arguments.
Definition conf.c:5768
snd_config_add_after
int snd_config_add_after(snd_config_t *after, snd_config_t *child)
Adds a child after another child configuration node.
Definition conf.c:2187
snd_config_make_pointer
int snd_config_make_pointer(snd_config_t **config, const char *key)
Creates a pointer configuration node.
Definition conf.c:2608
snd_config_get_id
int snd_config_get_id(const snd_config_t *config, const char **value)
Returns the id of a configuration node.
Definition conf.c:1893
snd_config_is_array
int snd_config_is_array(const snd_config_t *config)
Returns if the compound is an array (and count of items).
Definition conf.c:1845
snd_config_get_bool
int snd_config_get_bool(const snd_config_t *conf)
Gets the boolean value from a configuration node.
Definition confmisc.c:117
snd_config_ref
void snd_config_ref(snd_config_t *top)
Take the reference of the config tree.
Definition conf.c:4723
snd_config_delete_compound_members
int snd_config_delete_compound_members(const snd_config_t *config)
Deletes the children of a node.
Definition conf.c:2441
snd_config_expand_fcn_t
int(* snd_config_expand_fcn_t)(snd_config_t **dst, const char *s, void *private_data)
custom expansion callback
Definition conf.h:127
snd_config_test_id
int snd_config_test_id(const snd_config_t *config, const char *id)
Compares the id of a configuration node to a given string.
Definition conf.c:3405
snd_names_list
int snd_names_list(const char *iface, snd_devname_t **list)
This function is unimplemented.
Definition names.c:42
snd_config_get_integer64
int snd_config_get_integer64(const snd_config_t *config, long long *value)
Returns the value of a 64-bit-integer configuration node.
Definition conf.c:3196
snd_config_top
int snd_config_top(snd_config_t **config)
Creates a top level configuration node.
Definition conf.c:1957
snd_config_save
int snd_config_save(snd_config_t *config, snd_output_t *out)
Dumps the contents of a configuration node or tree.
Definition conf.c:3432
snd_config_set_integer64
int snd_config_set_integer64(snd_config_t *config, long long value)
Changes the value of a 64-bit-integer configuration node.
Definition conf.c:3002
snd_config_imake_integer
int snd_config_imake_integer(snd_config_t **config, const char *key, const long value)
Creates an integer configuration node with the given initial value.
Definition conf.c:2778
SND_CONFIG_TYPE_REAL
@ SND_CONFIG_TYPE_REAL
Definition conf.h:59
SND_CONFIG_TYPE_INTEGER64
@ SND_CONFIG_TYPE_INTEGER64
Definition conf.h:57
SND_CONFIG_TYPE_COMPOUND
@ SND_CONFIG_TYPE_COMPOUND
Definition conf.h:65
SND_CONFIG_TYPE_STRING
@ SND_CONFIG_TYPE_STRING
Definition conf.h:61
SND_CONFIG_TYPE_INTEGER
@ SND_CONFIG_TYPE_INTEGER
Definition conf.h:55
SND_CONFIG_TYPE_POINTER
@ SND_CONFIG_TYPE_POINTER
Definition conf.h:63
snd_input_t
struct _snd_input snd_input_t
Internal structure for an input object.
Definition input.h:62
snd_output_t
struct _snd_output snd_output_t
Internal structure for an output object.
Definition output.h:60
snd_devname
Definition conf.h:232
snd_devname::comment
char * comment
Definition conf.h:234
snd_devname::next
snd_devname_t * next
Definition conf.h:235
snd_devname::name
char * name
Definition conf.h:233
type
uint8_t type
Definition ump_msg.h:1