[FFmpeg-devel] [PATCH 3/7] avformat/matroskadec: export Dynamic HDR10+ packet side data

James Almer jamrial at gmail.com
Fri Mar 24 14:34:34 EET 2023


On 3/24/2023 8:40 AM, Anton Khirnov wrote:
> Quoting James Almer (2023-03-24 12:28:41)
>> On 3/24/2023 8:18 AM, Anton Khirnov wrote:
>>> Quoting James Almer (2023-03-21 18:06:33)
>>>> @@ -3615,12 +3635,54 @@ static int matroska_parse_webvtt(MatroskaDemuxContext *matroska,
>>>>    }
>>>>    
>>>>    static int matroska_parse_block_additional(MatroskaDemuxContext *matroska,
>>>> -                                           AVPacket *pkt,
>>>> +                                           MatroskaTrack *track, AVPacket *pkt,
>>>>                                               const uint8_t *data, int size, uint64_t id)
>>>>    {
>>>> -    uint8_t *side_data = av_packet_new_side_data(pkt,
>>>> -                                                 AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL,
>>>> -                                                 size + 8);
>>>> +    uint8_t *side_data;
>>>> +    int res;
>>>> +
>>>> +    switch (id) {
>>>> +    case 4: {
>>>> +        int country_code, provider_code;
>>>> +        int provider_oriented_code, application_identifier;
>>>> +        size_t hdrplus_size;
>>>> +        AVDynamicHDRPlus *hdrplus;
>>>> +
>>>> +        if (!track->blockaddid_itu_t_t35)
>>>> +            break; //ignore
>>>> +
>>>> +        /* ITU-T T.35 metadata */
>>>> +        country_code  = bytestream_get_byte(&data);
>>>> +        provider_code = bytestream_get_be16(&data);
>>>> +
>>>> +        if (country_code != 0xB5 || provider_code != 0x3C)
>>>> +            break; // ignore
>>>> +
>>>> +        provider_oriented_code = bytestream_get_be16(&data);
>>>> +        application_identifier = bytestream_get_byte(&data);
>>>
>>> Does something guarantee data is large enough for all thse
>>> bytestream_*()?
>>
>> I can add a check for size >= 6 for them. The rest of the payload will
>> be checked by av_dynamic_hdr_plus_from_t35().
> 
> My preference is bytestream2 to avoid explicit checks completely, but as
> you like.

Ok, will do.


More information about the ffmpeg-devel mailing list