[FFmpeg-devel] [PATCH] vsrc_buffer: remove dependency on AVFrame

Michael Niedermayer michaelni at gmx.at
Sat May 14 13:33:40 CEST 2011


On Sat, May 14, 2011 at 12:04:45PM +0200, Stefano Sabatini wrote:
> On date Saturday 2011-05-14 01:37:57 +0200, Michael Niedermayer encoded:
> > On Fri, May 13, 2011 at 10:52:46PM +0200, Stefano Sabatini wrote:
> > > On date Friday 2011-05-13 21:12:59 +0200, Michael Niedermayer encoded:
> > > > On Fri, May 13, 2011 at 06:42:14PM +0200, Stefano Sabatini wrote:
> > > > > Change the interface of av_vsrc_buffer_add_frame(), make it accept in input
> > > > > an AVFilterBufferRef rather than an AVFrame.
> > > > > 
> > > > > This way the interface can be used without requiring the
> > > > > inclusion/installation of libavcodec headers.
> > > > 
> > > 
> > > > theres no need for headers to be installed, struct AVFrame or even
> > > > void * can be used.
> > > 
> > > but in case you want to use the function in a pure libavfilter app you
> > > can't.
> > > 
> > > > [...]
> > > > > -                    // add it to be filtered
> > > > > -                    av_vsrc_buffer_add_frame2(ost->input_video_filter, &picture, ""); //TODO user setable params
> > > > > +
> > > > > +                    picref = avfilter_get_video_buffer_ref_from_arrays(
> > > > > +                        picture.data, picture.linesize, AV_PERM_WRITE,
> > > > > +                        picture.width, picture.height, picture.format);
> > > > > +                    avfilter_copy_frame_props(picref, &picture);
> > > > > +                    av_vsrc_buffer_add_frame2(ost->input_video_filter, picref, ""); //TODO user setable params
> > > > >                  }
> > > > >              }
> > > > >          }
> > > > 
> > > > This is much more complex for user applications and not extendable
> > > > we just added these fields days ago. more will be added and this will
> > > > always need updating.
> > > 
> > > But we should only rely on fields contained in the video filter
> > > buffer, rather than in AVFrame which contains information which can't
> > > be propagated in the filterchain. And the AVFrame <-> A/V filter
> > > buffer mapping can be easily extended by extending
> > > avfilter_copy_frame_props().
> > > 
> > > > Iam not against this patch if you want it but i think the people
> > > > using libavfilter & libavcodec would prefer a simple interface
> > > > that allows passing an AVFrame.
> > > 
> > > What about:
> > > 
> > > av_vsrc_buffer_add_frame2(ost->input_video_filter, avfilter_get_video_buffer_ref_from_frame(frame, perm), "");
> > > ?
> > 
> > this looks much better
> 
> See attached (works on top of the other patch).
> -- 
> FFmpeg = Friendly and Furious Meaningless Power Elfic Gorilla

>  ffmpeg.c              |    9 +++------
>  libavfilter/avcodec.c |   13 +++++++++++++
>  libavfilter/avcodec.h |    8 ++++++++
>  3 files changed, 24 insertions(+), 6 deletions(-)
> f9b423c1127a5227de457e2eb2e526a4a54897e0  0004-lavfi-add-avfilter_get_video_buffer_ref_from_frame-t.patch
> From 922e696fca1f928a70efe28621bc7f8ca7b8789d Mon Sep 17 00:00:00 2001
> From: Stefano Sabatini <stefano.sabatini-lala at poste.it>
> Date: Sat, 14 May 2011 11:46:14 +0200
> Subject: [PATCH] lavfi: add avfilter_get_video_buffer_ref_from_frame to avcodec.h
> 
> Simplify passing AVFrame data to av_vsrc_buffer_add_frame2().

LGTM

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Opposition brings concord. Out of discord comes the fairest harmony.
-- Heraclitus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110514/ed922e6c/attachment.asc>


More information about the ffmpeg-devel mailing list