[MPlayer-dev-eng] MPEG demuxer misdetects an aiff file as MPEG-ES

Nico Sabbi Nicola.Sabbi at poste.it
Mon Jan 21 23:22:39 CET 2008


Il Monday 21 January 2008 21:56:34 Roberto Togni ha scritto:
> Hi
>
> From bugzilla #997 http://bugzilla.mplayerhq.hu/show_bug.cgi?id=997
> The sample file was moved to samples/AIFF/dragon.aif
>
> The problem is that the mpeg demuxer misdetects that file as
> mpeg-es, preventing the demuxer probe to continue.
>
> Can somebody familiar with mpeg demuxer have a look at it?
>
> Ciao,
>  Roberto

the following patch fixes detection and *shouldn't* do any harm
to MPEG demuxers, but that probing code is so crazy
(300l to teh author) that I can't be absolutely sure, so please test
it

Index: libmpdemux/demux_mpg.c
===================================================================
--- libmpdemux/demux_mpg.c      (revisione 25710)
+++ libmpdemux/demux_mpg.c      (copia locale)
@@ -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;



More information about the MPlayer-dev-eng mailing list