History

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.

Andreas Rheinhardt committed 1 year ago

Commit 92e310e1 parent bf6d3dc2 files · +6 −1Browse files

Unified · Split

2 files
  1. libavformat/matroskadec.c +5 −0
  2. tests/ref/fate/matroska-mastering-display-metadata +1 −1
libavformat/matroskadec.c+5−0
@@ -2877,6 +2877,11 @@ static int mkv_parse_video_codec(MatroskaTrack *track, AVCodecParameters *par, · 2876 unmodified lines
2877{2877{
2878 if (!strcmp(track->codec_id, "V_MS/VFW/FOURCC") &&2878 if (!strcmp(track->codec_id, "V_MS/VFW/FOURCC") &&
2879 track->codec_priv.size >= 40) {2879 track->codec_priv.size >= 40) {
2880 uint32_t size = AV_RL32A(track->codec_priv.data);
2881 // VFW extradata is padded to an even length, yet
2882 // the size field contains the real length.
2883 if (size & 1 && size == track->codec_priv.size - 1)
2884 --track->codec_priv.size;
2880 track->ms_compat = 1;2885 track->ms_compat = 1;
2881 par->bits_per_coded_sample = AV_RL16(track->codec_priv.data + 14);2886 par->bits_per_coded_sample = AV_RL16(track->codec_priv.data + 14);
2882 par->codec_tag = AV_RL32(track->codec_priv.data + 16);2887 par->codec_tag = AV_RL32(track->codec_priv.data + 16);
tests/ref/fate/matroska-mastering-display-metadata+1−1
@@ -1,7 +1,7 @@
1c1e5e2ecf433cf05af8556debc7d4d0b *tests/data/fate/matroska-mastering-display-metadata.matroska1c1e5e2ecf433cf05af8556debc7d4d0b *tests/data/fate/matroska-mastering-display-metadata.matroska
21669773 tests/data/fate/matroska-mastering-display-metadata.matroska21669773 tests/data/fate/matroska-mastering-display-metadata.matroska
3#extradata 0: 4, 0x040901a33#extradata 0: 4, 0x040901a3
4#extradata 3: 202, 0xfce962794#extradata 3: 201, 0x9a706279
5#tb 0: 1/10005#tb 0: 1/1000
6#media_type 0: video6#media_type 0: video
7#codec_id 0: prores7#codec_id 0: prores

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t