changeset 26875:c276296cb6f8

Simplify/make new_sh behaviour more consistent when a stream gets redefined.
author reimar
date Tue, 27 May 2008 17:33:13 +0000
parents c73c138aad88
children d99d0f7c0e80
files libmpdemux/demuxer.c
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demuxer.c	Tue May 27 17:30:20 2008 +0000
+++ b/libmpdemux/demuxer.c	Tue May 27 17:33:13 2008 +0000
@@ -268,6 +268,7 @@
         sh_audio_t *sh = calloc(1, sizeof(sh_audio_t));
         mp_msg(MSGT_DEMUXER,MSGL_V,MSGTR_FoundAudioStream,id);
         demuxer->a_streams[id] = sh;
+        sh->aid = aid;
         // set some defaults
         sh->samplesize=2;
         sh->sample_format=AF_FORMAT_S16_NE;
@@ -275,7 +276,6 @@
         sh->pts=MP_NOPTS_VALUE;
           mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_AUDIO_ID=%d\n", aid);
     }
-    ((sh_audio_t *)demuxer->a_streams[id])->aid = aid;
     return demuxer->a_streams[id];
 }
 
@@ -299,11 +299,12 @@
     if(demuxer->v_streams[id]){
         mp_msg(MSGT_DEMUXER,MSGL_WARN,MSGTR_VideoStreamRedefined,id);
     } else {
+        sh_video_t *sh = calloc(1, sizeof(sh_video_t));
         mp_msg(MSGT_DEMUXER,MSGL_V,MSGTR_FoundVideoStream,id);
-        demuxer->v_streams[id]=calloc(1, sizeof(sh_video_t));
+        demuxer->v_streams[id] = sh;
+        sh->vid = vid;
           mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VIDEO_ID=%d\n", vid);
     }
-    ((sh_video_t *)demuxer->v_streams[id])->vid = vid;
     return demuxer->v_streams[id];
 }