[Mplayer-cvslog] CVS: main/libmpdemux demuxer.c,1.136,1.137

Alban Bedel CVS albeu at mplayerhq.hu
Thu Mar 27 21:38:20 CET 2003


Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var/tmp.root/cvs-serv4486/libmpdemux

Modified Files:
	demuxer.c 
Log Message:
Fix rawvideo and -audiofile
Use the new config header
Add a cache for the stream used by -audiofile


Index: demuxer.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demuxer.c,v
retrieving revision 1.136
retrieving revision 1.137
diff -u -r1.136 -r1.137
--- demuxer.c	16 Mar 2003 20:13:27 -0000	1.136
+++ demuxer.c	27 Mar 2003 20:38:14 -0000	1.137
@@ -11,7 +11,7 @@
 #include "config.h"
 #include "mp_msg.h"
 #include "help_mp.h"
-#include "../cfgparser.h"
+#include "../m_config.h"
 
 #include "stream.h"
 #include "demuxer.h"
@@ -598,9 +598,9 @@
   demuxer = new_demuxer(stream,DEMUXER_TYPE_RAWAUDIO,audio_id,video_id,dvdsub_id);
   file_format = DEMUXER_TYPE_RAWAUDIO;
 }
-if(use_rawvideo) {
+if(file_format == DEMUXER_TYPE_RAWVIDEO) {
   demuxer = new_demuxer(stream,DEMUXER_TYPE_RAWVIDEO,audio_id,video_id,dvdsub_id);
-  file_format = DEMUXER_TYPE_RAWVIDEO;
+  //file_format = DEMUXER_TYPE_RAWVIDEO;
 }
 
 #ifdef USE_TV
@@ -1156,6 +1156,7 @@
 char* audio_stream = NULL;
 char* sub_stream = NULL;
 int demuxer_type = 0, audio_demuxer_type = 0, sub_demuxer_type = 0;
+int audio_stream_cache = 0;
 
 extern int hr_mp3_seek;
 
@@ -1170,6 +1171,14 @@
       mp_msg(MSGT_DEMUXER,MSGL_ERR,MSGTR_CannotOpenAudioStream,audio_stream);
       return NULL;
     }
+    if(audio_stream_cache) {
+      if(!stream_enable_cache(as,audio_stream_cache*1024,audio_stream_cache*1024/5,
+			      audio_stream_cache*1024/20)) {
+	free_stream(as);
+	mp_msg(MSGT_DEMUXER,MSGL_ERR,"Can't enable audio stream cache\n");
+	return NULL;
+      }
+    }
   }
   if(sub_stream) {
     ss = open_stream(sub_stream,0,&sfmt);
@@ -1180,19 +1189,26 @@
   }
 
   vd = demux_open_stream(vs,demuxer_type ? demuxer_type : file_format,audio_stream ? -2 : audio_id,video_id, sub_stream ? -2 : dvdsub_id, filename);
-  if(!vd)
+  if(!vd) {
+    if(as) free_stream(as);
+    if(ss) free_stream(ss);
     return NULL;
+  }
   if(as) {
     ad = demux_open_stream(as,audio_demuxer_type ? audio_demuxer_type : afmt,audio_id,-2,-2, audio_stream);
-    if(!ad)
+    if(!ad) {
       mp_msg(MSGT_DEMUXER,MSGL_WARN,MSGTR_OpeningAudioDemuxerFailed,audio_stream);
+      free_stream(as);
+    }
     else if(ad->audio->sh && ((sh_audio_t*)ad->audio->sh)->format == 0x55) // MP3
       hr_mp3_seek=1; // Enable high res seeking
   }
   if(ss) {
     sd = demux_open_stream(ss,sub_demuxer_type ? sub_demuxer_type : sfmt,-2,-2,dvdsub_id, sub_stream);
-    if(!sd)
+    if(!sd) {
       mp_msg(MSGT_DEMUXER,MSGL_WARN,MSGTR_OpeningSubtitlesDemuxerFailed,sub_stream);
+      free_stream(ss);
+    }
   }
 
   if(ad && sd)



More information about the MPlayer-cvslog mailing list