[FFmpeg-devel] [RFC] GXF Patches - HD

Reuben Martin reuben.m at gmail.com
Thu Jul 25 09:04:04 CEST 2013


On Saturday, July 20, 2013 11:50:09 PM Michael Niedermayer wrote:
> On Mon, Jun 17, 2013 at 03:24:49PM -0500, Reuben Martin wrote:
> > DAR & tests updates
> > 
> >  gxfenc.c |   56 ++++++++++++++++++++++++++++++++++++++++++++++++--------
> >  1 file changed, 48 insertions(+), 8 deletions(-)
> > 
> > 5c8a8eccfe78b0c44cffae9948bc2e3b8f1c7562  05-GXF_DAR.patch
> > From c29c0fe20675254f6a09e114a32bd30128d44b14 Mon Sep 17 00:00:00 2001
> > From: Reuben Martin <reuben.m at gmail.com>
> > Date: Thu, 13 Jun 2013 00:53:17 -0500
> > Subject: [PATCH 5/8] Set GXF bits indicating DAR
> > 
> > ---
> > 
> >  libavformat/gxfenc.c | 56
> >  ++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 48
> >  insertions(+), 8 deletions(-)
> > 
> > diff --git a/libavformat/gxfenc.c b/libavformat/gxfenc.c
> > index 8411934..e5a07c5 100644
> > --- a/libavformat/gxfenc.c
> > +++ b/libavformat/gxfenc.c
> > @@ -59,6 +59,7 @@ typedef struct GXFStreamContext {
> > 
> >      int p_per_gop;
> >      int b_per_i_or_p; ///< number of B frames per I frame or P frame
> >      int first_gop_closed;
> > 
> > +    int aspect_ratio; ///< display aspect ratio: 0 => 4:3, 1 => 16:9
> 
> aspect_ratio_id as its not a ratio

Good point.

> 
> >      unsigned order;   ///< interleaving order
> >  
> >  } GXFStreamContext;
> > 
> > @@ -206,10 +207,10 @@ static int gxf_write_mpeg_auxiliary(AVIOContext *pb,
> > AVStream *st)> 
> >          starting_line = 23; // default PAL
> >      
> >      size = snprintf(buffer, sizeof(buffer), "Ver 1\nBr %.6f\nIpg 1\nPpi
> >      %d\nBpiop %d\n"> 
> > -                    "Pix 0\nCf %d\nCg %d\nSl %d\nnl16 %d\nVi 1\nf1 1\n",
> > +                    "Pix 0\nCf %d\nCg %d\nSl %d\nnl16 %d\nVi 1\nf1 1\nar
> > %d\n",> 
> >                      (float)st->codec->bit_rate, sc->p_per_gop,
> >                      sc->b_per_i_or_p,
> >                      st->codec->pix_fmt == AV_PIX_FMT_YUV422P ? 2 : 1,
> >                      sc->first_gop_closed == 1,> 
> > -                    starting_line, (st->codec->height + 15) / 16);
> > +                    starting_line, (st->codec->height + 15) / 16,
> > sc->aspect_ratio);> 
> >      av_assert0(size < sizeof(buffer));
> >      avio_w8(pb, TRACK_MPG_AUX);
> >      avio_w8(pb, size + 1);
> > 
> > @@ -219,12 +220,25 @@ static int gxf_write_mpeg_auxiliary(AVIOContext *pb,
> > AVStream *st)> 
> >  static int gxf_write_dv_auxiliary(AVIOContext *pb, AVStream *st)
> >  {
> > 
> > +    GXFStreamContext *sc = st->priv_data;
> > 
> >      int64_t track_aux_data = 0;
> >      
> >      avio_w8(pb, TRACK_AUX);
> >      avio_w8(pb, 8);
> > 
> > -    if (st->codec->pix_fmt == PIX_FMT_YUV420P)
> > -        track_aux_data |= 0x01;     /* marks stream as DVCAM instead of
> > DVPRO */ +
> > +    switch (sc->track_type) {
> > +        case 5:
> > +            if (sc->aspect_ratio)
> > +                track_aux_data |= 0x10;  /* 16:9 */
> > +            if (st->codec->pix_fmt == PIX_FMT_YUV420P)
> > +                track_aux_data |= 0x01;  /* marks stream as DVCAM instead
> > of DVPRO */ +            break;
> > +        case 6:
> > +            if (sc->aspect_ratio)
> > +                track_aux_data |= 0x01;  /* 16:9 (yes, this bit flag's
> > location is different than that used with track type 5) */ +           
> > break;
> > +    }
> 
> the other track types get no aspect nor pixel format dependant
> track_aux_data, is that intended ?
> 

The MPEG tracks do (see changes made in the same patch to 
gxf_write_mpeg_auxiliary) However SMPTE 360-2009 makes no mention of auxiliary 
data for MJPEG. It only addresses aux data for DV, MPEG, and Timecode streams. 
If there is an earlier spec that address aux data for MJPEG, I don't have 
access to it.

-Reuben


More information about the ffmpeg-devel mailing list