[Mplayer-cvslog] CVS: main dec_audio.c,1.22,1.23 dec_video.c,1.3,1.4 demux_asf.c,1.9,1.10 mplayer.c,1.179,1.180

Arpi of Ize arpi at mplayer.dev.hu
Mon Jul 16 14:53:50 CEST 2001


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

Modified Files:
	dec_audio.c dec_video.c demux_asf.c mplayer.c 
Log Message:
some cleanup - fixed warnings, removed old stuff, moved audio resync to dec_audio

Index: dec_audio.c
===================================================================
RCS file: /cvsroot/mplayer/main/dec_audio.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- dec_audio.c	14 Jul 2001 16:58:55 -0000	1.22
+++ dec_audio.c	16 Jul 2001 12:53:48 -0000	1.23
@@ -32,6 +32,10 @@
 #include "loader/DirectShow/DS_AudioDec.h"
 #endif
 
+extern int init_acm_audio_codec(sh_audio_t *sh_audio);
+extern int acm_decode_audio(sh_audio_t *sh_audio, void* a_buffer,int minlen,int maxlen);
+
+
 static sh_audio_t* dec_audio_sh=NULL;
 
 // AC3 decoder buffer callback:
@@ -51,15 +55,9 @@
   return len;
 }
 
-
 int init_audio(sh_audio_t *sh_audio){
-
 int driver=sh_audio->codec->driver;
 
-extern int init_acm_audio_codec(sh_audio_t *sh_audio);
-//extern int acm_decode_audio(sh_audio_t *sh_audio, void* a_buffer,int len);
-extern int acm_decode_audio(sh_audio_t *sh_audio, void* a_buffer,int minlen,int maxlen);
-
 sh_audio->samplesize=2;
 #if WORDS_BIGENDIAN
 sh_audio->sample_format=AFMT_S16_BE;
@@ -344,8 +342,7 @@
 
 #ifdef USE_DIRECTSHOW
       case 7: // DirectShow
-      { int ret;
-        int size_in=0;
+      { int size_in=0;
         int size_out=0;
         int srcsize=DS_AudioDecoder_GetSrcSize(maxlen);
         if(verbose>2)printf("DShow says: srcsize=%d  (buffsize=%d)  out_size=%d\n",srcsize,sh_audio->a_in_buffer_size,maxlen);
@@ -373,4 +370,30 @@
     return len;
 }
 
+void resync_audio_stream(sh_audio_t *sh_audio){
+        switch(sh_audio->codec->driver){
+        case 1:
+          MP3_DecodeFrame(NULL,-2); // resync
+          MP3_DecodeFrame(NULL,-2); // resync
+          MP3_DecodeFrame(NULL,-2); // resync
+          break;
+        case 3:
+          ac3_bitstream_reset();    // reset AC3 bitstream buffer
+    //      if(verbose){ printf("Resyncing AC3 audio...");fflush(stdout);}
+          sh_audio->ac3_frame=ac3_decode_frame(); // resync
+    //      if(verbose) printf(" OK!\n");
+          break;
+        case 4:
+        case 7:
+          sh_audio->a_in_buffer_len=0;        // reset ACM/DShow audio buffer
+          break;
+        }
+}
 
+void skip_audio_frame(sh_audio_t *sh_audio){
+              switch(sh_audio->codec->driver){
+                case 1: MP3_DecodeFrame(NULL,-2);break; // skip MPEG frame
+                case 3: sh_audio->ac3_frame=ac3_decode_frame();break; // skip AC3 frame
+                default: ds_fill_buffer(sh_audio->ds);  // skip PCM frame
+              }
+}

Index: dec_video.c
===================================================================
RCS file: /cvsroot/mplayer/main/dec_video.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- dec_video.c	12 Jul 2001 15:35:51 -0000	1.3
+++ dec_video.c	16 Jul 2001 12:53:48 -0000	1.4
@@ -10,6 +10,8 @@
 extern double video_time_usage;
 extern double vout_time_usage;
 
+#include "linux/timer.h"
+
 #include "stream.h"
 #include "demuxer.h"
 
@@ -383,9 +385,7 @@
     break;
 #endif
   case 1: {
-        int in_frame=0;
         int t=0;
-        float newfps;
 
         t-=GetTimer();
           mpeg2_decode_data(video_out, start, start+in_size,drop_frame);

Index: demux_asf.c
===================================================================
RCS file: /cvsroot/mplayer/main/demux_asf.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- demux_asf.c	3 Jun 2001 23:34:59 -0000	1.9
+++ demux_asf.c	16 Jul 2001 12:53:48 -0000	1.10
@@ -239,6 +239,7 @@
                  break;
               default:
                  printf("Warning! unknown segtype == 0x%2X  \n",segtype);
+		 x=0;
               }
 
               type=p[0]; p++;        // 0x01: grouping  0x08: single

Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.179
retrieving revision 1.180
diff -u -r1.179 -r1.180
--- mplayer.c	10 Jul 2001 13:24:59 -0000	1.179
+++ mplayer.c	16 Jul 2001 12:53:48 -0000	1.180
@@ -30,12 +30,6 @@
 #define DEFAULT_CDROM_DEVICE    "/dev/cdrom"
 #endif
 
-#ifndef MAX_OUTBURST
-#error "============================================="
-#error "Please re-run ./configure and then try again!"
-#error "============================================="
-#endif
-
 #include "cfgparser.h"
 #include "cfg-mplayer-def.h"
 
@@ -46,9 +40,6 @@
 
 #include "libao2/audio_out.h"
 
-// CODECS:
-#include "mp3lib/mp3.h"
-#include "libac3/ac3.h"
 #include "libmpeg2/mpeg2.h"
 #include "libmpeg2/mpeg2_internal.h"
 
@@ -60,17 +51,8 @@
 #include "dvdauth.h"
 #include "spudec.h"
 
-#ifdef USE_DIRECTSHOW
-//#include "DirectShow/DS_VideoDec.h"
-//#include "DirectShow/DS_AudioDec.h"
-#endif
-
-//#include "opendivx/decore.h"
-
 extern char* win32_codec_name;  // must be set before calling DrvOpen() !!!
 
-// extern int errno;
-
 #include "linux/getch2.h"
 #include "linux/keycodes.h"
 #include "linux/timer.h"
@@ -153,7 +135,6 @@
 //**************************************************************************//
 
 static int max_framesize=0;
-//static int show_packets=0;
 
 #include "stream.h"
 #include "demuxer.h"
@@ -162,8 +143,6 @@
 
 static int avi_bitrate=0;
 
-//#include "aviprint.c"
-
 sh_audio_t* new_sh_audio(demuxer_t *demuxer,int id){
     if(demuxer->a_streams[id]){
         printf("Warning! Audio stream header %d redefined!\n",id);
@@ -261,6 +240,7 @@
 
 // IMHO this stuff is no longer of use, or is there a special
 // reason why dshow should be completely disabled? - atmos ::
+// yes, people without working c++ compiler can disable it - A'rpi
 #ifdef USE_DIRECTSHOW
 int allow_dshow=1;
 #else
@@ -395,13 +375,19 @@
 }
 
 extern int vcd_get_track_end(int fd,int track);
-extern int init_audio(sh_audio_t *sh_audio);
 extern int init_video_codec(sh_video_t *sh_video);
-extern void mpeg2_allocate_image_buffers(picture_t * picture);
+//extern void mpeg2_allocate_image_buffers(picture_t * picture);
 extern void write_avi_header_1(FILE *f,int fcc,float fps,int width,int height);
-extern int vo_init(void);
+
+// dec_audio.c:
+extern int init_audio(sh_audio_t *sh_audio);
 extern int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int maxlen);
+extern void resync_audio_stream(sh_audio_t *sh_audio);
+extern void skip_audio_frame(sh_audio_t *sh_audio);
 
+// dec_video.c:
+extern int init_video(sh_video_t *sh_video);
+extern int decode_video(vo_functions_t *video_out,sh_video_t *sh_video,unsigned char *start,int in_size,int drop_frame);
 
 #include "mixer.h"
 #include "cfg-mplayer.h"
@@ -1517,7 +1503,6 @@
 
   if(file_format==DEMUXER_TYPE_MPEG_ES || file_format==DEMUXER_TYPE_MPEG_PS){
         int in_frame=0;
-        int t=0;
         float newfps;
         videobuf_len=0;
         while(videobuf_len<VIDEOBUFFER_SIZE-MAX_VIDEO_PACKET_SIZE){
@@ -2106,24 +2091,7 @@
         }
         
         current_module="resync_audio";
-
-        switch(sh_audio->codec->driver){
-        case 1:
-          MP3_DecodeFrame(NULL,-2); // resync
-          MP3_DecodeFrame(NULL,-2); // resync
-          MP3_DecodeFrame(NULL,-2); // resync
-          break;
-        case 3:
-          ac3_bitstream_reset();    // reset AC3 bitstream buffer
-    //      if(verbose){ printf("Resyncing AC3 audio...");fflush(stdout);}
-          sh_audio->ac3_frame=ac3_decode_frame(); // resync
-    //      if(verbose) printf(" OK!\n");
-          break;
-        case 4:
-        case 7:
-          sh_audio->a_in_buffer_len=0;        // reset ACM/DShow audio buffer
-          break;
-        }
+	resync_audio_stream(sh_audio);
 
         // re-sync PTS (MPEG-PS only!!!)
         if(file_format==DEMUXER_TYPE_MPEG_PS)
@@ -2132,11 +2100,7 @@
           
           } else {
             while(d_video->pts > d_audio->pts){
-              switch(sh_audio->codec->driver){
-                case 1: MP3_DecodeFrame(NULL,-2);break; // skip MPEG frame
-                case 3: sh_audio->ac3_frame=ac3_decode_frame();break; // skip AC3 frame
-                default: ds_fill_buffer(d_audio);  // skip PCM frame
-              }
+	      skip_audio_frame(sh_audio);
             }
           }
         }




More information about the MPlayer-cvslog mailing list