]> git.alsa-project.org Git - alsa-lib.git/commitdiff
topology: add snd_tplg_create() with flags
authorJaroslav Kysela <perex@perex.cz>
Fri, 20 Dec 2019 13:59:00 +0000 (14:59 +0100)
committerJaroslav Kysela <perex@perex.cz>
Fri, 3 Jan 2020 22:38:08 +0000 (23:38 +0100)
Add SND_TPLG_CREATE_VERBOSE and SND_TPLG_CREATE_DAPM_NOSORT
flags for the special operations.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
include/topology.h
src/topology/dapm.c
src/topology/parser.c
src/topology/tplg_local.h

index 69aa5ed733e3734d42181ff0416b02219310389a..63c13a9885e9d860953ab0bcb3a88859a373ce6c 100644 (file)
@@ -771,12 +771,22 @@ enum snd_tplg_type {
 /** Fit for all user cases */
 #define SND_TPLG_INDEX_ALL  0
 
+/** Flags for the snd_tplg_create */
+#define SND_TPLG_CREATE_VERBOSE                (1<<0)  /*!< Verbose output */
+#define SND_TPLG_CREATE_DAPM_NOSORT    (1<<1)  /*!< Do not sort DAPM objects by index */
+
 /**
  * \brief Create a new topology parser instance.
  * \return New topology parser instance
  */
 snd_tplg_t *snd_tplg_new(void);
 
+/**
+ * \brief Create a new topology parser instance.
+ * \return New topology parser instance
+ */
+snd_tplg_t *snd_tplg_create(int flags);
+
 /**
  * \brief Free a topology parser instance.
  * \param tplg Topology parser instance
index 2bdacedca12533da24354472421743de1b6c5056..d6c15fc1dfaa5658f1af816084f614e3242da2d4 100644 (file)
@@ -268,7 +268,10 @@ struct tplg_elem *tplg_elem_new_route(snd_tplg_t *tplg, int index)
                return NULL;
 
        elem->index = index;
-       tplg_elem_insert(elem, &tplg->route_list);
+       if (tplg->dapm_sort)
+               tplg_elem_insert(elem, &tplg->route_list);
+       else
+               list_add_tail(&elem->list, &tplg->route_list);
        strcpy(elem->id, "line");
        elem->type = SND_TPLG_TYPE_DAPM_GRAPH;
        elem->size = sizeof(*line);
index de5edd1b6591d9e4dfaadc2e480473cadc50b7d6..8f810f751533dfaf2cea1e193e5b73d8d290312e 100644 (file)
@@ -432,7 +432,7 @@ static bool is_little_endian(void)
        return false;
 }
 
-snd_tplg_t *snd_tplg_new(void)
+snd_tplg_t *snd_tplg_create(int flags)
 {
        snd_tplg_t *tplg;
 
@@ -445,6 +445,9 @@ snd_tplg_t *snd_tplg_new(void)
        if (!tplg)
                return NULL;
 
+       tplg->verbose = !!(flags & SND_TPLG_CREATE_VERBOSE);
+       tplg->dapm_sort = (flags & SND_TPLG_CREATE_DAPM_NOSORT) == 0;
+
        tplg->manifest.size = sizeof(struct snd_soc_tplg_manifest);
 
        INIT_LIST_HEAD(&tplg->tlv_list);
@@ -469,6 +472,11 @@ snd_tplg_t *snd_tplg_new(void)
        return tplg;
 }
 
+snd_tplg_t *snd_tplg_new(void)
+{
+       return snd_tplg_create(0);
+}
+
 void snd_tplg_free(snd_tplg_t *tplg)
 {
        free(tplg->bin);
index 42a3aa96ba0ea34524a0bd4384854b6a061bd599..74b3a55cada44832959cf34f8ef462fefc79ba26 100644 (file)
@@ -66,6 +66,7 @@ struct snd_tplg {
        size_t bin_size;
 
        int verbose;
+       unsigned int dapm_sort: 1;
        unsigned int version;
 
        /* runtime state */