return 1;
}
snd_config_foreach(i, conf) {
- snd_config_t *n = snd_config_entry(i);
- if (strcmp(n->id, "comment") == 0)
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id = snd_config_get_id(n);
+ if (strcmp(id, "comment") == 0)
continue;
- if (strcmp(n->id, "host") == 0) {
- err = snd_config_string_get(n, &host);
+ if (strcmp(id, "host") == 0) {
+ err = snd_config_get_string(n, &host);
if (err < 0) {
- ERROR("Invalid type for %s", n->id);
+ ERROR("Invalid type for %s", id);
return 1;
}
continue;
}
- if (strcmp(n->id, "socket") == 0) {
- err = snd_config_string_get(n, &socket);
+ if (strcmp(id, "socket") == 0) {
+ err = snd_config_get_string(n, &socket);
if (err < 0) {
- ERROR("Invalid type for %s", n->id);
+ ERROR("Invalid type for %s", id);
return 1;
}
continue;
}
- if (strcmp(n->id, "port") == 0) {
- err = snd_config_integer_get(n, &port);
+ if (strcmp(id, "port") == 0) {
+ err = snd_config_get_integer(n, &port);
if (err < 0) {
- ERROR("Invalid type for %s", n->id);
+ ERROR("Invalid type for %s", id);
return 1;
}
continue;
}
- ERROR("Unknown field %s", n->id);
+ ERROR("Unknown field %s", id);
return 1;
}
if (!host) {
-#define LIST_HEAD_IS_DEFINED
-struct list_head {
- struct list_head *next, *prev;
-};
-
-/**
- * list_entry - get the struct for this entry
- * @ptr: the &struct list_head pointer.
- * @type: the type of the struct this is embedded in.
- * @member: the name of the list_struct within the struct.
- */
-#define list_entry(ptr, type, member) \
- ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
-
enum _snd_config_type {
SND_CONFIG_TYPE_INTEGER,
SND_CONFIG_TYPE_REAL,
#define SND_CONFIG_TYPE_COMPOUND ((snd_config_type_t) SND_CONFIG_TYPE_COMPOUND)
typedef struct _snd_config snd_config_t;
+typedef struct _snd_config_iterator *snd_config_iterator_t;
-struct _snd_config {
- char *id;
- snd_config_type_t type;
- union {
- long integer;
- char *string;
- double real;
- struct {
- struct list_head fields;
- int join;
- } compound;
- } u;
- struct list_head list;
- snd_config_t *father;
-};
-
-static inline snd_config_type_t snd_config_type(snd_config_t *config)
-{
- return config->type;
-}
+#ifdef __cplusplus
+extern "C" {
+#endif
-static inline char *snd_config_id(snd_config_t *config)
-{
- return config->id;
-}
+snd_config_type_t snd_config_get_type(snd_config_t *config);
+char *snd_config_get_id(snd_config_t *config);
int snd_config_top(snd_config_t **config);
int snd_config_make(snd_config_t **config, const char *key,
snd_config_type_t type);
-int snd_config_integer_make(snd_config_t **config, const char *key);
-int snd_config_real_make(snd_config_t **config, const char *key);
-int snd_config_string_make(snd_config_t **config, const char *key);
-int snd_config_compound_make(snd_config_t **config, const char *key, int join);
-
-int snd_config_integer_set(snd_config_t *config, long value);
-int snd_config_real_set(snd_config_t *config, double value);
-int snd_config_string_set(snd_config_t *config, const char *value);
-int snd_config_integer_get(snd_config_t *config, long *value);
-int snd_config_real_get(snd_config_t *config, double *value);
-int snd_config_string_get(snd_config_t *config, const char **value);
-
-typedef struct list_head *snd_config_iterator_t;
+int snd_config_make_integer(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_compound(snd_config_t **config, const char *key, int join);
+
+int snd_config_set_integer(snd_config_t *config, 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_get_integer(snd_config_t *config, long *value);
+int snd_config_get_real(snd_config_t *config, double *value);
+int snd_config_get_string(snd_config_t *config, const char **value);
+
+snd_config_iterator_t snd_config_iterator_first(snd_config_t *node);
+snd_config_iterator_t snd_config_iterator_next(snd_config_iterator_t iterator);
+snd_config_iterator_t snd_config_iterator_end(snd_config_t *node);
+snd_config_t *snd_config_iterator_entry(snd_config_iterator_t iterator);
#define snd_config_foreach(iterator, node) \
- assert((node)->type == SND_CONFIG_TYPE_COMPOUND); \
- for (iterator = (node)->u.compound.fields.next; iterator != &(node)->u.compound.fields; iterator = iterator->next)
-
-#define snd_config_entry(iterator) list_entry(iterator, snd_config_t, list)
+ for (iterator = snd_config_iterator_first(node); iterator != snd_config_iterator_end(node); iterator = snd_config_iterator_next(iterator))
-snd_config_type_t snd_config_type(snd_config_t *config);
-char *snd_config_id(snd_config_t *config);
+snd_config_type_t snd_config_get_type(snd_config_t *config);
+char *snd_config_get_id(snd_config_t *config);
extern snd_config_t *snd_config;
int snd_config_update();
+
+#ifdef __cplusplus
+}
+#endif
+
#define list_for_each(pos, head) \
for (pos = (head)->next; pos != (head); pos = pos->next)
+/**
+ * list_entry - get the struct for this entry
+ * @ptr: the &struct list_head pointer.
+ * @type: the type of the struct this is embedded in.
+ * @member: the name of the list_struct within the struct.
+ */
+#define list_entry(ptr, type, member) \
+ ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
+
+
#endif /* _LIST_H */
*
*/
+#define _snd_config_iterator list_head
+
#include <stdarg.h>
#include <sys/stat.h>
#include "local.h"
#include "list.h"
+struct _snd_config {
+ char *id;
+ snd_config_type_t type;
+ union {
+ long integer;
+ char *string;
+ double real;
+ struct {
+ struct list_head fields;
+ int join;
+ } compound;
+ } u;
+ struct list_head list;
+ snd_config_t *father;
+};
+
#define SYS_ASOUNDRC "/etc/asound.conf"
#define USR_ASOUNDRC ".asoundrc"
}
}
+snd_config_type_t snd_config_get_type(snd_config_t *config)
+{
+ return config->type;
+}
+
+char *snd_config_get_id(snd_config_t *config)
+{
+ return config->id;
+}
+
static int _snd_config_make(snd_config_t **config, char *id,
snd_config_type_t type)
{
{
snd_config_iterator_t i;
snd_config_foreach(i, config) {
- snd_config_t *n = snd_config_entry(i);
+ snd_config_t *n = snd_config_iterator_entry(i);
if (len < 0) {
if (strcmp(n->id, id) == 0) {
*result = n;
snd_config_iterator_t i;
assert(father && leaf);
snd_config_foreach(i, father) {
- snd_config_t *n = snd_config_entry(i);
+ snd_config_t *n = snd_config_iterator_entry(i);
if (strcmp(leaf->id, n->id) == 0)
return -EEXIST;
}
i = config->u.compound.fields.next;
while (i != &config->u.compound.fields) {
struct list_head *nexti = i->next;
- snd_config_t *leaf = snd_config_entry(i);
+ snd_config_t *leaf = snd_config_iterator_entry(i);
err = snd_config_delete(leaf);
if (err < 0)
return err;
return _snd_config_make(config, id1, type);
}
-int snd_config_integer_make(snd_config_t **config, const char *id)
+int snd_config_make_integer(snd_config_t **config, const char *id)
{
return snd_config_make(config, id, SND_CONFIG_TYPE_INTEGER);
}
-int snd_config_real_make(snd_config_t **config, const char *id)
+int snd_config_make_real(snd_config_t **config, const char *id)
{
return snd_config_make(config, id, SND_CONFIG_TYPE_REAL);
}
-int snd_config_string_make(snd_config_t **config, const char *id)
+int snd_config_make_string(snd_config_t **config, const char *id)
{
return snd_config_make(config, id, SND_CONFIG_TYPE_STRING);
}
-int snd_config_compound_make(snd_config_t **config, const char *id,
+int snd_config_make_compound(snd_config_t **config, const char *id,
int join)
{
int err;
return 0;
}
-int snd_config_integer_set(snd_config_t *config, long value)
+int snd_config_set_integer(snd_config_t *config, long value)
{
assert(config);
if (config->type != SND_CONFIG_TYPE_INTEGER)
return 0;
}
-int snd_config_real_set(snd_config_t *config, double value)
+int snd_config_set_real(snd_config_t *config, double value)
{
assert(config);
if (config->type != SND_CONFIG_TYPE_REAL)
return 0;
}
-int snd_config_string_set(snd_config_t *config, const char *value)
+int snd_config_set_string(snd_config_t *config, const char *value)
{
assert(config);
if (config->type != SND_CONFIG_TYPE_STRING)
return 0;
}
-int snd_config_integer_get(snd_config_t *config, long *ptr)
+int snd_config_get_integer(snd_config_t *config, long *ptr)
{
assert(config && ptr);
if (config->type != SND_CONFIG_TYPE_INTEGER)
return 0;
}
-int snd_config_real_get(snd_config_t *config, double *ptr)
+int snd_config_get_real(snd_config_t *config, double *ptr)
{
assert(config && ptr);
if (config->type != SND_CONFIG_TYPE_REAL)
return 0;
}
-int snd_config_string_get(snd_config_t *config, const char **ptr)
+int snd_config_get_string(snd_config_t *config, const char **ptr)
{
assert(config && ptr);
if (config->type != SND_CONFIG_TYPE_STRING)
snd_config_iterator_t i;
assert(config && out);
snd_config_foreach(i, config) {
- snd_config_t *n = snd_config_entry(i);
+ snd_config_t *n = snd_config_iterator_entry(i);
if (n->type == SND_CONFIG_TYPE_COMPOUND &&
n->u.compound.join) {
err = _snd_config_save_leaves(n, out, level, joins + 1);
}
return 0;
}
+
+snd_config_iterator_t snd_config_iterator_first(snd_config_t *node)
+{
+ assert(node->type == SND_CONFIG_TYPE_COMPOUND);
+ return node->u.compound.fields.next;
+}
+
+snd_config_iterator_t snd_config_iterator_next(snd_config_iterator_t iterator)
+{
+ return iterator->next;
+}
+
+snd_config_iterator_t snd_config_iterator_end(snd_config_t *node)
+{
+ assert(node->type == SND_CONFIG_TYPE_COMPOUND);
+ return &node->u.compound.fields;
+}
+
+snd_config_t *snd_config_iterator_entry(snd_config_iterator_t iterator)
+{
+ return list_entry(iterator, snd_config_t, list);
+}
+
ERR("Unknown control %s", name);
return -ENOENT;
}
- if (snd_config_type(ctl_conf) != SND_CONFIG_TYPE_COMPOUND)
+ if (snd_config_get_type(ctl_conf) != SND_CONFIG_TYPE_COMPOUND)
return -EINVAL;
err = snd_config_search(ctl_conf, "type", &conf);
if (err < 0)
return err;
- err = snd_config_string_get(conf, &str);
+ err = snd_config_get_string(conf, &str);
if (err < 0)
return err;
err = snd_config_searchv(snd_config, &type_conf, "ctltype", str, 0);
snd_config_foreach(i, type_conf) {
- snd_config_t *n = snd_config_entry(i);
- if (strcmp(n->id, "comment") == 0)
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id = snd_config_get_id(n);
+ if (strcmp(id, "comment") == 0)
continue;
- if (strcmp(n->id, "lib") == 0) {
- err = snd_config_string_get(n, &lib);
+ if (strcmp(id, "lib") == 0) {
+ err = snd_config_get_string(n, &lib);
if (err < 0)
return -EINVAL;
continue;
}
- if (strcmp(n->id, "open") == 0) {
- err = snd_config_string_get(n, &open);
+ if (strcmp(id, "open") == 0) {
+ err = snd_config_get_string(n, &open);
if (err < 0)
return -EINVAL;
continue;
const char *str;
int err;
snd_config_foreach(i, conf) {
- snd_config_t *n = snd_config_entry(i);
- if (strcmp(n->id, "comment") == 0)
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id = snd_config_get_id(n);
+ if (strcmp(id, "comment") == 0)
continue;
- if (strcmp(n->id, "type") == 0)
+ if (strcmp(id, "type") == 0)
continue;
- if (strcmp(n->id, "card") == 0) {
- err = snd_config_integer_get(n, &card);
+ if (strcmp(id, "card") == 0) {
+ err = snd_config_get_integer(n, &card);
if (err < 0) {
- err = snd_config_string_get(n, &str);
+ err = snd_config_get_string(n, &str);
if (err < 0)
return -EINVAL;
card = snd_card_get_index(str);
int local;
struct hostent *h;
snd_config_foreach(i, conf) {
- snd_config_t *n = snd_config_entry(i);
- if (strcmp(n->id, "comment") == 0)
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id = snd_config_get_id(n);
+ if (strcmp(id, "comment") == 0)
continue;
- if (strcmp(n->id, "type") == 0)
+ if (strcmp(id, "type") == 0)
continue;
- if (strcmp(n->id, "server") == 0) {
- err = snd_config_string_get(n, &server);
+ if (strcmp(id, "server") == 0) {
+ err = snd_config_get_string(n, &server);
if (err < 0) {
- ERR("Invalid type for %s", n->id);
+ ERR("Invalid type for %s", id);
return -EINVAL;
}
continue;
}
- if (strcmp(n->id, "sname") == 0) {
- err = snd_config_string_get(n, &sname);
+ if (strcmp(id, "sname") == 0) {
+ err = snd_config_get_string(n, &sname);
if (err < 0) {
- ERR("Invalid type for %s", n->id);
+ ERR("Invalid type for %s", id);
return -EINVAL;
}
continue;
}
- ERR("Unknown field %s", n->id);
+ ERR("Unknown field %s", id);
return -EINVAL;
}
if (!sname) {
return -EINVAL;
}
snd_config_foreach(i, conf) {
- snd_config_t *n = snd_config_entry(i);
- if (strcmp(n->id, "comment") == 0)
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id = snd_config_get_id(n);
+ if (strcmp(id, "comment") == 0)
continue;
- if (strcmp(n->id, "host") == 0) {
- err = snd_config_string_get(n, &host);
+ if (strcmp(id, "host") == 0) {
+ err = snd_config_get_string(n, &host);
if (err < 0) {
- ERR("Invalid type for %s", n->id);
+ ERR("Invalid type for %s", id);
return -EINVAL;
}
continue;
}
- if (strcmp(n->id, "socket") == 0) {
- err = snd_config_string_get(n, &socket);
+ if (strcmp(id, "socket") == 0) {
+ err = snd_config_get_string(n, &socket);
if (err < 0) {
- ERR("Invalid type for %s", n->id);
+ ERR("Invalid type for %s", id);
return -EINVAL;
}
continue;
}
- if (strcmp(n->id, "port") == 0) {
- err = snd_config_integer_get(n, &port);
+ if (strcmp(id, "port") == 0) {
+ err = snd_config_get_integer(n, &port);
if (err < 0) {
- ERR("Invalid type for %s", n->id);
+ ERR("Invalid type for %s", id);
return -EINVAL;
}
continue;
}
- ERR("Unknown field %s", n->id);
+ ERR("Unknown field %s", id);
return -EINVAL;
}
ERR("Unknown PCM %s", name);
return -ENOENT;
}
- if (snd_config_type(pcm_conf) != SND_CONFIG_TYPE_COMPOUND) {
+ if (snd_config_get_type(pcm_conf) != SND_CONFIG_TYPE_COMPOUND) {
ERR("Invalid type for PCM %s definition", name);
return -EINVAL;
}
err = snd_config_search(pcm_conf, "stream", &conf);
if (err >= 0) {
- err = snd_config_string_get(conf, &str);
+ const char *id = snd_config_get_id(conf);
+ err = snd_config_get_string(conf, &str);
if (err < 0) {
- ERR("Invalid type for %s", conf->id);
+ ERR("Invalid type for %s", id);
return err;
}
if (strcmp(str, "playback") == 0) {
if (stream != SND_PCM_STREAM_CAPTURE)
return -EINVAL;
} else {
- ERR("Invalid value for %s", conf->id);
+ ERR("Invalid value for %s", id);
return -EINVAL;
}
}
ERR("type is not defined");
return err;
}
- err = snd_config_string_get(conf, &str);
+ err = snd_config_get_string(conf, &str);
if (err < 0) {
- ERR("Invalid type for %s", conf->id);
+ ERR("Invalid type for %s", snd_config_get_id(conf));
return err;
}
err = snd_config_searchv(snd_config, &type_conf, "pcmtype", str, 0);
return err;
}
snd_config_foreach(i, type_conf) {
- snd_config_t *n = snd_config_entry(i);
- if (strcmp(n->id, "comment") == 0)
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id = snd_config_get_id(n);
+ if (strcmp(id, "comment") == 0)
continue;
- if (strcmp(n->id, "lib") == 0) {
- err = snd_config_string_get(n, &lib);
+ if (strcmp(id, "lib") == 0) {
+ err = snd_config_get_string(n, &lib);
if (err < 0) {
- ERR("Invalid type for %s", n->id);
+ ERR("Invalid type for %s", id);
return -EINVAL;
}
continue;
}
- if (strcmp(n->id, "open") == 0) {
- err = snd_config_string_get(n, &open);
+ if (strcmp(id, "open") == 0) {
+ err = snd_config_get_string(n, &open);
if (err < 0) {
- ERR("Invalid type for %s", n->id);
+ ERR("Invalid type for %s", id);
return -EINVAL;
}
continue;
- ERR("Unknown field %s", n->id);
+ ERR("Unknown field %s", id);
return -EINVAL;
}
}
snd_pcm_t *spcm;
snd_pcm_format_t sformat = SND_PCM_FORMAT_UNKNOWN;
snd_config_foreach(i, conf) {
- snd_config_t *n = snd_config_entry(i);
- if (strcmp(n->id, "comment") == 0)
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id = snd_config_get_id(n);
+ if (strcmp(id, "comment") == 0)
continue;
- if (strcmp(n->id, "type") == 0)
+ if (strcmp(id, "type") == 0)
continue;
- if (strcmp(n->id, "stream") == 0)
+ if (strcmp(id, "stream") == 0)
continue;
- if (strcmp(n->id, "sname") == 0) {
- err = snd_config_string_get(n, &sname);
+ if (strcmp(id, "sname") == 0) {
+ err = snd_config_get_string(n, &sname);
if (err < 0) {
- ERR("Invalid type for %s", n->id);
+ ERR("Invalid type for %s", id);
return -EINVAL;
}
continue;
}
- if (strcmp(n->id, "sformat") == 0) {
+ if (strcmp(id, "sformat") == 0) {
const char *f;
- err = snd_config_string_get(n, &f);
+ err = snd_config_get_string(n, &f);
if (err < 0) {
- ERR("Invalid type for %s", n->id);
+ ERR("Invalid type for %s", id);
return -EINVAL;
}
sformat = snd_pcm_format_value(f);
}
continue;
}
- ERR("Unknown field %s", n->id);
+ ERR("Unknown field %s", id);
return -EINVAL;
}
if (!sname) {
snd_pcm_t *spcm;
snd_pcm_format_t sformat = SND_PCM_FORMAT_UNKNOWN;
snd_config_foreach(i, conf) {
- snd_config_t *n = snd_config_entry(i);
- if (strcmp(n->id, "comment") == 0)
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id = snd_config_get_id(n);
+ if (strcmp(id, "comment") == 0)
continue;
- if (strcmp(n->id, "type") == 0)
+ if (strcmp(id, "type") == 0)
continue;
- if (strcmp(n->id, "stream") == 0)
+ if (strcmp(id, "stream") == 0)
continue;
- if (strcmp(n->id, "sname") == 0) {
- err = snd_config_string_get(n, &sname);
+ if (strcmp(id, "sname") == 0) {
+ err = snd_config_get_string(n, &sname);
if (err < 0) {
- ERR("Invalid type for %s", n->id);
+ ERR("Invalid type for %s", id);
return -EINVAL;
}
continue;
}
- if (strcmp(n->id, "sformat") == 0) {
+ if (strcmp(id, "sformat") == 0) {
const char *f;
- err = snd_config_string_get(n, &f);
+ err = snd_config_get_string(n, &f);
if (err < 0) {
- ERR("Invalid type for %s", n->id);
+ ERR("Invalid type for %s", id);
return -EINVAL;
}
sformat = snd_pcm_format_value(f);
}
continue;
}
- ERR("Unknown field %s", n->id);
+ ERR("Unknown field %s", id);
return -EINVAL;
}
if (!sname) {
int err;
snd_pcm_t *spcm;
snd_config_foreach(i, conf) {
- snd_config_t *n = snd_config_entry(i);
- if (strcmp(n->id, "comment") == 0)
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id = snd_config_get_id(n);
+ if (strcmp(id, "comment") == 0)
continue;
- if (strcmp(n->id, "type") == 0)
+ if (strcmp(id, "type") == 0)
continue;
- if (strcmp(n->id, "stream") == 0)
+ if (strcmp(id, "stream") == 0)
continue;
- if (strcmp(n->id, "sname") == 0) {
- err = snd_config_string_get(n, &sname);
+ if (strcmp(id, "sname") == 0) {
+ err = snd_config_get_string(n, &sname);
if (err < 0) {
- ERR("Invalid type for %s", n->id);
+ ERR("Invalid type for %s", id);
return -EINVAL;
}
continue;
}
- ERR("Unknown field %s", n->id);
+ ERR("Unknown field %s", id);
return -EINVAL;
}
if (!sname) {
const char *format = NULL;
long fd = -1;
snd_config_foreach(i, conf) {
- snd_config_t *n = snd_config_entry(i);
- if (strcmp(n->id, "comment") == 0)
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id = snd_config_get_id(n);
+ if (strcmp(id, "comment") == 0)
continue;
- if (strcmp(n->id, "type") == 0)
+ if (strcmp(id, "type") == 0)
continue;
- if (strcmp(n->id, "stream") == 0)
+ if (strcmp(id, "stream") == 0)
continue;
- if (strcmp(n->id, "sname") == 0) {
- err = snd_config_string_get(n, &sname);
+ if (strcmp(id, "sname") == 0) {
+ err = snd_config_get_string(n, &sname);
if (err < 0) {
- ERR("Invalid type for %s", n->id);
+ ERR("Invalid type for %s", id);
return -EINVAL;
}
continue;
}
- if (strcmp(n->id, "format") == 0) {
- err = snd_config_string_get(n, &format);
+ if (strcmp(id, "format") == 0) {
+ err = snd_config_get_string(n, &format);
if (err < 0) {
- ERR("Invalid type for %s", n->id);
+ ERR("Invalid type for %s", id);
return -EINVAL;
}
continue;
}
- if (strcmp(n->id, "file") == 0) {
- err = snd_config_string_get(n, &fname);
+ if (strcmp(id, "file") == 0) {
+ err = snd_config_get_string(n, &fname);
if (err < 0) {
- err = snd_config_integer_get(n, &fd);
+ err = snd_config_get_integer(n, &fd);
if (err < 0) {
- ERR("Invalid type for %s", n->id);
+ ERR("Invalid type for %s", id);
return -EINVAL;
}
}
continue;
}
- ERR("Unknown field %s", n->id);
+ ERR("Unknown field %s", id);
return -EINVAL;
}
if (!sname) {
const char *str;
int err;
snd_config_foreach(i, conf) {
- snd_config_t *n = snd_config_entry(i);
- if (strcmp(n->id, "comment") == 0)
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id = snd_config_get_id(n);
+ if (strcmp(id, "comment") == 0)
continue;
- if (strcmp(n->id, "type") == 0)
+ if (strcmp(id, "type") == 0)
continue;
- if (strcmp(n->id, "stream") == 0)
+ if (strcmp(id, "stream") == 0)
continue;
- if (strcmp(n->id, "card") == 0) {
- err = snd_config_integer_get(n, &card);
+ if (strcmp(id, "card") == 0) {
+ err = snd_config_get_integer(n, &card);
if (err < 0) {
- err = snd_config_string_get(n, &str);
+ err = snd_config_get_string(n, &str);
if (err < 0) {
- ERR("Invalid type for %s", n->id);
+ ERR("Invalid type for %s", id);
return -EINVAL;
}
card = snd_card_get_index(str);
if (card < 0) {
- ERR("Invalid value for %s", n->id);
+ ERR("Invalid value for %s", id);
return card;
}
}
continue;
}
- if (strcmp(n->id, "device") == 0) {
- err = snd_config_integer_get(n, &device);
+ if (strcmp(id, "device") == 0) {
+ err = snd_config_get_integer(n, &device);
if (err < 0) {
- ERR("Invalid type for %s", n->id);
+ ERR("Invalid type for %s", id);
return err;
}
continue;
}
- if (strcmp(n->id, "subdevice") == 0) {
- err = snd_config_integer_get(n, &subdevice);
+ if (strcmp(id, "subdevice") == 0) {
+ err = snd_config_get_integer(n, &subdevice);
if (err < 0) {
- ERR("Invalid type for %s", n->id);
+ ERR("Invalid type for %s", id);
return err;
}
continue;
}
- ERR("Unknown field %s", n->id);
+ ERR("Unknown field %s", id);
return -EINVAL;
}
if (card < 0) {
snd_pcm_t *spcm;
snd_pcm_format_t sformat = SND_PCM_FORMAT_UNKNOWN;
snd_config_foreach(i, conf) {
- snd_config_t *n = snd_config_entry(i);
- if (strcmp(n->id, "comment") == 0)
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id = snd_config_get_id(n);
+ if (strcmp(id, "comment") == 0)
continue;
- if (strcmp(n->id, "type") == 0)
+ if (strcmp(id, "type") == 0)
continue;
- if (strcmp(n->id, "stream") == 0)
+ if (strcmp(id, "stream") == 0)
continue;
- if (strcmp(n->id, "sname") == 0) {
- err = snd_config_string_get(n, &sname);
+ if (strcmp(id, "sname") == 0) {
+ err = snd_config_get_string(n, &sname);
if (err < 0) {
- ERR("Invalid type for %s", n->id);
+ ERR("Invalid type for %s", id);
return -EINVAL;
}
continue;
}
- if (strcmp(n->id, "sformat") == 0) {
+ if (strcmp(id, "sformat") == 0) {
const char *f;
- err = snd_config_string_get(n, &f);
+ err = snd_config_get_string(n, &f);
if (err < 0) {
- ERR("Invalid type for %s", n->id);
+ ERR("Invalid type for %s", id);
return -EINVAL;
}
sformat = snd_pcm_format_value(f);
}
continue;
}
- ERR("Unknown field %s", n->id);
+ ERR("Unknown field %s", id);
return -EINVAL;
}
if (!sname) {
snd_pcm_t *spcm;
snd_pcm_format_t sformat = SND_PCM_FORMAT_UNKNOWN;
snd_config_foreach(i, conf) {
- snd_config_t *n = snd_config_entry(i);
- if (strcmp(n->id, "comment") == 0)
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id = snd_config_get_id(n);
+ if (strcmp(id, "comment") == 0)
continue;
- if (strcmp(n->id, "type") == 0)
+ if (strcmp(id, "type") == 0)
continue;
- if (strcmp(n->id, "stream") == 0)
+ if (strcmp(id, "stream") == 0)
continue;
- if (strcmp(n->id, "sname") == 0) {
- err = snd_config_string_get(n, &sname);
+ if (strcmp(id, "sname") == 0) {
+ err = snd_config_get_string(n, &sname);
if (err < 0) {
- ERR("Invalid type for %s", n->id);
+ ERR("Invalid type for %s", id);
return -EINVAL;
}
continue;
}
- if (strcmp(n->id, "sformat") == 0) {
+ if (strcmp(id, "sformat") == 0) {
const char *f;
- err = snd_config_string_get(n, &f);
+ err = snd_config_get_string(n, &f);
if (err < 0) {
- ERR("Invalid type for %s", n->id);
+ ERR("Invalid type for %s", id);
return -EINVAL;
}
sformat = snd_pcm_format_value(f);
}
continue;
}
- ERR("Unknown field %s", n->id);
+ ERR("Unknown field %s", id);
return -EINVAL;
}
if (!sname) {
unsigned int slaves_count = 0;
unsigned int channels_count = 0;
snd_config_foreach(i, conf) {
- snd_config_t *n = snd_config_entry(i);
- if (strcmp(n->id, "comment") == 0)
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id = snd_config_get_id(n);
+ if (strcmp(id, "comment") == 0)
continue;
- if (strcmp(n->id, "type") == 0)
+ if (strcmp(id, "type") == 0)
continue;
- if (strcmp(n->id, "stream") == 0)
+ if (strcmp(id, "stream") == 0)
continue;
- if (strcmp(n->id, "slave") == 0) {
- if (snd_config_type(n) != SND_CONFIG_TYPE_COMPOUND) {
- ERR("Invalid type for %s", n->id);
+ if (strcmp(id, "slave") == 0) {
+ if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
+ ERR("Invalid type for %s", id);
return -EINVAL;
}
slave = n;
continue;
}
- if (strcmp(n->id, "binding") == 0) {
- if (snd_config_type(n) != SND_CONFIG_TYPE_COMPOUND) {
- ERR("Invalid type for %s", n->id);
+ if (strcmp(id, "binding") == 0) {
+ if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
+ ERR("Invalid type for %s", id);
return -EINVAL;
}
binding = n;
continue;
}
- ERR("Unknown field %s", n->id);
+ ERR("Unknown field %s", id);
return -EINVAL;
}
if (!slave) {
snd_config_foreach(i, binding) {
int cchannel = -1;
char *p;
- snd_config_t *m = snd_config_entry(i);
+ snd_config_t *m = snd_config_iterator_entry(i);
+ const char *id = snd_config_get_id(m);
errno = 0;
- cchannel = strtol(m->id, &p, 10);
+ cchannel = strtol(id, &p, 10);
if (errno || *p || cchannel < 0) {
- ERR("Invalid channel number: %s", m->id);
+ ERR("Invalid channel number: %s", id);
return -EINVAL;
}
if ((unsigned)cchannel >= channels_count)
channels_sidx[idx] = -1;
idx = 0;
snd_config_foreach(i, slave) {
- snd_config_t *m = snd_config_entry(i);
+ snd_config_t *m = snd_config_iterator_entry(i);
const char *name = NULL;
long channels = -1;
- slaves_id[idx] = m->id;
+ slaves_id[idx] = snd_config_get_id(m);
snd_config_foreach(j, m) {
- snd_config_t *n = snd_config_entry(j);
- if (strcmp(n->id, "comment") == 0)
+ snd_config_t *n = snd_config_iterator_entry(j);
+ const char *id = snd_config_get_id(n);
+ if (strcmp(id, "comment") == 0)
continue;
- if (strcmp(n->id, "name") == 0) {
- err = snd_config_string_get(n, &name);
+ if (strcmp(id, "name") == 0) {
+ err = snd_config_get_string(n, &name);
if (err < 0) {
- ERR("Invalid type for %s", n->id);
+ ERR("Invalid type for %s", id);
goto _free;
}
continue;
}
- if (strcmp(n->id, "channels") == 0) {
- err = snd_config_integer_get(n, &channels);
+ if (strcmp(id, "channels") == 0) {
+ err = snd_config_get_integer(n, &channels);
if (err < 0) {
- ERR("Invalid type for %s", n->id);
+ ERR("Invalid type for %s", id);
goto _free;
}
continue;
}
- ERR("Unknown field %s", n->id);
+ ERR("Unknown field %s", id);
err = -EINVAL;
goto _free;
}
}
snd_config_foreach(i, binding) {
- snd_config_t *m = snd_config_entry(i);
+ snd_config_t *m = snd_config_iterator_entry(i);
long cchannel = -1;
long schannel = -1;
int slave = -1;
long val;
const char *str;
- cchannel = strtol(m->id, 0, 10);
+ const char *id = snd_config_get_id(m);
+ cchannel = strtol(id, 0, 10);
if (cchannel < 0) {
- ERR("Invalid channel number: %s", m->id);
+ ERR("Invalid channel number: %s", id);
err = -EINVAL;
goto _free;
}
snd_config_foreach(j, m) {
- snd_config_t *n = snd_config_entry(j);
- if (strcmp(n->id, "comment") == 0)
+ snd_config_t *n = snd_config_iterator_entry(j);
+ const char *id = snd_config_get_id(n);
+ if (strcmp(id, "comment") == 0)
continue;
- if (strcmp(n->id, "sidx") == 0) {
+ if (strcmp(id, "sidx") == 0) {
char buf[32];
unsigned int k;
- err = snd_config_string_get(n, &str);
+ err = snd_config_get_string(n, &str);
if (err < 0) {
- err = snd_config_integer_get(n, &val);
+ err = snd_config_get_integer(n, &val);
if (err < 0) {
- ERR("Invalid value for %s", n->id);
+ ERR("Invalid value for %s", id);
goto _free;
}
sprintf(buf, "%ld", val);
}
continue;
}
- if (strcmp(n->id, "schannel") == 0) {
- err = snd_config_integer_get(n, &schannel);
+ if (strcmp(id, "schannel") == 0) {
+ err = snd_config_get_integer(n, &schannel);
if (err < 0) {
- ERR("Invalid type for %s", n->id);
+ ERR("Invalid type for %s", id);
goto _free;
}
continue;
}
- ERR("Unknown field %s", n->id);
+ ERR("Unknown field %s", id);
err = -EINVAL;
goto _free;
}
{
snd_config_iterator_t i;
snd_config_foreach(i, conf) {
- snd_config_t *n = snd_config_entry(i);
- if (strcmp(n->id, "comment") == 0)
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id = snd_config_get_id(n);
+ if (strcmp(id, "comment") == 0)
continue;
- if (strcmp(n->id, "type") == 0)
+ if (strcmp(id, "type") == 0)
continue;
- if (strcmp(n->id, "stream") == 0)
+ if (strcmp(id, "stream") == 0)
continue;
- ERR("Unknown field %s", n->id);
+ ERR("Unknown field %s", id);
return -EINVAL;
}
return snd_pcm_null_open(pcmp, name, stream, mode);
snd_pcm_route_ttable_entry_t *ttable = NULL;
unsigned int cused, sused;
snd_config_foreach(i, conf) {
- snd_config_t *n = snd_config_entry(i);
- if (strcmp(n->id, "comment") == 0)
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id = snd_config_get_id(n);
+ if (strcmp(id, "comment") == 0)
continue;
- if (strcmp(n->id, "type") == 0)
+ if (strcmp(id, "type") == 0)
continue;
- if (strcmp(n->id, "stream") == 0)
+ if (strcmp(id, "stream") == 0)
continue;
- if (strcmp(n->id, "sname") == 0) {
- err = snd_config_string_get(n, &sname);
+ if (strcmp(id, "sname") == 0) {
+ err = snd_config_get_string(n, &sname);
if (err < 0) {
- ERR("Invalid type for %s", n->id);
+ ERR("Invalid type for %s", id);
return -EINVAL;
}
continue;
}
- if (strcmp(n->id, "ttable") == 0) {
- if (snd_config_type(n) != SND_CONFIG_TYPE_COMPOUND) {
- ERR("Invalid type for %s", n->id);
+ if (strcmp(id, "ttable") == 0) {
+ if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
+ ERR("Invalid type for %s", id);
return -EINVAL;
}
tt = n;
continue;
}
- ERR("Unknown field %s", n->id);
+ ERR("Unknown field %s", id);
return -EINVAL;
}
if (!sname) {
snd_pcm_format_t sformat = SND_PCM_FORMAT_UNKNOWN;
long srate = -1;
snd_config_foreach(i, conf) {
- snd_config_t *n = snd_config_entry(i);
- if (strcmp(n->id, "comment") == 0)
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id = snd_config_get_id(n);
+ if (strcmp(id, "comment") == 0)
continue;
- if (strcmp(n->id, "type") == 0)
+ if (strcmp(id, "type") == 0)
continue;
- if (strcmp(n->id, "stream") == 0)
+ if (strcmp(id, "stream") == 0)
continue;
- if (strcmp(n->id, "sname") == 0) {
- err = snd_config_string_get(n, &sname);
+ if (strcmp(id, "sname") == 0) {
+ err = snd_config_get_string(n, &sname);
if (err < 0) {
- ERR("Invalid type for %s", n->id);
+ ERR("Invalid type for %s", id);
return -EINVAL;
}
continue;
}
- if (strcmp(n->id, "sformat") == 0) {
+ if (strcmp(id, "sformat") == 0) {
const char *f;
- err = snd_config_string_get(n, &f);
+ err = snd_config_get_string(n, &f);
if (err < 0) {
- ERR("Invalid type for %s", n->id);
+ ERR("Invalid type for %s", id);
return -EINVAL;
}
sformat = snd_pcm_format_value(f);
}
continue;
}
- if (strcmp(n->id, "srate") == 0) {
- err = snd_config_integer_get(n, &srate);
+ if (strcmp(id, "srate") == 0) {
+ err = snd_config_get_integer(n, &srate);
if (err < 0) {
- ERR("Invalid type for %s", n->id);
+ ERR("Invalid type for %s", id);
return -EINVAL;
}
continue;
}
- ERR("Unknown field %s", n->id);
+ ERR("Unknown field %s", id);
return -EINVAL;
}
if (!sname) {
for (k = 0; k < tt_csize * tt_ssize; ++k)
ttable[k] = 0.0;
snd_config_foreach(i, tt) {
- snd_config_t *in = snd_config_entry(i);
+ snd_config_t *in = snd_config_iterator_entry(i);
snd_config_iterator_t j;
char *p;
long cchannel;
errno = 0;
- cchannel = strtol(in->id, &p, 10);
+ cchannel = strtol(snd_config_get_id(in), &p, 10);
if (errno || *p ||
cchannel < 0 || (unsigned int) cchannel > tt_csize) {
- ERR("Invalid client channel: %s", in->id);
+ ERR("Invalid client channel: %s", snd_config_get_id(in));
return -EINVAL;
}
- if (snd_config_type(in) != SND_CONFIG_TYPE_COMPOUND)
+ if (snd_config_get_type(in) != SND_CONFIG_TYPE_COMPOUND)
return -EINVAL;
snd_config_foreach(j, in) {
- snd_config_t *jn = snd_config_entry(j);
+ snd_config_t *jn = snd_config_iterator_entry(j);
double value;
long schannel;
int err;
+ const char *id = snd_config_get_id(jn);
errno = 0;
- schannel = strtol(jn->id, &p, 10);
+ schannel = strtol(id, &p, 10);
if (errno || *p ||
schannel < 0 || (unsigned int) schannel > tt_ssize ||
(schannels > 0 && schannel >= schannels)) {
- ERR("Invalid slave channel: %s", jn->id);
+ ERR("Invalid slave channel: %s", id);
return -EINVAL;
}
- err = snd_config_real_get(jn, &value);
+ err = snd_config_get_real(jn, &value);
if (err < 0) {
long v;
- err = snd_config_integer_get(jn, &v);
+ err = snd_config_get_integer(jn, &v);
if (err < 0) {
- ERR("Invalid type for %s", jn->id);
+ ERR("Invalid type for %s", id);
return -EINVAL;
}
value = v;
snd_pcm_route_ttable_entry_t ttable[MAX_CHANNELS*MAX_CHANNELS];
unsigned int cused, sused;
snd_config_foreach(i, conf) {
- snd_config_t *n = snd_config_entry(i);
- if (strcmp(n->id, "comment") == 0)
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id = snd_config_get_id(n);
+ if (strcmp(id, "comment") == 0)
continue;
- if (strcmp(n->id, "type") == 0)
+ if (strcmp(id, "type") == 0)
continue;
- if (strcmp(n->id, "stream") == 0)
+ if (strcmp(id, "stream") == 0)
continue;
- if (strcmp(n->id, "sname") == 0) {
- err = snd_config_string_get(n, &sname);
+ if (strcmp(id, "sname") == 0) {
+ err = snd_config_get_string(n, &sname);
if (err < 0) {
- ERR("Invalid type for %s", n->id);
+ ERR("Invalid type for %s", id);
return -EINVAL;
}
continue;
}
- if (strcmp(n->id, "sformat") == 0) {
+ if (strcmp(id, "sformat") == 0) {
const char *f;
- err = snd_config_string_get(n, &f);
+ err = snd_config_get_string(n, &f);
if (err < 0) {
- ERR("Invalid type for %s", n->id);
+ ERR("Invalid type for %s", id);
return -EINVAL;
}
sformat = snd_pcm_format_value(f);
}
continue;
}
- if (strcmp(n->id, "schannels") == 0) {
- err = snd_config_integer_get(n, &schannels);
+ if (strcmp(id, "schannels") == 0) {
+ err = snd_config_get_integer(n, &schannels);
if (err < 0) {
- ERR("Invalid type for %s", n->id);
+ ERR("Invalid type for %s", id);
return -EINVAL;
}
continue;
}
- if (strcmp(n->id, "ttable") == 0) {
- if (snd_config_type(n) != SND_CONFIG_TYPE_COMPOUND) {
- ERR("Invalid type for %s", n->id);
+ if (strcmp(id, "ttable") == 0) {
+ if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
+ ERR("Invalid type for %s", id);
return -EINVAL;
}
tt = n;
continue;
}
- ERR("Unknown field %s", n->id);
+ ERR("Unknown field %s", id);
return -EINVAL;
}
if (!sname) {
long srate = -1;
snd_config_foreach(i, conf) {
- snd_config_t *n = snd_config_entry(i);
- if (strcmp(n->id, "comment") == 0)
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id = snd_config_get_id(n);
+ if (strcmp(id, "comment") == 0)
continue;
- if (strcmp(n->id, "type") == 0)
+ if (strcmp(id, "type") == 0)
continue;
- if (strcmp(n->id, "stream") == 0)
+ if (strcmp(id, "stream") == 0)
continue;
- if (strcmp(n->id, "sname") == 0) {
- err = snd_config_string_get(n, &sname);
+ if (strcmp(id, "sname") == 0) {
+ err = snd_config_get_string(n, &sname);
if (err < 0) {
- ERR("Invalid type for %s", n->id);
+ ERR("Invalid type for %s", id);
return -EINVAL;
}
continue;
}
- if (strcmp(n->id, "sformat") == 0) {
+ if (strcmp(id, "sformat") == 0) {
const char *f;
- err = snd_config_string_get(n, &f);
+ err = snd_config_get_string(n, &f);
if (err < 0) {
- ERR("Invalid type for %s", n->id);
+ ERR("Invalid type for %s", id);
return -EINVAL;
}
sformat = snd_pcm_format_value(f);
}
continue;
}
- if (strcmp(n->id, "schannels") == 0) {
- err = snd_config_integer_get(n, &schannels_count);
+ if (strcmp(id, "schannels") == 0) {
+ err = snd_config_get_integer(n, &schannels_count);
if (err < 0) {
- ERR("Invalid type for %s", n->id);
+ ERR("Invalid type for %s", id);
return -EINVAL;
}
continue;
}
- if (strcmp(n->id, "srate") == 0) {
- err = snd_config_integer_get(n, &srate);
+ if (strcmp(id, "srate") == 0) {
+ err = snd_config_get_integer(n, &srate);
if (err < 0) {
- ERR("Invalid type for %s", n->id);
+ ERR("Invalid type for %s", id);
return -EINVAL;
}
continue;
}
- if (strcmp(n->id, "binding") == 0) {
- if (snd_config_type(n) != SND_CONFIG_TYPE_COMPOUND) {
- ERR("Invalid type for %s", n->id);
+ if (strcmp(id, "binding") == 0) {
+ if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
+ ERR("Invalid type for %s", id);
return -EINVAL;
}
binding = n;
continue;
}
- ERR("Unknown field %s", n->id);
+ ERR("Unknown field %s", id);
return -EINVAL;
}
if (!sname) {
snd_config_foreach(i, binding) {
int cchannel = -1;
char *p;
- snd_config_t *n = snd_config_entry(i);
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id = snd_config_get_id(n);
errno = 0;
- cchannel = strtol(n->id, &p, 10);
+ cchannel = strtol(id, &p, 10);
if (errno || *p || cchannel < 0) {
- ERR("Invalid client channel in binding: %s", n->id);
+ ERR("Invalid client channel in binding: %s", id);
return -EINVAL;
}
if ((unsigned)cchannel >= channels_count)
channels_map[idx] = -1;
snd_config_foreach(i, binding) {
- snd_config_t *n = snd_config_entry(i);
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id = snd_config_get_id(n);
long cchannel;
long schannel = -1;
- cchannel = strtol(n->id, 0, 10);
- err = snd_config_integer_get(n, &schannel);
+ cchannel = strtol(id, 0, 10);
+ err = snd_config_get_integer(n, &schannel);
if (err < 0)
goto _free;
assert(schannels_count <= 0 || schannel < schannels_count);
int local;
struct hostent *h;
snd_config_foreach(i, conf) {
- snd_config_t *n = snd_config_entry(i);
- if (strcmp(n->id, "comment") == 0)
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id = snd_config_get_id(n);
+ if (strcmp(id, "comment") == 0)
continue;
- if (strcmp(n->id, "type") == 0)
+ if (strcmp(id, "type") == 0)
continue;
- if (strcmp(n->id, "stream") == 0)
+ if (strcmp(id, "stream") == 0)
continue;
- if (strcmp(n->id, "server") == 0) {
- err = snd_config_string_get(n, &server);
+ if (strcmp(id, "server") == 0) {
+ err = snd_config_get_string(n, &server);
if (err < 0) {
- ERR("Invalid type for %s", n->id);
+ ERR("Invalid type for %s", id);
return -EINVAL;
}
continue;
}
- if (strcmp(n->id, "sname") == 0) {
- err = snd_config_string_get(n, &sname);
+ if (strcmp(id, "sname") == 0) {
+ err = snd_config_get_string(n, &sname);
if (err < 0) {
- ERR("Invalid type for %s", n->id);
+ ERR("Invalid type for %s", id);
return -EINVAL;
}
continue;
}
- ERR("Unknown field %s", n->id);
+ ERR("Unknown field %s", id);
return -EINVAL;
}
if (!sname) {
return -EINVAL;
}
snd_config_foreach(i, sconfig) {
- snd_config_t *n = snd_config_entry(i);
- if (strcmp(n->id, "comment") == 0)
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id = snd_config_get_id(n);
+ if (strcmp(id, "comment") == 0)
continue;
- if (strcmp(n->id, "host") == 0) {
- err = snd_config_string_get(n, &host);
+ if (strcmp(id, "host") == 0) {
+ err = snd_config_get_string(n, &host);
if (err < 0) {
- ERR("Invalid type for %s", n->id);
+ ERR("Invalid type for %s", id);
return -EINVAL;
}
continue;
}
- if (strcmp(n->id, "socket") == 0) {
- err = snd_config_string_get(n, &socket);
+ if (strcmp(id, "socket") == 0) {
+ err = snd_config_get_string(n, &socket);
if (err < 0) {
- ERR("Invalid type for %s", n->id);
+ ERR("Invalid type for %s", id);
return -EINVAL;
}
continue;
}
- if (strcmp(n->id, "port") == 0) {
- err = snd_config_integer_get(n, &port);
+ if (strcmp(id, "port") == 0) {
+ err = snd_config_get_integer(n, &port);
if (err < 0) {
- ERR("Invalid type for %s", n->id);
+ ERR("Invalid type for %s", id);
return -EINVAL;
}
continue;
}
- ERR("Unknown field %s", n->id);
+ ERR("Unknown field %s", id);
return -EINVAL;
}
ERR("Unknown RAWMIDI %s", name);
return -ENOENT;
}
- if (snd_config_type(rawmidi_conf) != SND_CONFIG_TYPE_COMPOUND) {
+ if (snd_config_get_type(rawmidi_conf) != SND_CONFIG_TYPE_COMPOUND) {
ERR("Invalid type for RAWMIDI %s definition", name);
return -EINVAL;
}
err = snd_config_search(rawmidi_conf, "streams", &conf);
if (err >= 0) {
- err = snd_config_string_get(conf, &str);
+ const char *id = snd_config_get_id(conf);
+ err = snd_config_get_string(conf, &str);
if (err < 0) {
- ERR("Invalid type for %s", conf->id);
+ ERR("Invalid type for %s", id);
return err;
}
if (strcmp(str, "output") == 0) {
if (streams != SND_RAWMIDI_OPEN_DUPLEX)
return -EINVAL;
} else {
- ERR("Invalid value for %s", conf->id);
+ ERR("Invalid value for %s", id);
return -EINVAL;
}
}
ERR("type is not defined");
return err;
}
- err = snd_config_string_get(conf, &str);
+ err = snd_config_get_string(conf, &str);
if (err < 0) {
- ERR("Invalid type for %s", conf->id);
+ ERR("Invalid type for %s", snd_config_get_id(conf));
return err;
}
err = snd_config_searchv(snd_config, &type_conf, "rawmiditype", str, 0);
return err;
}
snd_config_foreach(i, type_conf) {
- snd_config_t *n = snd_config_entry(i);
- if (strcmp(n->id, "comment") == 0)
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id = snd_config_get_id(n);
+ if (strcmp(id, "comment") == 0)
continue;
- if (strcmp(n->id, "lib") == 0) {
- err = snd_config_string_get(n, &lib);
+ if (strcmp(id, "lib") == 0) {
+ err = snd_config_get_string(n, &lib);
if (err < 0) {
- ERR("Invalid type for %s", n->id);
+ ERR("Invalid type for %s", id);
return -EINVAL;
}
continue;
}
- if (strcmp(n->id, "open") == 0) {
- err = snd_config_string_get(n, &open);
+ if (strcmp(id, "open") == 0) {
+ err = snd_config_get_string(n, &open);
if (err < 0) {
- ERR("Invalid type for %s", n->id);
+ ERR("Invalid type for %s", id);
return -EINVAL;
}
continue;
- ERR("Unknown field %s", n->id);
+ ERR("Unknown field %s", id);
return -EINVAL;
}
}
const char *str;
int err;
snd_config_foreach(i, conf) {
- snd_config_t *n = snd_config_entry(i);
- if (strcmp(n->id, "comment") == 0)
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id = snd_config_get_id(n);
+ if (strcmp(id, "comment") == 0)
continue;
- if (strcmp(n->id, "type") == 0)
+ if (strcmp(id, "type") == 0)
continue;
- if (strcmp(n->id, "streams") == 0)
+ if (strcmp(id, "streams") == 0)
continue;
- if (strcmp(n->id, "card") == 0) {
- err = snd_config_integer_get(n, &card);
+ if (strcmp(id, "card") == 0) {
+ err = snd_config_get_integer(n, &card);
if (err < 0) {
- err = snd_config_string_get(n, &str);
+ err = snd_config_get_string(n, &str);
if (err < 0)
return -EINVAL;
card = snd_card_get_index(str);
}
continue;
}
- if (strcmp(n->id, "device") == 0) {
- err = snd_config_integer_get(n, &device);
+ if (strcmp(id, "device") == 0) {
+ err = snd_config_get_integer(n, &device);
if (err < 0)
return err;
continue;
}
- if (strcmp(n->id, "subdevice") == 0) {
- err = snd_config_integer_get(n, &subdevice);
+ if (strcmp(id, "subdevice") == 0) {
+ err = snd_config_get_integer(n, &subdevice);
if (err < 0)
return err;
continue;
ERR("Unknown SEQ %s", name);
return -ENOENT;
}
- if (snd_config_type(seq_conf) != SND_CONFIG_TYPE_COMPOUND) {
+ if (snd_config_get_type(seq_conf) != SND_CONFIG_TYPE_COMPOUND) {
ERR("Invalid type for SEQ %s definition", name);
return -EINVAL;
}
err = snd_config_search(seq_conf, "streams", &conf);
if (err >= 0) {
- err = snd_config_string_get(conf, &str);
+ const char *id = snd_config_get_id(conf);
+ err = snd_config_get_string(conf, &str);
if (err < 0) {
- ERR("Invalid type for %s", conf->id);
+ ERR("Invalid type for %s", id);
return err;
}
if (strcmp(str, "output") == 0) {
if (streams != SND_SEQ_OPEN_DUPLEX)
return -EINVAL;
} else {
- ERR("Invalid value for %s", conf->id);
+ ERR("Invalid value for %s", id);
return -EINVAL;
}
}
ERR("type is not defined");
return err;
}
- err = snd_config_string_get(conf, &str);
+ err = snd_config_get_string(conf, &str);
if (err < 0) {
- ERR("Invalid type for %s", conf->id);
+ ERR("Invalid type for %s", snd_config_get_id(conf));
return err;
}
err = snd_config_searchv(snd_config, &type_conf, "seqtype", str, 0);
return err;
}
snd_config_foreach(i, type_conf) {
- snd_config_t *n = snd_config_entry(i);
- if (strcmp(n->id, "comment") == 0)
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id = snd_config_get_id(n);
+ if (strcmp(id, "comment") == 0)
continue;
- if (strcmp(n->id, "lib") == 0) {
- err = snd_config_string_get(n, &lib);
+ if (strcmp(id, "lib") == 0) {
+ err = snd_config_get_string(n, &lib);
if (err < 0) {
- ERR("Invalid type for %s", n->id);
+ ERR("Invalid type for %s", id);
return -EINVAL;
}
continue;
}
- if (strcmp(n->id, "open") == 0) {
- err = snd_config_string_get(n, &open);
+ if (strcmp(id, "open") == 0) {
+ err = snd_config_get_string(n, &open);
if (err < 0) {
- ERR("Invalid type for %s", n->id);
+ ERR("Invalid type for %s", id);
return -EINVAL;
}
continue;
- ERR("Unknown field %s", n->id);
+ ERR("Unknown field %s", id);
return -EINVAL;
}
}
{
snd_config_iterator_t i;
snd_config_foreach(i, conf) {
- snd_config_t *n = snd_config_entry(i);
- if (strcmp(n->id, "comment") == 0)
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id = snd_config_get_id(n);
+ if (strcmp(id, "comment") == 0)
continue;
- if (strcmp(n->id, "type") == 0)
+ if (strcmp(id, "type") == 0)
continue;
- if (strcmp(n->id, "streams") == 0)
+ if (strcmp(id, "streams") == 0)
continue;
return -EINVAL;
}