changeset 940:53c4a89c1a82 libavformat

mpeg-ps probe 2nd try
author michael
date Sat, 11 Feb 2006 09:27:00 +0000
parents 61959072be81
children 5e15da09cd6b
files mpeg.c
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mpeg.c	Fri Feb 10 01:24:32 2006 +0000
+++ b/mpeg.c	Sat Feb 11 09:27:00 2006 +0000
@@ -1263,7 +1263,7 @@
 static int mpegps_probe(AVProbeData *p)
 {
     uint32_t code= -1;
-    int sys=0, pspack=0;
+    int sys=0, pspack=0, priv1=0, vid=0;
     int i;
 
     for(i=0; i<p->buf_size; i++){
@@ -1271,12 +1271,16 @@
         if ((code & 0xffffff00) == 0x100) {
             switch(code){
             case SYSTEM_HEADER_START_CODE:    sys++; break;
+            case         PRIVATE_STREAM_1:  priv1++; break;
             case          PACK_START_CODE: pspack++; break;
+            case       (VIDEO_ID + 0x100):    vid++; break;
             }
         }
     }
     if(sys && sys*9 <= pspack*10)
         return AVPROBE_SCORE_MAX/2+2; // +1 for .mpg
+    if((priv1 || vid) && (priv1+vid)*9 <= pspack*10)
+        return AVPROBE_SCORE_MAX/2+2; // +1 for .mpg
     return 0;
 }