diff options
-rw-r--r-- | src/combined/ffmpeg/ff_audio_decoder.c | 10 | ||||
-rw-r--r-- | src/combined/ffmpeg/ff_video_decoder.c | 12 | ||||
-rw-r--r-- | src/combined/ffmpeg/ffmpeg_compat.h | 11 | ||||
-rw-r--r-- | src/dxr3/ffmpeg_encoder.c | 2 |
4 files changed, 23 insertions, 12 deletions
diff --git a/src/combined/ffmpeg/ff_audio_decoder.c b/src/combined/ffmpeg/ff_audio_decoder.c index e0cdb78b5..aa8c674ab 100644 --- a/src/combined/ffmpeg/ff_audio_decoder.c +++ b/src/combined/ffmpeg/ff_audio_decoder.c @@ -1117,11 +1117,11 @@ static void ff_audio_dispose (audio_decoder_t *this_gen) { free16 (this->buf); free16 (this->decode_buffer); - if(this->context && this->context->extradata) - free(this->context->extradata); - - if(this->context) - av_free(this->context); + if (this->context) { + _x_freep (&this->context->extradata); + this->context->extradata_size = 0; + avcodec_free_context (&this->context); + } free (this_gen); } diff --git a/src/combined/ffmpeg/ff_video_decoder.c b/src/combined/ffmpeg/ff_video_decoder.c index 8a449378e..33e3fd17a 100644 --- a/src/combined/ffmpeg/ff_video_decoder.c +++ b/src/combined/ffmpeg/ff_video_decoder.c @@ -2474,14 +2474,14 @@ static void ff_dispose (video_decoder_t *this_gen) { if (this->slice_offset_table) free (this->slice_offset_table); - if(this->context && this->context->extradata) - free(this->context->extradata); - - if( this->context ) - av_free( this->context ); + if (this->context) { + _x_freep (&this->context->extradata); + this->context->extradata_size = 0; + avcodec_free_context (&this->context); + } if( this->av_frame ) - av_free( this->av_frame ); + avcodec_free_frame( &this->av_frame ); if (this->buf) free(this->buf); diff --git a/src/combined/ffmpeg/ffmpeg_compat.h b/src/combined/ffmpeg/ffmpeg_compat.h index edd01ddba..4d9d66bf0 100644 --- a/src/combined/ffmpeg/ffmpeg_compat.h +++ b/src/combined/ffmpeg/ffmpeg_compat.h @@ -205,4 +205,15 @@ # define AV_BUFFER 1 #endif +#if LIBAVCODEC_VERSION_INT < AV_INT_VERSION(55,63,100) +# define avcodec_free_context(pp) av_free(*(pp)) +#endif + +#if LIBAVCODEC_VERSION_INT < AV_INT_VERSION(54,59,100) +# define avcodec_free_frame(pp) av_free(*(pp)) +#elif LIBAVCODEC_VERSION_INT >= AV_INT_VERSION(55,45,101) +# define avcodec_alloc_frame() av_frame_alloc() +# define avcodec_free_frame(pp) av_frame_free(pp) +#endif + #endif /* XINE_AVCODEC_COMPAT_H */ diff --git a/src/dxr3/ffmpeg_encoder.c b/src/dxr3/ffmpeg_encoder.c index 1dd912dba..9b77d0786 100644 --- a/src/dxr3/ffmpeg_encoder.c +++ b/src/dxr3/ffmpeg_encoder.c @@ -319,7 +319,7 @@ static int lavc_on_unneeded(dxr3_driver_t *drv) lprintf("flushing buffers\n"); if (this->context) { avcodec_close(this->context); - free(this->context); + avcodec_free_context (&this->context); free(this->picture); this->context = NULL; this->picture = NULL; |