[Mplayer-cvslog] CVS: main/libmpdemux asfheader.c,1.27,1.28

Arpi of Ize arpi at mplayer.dev.hu
Sat Jan 26 02:21:44 CET 2002


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

Modified Files:
	asfheader.c 
Log Message:
pre-check for audio/video streams (hope it fix wma steraming)

Index: asfheader.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/asfheader.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- asfheader.c	24 Jan 2002 05:30:41 -0000	1.27
+++ asfheader.c	26 Jan 2002 01:21:41 -0000	1.28
@@ -129,6 +129,8 @@
 
 int read_asf_header(demuxer_t *demuxer){
   static unsigned char buffer[1024];
+  int audio_streams=0;
+  int video_streams=0;
   
 #if 1
   //printf("ASF file! (subchunks: %d)\n",asfh.cno);
@@ -162,6 +164,7 @@
       switch(ASF_LOAD_GUID_PREFIX(streamh.type)){
       case ASF_GUID_PREFIX_audio_stream: {
         sh_audio_t* sh_audio=new_sh_audio(demuxer,streamh.stream_no & 0x7F);
+	++audio_streams;
         sh_audio->wf=calloc((streamh.type_size<sizeof(WAVEFORMATEX))?sizeof(WAVEFORMATEX):streamh.type_size,1);
         memcpy(sh_audio->wf,buffer,streamh.type_size);
 	le2me_WAVEFORMATEX(sh_audio->wf);
@@ -182,6 +185,7 @@
       case ASF_GUID_PREFIX_video_stream: {
         sh_video_t* sh_video=new_sh_video(demuxer,streamh.stream_no & 0x7F);
         int len=streamh.type_size-(4+4+1+2);
+	++video_streams;
 //        sh_video->bih=malloc(chunksize); memset(sh_video->bih,0,chunksize);
         sh_video->bih=calloc((len<sizeof(BITMAPINFOHEADER))?sizeof(BITMAPINFOHEADER):len,1);
         memcpy(sh_video->bih,&buffer[4+4+1+2],len);
@@ -306,6 +310,16 @@
 
   if(!stream_seek(demuxer->stream,endpos)) break;
 } // while EOF
+
+mp_msg(MSGT_HEADER,MSGL_V,"ASF: %d audio and %d video streams found\n",audio_streams,video_streams);
+if(!audio_streams) demuxer->audio->id=-2;  // nosound
+if(!video_streams){
+    if(!audio_streams){
+	mp_msg(MSGT_HEADER,MSGL_ERR,"ASF: no audio or video headers found - broken file?\n");
+	return 0; 
+    }
+    demuxer->video->id=-2; // audio-only
+}
 
 #if 0
 if(verbose){




More information about the MPlayer-cvslog mailing list