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

Anton Khirnov anton at khirnov.net
Fri Mar 24 13:18:33 EET 2023


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_*()?


-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list