commit d1bbbc972e6dedf7adfbb01b9c80645165d48227 Author: Alexis Ballier Date: Mon Jul 9 09:19:16 2012 -0400 AvFilter: Map and use av_buffersrc_add_frame instead of av_vsrc_buffer_add_frame with libavfilter version 3. diff --git a/lib/DllAvFilter.h b/lib/DllAvFilter.h index d272c3b..de6f4c0 100644 --- a/lib/DllAvFilter.h +++ b/lib/DllAvFilter.h @@ -74,7 +74,11 @@ public: virtual void avfilter_inout_free(AVFilterInOut **inout)=0; virtual int avfilter_graph_parse(AVFilterGraph *graph, const char *filters, AVFilterInOut **inputs, AVFilterInOut **outputs, void *log_ctx)=0; virtual int avfilter_graph_config(AVFilterGraph *graphctx, void *log_ctx)=0; +#if LIBAVFILTER_VERSION_INT < AV_VERSION_INT(3,0,0) virtual int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame, int flags)=0; +#else + virtual int av_buffersrc_add_frame(AVFilterContext *buffer_filter, AVFrame *frame, int flags)=0; +#endif virtual void avfilter_unref_buffer(AVFilterBufferRef *ref)=0; virtual int avfilter_link(AVFilterContext *src, unsigned srcpad, AVFilterContext *dst, unsigned dstpad)=0; virtual int av_buffersink_get_buffer_ref(AVFilterContext *buffer_sink, AVFilterBufferRef **bufref, int flags)=0; @@ -130,7 +134,11 @@ public: { return ::avfilter_graph_config(graphctx, log_ctx); } +#if LIBAVFILTER_VERSION_INT < AV_VERSION_INT(3,0,0) virtual int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame, int flags) { return ::av_vsrc_buffer_add_frame(buffer_filter, frame, flags); } +#else + virtual int av_buffersrc_add_frame(AVFilterContext *buffer_filter, AVFrame* frame, int flags) { return ::av_buffersrc_add_frame(buffer_filter, frame, flags); } +#endif virtual void avfilter_unref_buffer(AVFilterBufferRef *ref) { ::avfilter_unref_buffer(ref); } virtual int avfilter_link(AVFilterContext *src, unsigned srcpad, AVFilterContext *dst, unsigned dstpad) { return ::avfilter_link(src, srcpad, dst, dstpad); } virtual int av_buffersink_get_buffer_ref(AVFilterContext *buffer_sink, AVFilterBufferRef **bufref, int flags) { return ::av_buffersink_get_buffer_ref(buffer_sink, bufref, flags); } @@ -162,7 +170,11 @@ class DllAvFilter : public DllDynamic, DllAvFilterInterface DEFINE_METHOD1(void, avfilter_inout_free_dont_call, (AVFilterInOut **p1)) DEFINE_FUNC_ALIGNED5(int, __cdecl, avfilter_graph_parse_dont_call, AVFilterGraph *, const char *, AVFilterInOut **, AVFilterInOut **, void *) DEFINE_FUNC_ALIGNED2(int, __cdecl, avfilter_graph_config_dont_call, AVFilterGraph *, void *) +#if LIBAVFILTER_VERSION_INT < AV_VERSION_INT(3,0,0) DEFINE_METHOD3(int, av_vsrc_buffer_add_frame, (AVFilterContext *p1, AVFrame *p2, int p3)) +#else + DEFINE_METHOD3(int, av_buffersrc_add_frame, (AVFilterContext *p1, AVFrame *p2, int p3)) +#endif DEFINE_METHOD1(void, avfilter_unref_buffer, (AVFilterBufferRef *p1)) DEFINE_METHOD4(int, avfilter_link, (AVFilterContext *p1, unsigned p2, AVFilterContext *p3, unsigned p4)) DEFINE_FUNC_ALIGNED3(int , __cdecl, av_buffersink_get_buffer_ref, AVFilterContext *, AVFilterBufferRef **, int); @@ -181,7 +193,11 @@ class DllAvFilter : public DllDynamic, DllAvFilterInterface RESOLVE_METHOD_RENAME(avfilter_inout_free, avfilter_inout_free_dont_call) RESOLVE_METHOD_RENAME(avfilter_graph_parse, avfilter_graph_parse_dont_call) RESOLVE_METHOD_RENAME(avfilter_graph_config, avfilter_graph_config_dont_call) +#if LIBAVFILTER_VERSION_INT < AV_VERSION_INT(3,0,0) RESOLVE_METHOD(av_vsrc_buffer_add_frame) +#else + RESOLVE_METHOD(av_buffersrc_add_frame) +#endif RESOLVE_METHOD(avfilter_unref_buffer) RESOLVE_METHOD(avfilter_link) RESOLVE_METHOD(av_buffersink_get_buffer_ref) diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp index cb3e5a4..dd84dc3 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp @@ -776,10 +776,18 @@ int CDVDVideoCodecFFmpeg::FilterProcess(AVFrame* frame) if (frame) { +#if LIBAVFILTER_VERSION_INT < AV_VERSION_INT(3,0,0) result = m_dllAvFilter.av_vsrc_buffer_add_frame(m_pFilterIn, frame, 0); +#else + result = m_dllAvFilter.av_buffersrc_add_frame(m_pFilterIn, frame, 0); +#endif if (result < 0) { +#if LIBAVFILTER_VERSION_INT < AV_VERSION_INT(3,0,0) CLog::Log(LOGERROR, "CDVDVideoCodecFFmpeg::FilterProcess - av_vsrc_buffer_add_frame"); +#else + CLog::Log(LOGERROR, "CDVDVideoCodecFFmpeg::FilterProcess - av_buffersrc_add_frame"); +#endif return VC_ERROR; } }