summaryrefslogtreecommitdiffstats
path: root/demux_mpg.c
diff options
context:
space:
mode:
authorarpi_esp <arpi_esp@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-04-15 03:40:37 +0000
committerarpi_esp <arpi_esp@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-04-15 03:40:37 +0000
commit2ba092874905669f0f8e8fda1b043c73e50db716 (patch)
treef6fb6813964153e16bad3a110c330a3f57ca7f5f /demux_mpg.c
parent4eca33639f3d69767e15c92b35fc7387453ae126 (diff)
downloadmpv-2ba092874905669f0f8e8fda1b043c73e50db716.tar.bz2
mpv-2ba092874905669f0f8e8fda1b043c73e50db716.tar.xz
new stream selection code
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@427 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'demux_mpg.c')
-rw-r--r--demux_mpg.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/demux_mpg.c b/demux_mpg.c
index ba7dd9f304..3b3e5fc804 100644
--- a/demux_mpg.c
+++ b/demux_mpg.c
@@ -83,19 +83,15 @@ static int demux_mpg_read_packet(demuxer_t *demux,int id){
//============== DVD Audio sub-stream ======================
if(id==0x1BD){
- int aid=stream_read_char(demux->stream)&0x7F;--len;
- ds=demux->audio;
- if(ds->id==-1) ds->id=aid;
- if(!dvdaudio_table[aid]){
- dvdaudio_table[aid]=1;
- printf("DVD Audio format: %s ID=%d%s\n",
- ((aid&0x70)==0x20)?"PCM":"AC3",aid,(ds->id==aid)?" CURRENT":"");
- }
+ int aid=128+(stream_read_char(demux->stream)&0x7F);--len;
if(len<3) return -1; // invalid audio packet
- if(ds->id!=aid){
- // drop packet (not selected channel)
- ds=NULL;
- } else {
+
+ if(!avi_header.a_streams[aid]) new_sh_audio(aid);
+ if(demux->audio->id==-1) demux->audio->id=aid;
+
+ if(demux->audio->id==aid){
+ ds=demux->audio;
+ if(!ds->sh) ds->sh=avi_header.a_streams[aid];
// READ Packet: Skip additional audio header data:
c=stream_read_char(demux->stream);
c=stream_read_char(demux->stream);
@@ -130,17 +126,23 @@ static int demux_mpg_read_packet(demuxer_t *demux,int id){
if(id>=0x1C0 && id<=0x1DF){
// mpeg audio
int aid=id-0x1C0;
+ if(!avi_header.a_streams[aid]) new_sh_audio(aid);
if(demux->audio->id==-1) demux->audio->id=aid;
if(demux->audio->id==aid){
ds=demux->audio;
+ if(!ds->sh) ds->sh=avi_header.a_streams[aid];
if(ds->type==-1) ds->type=1;
}
} else
if(id>=0x1E0 && id<=0x1EF){
// mpeg video
int aid=id-0x1E0;
+ if(!avi_header.v_streams[aid]) new_sh_video(aid);
if(demux->video->id==-1) demux->video->id=aid;
- if(demux->video->id==aid) ds=demux->video;
+ if(demux->video->id==aid){
+ ds=demux->video;
+ if(!ds->sh) ds->sh=avi_header.v_streams[aid];
+ }
}
if(ds){