Only insert the icpf atom in ProRes mkv packets if it isn't already present.

The patch allows to read broken mkv files containing ProRes as written by
the Haali muxer.
Fixes a part of ticket #3434.
This commit is contained in:
Carl Eugen Hoyos 2014-04-17 14:46:11 +02:00
parent 197fe392db
commit 6c18200c2f
1 changed files with 3 additions and 2 deletions

View File

@ -2545,7 +2545,8 @@ static int matroska_parse_frame(MatroskaDemuxContext *matroska,
pkt_data = wv_data; pkt_data = wv_data;
} }
if (st->codec->codec_id == AV_CODEC_ID_PRORES) if (st->codec->codec_id == AV_CODEC_ID_PRORES &&
AV_RB32(&data[4]) != MKBETAG('i', 'c', 'p', 'f'))
offset = 8; offset = 8;
pkt = av_mallocz(sizeof(AVPacket)); pkt = av_mallocz(sizeof(AVPacket));
@ -2556,7 +2557,7 @@ static int matroska_parse_frame(MatroskaDemuxContext *matroska,
goto fail; goto fail;
} }
if (st->codec->codec_id == AV_CODEC_ID_PRORES) { if (st->codec->codec_id == AV_CODEC_ID_PRORES && offset == 8) {
uint8_t *buf = pkt->data; uint8_t *buf = pkt->data;
bytestream_put_be32(&buf, pkt_size); bytestream_put_be32(&buf, pkt_size);
bytestream_put_be32(&buf, MKBETAG('i', 'c', 'p', 'f')); bytestream_put_be32(&buf, MKBETAG('i', 'c', 'p', 'f'));