aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2024-07-07 16:51:02 -0300
committerJames Almer <jamrial@gmail.com>2024-07-08 13:30:24 -0300
commitdc763efe70a3a8999bea81f788a2629ca95de9c9 (patch)
treeec19f1b49a284f02341d39aa50d2592d257a1e5c
parentd570457eb73fa7221e7aaa7d7ee74faf8f040224 (diff)
downloadffmpeg-dc763efe70a3a8999bea81f788a2629ca95de9c9.tar.gz
avformat/matroskadec: don't infer display dimensions when DisplayUnit is not pixels
The spec doesn't define a default value for other values of DisplayUnit. Signed-off-by: James Almer <jamrial@gmail.com>
-rw-r--r--libavformat/matroskadec.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index d1a135ed63..33de5bc4e9 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -2965,7 +2965,8 @@ static int mkv_parse_video(MatroskaTrack *track, AVStream *st,
&display_width_mul, &display_height_mul);
if (track->video.display_unit < MATROSKA_VIDEO_DISPLAYUNIT_UNKNOWN) {
- if (track->video.display_width && track->video.display_height &&
+ if (track->video.display_width && track->video.display_height &&
+ track->video.display_width != -1 && track->video.display_height != -1 &&
par->height < INT64_MAX / track->video.display_width / display_width_mul &&
par->width < INT64_MAX / track->video.display_height / display_height_mul)
av_reduce(&st->sample_aspect_ratio.num,
@@ -3139,10 +3140,12 @@ static int matroska_parse_tracks(AVFormatContext *s)
track->default_duration = default_duration;
}
}
- if (track->video.display_width == -1)
- track->video.display_width = track->video.pixel_width;
- if (track->video.display_height == -1)
- track->video.display_height = track->video.pixel_height;
+ if (track->video.display_unit == MATROSKA_VIDEO_DISPLAYUNIT_PIXELS) {
+ if (track->video.display_width == -1)
+ track->video.display_width = track->video.pixel_width;
+ if (track->video.display_height == -1)
+ track->video.display_height = track->video.pixel_height;
+ }
} else if (track->type == MATROSKA_TRACK_TYPE_AUDIO) {
if (!track->audio.out_samplerate)
track->audio.out_samplerate = track->audio.samplerate;