[FFmpeg-devel] [PATCH]Only expect prores packet offset in mkv if the specified codec id was set

Carl Eugen Hoyos cehoyos at ag.or.at
Wed Apr 9 02:03:07 CEST 2014


On Monday 07 April 2014 05:27:33 pm Michael Niedermayer wrote:
> On Sun, Apr 06, 2014 at 12:47:52AM +0000, Carl Eugen Hoyos wrote:
> > Michael Niedermayer <michaelni <at> gmx.at> writes:
> > > > Attached patch will be necessary to support decoding
> > > > broken prores-in-mkv.
> >
> > Sorry if this was unclear:
> > The patch is necessary to decode currently unsupported
> > prores-mkv-files (which believe that mov code points ==
> > fourcc), it is not sufficient though: Either searching
> > for code points if nothing was found in the fourcc list
> > or the hacky solution of adding prores to riff.c is
> > also needed.
> >
> > > > Please comment, Carl Eugen
> > >
> > > where can i find such a file ?
> >
> > The Haali mkv file in:
> > http://samples.ffmpeg.org/ffmpeg-bugs/trac/ticket3434/
>
> i think its better to check if the icpf chunk header is in there
> and add it if its not instead of making that depenant from the
> codec string id
> also theres a second prores check  in there

New patch attached.

Thank you, Carl Eugen
-------------- next part --------------
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 6976da8..66268fd 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -2545,7 +2545,8 @@ static int matroska_parse_frame(MatroskaDemuxContext *matroska,
         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;
 
     pkt = av_mallocz(sizeof(AVPacket));
@@ -2556,7 +2557,7 @@ static int matroska_parse_frame(MatroskaDemuxContext *matroska,
         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;
         bytestream_put_be32(&buf, pkt_size);
         bytestream_put_be32(&buf, MKBETAG('i', 'c', 'p', 'f'));


More information about the ffmpeg-devel mailing list