[FFmpeg-devel] [PATCH] movie video source

Stefano Sabatini stefano.sabatini-lala
Fri Dec 31 17:41:40 CET 2010


On date Friday 2010-12-31 16:44:25 +0100, Stefano Sabatini encoded:
> On date Friday 2010-12-31 16:35:30 +0100, Stefano Sabatini encoded:
> > On date Thursday 2010-12-30 01:03:38 +0100, Michael Niedermayer encoded:
> > > On Tue, Dec 28, 2010 at 02:42:33PM +0100, Stefano Sabatini wrote:
> > [...]
> > > >  doc/filters.texi         |   35 ++++++
> > > >  libavfilter/Makefile     |    2 +
> > > >  libavfilter/allfilters.c |    1 +
> > > >  libavfilter/vsrc_movie.c |  266 ++++++++++++++++++++++++++++++++++++++++++++++
> > > >  4 files changed, 304 insertions(+), 0 deletions(-)
> > > >  create mode 100644 libavfilter/vsrc_movie.c
> > > > 
> > > > diff --git a/doc/filters.texi b/doc/filters.texi
> > > > index 0039044..8f17a4e 100644
> > > > --- a/doc/filters.texi
> > > > +++ b/doc/filters.texi
> > > > @@ -1086,6 +1086,41 @@ to the pad with identifier "in".
> > > >  "color=red@@0.2:qcif:10 [color]; [in][color] overlay [out]"
> > > >  @end example
> > > >  
> > > > + at section movie
> > > > +
> > > > +Read a video stream from a movie container.
> > > > +
> > > > +It accepts the syntax:
> > > > + at example
> > > > + at var{seekpoint}:@var{format}:@var{filename}[:@var{stream_index}]
> > > > + at end example
> > > > +
> > > 
> > > > + at var{seekpoint} specifies the seek point in microseconds, the frames
> > > > +will be output starting from this seek point.
> > > 
> > > should be seconds and SI postfixes should be supported, we have code for that
> > 
> > Fixed.
> > 
> > > > +
> > > > + at var{format} specifies the assumed format for the input file, and can
> > > > +be either the name of a container of an input device.
> > > 
> > > thats not a english sentance
> > 
> > Fixed.
> > 
> > [...]
> > > > diff --git a/libavfilter/vsrc_movie.c b/libavfilter/vsrc_movie.c
> > > > new file mode 100644
> > > > index 0000000..ffc0480
> > > > --- /dev/null
> > > > +++ b/libavfilter/vsrc_movie.c
> > > > @@ -0,0 +1,266 @@
> > [...]
> > > > +/**
> > > > + * @file
> > > > + * movie file video source filter
> > > > + *
> > > > + * @todo use direct rendering (no allocation of a new frame)
> > > 
> > > + support more than one output stream
> > >
> > > > + */
> > > > +
> > > 
> > > > +#define DEBUG
> > > 
> > > ?
> > 
> > Useful for debugging, left but commented out.
> > 
> > [...]
> > > > +static int movie_get_frame(AVFilterLink *outlink)
> > > > +{
> > > > +    MovieContext *movie = outlink->src->priv;
> > > > +    AVPacket packet;
> > > > +    int frame_finished;
> > > > +
> > > > +    if (movie->is_done == 1)
> > > > +        return 0;
> > > > +
> > > > +    while (av_read_frame(movie->format_ctx, &packet) >= 0) {
> > > 
> > > missing EAGAIN handling
> > 
> > Should be fixed.
> > 
> > > > +        // Is this a packet from the video stream?
> > > > +        if (packet.stream_index == movie->stream_idx) {
> > > > +            // Decode video frame
> > > > +            avcodec_decode_video2(movie->codec_ctx, movie->frame, &frame_finished, &packet);
> > > > +
> > > > +            // Did we get a video frame?
> > > > +            if (frame_finished) {
> > > > +                movie->picref =
> > > > +                    avfilter_get_video_buffer_ref_from_arrays(movie->frame->data, movie->frame->linesize,
> > > > +                                                              AV_PERM_READ,
> > > > +                                                              outlink->format, outlink->w, outlink->h);
> >  
> > > > +                movie->picref->pts = packet.pts;
> > > 
> > > this is wrong
> > > 
> > > 
> > > > +                movie->picref->pos = packet.pos;
> > > 
> > > so is this
> > 
> > wtf why?
> 
> And the patch...

Updated with a saner interface which should make easier to add more
options (docs yet to update).
-- 
FFmpeg = Freak & Fundamental Minimal Powered Embarassing God



More information about the ffmpeg-devel mailing list