[FFmpeg-devel] [PATCH 1/2] mpeg12: raise timecode string to codec context.

Michael Niedermayer michaelni at gmx.at
Tue Nov 22 18:15:34 CET 2011


On Tue, Nov 22, 2011 at 06:01:10PM +0100, Clément Bœsch wrote:
> On Wed, Nov 16, 2011 at 06:07:50PM +0100, Michael Niedermayer wrote:
> > On Wed, Nov 16, 2011 at 05:52:33PM +0100, Clément Bœsch wrote:
> > > From: Clément Bœsch <clement.boesch at smartjog.com>
> > > 
> > > ---
> > >  doc/APIchanges       |    3 +++
> > >  libavcodec/avcodec.h |    7 +++++++
> > >  libavcodec/mpeg12.c  |   10 ++++++----
> > >  libavcodec/version.h |    2 +-
> > >  4 files changed, 17 insertions(+), 5 deletions(-)
> > > 
> > > diff --git a/doc/APIchanges b/doc/APIchanges
> > > index 8a2a9de..cc72063 100644
> > > --- a/doc/APIchanges
> > > +++ b/doc/APIchanges
> > > @@ -13,6 +13,9 @@ libavutil:   2011-04-18
> > >  
> > >  API changes, most recent first:
> > >  
> > > +2011-11-xx - xxxxxxx - lavc 53.35.0
> > > +  Add timecode string (timecode_str) to AVCodecContext.
> > > +
> > >  2011-11-03 - 96949da - lavu 51.23.0
> > >    Add av_strcasecmp() and av_strncasecmp() to avstring.h.
> > >  
> > > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> > > index d62cbfb..88ebbad 100644
> > > --- a/libavcodec/avcodec.h
> > > +++ b/libavcodec/avcodec.h
> > > @@ -2679,6 +2679,13 @@ typedef struct AVCodecContext {
> > >       */
> > >      int64_t timecode_frame_start;
> > >  
> > > +    /**
> > > +     * Codec timecode string
> > > +     * - encoding: unused
> > > +     * - decoding: set by libavcodec
> > > +     */
> > > +    char timecode_str[16];
> > > +
> > >  #if FF_API_REQUEST_CHANNELS
> > 
> > adding it in the middle can cause ABI issues
> > also a note saying that it should only be accessed via av_opt*
> > would avoid ABI issues if it moves
> > char [16] might not work well with av_opt though
> > 
> 
> Here is another way (with just a micro bump) of solving that issue: I used
> the timecode_frame_start to store the 25-bit value from the GOP header
> since it is ATM only used for encoding.
> 
> Maybe the timecode code could be exported so we can add a helper in order
> to get the string representation.
> 
> About using av_opt* functions instead, it is not an easy solution: adding
> a user RO field in the options doesn't work for probing since the context
> is reset (avformat_find_stream_info → avcodec_close → av_opt_free) and
> thus the field is freed and set to NULL. Because of that issue, having it
> in ffprobe is compromised.
> 
> Here is a way to test the attached patch:
>   ./ffmpeg -debug 1 -i foo.mpg -f null -|& grep GOP
> 
> The second patch (for ffprobe) will be sent in a moment.
> 
> -- 
> Clément B.

>  avcodec.h |    2 +-
>  mpeg12.c  |   20 +++++++++-----------
>  version.h |    2 +-
>  3 files changed, 11 insertions(+), 13 deletions(-)
> a5367bf57ba13e03733ad0d95414d75cd426e471  0001-mpeg12-raise-timecode-to-codec-context.patch
> From 4fff640feda72baed7426eceaab8cc36f4ae9ecb Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= <clement.boesch at smartjog.com>
> Date: Wed, 16 Nov 2011 17:40:00 +0100
> Subject: [PATCH 1/2] mpeg12: raise timecode to codec context.

LGTM

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

It is dangerous to be right in matters on which the established authorities
are wrong. -- Voltaire
-------------- 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/20111122/b4475d32/attachment.asc>


More information about the ffmpeg-devel mailing list