ffmpeg: Use av_frame_* instead of deprecated avcodec_*_frame functions beginning with lavc 55.45.101.

This commit is contained in:
Sam Edwards 2015-02-24 16:22:37 -08:00
parent 903966371c
commit f0b3e08e9c
2 changed files with 12 additions and 1 deletions

View File

@ -148,7 +148,11 @@ FfmpegAudioCursor(FfmpegAudio *src) :
_can_seek = true;
_can_seek_fast = true;
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(54, 59, 100)
_frame = av_frame_alloc();
#else
_frame = avcodec_alloc_frame();
#endif
_packet = new AVPacket;
_buffer_size = AVCODEC_MAX_AUDIO_FRAME_SIZE / 2;
@ -194,7 +198,9 @@ FfmpegAudioCursor::
void FfmpegAudioCursor::
cleanup() {
if (_frame) {
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(54, 59, 100)
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55, 45, 101)
av_frame_free(&_frame);
#elif LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(54, 59, 100)
avcodec_free_frame(&_frame);
#else
av_free(&_frame);

View File

@ -94,8 +94,13 @@ init_from(FfmpegVideo *source) {
PIX_FMT_BGR24, SWS_BILINEAR | SWS_PRINT_INFO, NULL, NULL, NULL);
#endif // HAVE_SWSCALE
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(54, 59, 100)
_frame = av_frame_alloc();
_frame_out = av_frame_alloc();
#else
_frame = avcodec_alloc_frame();
_frame_out = avcodec_alloc_frame();
#endif
if ((_frame == 0)||(_frame_out == 0)) {
cleanup();