From e42e0f2e2a28840cf6df4a7d6c8934a4364056a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= Date: Fri, 3 May 2024 18:47:15 +0200 Subject: [PATCH] demux_mkv: make V_QUICKTIME codec detection generic This allows playing files with any fourcc that is supported by mpv. --- demux/demux_mkv.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/demux/demux_mkv.c b/demux/demux_mkv.c index 9bee8a4011..d2df33cb0d 100644 --- a/demux/demux_mkv.c +++ b/demux/demux_mkv.c @@ -1527,15 +1527,14 @@ static int demux_mkv_open_video(demuxer_t *demuxer, mkv_track_t *track) sh_v->codec_tag = track->colorspace; sh_v->codec = "rawvideo"; } else if (strcmp(track->codec_id, "V_QUICKTIME") == 0) { - uint32_t fourcc1 = 0, fourcc2 = 0; if (track->private_size >= 8) { - fourcc1 = AV_RL32(track->private_data + 0); - fourcc2 = AV_RL32(track->private_data + 4); - } - if (fourcc1 == MKTAG('S', 'V', 'Q', '3') || - fourcc2 == MKTAG('S', 'V', 'Q', '3')) - { - sh_v->codec = "svq3"; + sh_v->codec_tag = AV_RL32(track->private_data + 4); + mp_set_codec_from_tag(sh_v); + // Some non-compliant files have fourcc at offset 0. + if (!sh_v->codec) { + sh_v->codec_tag = AV_RL32(track->private_data); + mp_set_codec_from_tag(sh_v); + } extradata = track->private_data; extradata_size = track->private_size; }