From: <dg...@us...> - 2006-10-13 21:41:35
|
Update of /cvsroot/xine/xine-lib/src/libffmpeg In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv27739 Modified Files: audio_decoder.c Log Message: Revert my latest change, broke more than it fixed... now this means that the decoding is still broken in recent FFmpeg it seems. Index: audio_decoder.c =================================================================== RCS file: /cvsroot/xine/xine-lib/src/libffmpeg/audio_decoder.c,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- audio_decoder.c 11 Oct 2006 12:53:12 -0000 1.28 +++ audio_decoder.c 13 Oct 2006 21:41:30 -0000 1.29 @@ -68,7 +68,6 @@ AVCodecContext *context; AVCodec *codec; - AVCodecParserContext *parser; char *decode_buffer; int decoder_ok; @@ -166,7 +165,6 @@ } this->context = avcodec_alloc_context(); - this->parser = NULL; if(buf->decoder_flags & BUF_FLAG_STDHEADER) { this->audio_sample_rate = buf->decoder_info[1]; @@ -235,8 +233,7 @@ this->size = 0; this->decode_buffer = xine_xmalloc(AVCODEC_MAX_AUDIO_FRAME_SIZE); - - this->parser = av_parser_init(this->context->codec_id); + return; } } else if ((buf->decoder_flags & BUF_FLAG_SPECIAL) && @@ -291,25 +288,11 @@ offset = 0; while (this->size>0) { - uint8_t *parsed_data = NULL; - int parsed_size = 0; - - if ( ! this->parser ) - this->parser = av_parser_init(this->context->codec_id); - - bytes_consumed = av_parser_parse(this->parser, - this->context, - &parsed_data, - &parsed_size, - &this->buf[offset], - this->size, - 0, 0); - avcodec_decode_audio(this->context, - (int16_t *)this->decode_buffer, - &decode_buffer_size, - parsed_data, - parsed_size); - free(parsed_data); + bytes_consumed = avcodec_decode_audio (this->context, + (int16_t *)this->decode_buffer, + &decode_buffer_size, + &this->buf[offset], + this->size); if (bytes_consumed<0) { xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, @@ -371,10 +354,6 @@ if( this->context && this->decoder_ok ) { pthread_mutex_lock (&ffmpeg_lock); avcodec_close (this->context); - if ( this->parser ) { - av_parser_close (this->parser); - this->parser = NULL; - } avcodec_open (this->context, this->codec); pthread_mutex_unlock (&ffmpeg_lock); } @@ -390,10 +369,6 @@ if( this->context && this->decoder_ok ) { pthread_mutex_lock (&ffmpeg_lock); avcodec_close (this->context); - if ( this->parser ) { - av_parser_close (this->parser); - this->parser = NULL; - } pthread_mutex_unlock (&ffmpeg_lock); } @@ -404,10 +379,11 @@ free(this->buf); free(this->decode_buffer); - if(this->context) + if(this->context && this->context->extradata) free(this->context->extradata); - free(this->context); + if(this->context) + free(this->context); free (this_gen); } |