[FFmpeg-devel] [PATCH v3 5/7] avformat/matroskaenc: write a MaxBlockAdditionID element

James Almer jamrial at gmail.com
Thu Mar 30 04:28:11 EEST 2023


On 3/29/2023 9:44 PM, Andreas Rheinhardt wrote:
>> @@ -3070,6 +3082,25 @@ after_cues:
>>   
>>       if (mkv->track.bc) {
>>           // write Tracks master
>> +        int64_t end = avio_tell(mkv->track.bc);
>> +
>> +        for (int i = 0; i < s->nb_streams; i++) {
> AVFormatContext.nb_streams is unsigned, so i should be, too.

This same kind of loop is done with an int everywhere, but ok, will 
change it since it's harmless.

> 
>> +            const mkv_track *track = &mkv->tracks[i];
>> +
>> +            if (IS_WEBM(mkv))
>> +                break;
> This check does not belong into the loop.

Changed, but it looks uglier now.

> 
>> +            if (!track->max_blockaddid)
>> +                continue;
>> +
>> +            // We reserved a single byte to write this value.
>> +            av_assert0(track->max_blockaddid <= 0xFF);
>> +
>> +            avio_seek(mkv->track.bc, track->blockadditionmapping_offset, SEEK_SET);
>> +
>> +            put_ebml_uint(mkv->track.bc, MATROSKA_ID_TRACKMAXBLKADDID, track->max_blockaddid);
>> +        }
>> +
>> +        avio_seek(mkv->track.bc, end, SEEK_SET);
> This seek (and the avio_tell() before the loop) seem unnecessary; see
> 0fc150f048398c9dbb8578f25e916fd356c18a54.

Ah, good to know. Will remove it then.


More information about the ffmpeg-devel mailing list