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 ## _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);
-
- if (!strcmp(cmd, "sample_rate")) {
- if (cwt->state != CWS_HAVE_HEADER)
- return -E_BTR_NAVAIL;
- *result = make_message("%d", cwt->sample_rate);
- return 1;
- }
- if (!strcmp(cmd, "channels")) {
- if (cwt->state != CWS_HAVE_HEADER)
- return -E_BTR_NAVAIL;
- *result = make_message("%d", cwt->channels);
- return 1;
- }
+ HANDLE_EXEC(sample_rate);
+ HANDLE_EXEC(channels);
return -ERRNO_TO_PARA_ERROR(ENOTSUP);
}