- int i, ret = -E_WRITE_SYNTAX;
- struct writer_node_group *wng = NULL;
-
- if (conf.list_writers_given) {
- char *msg = NULL;
- FOR_EACH_WRITER(i) {
- char *tmp = make_message("%s%s%s",
- i? msg : "",
- i? " " : "",
- writer_names[i]);
- free(msg);
- msg = tmp;
- }
- fprintf(stderr, "%s\n", msg);
- free(msg);
- exit(EXIT_SUCCESS);
- }
-// if (conf.prebuffer_arg < 0 || conf.prebuffer_arg > 100)
-// goto out;
- if (conf.start_time_given) {
- long unsigned sec, usec;
- if (sscanf(conf.start_time_arg, "%lu:%lu",
- &sec, &usec) != 2)
- goto out;
- idt.start_time.tv_sec = sec;
- idt.start_time.tv_usec = usec;
- }
- if (!conf.writer_given) {
- wng = setup_default_wng();
- ret = 1;
+ struct check_wav_task *cwt = container_of(t, struct check_wav_task, task);
+ struct btr_node *btrn = cwt->btrn;
+ unsigned char *a;
+ size_t sz;
+ int ret;
+ uint16_t bps; /* bits per sample */
+ const char *sample_formats[] = {SAMPLE_FORMATS};
+
+ t->error = 0;
+ ret = btr_node_status(btrn, cwt->min_iqs, BTR_NT_INTERNAL);
+ if (ret <= 0)
+ goto out;
+ if (cwt->state != CWS_NEED_HEADER)
+ goto pushdown;
+ btr_merge(btrn, cwt->min_iqs);
+ sz = btr_next_buffer(btrn, (char **)&a);
+ if (sz < cwt->min_iqs) /* file size less than WAV_HEADER_SIZE */
+ goto pushdown;
+ cwt->min_iqs = 0;
+ /*
+ * The default byte ordering assumed for WAVE data files is
+ * little-endian. Files written using the big-endian byte ordering
+ * scheme have the identifier RIFX instead of RIFF.
+ */
+ if (a[0] != 'R' || a[1] != 'I' || a[2] != 'F' ||
+ (a[3] != 'F' && a[3] != 'X')) {
+ PARA_NOTICE_LOG("wav header not found\n");
+ cwt->state = CWS_NO_HEADER;
+ sprintf(t->status, "check wav: no header");