]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
check_wav: Ask parent nodes before falling back to defaults.
authorAndre Noll <maan@systemlinux.org>
Sun, 28 Oct 2012 14:21:56 +0000 (15:21 +0100)
committerAndre Noll <maan@systemlinux.org>
Sun, 25 Nov 2012 13:08:55 +0000 (14:08 +0100)
This instructs the ->execute handler of the check_wav task to ask its
parent nodes for the channel count, sample rate and sample format in
case no wav header was found and no value for the query was given at
the command line. Currently this can never succeed, since the only
parent node of the check_wav task is the stdin task, which has no
clue about these things. However, once check_wav is being used by
the resample filter, one parent might be a decoder which can tell.

This requires to add the new public btr_parent() to buffer_tree.c to
let the check_wav node obtain the node to start the search from.

buffer_tree.c
buffer_tree.h
check_wav.c

index 63be36d7a10042c5f21b6a95677cdea369ffa12c..4bcc88abb9e56be5b5c29d7b9b9115ff84dfc009 100644 (file)
@@ -1225,3 +1225,8 @@ void btr_get_node_start(struct btr_node *btrn, struct timeval *tv)
 {
        *tv = btrn->start;
 }
+
+struct btr_node *btr_parent(struct btr_node *btrn)
+{
+       return btrn->parent;
+}
index b0817759ee145dfd4ef7bb9ddcb5412b6d00b0fd..071b055c9e21a5469a91f6f1830302fd48352369 100644 (file)
@@ -204,3 +204,4 @@ int btr_node_status(struct btr_node *btrn, size_t min_iqs,
 void btr_get_node_start(struct btr_node *btrn, struct timeval *tv);
 struct btr_node *btr_search_node(const char *name, struct btr_node *root);
 void btr_drain(struct btr_node *btrn);
+struct btr_node *btr_parent(struct btr_node *btrn);
index 12f44b5be4efb032ba6db054764d108b987cb58c..ab1c61887cc1ac3536dd8c364fdd0a9a1bd5cf7b 100644 (file)
@@ -77,6 +77,13 @@ out:
                        val = header_val;
                        break;
                case CWS_NO_HEADER:
+                       /*
+                        * No wav header available and no value specified at
+                        * the command line. Maybe one of our parent nodes
+                        * knows.
+                        */
+                       if (btr_exec_up(btr_parent(cwc->btrn), cmd, result) >= 0)
+                               return 1;
                        /* Use default value */
                        val = arg;
                        break;