]> git.sesse.net Git - ffmpeg/commitdiff
h264: support invalid annex B in mp4
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 27 Nov 2012 17:06:00 +0000 (18:06 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 27 Nov 2012 17:06:00 +0000 (18:06 +0100)
Fixes Ticket1914

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/h264.c

index 33803bfe86757219990bda276833f793f29eb9a5..14843cf24e866778578e7ad249c45efa845e8161 100644 (file)
@@ -3763,6 +3763,13 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size)
         ff_h264_reset_sei(h);
     }
 
+    if (h->nal_length_size == 4) {
+        if (buf_size > 8 && AV_RB32(buf) == 1 && AV_RB32(buf+5) > (unsigned)buf_size) {
+            h->is_avc = 0;
+        }else if(buf_size > 3 && AV_RB32(buf) > 1 && AV_RB32(buf) <= (unsigned)buf_size)
+            h->is_avc = 1;
+    }
+
     for (; pass <= 1; pass++) {
         buf_index     = 0;
         context_count = 0;