summaryrefslogtreecommitdiffstats
path: root/libmpdemux/demux_mpg.c
diff options
context:
space:
mode:
authorarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-02-14 23:41:34 +0000
committerarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-02-14 23:41:34 +0000
commite73f29e80071d475ac4b1b30a1889f2c16f92fb2 (patch)
tree88499b285833bdbd4ee841420fafe98f6acff4f2 /libmpdemux/demux_mpg.c
parent360bb11537ce9297bf96ca3aa370b7b692d8c00b (diff)
downloadmpv-e73f29e80071d475ac4b1b30a1889f2c16f92fb2.tar.bz2
mpv-e73f29e80071d475ac4b1b30a1889f2c16f92fb2.tar.xz
added mp3 detection
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4712 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux/demux_mpg.c')
-rw-r--r--libmpdemux/demux_mpg.c10
1 files changed, 9 insertions, 1 deletions
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);