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

Stefano Sabatini stefano.sabatini-lala at poste.it
Sun May 1 16:29:54 CEST 2011


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-lavfi-add-avfilter_copy_frame_props.patch
Type: text/x-diff
Size: 7212 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110501/47d02dd7/attachment.bin>


More information about the ffmpeg-devel mailing list