From e73f29e80071d475ac4b1b30a1889f2c16f92fb2 Mon Sep 17 00:00:00 2001 From: arpi Date: Thu, 14 Feb 2002 23:41:34 +0000 Subject: [PATCH] added mp3 detection git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4712 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpdemux/demux_mpg.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/libmpdemux/demux_mpg.c b/libmpdemux/demux_mpg.c index 0e2dc257ee..ae5a25b61e 100644 --- a/libmpdemux/demux_mpg.c +++ b/libmpdemux/demux_mpg.c @@ -12,6 +12,7 @@ #include "demuxer.h" #include "parse_es.h" #include "stheader.h" +#include "mp3_hdr.h" #include "dvdauth.h" @@ -238,6 +239,7 @@ int num_elementary_packets100=0; int num_elementary_packets101=0; int num_elementary_packets1B6=0; int num_elementary_packetsPES=0; +int num_mp3audio_packets=0; int demux_mpg_es_fill_buffer(demuxer_t *demux){ // Elementary video stream @@ -266,6 +268,7 @@ do{ head<<=8; if(head!=0x100){ head|=c; + if(mp_check_mp3_header(head)) ++num_mp3audio_packets; ++skipped; //++demux->filepos; continue; } @@ -304,7 +307,7 @@ do{ if(head==0x101) ++num_elementary_packets101; mp_msg(MSGT_DEMUX,MSGL_DBG3,"Opps... elementary video packet found: %03X\n",head); } else - if(head>=0x1C0 && head<0x1F0){ + if((head>=0x1C0 && head<0x1F0) || head==0x1BD){ ++num_elementary_packetsPES; mp_msg(MSGT_DEMUX,MSGL_DBG3,"Opps... PES packet found: %03X\n",head); } else @@ -316,6 +319,11 @@ do{ demux->stream->eof=1; break; } + if(num_mp3audio_packets>100 && num_elementary_packets100<10){ + mp_msg(MSGT_DEMUX,MSGL_V,"sync_mpeg_ps: seems to be MP3 stream...\n"); + demux->stream->eof=1; + break; + } #endif } } while(ret!=1);