1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-10 06:10:52 +02:00

avformat/matroskadec: Fix VfW extradata size

The structure is padded to an even length with an internal
size field to indicate the real size.
The matroska-matroska-display-metadata test (writing FFV1
in VFW mode) was affected by this.
It should also fix ticket #11613.

Reviewed-by: compn <ff@hawaiiantel.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt
2025-05-25 05:12:05 +02:00
parent bf6d3dc339
commit 92e310eb82
2 changed files with 6 additions and 1 deletions

View File

@@ -2877,6 +2877,11 @@ static int mkv_parse_video_codec(MatroskaTrack *track, AVCodecParameters *par,
{
if (!strcmp(track->codec_id, "V_MS/VFW/FOURCC") &&
track->codec_priv.size >= 40) {
uint32_t size = AV_RL32A(track->codec_priv.data);
// VFW extradata is padded to an even length, yet
// the size field contains the real length.
if (size & 1 && size == track->codec_priv.size - 1)
--track->codec_priv.size;
track->ms_compat = 1;
par->bits_per_coded_sample = AV_RL16(track->codec_priv.data + 14);
par->codec_tag = AV_RL32(track->codec_priv.data + 16);

View File

@@ -1,7 +1,7 @@
c1e5e2ecf433cf05af8556debc7d4d0b *tests/data/fate/matroska-mastering-display-metadata.matroska
1669773 tests/data/fate/matroska-mastering-display-metadata.matroska
#extradata 0: 4, 0x040901a3
#extradata 3: 202, 0xfce96279
#extradata 3: 201, 0x9a706279
#tb 0: 1/1000
#media_type 0: video
#codec_id 0: prores