[FFmpeg-devel] [PATCH] lavfi: add avfilter_copy_frame_props()

Michael Niedermayer michaelni at gmx.at
Mon May 2 12:42:04 CEST 2011


On Sun, May 01, 2011 at 04:29:54PM +0200, Stefano Sabatini wrote:
> On date Sunday 2011-05-01 16:05:12 +0200, Stefano Sabatini encoded:
> > On date Sunday 2011-05-01 15:56:56 +0200, Stefano Sabatini encoded:
> > > Avoid code duplication, increase robustness.
> > 
> > Consider this more like an RFC rather than a patch, since there is a
> > problem which needs to be discussed.
> > 
> > > ---
> > >  ffplay.c                  |    4 ++--
> > >  libavfilter/avfilter.h    |   24 ++++++++++++++++++++++++
> > >  libavfilter/vsrc_buffer.c |    8 ++------
> > >  libavfilter/vsrc_movie.c  |    7 +------
> > >  4 files changed, 29 insertions(+), 14 deletions(-)
> > > 
> > > diff --git a/ffplay.c b/ffplay.c
> > > index 945e08f..6f41a55 100644
> > > --- a/ffplay.c
> > > +++ b/ffplay.c
> > > @@ -1686,9 +1686,9 @@ static int input_request_frame(AVFilterLink *link)
> > >      }
> > >      av_free_packet(&pkt);
> > >  
> > > +    avfilter_copy_frame_props(picref, priv->frame);
> > >      picref->pts = pts;
> > > -    picref->pos = priv->frame->pkt_pos;
> > > -    picref->video->sample_aspect_ratio = priv->frame->sample_aspect_ratio;
> > > +
> > >      avfilter_start_frame(link, picref);
> > >      avfilter_draw_slice(link, 0, link->h, 1);
> > >      avfilter_end_frame(link);
> > > diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
> > > index 5003152..7a3f54a 100644
> > > --- a/libavfilter/avfilter.h
> > > +++ b/libavfilter/avfilter.h
> > > @@ -163,6 +163,30 @@ static inline void avfilter_copy_buffer_ref_props(AVFilterBufferRef *dst, AVFilt
> > >      }
> > >  }
> > >  
> > 
> > > +#if CONFIG_AVCODEC
> > > +#include "libavcodec/avcodec.h" // AVFrame
> > 
> > This is problematic, indeed CONFIG_AVCODEC is defined in config.h,
> > which is not installed.
> > 
> > A possible solution would be to install a separate avfilter_avcodec.h
> > header, which is included in the application only if both libavfilter
> > and libavcodec are enabled (the "how" is left to the application
> > logic).
> > 
> > This new file would also contain the corresponding
> > avfilter_copy_buffer_ref_props_to_frame(AVFrame *dst, AVFilterBufferRef *src)
> > 
> > which I plan to add soon.
> 
> Tentative solution attached.
> -- 
> FFmpeg = Fiendish and Frenzy Maxi Power Enhancing Guru

>  ffmpeg.c                  |    1 
>  ffplay.c                  |    5 ++--
>  libavfilter/Makefile      |    2 -
>  libavfilter/avcodec.h     |   50 ++++++++++++++++++++++++++++++++++++++++++++++

isnt it possible to just always install libavcodec/avcodec.h even
if libavcodec is disabled?

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

It is dangerous to be right in matters on which the established authorities
are wrong. -- Voltaire
-------------- 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/20110502/6e6aa13e/attachment.asc>


More information about the ffmpeg-devel mailing list