[FFmpeg-devel] [PATCH] avformat/matroskadec: Output palette as stream side data
Andreas Rheinhardt
andreas.rheinhardt at outlook.com
Sun Oct 8 22:06:19 EEST 2023
Michael Niedermayer:
> On Thu, Oct 05, 2023 at 02:36:52PM +0200, Andreas Rheinhardt wrote:
>> This is simpler implementation-wise (it avoids an almost-always-false
>> check in read_packet and decreases sizeof(MatroskaTrack) by about 2/3)
>> and makes the side-data available directly after read_header.
>>
>> It also fixes the Matroska analog of ticket #10602: If a Matroska track
>> has a palette, said palette will be attached as side-data to the
>> first packet of said track and most likely, this is one read during
>> avformat_find_stream_info(). Yet if this packet is discarded because
>> of a seek performed immediately after avformat_find_stream_info(),
>> the information about the global palette will never reach the user.
>>
>> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
>> ---
>> Ticket #10602 can unfortunately not be fixed in this way,
>> because avi allows to update the palette mid-stream,
>> so that the palette contained in extradata must not be
>> exported via global side data due to the semantics of the latter.
>>
>> libavformat/matroskadec.c | 39 ++++++++++++---------------------------
>> 1 file changed, 12 insertions(+), 27 deletions(-)
>
> breaks:
> aletrek.mkv
>
> probably here:
> https://trac.ffmpeg.org/attachment/ticket/5071/aletrek.mkv
>
This is actually expected due to the recent changes with respect to side
data: Basically every piece of code currently only looks for palette
side data in packets, not in stream side data and if the latter is not
injected into packets, then it is available, but unused. This is the
reason I opposed deprecating avformat_inject_global_side_data(); see my
reply to James latest iteration of his patchset.
- Andreas
More information about the ffmpeg-devel
mailing list