[Ffmpeg-cvslog] r6940 - trunk/libavformat/raw.c

michael subversion
Wed Nov 8 02:21:23 CET 2006


Author: michael
Date: Wed Nov  8 02:21:23 2006
New Revision: 6940

Modified:
   trunk/libavformat/raw.c

Log:
mpeg4probe patch by (Thijs Vermeir ; thijs vermeir barco com)
tabs removed by me
VOL vs. VOP check fixed by me


Modified: trunk/libavformat/raw.c
==============================================================================
--- trunk/libavformat/raw.c	(original)
+++ trunk/libavformat/raw.c	Wed Nov  8 02:21:23 2006
@@ -346,6 +346,36 @@
     return 0;
 }
 
+#define VIDEO_OBJECT_START_CODE        0x00000100
+#define VIDEO_OBJECT_LAYER_START_CODE  0x00000120
+#define VISUAL_OBJECT_START_CODE       0x000001b5
+#define VOP_START_CODE                 0x000001b6
+
+static int mpeg4video_probe(AVProbeData *probe_packet)
+{
+    uint32_t temp_buffer= -1;
+    int VO=0, VOL=0, VOP = 0, VISO = 0;
+    int i;
+
+    for(i=0; i<probe_packet->buf_size; i++){
+        temp_buffer = (temp_buffer<<8) + probe_packet->buf[i];
+        if ((temp_buffer & 0xffffff00) == 0x100) {
+            switch(temp_buffer){
+            case VOP_START_CODE:             VOP++; break;
+            case VISUAL_OBJECT_START_CODE:  VISO++; break;
+            }
+            switch(temp_buffer & 0xfffffff0){
+            case VIDEO_OBJECT_START_CODE:            VO++; break;
+            case VIDEO_OBJECT_LAYER_START_CODE:     VOL++; break;
+            }
+        }
+    }
+
+    if ( VOP >= VISO && VOP >= VOL && VO >= VOL && VOL > 0)
+        return AVPROBE_SCORE_MAX/2;
+    return 0;
+}
+
 static int h263_probe(AVProbeData *p)
 {
     int code;
@@ -523,7 +553,7 @@
     "m4v",
     "raw MPEG4 video format",
     0,
-    NULL /*mpegvideo_probe*/,
+    mpeg4video_probe, /** probing for mpeg4 data */
     video_read_header,
     raw_read_partial_packet,
     raw_read_close,




More information about the ffmpeg-cvslog mailing list