changeset 12198:759b010d6c09

Do not crash on audio only streams
author rtognimp
date Tue, 13 Apr 2004 19:56:48 +0000
parents 3880aab280d9
children 4ec05f0d33da
files libmpdemux/demux_nsv.c
diffstat 1 files changed, 15 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_nsv.c	Tue Apr 13 19:56:37 2004 +0000
+++ b/libmpdemux/demux_nsv.c	Tue Apr 13 19:56:48 2004 +0000
@@ -143,20 +143,7 @@
     nsv_priv_t * priv = malloc(sizeof(nsv_priv_t));
     demuxer->priv=priv;
     priv->video_pack_no=0;
-    /* Create a new video stream header */
-    sh_video = new_sh_video ( demuxer, 0 );
 
-    /* Make sure the demuxer knows about the new video stream header
-     * (even though new_sh_video() ought to take care of it)
-     */
-    demuxer->video->sh = sh_video;
-
-    /* Make sure that the video demuxer stream header knows about its
-     * parent video demuxer stream (this is getting wacky), or else
-     * video_read_properties() will choke
-         */
-    sh_video->ds = demuxer->video;
-        
       /* disable seeking yet to be fixed*/
     demuxer->seekable = 0;
         
@@ -240,6 +227,20 @@
         priv->fps=hdr[16];
             
         if (strncmp(hdr+4,"NONE", 4)) {
+            /* Create a new video stream header */
+            sh_video = new_sh_video ( demuxer, 0 );
+
+            /* Make sure the demuxer knows about the new video stream header
+             * (even though new_sh_video() ought to take care of it)
+             */
+            demuxer->video->sh = sh_video;
+
+            /* Make sure that the video demuxer stream header knows about its
+             * parent video demuxer stream (this is getting wacky), or else
+             * video_read_properties() will choke
+             */
+            sh_video->ds = demuxer->video;
+        
             //   bytes 4-7  video codec fourcc
             priv->v_format = sh_video->format=mmioFOURCC(hdr[4],hdr[5],hdr[6],hdr[7]);
         
@@ -285,7 +286,6 @@
 
                 stream_seek(demuxer->stream,stream_tell(demuxer->stream)-9);
             } 
-        }
 
             
         switch(priv->fps){
@@ -308,6 +308,7 @@
             sh_video->fps = (float)priv->fps;
         }       
         sh_video->frametime = (float)1.0 / (float)sh_video->fps;
+       }
     }