[FFmpeg-devel] [PATCH 2/3] avformat/mxfenc: Write Mastering Display Colour Volume to MXF

Harry Mallon harry.mallon at codex.online
Wed Sep 9 17:52:52 EEST 2020



> On 3 Sep 2020, at 07:31, Marton Balint <cus at passwd.hu> wrote:
> 
> On Mon, 31 Aug 2020, Harry Mallon wrote:
> 
>> [..]
>> };
>> +static const MXFLocalTagPair mxf_mastering_display_local_tags[] = {
>> +    { 0x8201, {0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x04,0x20,0x04,0x01,0x01,0x01,0x00,0x00}}, /* Mastering Display Primaries */
>> +    { 0x8202, {0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x04,0x20,0x04,0x01,0x01,0x02,0x00,0x00}}, /* Mastering Display White Point Chromaticity */
>> +    { 0x8203, {0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x04,0x20,0x04,0x01,0x01,0x03,0x00,0x00}}, /* Mastering Display Maximum Luminance */
>> +    { 0x8204, {0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x04,0x20,0x04,0x01,0x01,0x04,0x00,0x00}}, /* Mastering Display Minimum Luminance */
> 
> Ain't these collide with AVC subdescriptor local tags?

Yep, doh. Fixed in v2.

> 
>> +};
>> +
>> static void mxf_write_uuid(AVIOContext *pb, enum MXFMetadataSetType type, int value)
>> {
>>    avio_write(pb, uuid_base, 12);
>> @@ -510,6 +518,7 @@ static void mxf_write_primer_pack(AVFormatContext *s)
>>    AVIOContext *pb = s->pb;
>>    int local_tag_number, i = 0;
>>    int avc_tags_count = 0;
>> +    int mastering_tags_count = 0;
>> 
>>    local_tag_number = FF_ARRAY_ELEMS(mxf_local_tag_batch);
>>    local_tag_number += mxf->store_user_comments * FF_ARRAY_ELEMS(mxf_user_comments_local_tag);
>> @@ -522,6 +531,15 @@ static void mxf_write_primer_pack(AVFormatContext *s)
>>        }
>>    }
>> +    for (i = 0; i < s->nb_streams; i++) {
>> +        uint8_t *side_data = av_stream_get_side_data(s->streams[i], AV_PKT_DATA_MASTERING_DISPLAY_METADATA, NULL);
> 
> You can get rid of the side_data temporary variable and use the function call directly in the if condition.

This and other comments fixed in v2 (also Tomas' comments)

> 
>> +        if (side_data) {
>> +            mastering_tags_count = FF_ARRAY_ELEMS(mxf_mastering_display_local_tags);
>> +            local_tag_number += mastering_tags_count;
>> +            break;
>> +        }
>> +    }
> 
> [..]
>> +


Thanks for the review

Best,
Harry


More information about the ffmpeg-devel mailing list