+ 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");
+ goto out;
+ }
+ PARA_INFO_LOG("found wav header\n");
+ cwt->state = CWS_HAVE_HEADER;
+ sprintf(t->status, "check wav: have header");
+ cwt->channels = (unsigned) a[22];
+ cwt->sample_rate = a[24] + (a[25] << 8) + (a[26] << 16) + (a[27] << 24);
+ bps = a[34] + ((unsigned)a[35] << 8);
+ if (bps != 8 && bps != 16) {
+ PARA_WARNING_LOG("%u bps not supported, assuming 16\n", bps);
+ bps = 16;