-static struct check_wav_task cwt;
-static struct initial_delay_task idt;
-static struct writer_node_group *wng;
-
-/** length of a standard wav header */
-#define WAV_HEADER_LEN 44
-
-/**
- * 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 awailable, return one.
- */
-static void check_wav_pre_select(__a_unused struct sched *s, struct task *t)
-{
- struct check_wav_task *wt = t->private_data;
- unsigned char *a;
-
- if (*wt->loaded < WAV_HEADER_LEN) {
- t->ret = *wt->eof? -E_PREMATURE_END : 1;
- return;
- }
- wt->channels = 2;
- wt->samplerate = 44100;
- a = (unsigned char*)wt->buf;
- t->ret = -E_NO_WAV_HEADER;
- if (a[0] != 'R' || a[1] != 'I' || a[2] != 'F' || a[3] != 'F')
- return;
- wt->channels = (unsigned) a[22];
- wt->samplerate = a[24] + (a[25] << 8) + (a[26] << 16) + (a[27] << 24);
- *wt->loaded -= WAV_HEADER_LEN;
- memmove(wt->buf, wt->buf + WAV_HEADER_LEN, *wt->loaded);
- t->ret = -E_WAV_HEADER_SUCCESS;
- PARA_INFO_LOG("channels: %d, sample rate: %d\n", wt->channels, wt->samplerate);
-}