diff options
author | 2002-01-26 01:21:41 +0000 | |
---|---|---|
committer | 2002-01-26 01:21:41 +0000 | |
commit | efb1d8e46188048fbb86fc3589d54068cb972b56 (patch) | |
tree | 81482c56dff8f410ce08e8a60d113302da0dd52c /libmpdemux | |
parent | 99be1c8952cfa3aa1ca0fc92507780d8477bc553 (diff) |
pre-check for audio/video streams (hope it fix wma steraming)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4350 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux')
-rw-r--r-- | libmpdemux/asfheader.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libmpdemux/asfheader.c b/libmpdemux/asfheader.c index 0dfce1ed1c..233ed3d462 100644 --- a/libmpdemux/asfheader.c +++ b/libmpdemux/asfheader.c @@ -129,6 +129,8 @@ extern void print_video_header(BITMAPINFOHEADER *h); 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 @@ while(!stream_eof(demuxer->stream)){ 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 @@ while(!stream_eof(demuxer->stream)){ 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); @@ -307,6 +311,16 @@ while(!stream_eof(demuxer->stream)){ 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){ printf("ASF duration: %d\n",(int)fileh.duration); |