]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - check_wav.c
Merge branch 't/utf8'
[paraslash.git] / check_wav.c
index 12f44b5be4efb032ba6db054764d108b987cb58c..80265472635d70b24be13b6723c0c26f56374fbe 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005-2012 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 2005-2013 Andre Noll <maan@systemlinux.org>
  *
  * Licensed under the GPL v2. For licencing details see COPYING.
  */
@@ -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;
@@ -97,6 +104,8 @@ int check_wav_post_select(struct check_wav_context *cwc)
        uint16_t bps; /* bits per sample */
        const char *sample_formats[] = {SAMPLE_FORMATS};
 
+       if (!btrn)
+               return 0;
        ret = btr_node_status(btrn, cwc->min_iqs, BTR_NT_INTERNAL);
        if (ret <= 0)
                goto out;
@@ -152,7 +161,8 @@ out:
 }
 
 struct check_wav_context *check_wav_init(struct btr_node *parent,
-               struct wav_params *params, struct btr_node **cw_btrn)
+               struct btr_node *child, struct wav_params *params,
+               struct btr_node **cw_btrn)
 {
        struct check_wav_context *cwc = para_calloc(sizeof(*cwc));
 
@@ -160,7 +170,7 @@ struct check_wav_context *check_wav_init(struct btr_node *parent,
        cwc->min_iqs = WAV_HEADER_LEN;
        cwc->params = *params;
        cwc->btrn = btr_new_node(&(struct btr_node_description)
-               EMBRACE(.name = "check_wav", .parent = parent,
+               EMBRACE(.name = "check_wav", .parent = parent, .child = child,
                .handler = check_wav_exec, .context = cwc));
        if (cw_btrn)
                *cw_btrn = cwc->btrn;