[FFmpeg-devel] [PATCH] lavc: add duration field to AVFrame
Michael Niedermayer
michaelni at gmx.at
Tue Oct 2 01:01:42 CEST 2012
On Tue, Oct 02, 2012 at 12:43:41AM +0200, Stefano Sabatini wrote:
> On date Tuesday 2012-10-02 00:12:07 +0200, Michael Niedermayer encoded:
> > On Thu, Sep 13, 2012 at 11:36:23AM +0200, Stefano Sabatini wrote:
> [...]
> > > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> > > index ddf785e..7da05b8 100644
> > > --- a/libavcodec/avcodec.h
> > > +++ b/libavcodec/avcodec.h
> > > @@ -1404,6 +1404,16 @@ typedef struct AVFrame {
> > > * - decoding: Read by user.
> > > */
> > > int64_t channels;
> > > +
> > > + /**
> > > + * duration of the frame, expressed in
> > > + * AVCodecContext->time_base units, AV_NOPTS_VALUE if unknown.
> > > + * Code outside libavcodec should access this field using:
> > > + * av_frame_get_duration(frame)
> > > + * - encoding: unused
> > > + * - decoding: Read by user.
> > > + */
> > > + int64_t duration;
> > > } AVFrame;
> >
> > the relation to repeat_pict should be clarified ideally
>
> And really I'm not the best person for doing that (repeat_pict seems
> only used by MPEG code).
I cant either because repeat_pict is the duration, my question is
pretty much why a second field with similar semantic is needed?
Its very possible that one is actually needed but i dont know if it
is ...
>
> > [...]
> > > @@ -1527,6 +1530,9 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi
> > > picture->height = avctx->height;
> > > if (picture->format == PIX_FMT_NONE)
> > > picture->format = avctx->pix_fmt;
> > > + if (picture->duration == AV_NOPTS_VALUE && avpkt->duration)
> > > + picture->duration = av_rescale_q(avpkt->duration, avctx->pkt_timebase,
> > > + avctx->time_base);
> > > }
> > >
> > > emms_c(); //needed to avoid an emms_c() call before every return;
> >
> > this looks wrong in case of B frames / frame reordering
>
> I believed that pkt_duration was related to the encoded packet even in
> that case. So how should be fixed? Hints?
it has to be reordered with the pts see ff_init_buffer_info()
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
The worst form of inequality is to try to make unequal things equal.
-- Aristotle
-------------- 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/20121002/c2eadc79/attachment.asc>
More information about the ffmpeg-devel
mailing list