[FFmpeg-devel] [PATCH] pkt_pts reordering

Michael Niedermayer michaelni
Sat Jan 8 00:07:56 CET 2011


On Fri, Jan 07, 2011 at 10:16:14PM +0100, Stefano Sabatini wrote:
> On date Friday 2011-01-07 15:37:01 +0100, Michael Niedermayer encoded:
> > There was some discussion about this, heres actual code
> > I will apply this later today if noone complains
> > Also after this patch it should become easier both to add multframe/thread
> > decoders as well as a single timestamp through guess_correct_pts()
> > 
> > -- 
> > Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> > 
> > The worst form of inequality is to try to make unequal things equal.
> > -- Aristotle
> 
> > From 67cbc7b3471beb99f325396f0ec5b5400d25644a Mon Sep 17 00:00:00 2001
> > From: Michael Niedermayer <michaelni at gmx.at>
> > Date: Fri, 7 Jan 2011 15:06:39 +0100
> > Subject: [PATCH 1/3] Add AVFrame.pkt_pts that contains the correctly reordered AVPacket.pts
> > 
> > ---
> >  doc/APIchanges       |    3 +++
> >  ffplay.c             |    4 ++++
> >  libavcodec/avcodec.h |   19 ++++++++++++++++++-
> >  libavcodec/utils.c   |    8 ++++++++
> >  4 files changed, 33 insertions(+), 1 deletions(-)
> > 
> > diff --git a/doc/APIchanges b/doc/APIchanges
> > index bf9d11d..3b0dc34 100644
> > --- a/doc/APIchanges
> > +++ b/doc/APIchanges
> > @@ -13,6 +13,9 @@ libavutil:   2009-03-08
> >  
> >  API changes, most recent first:
> >  
> > +2011-01-07 - r26254 - lavc 52.103.0 - pkt_pts
> > +  Add pkt_pts to AVFrame
> 
> Nit++: missing dot.

fixed and a few similar cases too, no doubt i will have forgotton one


[...]
> > @@ -1652,6 +1652,8 @@ static int input_get_buffer(AVCodecContext *codec, AVFrame *pic)
> >      pic->age    = INT_MAX;
> >      pic->type   = FF_BUFFER_TYPE_USER;
> >      pic->reordered_opaque = codec->reordered_opaque;
> > +    if(codec->pkt) pic->pkt_pts = codec->pkt->pts;
> > +    else           pic->pkt_pts = AV_NOPTS_VALUE;
> 
> Nit:
> I'd prefer
> pic->pkt_pts = codec->pkt ? codec->pkt->pts : AV_NOPTS_VALUE;
> but do as you prefer

i prefer my code, its less obfuscated


[...]
> >
> > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> > index 828b07a..1ed23eb 100644
> > --- a/libavcodec/avcodec.h
> > +++ b/libavcodec/avcodec.h
> > @@ -32,7 +32,7 @@
> >  #include "libavutil/cpu.h"
> >  
> >  #define LIBAVCODEC_VERSION_MAJOR 52
> > -#define LIBAVCODEC_VERSION_MINOR 102
> > +#define LIBAVCODEC_VERSION_MINOR 103
> >  #define LIBAVCODEC_VERSION_MICRO  0
> >  
> >  #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
> > @@ -1009,6 +1009,13 @@ typedef struct AVPanScan{
> >       * - decoding: Set by libavcodec\
> >       */\
> >      void *hwaccel_picture_private;\
> > +\
> > +    /**\
> > +     * reordered pts from the AVPacket that has been input into the decoder\
> > +     * - encoding: unused\
> > +     * - decoding: Read by user.\
> > +     */\
> > +    int64_t pkt_pts;\
> 
> could you clarify the meaning of "reordered" in this case? Also maybe
> it's more clear to say:
> ... from the *last* AVPacket that has been input into the decoder\

added "last", not sure what is unclear


[...]
> > @@ -628,6 +630,9 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi
> >      *got_picture_ptr= 0;
> >      if((avctx->coded_width||avctx->coded_height) && av_image_check_size(avctx->coded_width, avctx->coded_height, 0, avctx))
> >          return -1;
> > +
> > +    avctx->pkt= avpkt;
> 
> Nit+++: avctx->pkt_= avpkt;

fixed some of the space nitpiks, again, i likely forgot some

[...]

and patchset commited


-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Avoid a single point of failure, be that a person or equipment.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20110108/7d2c5d4c/attachment.pgp>



More information about the ffmpeg-devel mailing list