- 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;
- cwt->channels = 2;
- cwt->samplerate = 44100;
- if (a[0] != 'R' || a[1] != 'I' || a[2] != 'F' || a[3] != 'F') {
- 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->samplerate = a[24] + (a[25] << 8) + (a[26] << 16) + (a[27] << 24);
- PARA_INFO_LOG("channels: %d, sample rate: %d\n", cwt->channels, cwt->samplerate);
- btr_consume(btrn, WAV_HEADER_LEN);
-pushdown:
- btr_pushdown(btrn);
-out:
- t->error = ret;
- if (ret < 0)
- btr_remove_node(btrn);
+static void write_pre_select(struct sched *s, struct task *t)
+{
+ struct write_task *wt = container_of(t, struct write_task, task);
+ check_wav_pre_select(s, wt->cwc);