matroska: Support V_QUICKTIME as written in the specification

Check if the size is written the first 4 bytes and read the next 4
as fourcc candidate, fallback checking the initial for 4 bytes.

"The CodecPrivate contains all additional data that is stored in the
'stsd' (sample description) atom in the QuickTime file after the
mandatory video descriptor structure (starting with the size and FourCC
fields)"

CC: libav-stable@libav.org
This commit is contained in:
Luca Barbato 2016-03-12 13:46:13 +01:00
parent 92c1a83ee9
commit 8b4b1c1eea
1 changed files with 10 additions and 3 deletions

View File

@ -1661,9 +1661,16 @@ static int matroska_parse_tracks(AVFormatContext *s)
} else if (!strcmp(track->codec_id, "V_QUICKTIME") && } else if (!strcmp(track->codec_id, "V_QUICKTIME") &&
(track->codec_priv.size >= 86) && (track->codec_priv.size >= 86) &&
(track->codec_priv.data)) { (track->codec_priv.data)) {
track->video.fourcc = AV_RL32(track->codec_priv.data); if (track->codec_priv.size == AV_RB32(track->codec_priv.data)) {
codec_id = ff_codec_get_id(ff_codec_movvideo_tags, track->video.fourcc = AV_RL32(track->codec_priv.data + 4);
track->video.fourcc); codec_id = ff_codec_get_id(ff_codec_movvideo_tags,
track->video.fourcc);
}
if (codec_id == AV_CODEC_ID_NONE) {
track->video.fourcc = AV_RL32(track->codec_priv.data);
codec_id = ff_codec_get_id(ff_codec_movvideo_tags,
track->video.fourcc);
}
if (codec_id == AV_CODEC_ID_NONE) { if (codec_id == AV_CODEC_ID_NONE) {
char buf[32]; char buf[32];
av_get_codec_tag_string(buf, sizeof(buf), track->video.fourcc); av_get_codec_tag_string(buf, sizeof(buf), track->video.fourcc);