From caf557a6144e3f081b02c5ae8d519bfca8b7977f Mon Sep 17 00:00:00 2001 From: "benjamin.drung@gmail.com" Date: Tue, 10 Jun 2014 21:18:50 +0000 Subject: [PATCH] FFmpeg: Modify FFMPEG_INITALT to support loading from a different alternative library. av_frame_alloc/av_frame_free are defined in avutil, but the deprecated alternative functions avcodec_alloc_frame/avcodec_free_frame are defined in avcodec instead. FFMPEG_INITALT needs to be enhanced to support different library names. --- src/FFmpeg.cpp | 6 +++--- src/FFmpeg.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/FFmpeg.cpp b/src/FFmpeg.cpp index 58a6ccf9f..f595c87bc 100644 --- a/src/FFmpeg.cpp +++ b/src/FFmpeg.cpp @@ -870,7 +870,7 @@ bool FFmpegLibs::InitLibs(wxString libpath_format, bool WXUNUSED(showerr)) FFMPEG_INITDYN(avformat, avformat_open_input); FFMPEG_INITDYN(avformat, avio_size); FFMPEG_INITDYN(avformat, avio_alloc_context); - FFMPEG_INITALT(avformat, av_guess_format, guess_format); + FFMPEG_INITALT(avformat, av_guess_format, avformat, guess_format); FFMPEG_INITDYN(avcodec, av_init_packet); FFMPEG_INITDYN(avcodec, av_free_packet); @@ -903,8 +903,8 @@ bool FFmpegLibs::InitLibs(wxString libpath_format, bool WXUNUSED(showerr)) FFMPEG_INITDYN(avutil, av_freep); FFMPEG_INITDYN(avutil, av_rescale_q); FFMPEG_INITDYN(avutil, avutil_version); - FFMPEG_INITALT(avutil, av_frame_alloc, avcodec_alloc_frame); - FFMPEG_INITALT(avutil, av_frame_free, avcodec_free_frame); + FFMPEG_INITALT(avutil, av_frame_alloc, avcodec, avcodec_alloc_frame); + FFMPEG_INITALT(avutil, av_frame_free, avcodec, avcodec_free_frame); FFMPEG_INITDYN(avutil, av_samples_get_buffer_size); wxLogMessage(wxT("All symbols loaded successfully. Initializing the library.")); diff --git a/src/FFmpeg.h b/src/FFmpeg.h index 2e0d9e2cb..947a404c8 100644 --- a/src/FFmpeg.h +++ b/src/FFmpeg.h @@ -509,7 +509,7 @@ extern "C" { return false; \ } -#define FFMPEG_INITALT(w, f, a) \ +#define FFMPEG_INITALT(w, f, x, a) \ { \ wxLogNull off; \ *(void**)&f ## _fp = (void*)w->GetSymbol(wxT(#f)); \ @@ -518,7 +518,7 @@ extern "C" { { \ { \ wxLogNull off; \ - *(void**)&f ## _fp = (void*)w->GetSymbol(wxT(#a)); \ + *(void**)&f ## _fp = (void*)x->GetSymbol(wxT(#a)); \ } \ if (f ## _fp == NULL) \ { \