-/**
- * Test if audio buffer contains a valid wave header.
- *
- * \return If not, return -E_NO_WAV_HEADER, otherwise, return zero. If
- * there is less than WAV_HEADER_LEN bytes available, return one.
- */
-static void check_wav_pre_select(__a_unused struct sched *s, struct task *t)
+static void check_wav_pre_select(struct sched *s, struct task *t)
+{
+ struct check_wav_task *cwt = container_of(t, struct check_wav_task, task);
+ int ret;
+
+ ret = btr_node_status(cwt->btrn, cwt->min_iqs, BTR_NT_INTERNAL);
+ if (ret != 0)
+ sched_min_delay(s);
+}
+
+#define HANDLE_EXEC(_cmd) \
+ if (!strcmp(cmd, #_cmd)) { \
+ if (!conf._cmd ## _given && cwt->state == CWS_NEED_HEADER) \
+ return -E_BTR_NAVAIL; \
+ *result = make_message("%d", cwt->state == CWS_NO_HEADER || conf._cmd ## _given? \
+ conf._cmd ## _arg : cwt->_cmd); \
+ return 1; \
+ } \
+
+
+static int check_wav_exec(struct btr_node *btrn, const char *cmd, char **result)
+{
+ struct check_wav_task *cwt = btr_context(btrn);
+
+ HANDLE_EXEC(sample_rate);
+ HANDLE_EXEC(channels);
+ HANDLE_EXEC(sample_format);
+ return -ERRNO_TO_PARA_ERROR(ENOTSUP);
+}
+
+static void check_wav_post_select(__a_unused struct sched *s, struct task *t)