[FFmpeg-devel] [PATCH 13/13] avformat/mxfenc: Write transfer characteristic

Michael Niedermayer michael at niedermayer.cc
Wed May 9 00:04:58 EEST 2018


On Tue, May 08, 2018 at 01:00:51PM +0200, Tomas Härdin wrote:
> mån 2018-05-07 klockan 12:38 +0200 skrev Michael Niedermayer:
> > > Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> > 
> > +static int get_trc(UID ul, enum AVColorTransferCharacteristic trc)
> > +{
> > +    switch (trc){
> > +    case AVCOL_TRC_GAMMA28   :
> > +    case AVCOL_TRC_GAMMA22   :
> > +        memcpy(ul, (UID){0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x01,0x01,0x01,0x01,0x01,0x00,0x00}, 16);
> > +        return 0;
> > +    case AVCOL_TRC_BT709     :
> > +    case AVCOL_TRC_SMPTE170M :
> > +        memcpy(ul, (UID){0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x01,0x01,0x01,0x01,0x02,0x00,0x00}, 16);
> > +        return 0;
> > +    case AVCOL_TRC_SMPTE240M :
> > +        memcpy(ul, (UID){0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x01,0x01,0x01,0x01,0x03,0x00,0x00}, 16);
> > +        return 0;
> > +    case AVCOL_TRC_BT1361_ECG:
> > +        memcpy(ul, (UID){0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x06,0x04,0x01,0x01,0x01,0x01,0x05,0x00,0x00}, 16);
> > +        return 0;
> > +    case AVCOL_TRC_LINEAR    :
> > +        memcpy(ul, (UID){0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x06,0x04,0x01,0x01,0x01,0x01,0x06,0x00,0x00}, 16);
> > +        return 0;
> > +    case AVCOL_TRC_SMPTE428  :
> > +        memcpy(ul, (UID){0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x08,0x04,0x01,0x01,0x01,0x01,0x07,0x00,0x00}, 16);
> > +        return 0;
> > +    default:
> > +        return -1;
> > +    }
> > +}
> > +
> >  static void mxf_write_cdci_common(AVFormatContext *s, AVStream *st, const UID key, unsigned size)
> >  {
> >      MXFStreamContext *sc = st->priv_data;
> > @@ -1152,6 +1181,8 @@ static void mxf_write_cdci_common(AVFormatContext *s, AVStream *st, const UID ke
> >      int display_height;
> >      int f1, f2;
> >      unsigned desc_size = size+8+8+8+8+8+8+8+5+16+4+12+20+5 + 5*8 + 6;
> > +    UID transfer_ul = {0};
> > +
> >      if (sc->interlaced && sc->field_dominance)
> >          desc_size += 5;
> >      if (sc->signal_standard)
> > @@ -1164,6 +1195,8 @@ static void mxf_write_cdci_common(AVFormatContext *s, AVStream *st, const UID ke
> >          desc_size += 8 * 3;
> >      if (s->oformat == &ff_mxf_d10_muxer)
> >          desc_size += 8 + 8 + 8;
> > +    if (get_trc(transfer_ul, st->codecpar->color_trc) >= 0)
> > +        desc_size += 20;
> >  
> >      mxf_write_generic_desc(s, st, key, desc_size);
> >  
> > @@ -1305,6 +1338,12 @@ static void mxf_write_cdci_common(AVFormatContext *s, AVStream *st, const UID ke
> >      avio_wb32(pb, sc->aspect_ratio.num);
> >      avio_wb32(pb, sc->aspect_ratio.den);
> >  
> > +    //Transfer characteristic
> > +    if (transfer_ul[0]) {
> > +        mxf_write_local_tag(pb, 16, 0x3210);
> > +        avio_write(pb, transfer_ul, 16);
> > +    };
> 
> Looks OK, but I didn't check the ULs for correctness

will apply

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 2
"100% positive feedback" - "All either got their money back or didnt complain"
"Best seller ever, very honest" - "Seller refunded buyer after failed scam"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20180508/4bb334c2/attachment.sig>


More information about the ffmpeg-devel mailing list