[MPlayer-dev-eng] [PATCH] change demuxer for radio from "rawaudio" to "audio"
Reimar Döffinger
Reimar.Doeffinger at stud.uni-karlsruhe.de
Sun Jul 22 12:11:12 CEST 2007
Hello,
On Sun, Jul 22, 2007 at 03:49:22PM +0700, Vladimir Voroshilov wrote:
[..]
> + * \return length of hesder (44)
header
> +static int fill_wav_header(radio_priv_t* priv, char* buffer, int max_len){
Use either void * or uint8_t * for generic data buffer, not char*
> + int fake_length=0; //real data length in WAV is unknown
I think the right value for unknown is 0xffffffff, not 0.
> + *(uint32_t*)(buffer )=le2me_32(0x46464952); //RIFF
> + *(uint32_t*)(buffer+ 4)=le2me_32(fake_length+36);//file+Header length-8
> + *(uint32_t*)(buffer+ 8)=le2me_32(0x45564157); //WAVE
> + *(uint32_t*)(buffer+12)=le2me_32(0x20746d66); //"fmt "
> + *(uint32_t*)(buffer+16)=le2me_32(16); //WAVEFORMATEX length
> + *(uint16_t*)(buffer+20)=le2me_16(1); //PCM
> + *(uint16_t*)(buffer+22)=le2me_16(radio_param_achannels);
> + *(uint32_t*)(buffer+24)=le2me_32(radio_param_arate);
> + *(uint32_t*)(buffer+28)=le2me_32(bits_per_sample*radio_param_achannels*radio_param_arate/8);
> + *(uint16_t*)(buffer+32)=le2me_16(bits_per_sample*radio_param_achannels/8);
> + *(uint16_t*)(buffer+34)=le2me_16(bits_per_sample);
> + *(uint32_t*)(buffer+36)=le2me_32(0x61746164); //"data"
> + *(uint32_t*)(buffer+40)=le2me_32(fake_length); //file length
Use AV_WL* instead.
> static int fill_buffer_s(struct stream_st *s, char* buffer, int max_len){
> int len=max_len;
> + radio_priv_t* priv=(radio_priv_t*)s->priv;
>
> + if(!priv->header_passed){
> + priv->header_passed=1;
> + return fill_wav_header(priv,buffer,max_len);
> + }
> +
> #ifdef USE_RADIO_CAPTURE
> - radio_priv_t* priv=(radio_priv_t*)s->priv;
> -
Unrelated, but that case seems quite useless to me.
And did you test how this works with -dumpstream/-dumpaudio?
Greetings,
Reimar Döffinger
More information about the MPlayer-dev-eng
mailing list