changeset 25838:f75a531569a2

in the crazy ES probing code return DEMUXER_TYPE_MPEG_ES (mpeg12v) only if we have at least a couple of SEQ/GOP startcodes
author nicodvb
date Sat, 26 Jan 2008 19:01:13 +0000
parents 643064afe2a4
children 327e98d7d2be
files libmpdemux/demux_mpg.c
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_mpg.c	Sat Jan 26 18:47:39 2008 +0000
+++ b/libmpdemux/demux_mpg.c	Sat Jan 26 19:01:13 2008 +0000
@@ -601,6 +601,7 @@
 static int num_elementary_packets12x=0;
 static int num_elementary_packets1B6=0;
 static int num_elementary_packetsPES=0;
+static int num_mpeg12_startcode=0;
 static int num_h264_slice=0; //combined slice
 static int num_h264_dpa=0; //DPA Slice
 static int num_h264_dpb=0; //DPB Slice
@@ -618,6 +619,7 @@
   num_elementary_packets1B6=0;
   num_elementary_packets12x=0;
   num_elementary_packetsPES=0;
+  num_mpeg12_startcode=0;
   num_h264_slice=0; //combined slice
   num_h264_dpa=0; //DPA Slice
   num_h264_dpb=0; //DPB Slice
@@ -632,6 +634,7 @@
 static inline void update_stats(int head)
 {
   if(head==0x1B6) ++num_elementary_packets1B6;
+  else if(head==0x1B3 || head==0x1B8) ++num_mpeg12_startcode;
   else if(head==0x100) ++num_elementary_packets100;
   else if(head==0x101) ++num_elementary_packets101;
   else if(head==0x1BD || (0x1C0<=head && head<=0x1EF))
@@ -683,7 +686,7 @@
        return file_format;
 
       // some hack to get meaningfull error messages to our unhappy users:
-      if(num_elementary_packets100>=2 && num_elementary_packets101>=2 &&
+      if(num_mpeg12_startcode>=2 && num_elementary_packets100>=2 && num_elementary_packets101>=2 &&
          abs(num_elementary_packets101+8-num_elementary_packets100)<16) {
          if(num_elementary_packetsPES>=4 && num_elementary_packetsPES>=num_elementary_packets100-4) {
            return file_format;