[Mplayer-cvslog] CVS: main mplayer.c,1.181,1.182 demux_mpg.c,1.22,1.23 demuxer.c,1.10,1.11 demuxer.h,1.7,1.8

Arpi of Ize arpi at mplayer.dev.hu
Mon Jul 16 17:36:23 CEST 2001


Update of /cvsroot/mplayer/main
In directory mplayer:/var/tmp.root/cvs-serv11950

Modified Files:
	mplayer.c demux_mpg.c demuxer.c demuxer.h 
Log Message:
ds->type removed - using id-based audio format detection in mplayer.c

Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.181
retrieving revision 1.182
diff -u -r1.181 -r1.182
--- mplayer.c	16 Jul 2001 15:09:34 -0000	1.181
+++ mplayer.c	16 Jul 2001 15:36:20 -0000	1.182
@@ -911,11 +911,10 @@
     has_audio=0;sh_audio=NULL;
   } else {
     sh_audio=d_audio->sh;sh_audio->ds=d_audio;
-    if(verbose) printf("detected MPG-PS audio format: %d\n",d_audio->type);
-    switch(d_audio->type){
-      case 1: sh_audio->format=0x50;break; // mpeg
-      case 2: sh_audio->format=0x10001;break;  // dvd pcm
-      case 3: sh_audio->format=0x2000;break; // ac3
+    switch(d_audio->id & 0xE0){  // 1110 0000 b  (high 3 bit: type  low 5: id)
+      case 0x00: sh_audio->format=0x50;break; // mpeg
+      case 0xA0: sh_audio->format=0x10001;break;  // dvd pcm
+      case 0x80: sh_audio->format=0x2000;break; // ac3
       default: has_audio=0;sh_audio=NULL; // unknown type
     }
   }

Index: demux_mpg.c
===================================================================
RCS file: /cvsroot/mplayer/main/demux_mpg.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- demux_mpg.c	7 Jul 2001 18:46:15 -0000	1.22
+++ demux_mpg.c	16 Jul 2001 15:36:20 -0000	1.23
@@ -13,10 +13,6 @@
 //#define MAX_PS_PACKETSIZE 2048
 #define MAX_PS_PACKETSIZE (224*1024)
 
-//static void parse_dvdsub(unsigned char *buf,int len){
-//    printf("\rDVDsub packet: %d  \n",len);
-//}
-
 static int mpeg_pts_error=0;
 
 static unsigned int read_mpeg_timestamp(stream_t *s,int c){
@@ -33,7 +29,6 @@
   return pts;
 }
 
-//static char dvdaudio_table[256];
 //static unsigned int packet_start_pos=0;
 
 extern void *new_sh_audio(demuxer_t *demux,int id);
@@ -65,7 +60,6 @@
   len=stream_read_word(demux->stream);
   if(verbose>=3)  printf("PACKET len=%d",len);
 //  if(len==62480){ demux->synced=0;return -1;} /* :) */
-//  if(len==0 || len>MAX_PS_PACKETSIZE) return -2;  // invalid packet !!!!!!
   if(len==0 || len>MAX_PS_PACKETSIZE){
     if(verbose>=2) printf("Invalid PS packet len: %d\n",len);
     return -2;  // invalid packet !!!!!!
@@ -144,10 +138,8 @@
         if(!demux->s_streams[aid]){
             printf("==> Found subtitle: %d\n",aid);
             demux->s_streams[aid]=1;
-            // new_sh_audio(aid);
         }
 
-        //if(demux->audio->id==-1) demux->audio->id=aid; // autodetect :)
         if(demux->sub->id==aid){
             ds=demux->sub;
         }
@@ -170,11 +162,7 @@
         c=stream_read_char(demux->stream);//type|=c<<16;
 //        printf("[%06X]",type);
         len-=3;
-        if(ds->type==-1){
-          // autodetect type
-          ds->type=((aid&0xE0)==0xA0)?2:3;
-        }
-        if(ds->type==2 && len>=2){
+        if((aid&0xE0)==0xA0 && len>=2){
           // read PCM header
           int head;
           head=stream_read_char(demux->stream); head=c<<8;
@@ -215,7 +203,6 @@
     if(demux->audio->id==aid){
       ds=demux->audio;
       if(!ds->sh) ds->sh=demux->a_streams[aid];
-      if(ds->type==-1) ds->type=1;
     }
   } else
   if(id>=0x1E0 && id<=0x1EF){
@@ -252,7 +239,6 @@
 int num_elementary_packets1B6=0;
 
 int demux_mpg_es_fill_buffer(demuxer_t *demux){
-//if(demux->type==DEMUXER_TYPE_MPEG_ES)
   // Elementary video stream
   if(demux->stream->eof) return 0;
   demux->filepos=stream_tell(demux->stream);

Index: demuxer.c
===================================================================
RCS file: /cvsroot/mplayer/main/demuxer.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- demuxer.c	3 Jun 2001 23:34:59 -0000	1.10
+++ demuxer.c	16 Jul 2001 15:36:20 -0000	1.11
@@ -23,7 +23,6 @@
   ds->bytes=0;
   ds->first=ds->last=NULL;
   ds->id=id;
-  ds->type=-1;
   ds->demuxer=demuxer;
 //----------------
   ds->asf_seq=-1;

Index: demuxer.h
===================================================================
RCS file: /cvsroot/mplayer/main/demuxer.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- demuxer.h	16 Jul 2001 15:09:34 -0000	1.7
+++ demuxer.h	16 Jul 2001 15:36:20 -0000	1.8
@@ -44,7 +44,6 @@
   demux_packet_t *first;  // read to current buffer from here
   demux_packet_t *last;   // append new packets from input stream to here
   int id;                 // stream ID  (for multiple audio/video streams)
-  int type;               // stream type (currently used only for mpg-PS audio)
   struct demuxer_st *demuxer; // parent demuxer structure (stream handler)
 // ---- asf -----
   demux_packet_t *asf_packet;  // read asf fragments here




More information about the MPlayer-cvslog mailing list