[MPlayer-cvslog] r36836 - trunk/libmpdemux/demux_mpg.c

reimar subversion at mplayerhq.hu
Fri Feb 14 23:29:36 CET 2014


Author: reimar
Date: Fri Feb 14 23:29:36 2014
New Revision: 36836

Log:
Make sure that demuxer priv is allocated early enough.

Fixes not being able to switch audio streams any more.

Modified:
   trunk/libmpdemux/demux_mpg.c

Modified: trunk/libmpdemux/demux_mpg.c
==============================================================================
--- trunk/libmpdemux/demux_mpg.c	Fri Feb 14 23:29:35 2014	(r36835)
+++ trunk/libmpdemux/demux_mpg.c	Fri Feb 14 23:29:36 2014	(r36836)
@@ -189,14 +189,13 @@ static float read_first_mpeg_pts_at_posi
 /// Open an mpg physical stream
 static demuxer_t* demux_mpg_open(demuxer_t* demuxer) {
   stream_t *s = demuxer->stream;
-  mpg_demuxer_t* mpg_d;
+  mpg_demuxer_t* mpg_d = calloc(1,sizeof(*mpg_d));
+  if (!mpg_d)
+    return NULL;
+  demuxer->priv = mpg_d;
 
   while (demuxer->video->packs + demuxer->audio->packs < 2)
     if (!ds_fill_buffer(demuxer->video)) return 0;
-  mpg_d = calloc(1,sizeof(mpg_demuxer_t));
-  if(mpg_d)
-  {
-    demuxer->priv = mpg_d;
     mpg_d->last_pts = -1.0;
     mpg_d->first_pts = -1.0;
 
@@ -245,7 +244,6 @@ static demuxer_t* demux_mpg_open(demuxer
       stream_seek(s,pos);
       ds_fill_buffer(demuxer->video);
     } // if ( demuxer->seekable )
-  } // if ( mpg_d )
   return demuxer;
 }
 


More information about the MPlayer-cvslog mailing list