[FFmpeg-devel] [PATCH 2/5] lavf: inject sample skip side data when requested by the demuxer

Michael Niedermayer michaelni at gmx.at
Thu Jul 12 20:33:21 CEST 2012


On Thu, Jul 05, 2012 at 05:56:19PM +0200, Nicolas George wrote:
> Le septidi 17 messidor, an CCXX, Michael Niedermayer a écrit :
> > Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> > ---
> >  libavformat/avformat.h |    5 +++++
> >  libavformat/utils.c    |    8 ++++++++
> >  2 files changed, 13 insertions(+)
> > 
> > diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> > index 807c7ac..457845d 100644
> > --- a/libavformat/avformat.h
> > +++ b/libavformat/avformat.h
> > @@ -805,6 +805,11 @@ typedef struct AVStream {
> >       * should be discarded.
> >       */
> >      int skip_to_keyframe;
> > +
> > +    /**
> > +     * Number of samples to skip.
> > +     */
> > +    int skip_samples;
> 
> "Number of samples to skip at the start of the frame decoded from the next
> packet"?

yes, fixed


> 
> >  } AVStream;
> >  
> >  #define AV_PROGRAM_RUNNING 1
> > diff --git a/libavformat/utils.c b/libavformat/utils.c
> > index 70f8d46..931e3fb 100644
> > --- a/libavformat/utils.c
> > +++ b/libavformat/utils.c
> > @@ -1449,6 +1449,14 @@ int av_read_frame(AVFormatContext *s, AVPacket *pkt)
> >      }
> >  
> >  return_packet:
> > +
> > +    if(s->streams[pkt->stream_index]->skip_samples) {
> > +        uint8_t *p = av_packet_new_side_data(pkt, AV_PKT_DATA_SKIP_SAMPLES, 10);
> > +        AV_WL32(p  , s->streams[pkt->stream_index]->skip_samples);
> 
> Strange spacing.

fixed


> 
> > +        av_log(s, AV_LOG_DEBUG, "demuxer injecting skip %d\n", s->streams[pkt->stream_index]->skip_samples);
> > +        s->streams[pkt->stream_index]->skip_samples = 0;
> > +    }
> > +
> 
> There is no way of setting the skip for the end of the packet, nor the
> reason for the skip.

Thats partly true.
But we need to have the ABI of the side data for this out with the
first field we
want to use. Theres no reason to couple this to implement setting all.
I think its easier to add support for the other parts in seperate
changes and also allows better testing with git bisect.
Also a demuxer can trivially add any sidedata it wants directly
The skip_samples is mostly usefull for seeking which does not apply
in this way for the end.

patch applied

thanks


> OggOpus would possibly need the latter (but I need to
> think some more about it).



[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope
-------------- 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/20120712/b4b4b64a/attachment.asc>


More information about the ffmpeg-devel mailing list