]> granicus.if.org Git - handbrake/commitdiff
libhb: add i-frame detection for mpeg4 ts/ps streams
authorjstebbins <jstebbins.hb@gmail.com>
Wed, 30 Jul 2014 22:08:34 +0000 (22:08 +0000)
committerjstebbins <jstebbins.hb@gmail.com>
Wed, 30 Jul 2014 22:08:34 +0000 (22:08 +0000)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6247 b64f7644-9d1e-0410-96f1-a4d463321fa5

libhb/stream.c

index 37f1fc3a2f4bd4f90d59b35d79783c935f75607f..df19423f9e5e8d8d29e7d59f860a3791b093724a 100644 (file)
@@ -1357,6 +1357,21 @@ static int isIframe( hb_stream_t *stream, const uint8_t *buf, int len )
         // didn't find an I-frame
         return 0;
     }
+    if ( pes->stream_type == 0x10 || pes->codec_param == AV_CODEC_ID_MPEG4 )
+    {
+        // we have an vc1 stream
+        for (ii = 0; ii < len-1; ii++)
+        {
+            strid = (strid << 8) | buf[ii];
+            if ( strid == 0x1b6 )
+            {
+                if ((buf[ii+1] & 0xC0) == 0)
+                    return 1;
+            }
+        }
+        // didn't find an I-frame
+        return 0;
+    }
 
     // we don't understand the stream type so just say "yes" otherwise
     // we'll discard all the video.