diff libmpdemux/demux_avi.c @ 7501:20910550332f

fixed invalid -aid/-vid segfault
author arpi
date Wed, 25 Sep 2002 22:19:11 +0000
parents c4434bdf6e51
children ffe8bfaa2851
line wrap: on
line diff
--- a/libmpdemux/demux_avi.c	Wed Sep 25 21:41:42 2002 +0000
+++ b/libmpdemux/demux_avi.c	Wed Sep 25 22:19:11 2002 +0000
@@ -445,6 +445,16 @@
 
   //---- AVI header:
   read_avi_header(demuxer,(demuxer->stream->type!=STREAMTYPE_STREAM)?index_mode:-2);
+  
+  if(demuxer->audio->id>=0 && !demuxer->a_streams[demuxer->audio->id]){
+      mp_msg(MSGT_DEMUX,MSGL_WARN,"AVI: invalid audio stream ID: %d - ignoring (nosound)\n",demuxer->audio->id);
+      demuxer->audio->id=-2; // disabled
+  }
+  if(demuxer->video->id>=0 && !demuxer->v_streams[demuxer->video->id]){
+      mp_msg(MSGT_DEMUX,MSGL_WARN,"AVI: invalid video stream ID: %d - ignoring (using default)\n",demuxer->video->id);
+      demuxer->video->id=-1; // autodetect
+  }
+  
   stream_reset(demuxer->stream);
   stream_seek(demuxer->stream,demuxer->movi_start);
   priv->idx_pos=0;
@@ -518,7 +528,6 @@
   if(!ds_fill_buffer(d_video)){
     mp_msg(MSGT_DEMUX,MSGL_ERR,"AVI: " MSGTR_MissingVideoStreamBug);
     return NULL;
-//    GUI_MSG( mplAVIErrorMissingVideoStream )
   }
   sh_video=d_video->sh;sh_video->ds=d_video;
   if(d_audio->id!=-2){