alsa/0051-topology-fix-the-ops-parser-accept-integer-hexa-valu.patch
Takashi Iwai 6ab9f38ea9 Accepting request 766329 from home:tiwai:branches:multimedia:libs
- Backport upstream fixes:
  more topology fixes, a memory leak fix in mixer API, alsactl
  string handling fix, UCM config fixes:
  0032-Update-the-attributes.m4-macro-file-from-xine.patch
  0033-topology-avoid-to-use-the-atoi-directly-when-expecte.patch
  0034-topology-use-snd_config_get_bool-instead-own-impleme.patch
  0035-topology-fix-tplg_get_integer-handle-errno-ERANGE.patch
  0036-topology-add-tplg_get_unsigned-function.patch
  0037-topology-convert-builder-to-use-the-mallocated-memor.patch
  0038-topology-add-binary-output-from-the-builder.patch
  0039-topology-parser-recode-tplg_parse_config.patch
  0040-topology-add-snd_tplg_load-remove-snd_tplg_build_bin.patch
  0041-topology-move-the-topology-element-table-from-builde.patch
  0042-topology-add-parser-to-the-tplg_table.patch
  0043-topology-add-snd_tplg_save.patch
  0044-topology-add-snd_tplg_create-with-flags.patch
  0045-topology-add-snd_tplg_version-function.patch
  0046-topology-cleanup-the-SNDERR-calls.patch
  0047-topology-dapm-fix-the-SNDERR-Undefined.patch
  0048-topology-fix-the-unitialized-tuples.patch
  0049-topology-implement-shorter-hexa-uuid-00-00-parser.patch
  0050-topology-fix-the-TPLG_DEBUG-compilation.patch
  0051-topology-fix-the-ops-parser-accept-integer-hexa-valu.patch
  0052-topology-fix-the-wrong-memory-access-object-realloc.patch
  0053-topology-implement-snd_tplg_decode.patch
  0054-topology-move-the-elem-list-delete-to-tplg_elem_free.patch
  0055-topology-unify-the-log-mechanism.patch
  0056-topology-tplg_dbg-cleanups.patch
  0057-topology-cosmetic-changes-functions.patch
  0058-mixer-Fix-memory-leak-for-more-than-16-file-descript.patch

OBS-URL: https://build.opensuse.org/request/show/766329
OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa?expand=0&rev=265
2020-01-22 14:27:43 +00:00

92 lines
2.6 KiB
Diff

From c765615bce7903a0f3e3d5e7826483708398c184 Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Tue, 31 Dec 2019 15:27:58 +0100
Subject: [PATCH 51/63] topology: fix the ops parser (accept integer/hexa
values)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
src/topology/ops.c | 36 +++++++++++++++++++++++++-----------
1 file changed, 25 insertions(+), 11 deletions(-)
diff --git a/src/topology/ops.c b/src/topology/ops.c
index ad72ef1b2cb6..2885c7814604 100644
--- a/src/topology/ops.c
+++ b/src/topology/ops.c
@@ -67,6 +67,7 @@ int tplg_parse_ops(snd_tplg_t *tplg ATTRIBUTE_UNUSED, snd_config_t *cfg,
snd_config_t *n;
struct snd_soc_tplg_ctl_hdr *hdr = private;
const char *id, *value;
+ int ival;
tplg_dbg("\tOps\n");
hdr->size = sizeof(*hdr);
@@ -80,17 +81,23 @@ int tplg_parse_ops(snd_tplg_t *tplg ATTRIBUTE_UNUSED, snd_config_t *cfg,
continue;
/* get value - try strings then ints */
- if (snd_config_get_string(n, &value) < 0)
- continue;
+ if (snd_config_get_type(n) == SND_CONFIG_TYPE_STRING) {
+ if (snd_config_get_string(n, &value) < 0)
+ continue;
+ ival = lookup_ops(value);
+ } else {
+ if (tplg_get_integer(n, &ival, 0))
+ continue;
+ }
if (strcmp(id, "info") == 0)
- hdr->ops.info = lookup_ops(value);
+ hdr->ops.info = ival;
else if (strcmp(id, "put") == 0)
- hdr->ops.put = lookup_ops(value);
+ hdr->ops.put = ival;
else if (strcmp(id, "get") == 0)
- hdr->ops.get = lookup_ops(value);
+ hdr->ops.get = ival;
- tplg_dbg("\t\t%s = %s\n", id, value);
+ tplg_dbg("\t\t%s = %d\n", id, ival);
}
return 0;
@@ -146,6 +153,7 @@ int tplg_parse_ext_ops(snd_tplg_t *tplg ATTRIBUTE_UNUSED,
snd_config_t *n;
struct snd_soc_tplg_bytes_control *be = private;
const char *id, *value;
+ int ival;
tplg_dbg("\tExt Ops\n");
@@ -158,15 +166,21 @@ int tplg_parse_ext_ops(snd_tplg_t *tplg ATTRIBUTE_UNUSED,
continue;
/* get value - try strings then ints */
- if (snd_config_get_string(n, &value) < 0)
- continue;
+ if (snd_config_get_type(n) == SND_CONFIG_TYPE_STRING) {
+ if (snd_config_get_string(n, &value) < 0)
+ continue;
+ ival = lookup_ops(value);
+ } else {
+ if (tplg_get_integer(n, &ival, 0))
+ continue;
+ }
if (strcmp(id, "info") == 0)
- be->ext_ops.info = lookup_ops(value);
+ be->ext_ops.info = ival;
else if (strcmp(id, "put") == 0)
- be->ext_ops.put = lookup_ops(value);
+ be->ext_ops.put = ival;
else if (strcmp(id, "get") == 0)
- be->ext_ops.get = lookup_ops(value);
+ be->ext_ops.get = ival;
tplg_dbg("\t\t%s = %s\n", id, value);
}
--
2.16.4