From: James S. <jst...@us...> - 2004-06-06 16:13:39
|
Update of /cvsroot/xine/xine-lib/src/libffmpeg In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30183/libffmpeg Modified Files: audio_decoder.c Log Message: Don't assume buffer contains waveformatex header when BUF_FLAG_STDHEADER is set, it's optional Index: audio_decoder.c =================================================================== RCS file: /cvsroot/xine/xine-lib/src/libffmpeg/audio_decoder.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- audio_decoder.c 5 Jun 2004 16:37:37 -0000 1.9 +++ audio_decoder.c 6 Jun 2004 16:13:30 -0000 1.10 @@ -130,7 +130,7 @@ if (buf->decoder_flags & BUF_FLAG_FRAME_END) { int i, codec_type; - xine_waveformatex *audio_header = (xine_waveformatex *)this->buf; + xine_waveformatex *audio_header; codec_type = buf->type & 0xFFFF0000; this->codec = NULL; @@ -157,15 +157,19 @@ this->audio_sample_rate = buf->decoder_info[1]; this->audio_channels = buf->decoder_info[3]; - this->context->block_align = audio_header->nBlockAlign; - this->context->bit_rate = audio_header->nAvgBytesPerSec * 8; + if(this->size) { + audio_header = (xine_waveformatex *)this->buf; + + this->context->block_align = audio_header->nBlockAlign; + this->context->bit_rate = audio_header->nAvgBytesPerSec * 8; - if(audio_header->cbSize > 0) { - this->context->extradata = xine_xmalloc(audio_header->cbSize); - this->context->extradata_size = audio_header->cbSize; - memcpy( this->context->extradata, - (uint8_t *)audio_header + sizeof(xine_waveformatex), - audio_header->cbSize ); + if(audio_header->cbSize > 0) { + this->context->extradata = xine_xmalloc(audio_header->cbSize); + this->context->extradata_size = audio_header->cbSize; + memcpy( this->context->extradata, + (uint8_t *)audio_header + sizeof(xine_waveformatex), + audio_header->cbSize ); + } } } else { short *ptr; |