Skip to content

Commit

Permalink
Merge pull request #1139 from aballier/avfilter
Browse files Browse the repository at this point in the history
Avfilter: Bring xbmc in line with the new avfilter API.
  • Loading branch information
Arne Morten Kvarving committed Aug 3, 2012
2 parents 6791924 + d1bbbc9 commit 8b99da3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 13 deletions.
28 changes: 16 additions & 12 deletions lib/DllAvFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,11 @@ class DllAvFilterInterface
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;
virtual int avfilter_poll_frame(AVFilterLink *link)=0;
virtual int avfilter_request_frame(AVFilterLink *link)=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;
virtual AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int w, int h)=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;
Expand Down Expand Up @@ -133,10 +134,11 @@ class DllAvFilter : public DllDynamic, DllAvFilterInterface
{
return ::avfilter_graph_config(graphctx, log_ctx);
}
virtual int avfilter_poll_frame(AVFilterLink *link) { return ::avfilter_poll_frame(link); }
virtual int avfilter_request_frame(AVFilterLink *link) { return ::avfilter_request_frame(link); }
#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); }
virtual AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int w, int h) { return ::avfilter_get_video_buffer(link, perms, w, h); }
#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); }
Expand Down Expand Up @@ -168,10 +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 *)
DEFINE_FUNC_ALIGNED1(int, __cdecl, avfilter_poll_frame, AVFilterLink *)
DEFINE_FUNC_ALIGNED1(int, __cdecl, avfilter_request_frame, AVFilterLink*)
#if LIBAVFILTER_VERSION_INT < AV_VERSION_INT(3,0,0)
DEFINE_METHOD3(int, av_vsrc_buffer_add_frame, (AVFilterContext *p1, AVFrame *p2, int p3))
DEFINE_METHOD4(AVFilterBufferRef*, avfilter_get_video_buffer, (AVFilterLink *p1, int p2, int p3, int p4))
#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);
Expand All @@ -190,10 +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)
RESOLVE_METHOD(avfilter_poll_frame)
RESOLVE_METHOD(avfilter_request_frame)
#if LIBAVFILTER_VERSION_INT < AV_VERSION_INT(3,0,0)
RESOLVE_METHOD(av_vsrc_buffer_add_frame)
RESOLVE_METHOD(avfilter_get_video_buffer)
#else
RESOLVE_METHOD(av_buffersrc_add_frame)
#endif
RESOLVE_METHOD(avfilter_unref_buffer)
RESOLVE_METHOD(avfilter_link)
RESOLVE_METHOD(av_buffersink_get_buffer_ref)
Expand Down
10 changes: 9 additions & 1 deletion xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -794,10 +794,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;
}
}
Expand All @@ -810,7 +818,7 @@ int CDVDVideoCodecFFmpeg::FilterProcess(AVFrame* frame)

if ((frames = m_dllAvFilter.av_buffersink_poll_frame(m_pFilterOut)) < 0)
{
CLog::Log(LOGERROR, "CDVDVideoCodecFFmpeg::FilterProcess - avfilter_poll_frame");
CLog::Log(LOGERROR, "CDVDVideoCodecFFmpeg::FilterProcess - av_buffersink_poll_frame");
return VC_ERROR;
}

Expand Down

0 comments on commit 8b99da3

Please sign in to comment.