"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "topology/pre-process-object.c" between
alsa-utils-1.2.5.tar.bz2 and alsa-utils-1.2.5.1.tar.bz2

About: ALSA (Advanced Linux Sound Architecture) - Utilities.

pre-process-object.c  (alsa-utils-1.2.5.tar.bz2):pre-process-object.c  (alsa-utils-1.2.5.1.tar.bz2)
skipping to change at line 466 skipping to change at line 466
snd_config_t *class, const char *type, snd_config_t *class, const char *type,
const char *class_name, const c har *id) const char *class_name, const c har *id)
{ {
snd_config_t *obj_cfg = NULL; snd_config_t *obj_cfg = NULL;
char *config_id; char *config_id;
config_id = tplg_snprintf("Object.%s.%s.%s", type, class_name, id); config_id = tplg_snprintf("Object.%s.%s.%s", type, class_name, id);
if (!config_id) if (!config_id)
return NULL; return NULL;
snd_config_search(class, config_id, &obj_cfg); if (snd_config_search(class, config_id, &obj_cfg) < 0)
return NULL;
free(config_id); free(config_id);
return obj_cfg; return obj_cfg;
} }
static int tplg_pp_add_object_tuple_section(struct tplg_pre_processor *tplg_pp, static int tplg_pp_add_object_tuple_section(struct tplg_pre_processor *tplg_pp,
snd_config_t *class_cfg, snd_config_t *class_cfg,
snd_config_t *attr, char *data_name, snd_config_t *attr, char *data_name,
const char *token_ref) const char *token_ref)
{ {
snd_config_t *top, *tuple_cfg, *child, *cfg, *new; snd_config_t *top, *tuple_cfg, *child, *cfg, *new;
skipping to change at line 495 skipping to change at line 496
if (ret < 0) { if (ret < 0) {
ret = tplg_config_make_add(&top, "SectionVendorTuples", ret = tplg_config_make_add(&top, "SectionVendorTuples",
SND_CONFIG_TYPE_COMPOUND, tplg_pp->outp ut_cfg); SND_CONFIG_TYPE_COMPOUND, tplg_pp->outp ut_cfg);
if (ret < 0) { if (ret < 0) {
SNDERR("Error creating SectionVendorTuples config\n"); SNDERR("Error creating SectionVendorTuples config\n");
return ret; return ret;
} }
} }
type = strchr(token_ref, '.'); type = strchr(token_ref, '.');
if(!type) {
SNDERR("Error getting type for %s\n", token_ref);
return -EINVAL;
}
token = calloc(1, strlen(token_ref) - strlen(type) + 1); token = calloc(1, strlen(token_ref) - strlen(type) + 1);
if (!token) if (!token)
return -ENOMEM; return -ENOMEM;
snprintf(token, strlen(token_ref) - strlen(type) + 1, "%s", token_ref); snprintf(token, strlen(token_ref) - strlen(type) + 1, "%s", token_ref);
tuple_cfg = tplg_find_config(top, data_name); tuple_cfg = tplg_find_config(top, data_name);
if (!tuple_cfg) { if (!tuple_cfg) {
/* add new SectionVendorTuples */ /* add new SectionVendorTuples */
ret = tplg_config_make_add(&tuple_cfg, data_name, SND_CONFIG_TYPE _COMPOUND, top); ret = tplg_config_make_add(&tuple_cfg, data_name, SND_CONFIG_TYPE _COMPOUND, top);
if (ret < 0) { if (ret < 0) {
skipping to change at line 702 skipping to change at line 708
ret = tplg_pp_add_object_data_section(tplg_pp, data_cfg, data_cfg _name); ret = tplg_pp_add_object_data_section(tplg_pp, data_cfg, data_cfg _name);
if (ret < 0) { if (ret < 0) {
SNDERR("Failed to add data section %s\n", data_cfg_name); SNDERR("Failed to add data section %s\n", data_cfg_name);
free(data_cfg_name); free(data_cfg_name);
return ret; return ret;
} }
ret = tplg_pp_add_object_tuple_section(tplg_pp, class_cfg, n, dat a_cfg_name, ret = tplg_pp_add_object_tuple_section(tplg_pp, class_cfg, n, dat a_cfg_name,
token); token);
free(data_cfg_name);
if (ret < 0) { if (ret < 0) {
SNDERR("Failed to add data section %s\n", data_cfg_name); SNDERR("Failed to add data section %s\n", data_cfg_name);
free(data_cfg_name);
return ret; return ret;
} }
free(data_cfg_name);
} }
return 0; return 0;
} }
/* search for all template configs in the source config and copy them to the des tination */ /* search for all template configs in the source config and copy them to the des tination */
static int tplg_object_add_attributes(snd_config_t *dst, snd_config_t *template, static int tplg_object_add_attributes(snd_config_t *dst, snd_config_t *template,
snd_config_t *src) snd_config_t *src)
{ {
snd_config_iterator_t i, next; snd_config_iterator_t i, next;
skipping to change at line 1213 skipping to change at line 1220
const char *id, *class_id, *obj_id, *s; const char *id, *class_id, *obj_id, *s;
char *new_name; char *new_name;
int ret; int ret;
/* find config for class constructor attributes. Nothing to do if not def ined */ /* find config for class constructor attributes. Nothing to do if not def ined */
ret = snd_config_search(class_cfg, "attributes.constructor", &args); ret = snd_config_search(class_cfg, "attributes.constructor", &args);
if (ret < 0) if (ret < 0)
return 0; return 0;
/* set class name as the name prefix for the object */ /* set class name as the name prefix for the object */
snd_config_get_id(obj, &obj_id); if (snd_config_get_id(obj, &obj_id) < 0)
snd_config_get_id(class_cfg, &class_id); return -EINVAL;
if (snd_config_get_id(class_cfg, &class_id) < 0)
return -EINVAL;
new_name = strdup(class_id); new_name = strdup(class_id);
if (!new_name) if (!new_name)
return -ENOMEM; return -ENOMEM;
/* iterate through all class arguments and set object name */ /* iterate through all class arguments and set object name */
snd_config_for_each(i, next, args) { snd_config_for_each(i, next, args) {
snd_config_t *arg; snd_config_t *arg;
char *arg_value, *temp; char *arg_value, *temp;
n = snd_config_iterator_entry(i); n = snd_config_iterator_entry(i);
skipping to change at line 1278 skipping to change at line 1287
arg_value = strdup(s); arg_value = strdup(s);
if (!arg_value) { if (!arg_value) {
ret = -ENOMEM; ret = -ENOMEM;
goto err; goto err;
} }
break; break;
} }
default: default:
SNDERR("Argument '%s' in object '%s.%s' is not an integer or a string\n", SNDERR("Argument '%s' in object '%s.%s' is not an integer or a string\n",
s, class_id, obj_id); s, class_id, obj_id);
return -EINVAL; ret = -EINVAL;
goto err;
} }
/* alloc and concat arg value to the name */ /* alloc and concat arg value to the name */
temp = tplg_snprintf("%s.%s", new_name, arg_value); temp = tplg_snprintf("%s.%s", new_name, arg_value);
if (!temp) { if (!temp) {
ret = -ENOMEM; ret = -ENOMEM;
goto err; goto err;
} }
free(new_name); free(new_name);
new_name = temp; new_name = temp;
 End of changes. 7 change blocks. 
5 lines changed or deleted 15 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)