* This function looks at the first \p WAV_HEADER_SIZE bytes of the input queue
* of the btrn of \a cwc. If they look like a wav header, the function extracts
* the information of interest and swallows this part of the stream. Otherwise
* This function looks at the first \p WAV_HEADER_SIZE bytes of the input queue
* of the btrn of \a cwc. If they look like a wav header, the function extracts
* the information of interest and swallows this part of the stream. Otherwise
*
* Once the first part has been processed this way, the state of the instance
* changes from \p CWS_NEED_HEADER to \p CWS_HAVE_HEADER or \p CWS_NO_HEADER.
*
* Once the first part has been processed this way, the state of the instance
* changes from \p CWS_NEED_HEADER to \p CWS_HAVE_HEADER or \p CWS_NO_HEADER.
PARA_INFO_LOG("found wav header\n");
cwc->state = CWS_HAVE_HEADER;
/* Only set those values which have not already been set. */
PARA_INFO_LOG("found wav header\n");
cwc->state = CWS_HAVE_HEADER;
/* Only set those values which have not already been set. */
- cwc->channels = (unsigned)a[22];
- cwc->sample_rate = a[24] + (a[25] << 8) + (a[26] << 16) + (a[27] << 24);
- bps = a[34] + ((unsigned)a[35] << 8);
+ cwc->channels = a[22];
+ cwc->sample_rate = read_u32(a + 24);
+ bps = read_u16(a + 34);
if (bps != 8 && bps != 16) {
PARA_WARNING_LOG("%u bps not supported, assuming 16\n",
bps);
if (bps != 8 && bps != 16) {
PARA_WARNING_LOG("%u bps not supported, assuming 16\n",
bps);
- PARA_NOTICE_LOG("%dHz, %s, %s\n", cwc->sample_rate,
+ PARA_NOTICE_LOG("%uHz, %s, %s\n", cwc->sample_rate,
cwc->channels == 1? "mono" : "stereo",
sample_formats[cwc->sample_format]);
btr_consume(btrn, WAV_HEADER_LEN);
cwc->channels == 1? "mono" : "stereo",
sample_formats[cwc->sample_format]);
btr_consume(btrn, WAV_HEADER_LEN);