[MPlayer-cvslog] r33324 - in trunk/libmpdemux: demux_demuxers.c demuxer.c demuxer.h

reimar subversion at mplayerhq.hu
Mon Apr 25 01:06:39 CEST 2011


Author: reimar
Date: Mon Apr 25 01:06:38 2011
New Revision: 33324

Log:
Add a alloc_demuxer function that ensures all the critical stuff is
initialized and use it also in demux_demuxers.c.
This fixes the OSD counter being stuck at 0.

Modified:
   trunk/libmpdemux/demux_demuxers.c
   trunk/libmpdemux/demuxer.c
   trunk/libmpdemux/demuxer.h

Modified: trunk/libmpdemux/demux_demuxers.c
==============================================================================
--- trunk/libmpdemux/demux_demuxers.c	Sun Apr 24 23:32:36 2011	(r33323)
+++ trunk/libmpdemux/demux_demuxers.c	Mon Apr 25 01:06:38 2011	(r33324)
@@ -35,11 +35,10 @@ typedef struct dd_priv {
 extern const demuxer_desc_t demuxer_desc_demuxers;
 
 demuxer_t*  new_demuxers_demuxer(demuxer_t* vd, demuxer_t* ad, demuxer_t* sd) {
-  demuxer_t* ret;
+  // Video is the most important :-)
+  demuxer_t* ret = alloc_demuxer(vd->stream, DEMUXER_TYPE_DEMUXERS, vd->filename);
   dd_priv_t* priv;
 
-  ret = calloc(1,sizeof(demuxer_t));
-
   priv = malloc(sizeof(dd_priv_t));
   priv->vd = vd;
   priv->ad = ad;
@@ -47,8 +46,6 @@ demuxer_t*  new_demuxers_demuxer(demuxer
   ret->priv = priv;
 
   ret->type = ret->file_format = DEMUXER_TYPE_DEMUXERS;
-  // Video is the most important :-)
-  ret->stream = vd->stream;
   ret->seekable = vd->seekable && ad->seekable && sd->seekable;
 
   ret->video = vd->video;

Modified: trunk/libmpdemux/demuxer.c
==============================================================================
--- trunk/libmpdemux/demuxer.c	Sun Apr 24 23:32:36 2011	(r33323)
+++ trunk/libmpdemux/demuxer.c	Mon Apr 25 01:06:38 2011	(r33324)
@@ -225,9 +225,7 @@ static const demuxer_desc_t *get_demuxer
     return NULL;
 }
 
-
-demuxer_t *new_demuxer(stream_t *stream, int type, int a_id, int v_id,
-                       int s_id, char *filename)
+demuxer_t *alloc_demuxer(stream_t *stream, int type, const char *filename)
 {
     demuxer_t *d = calloc(1, sizeof(*d));
     d->stream = stream;
@@ -238,9 +236,6 @@ demuxer_t *new_demuxer(stream_t *stream,
     d->seekable = 1;
     d->synced = 0;
     d->filepos = -1;
-    d->audio = new_demuxer_stream(d, a_id);
-    d->video = new_demuxer_stream(d, v_id);
-    d->sub = new_demuxer_stream(d, s_id);
     d->type = type;
     if (type)
         if (!(d->desc = get_demuxer_desc_from_type(type)))
@@ -249,6 +244,16 @@ demuxer_t *new_demuxer(stream_t *stream,
                    "big troubles ahead.");
     if (filename) // Filename hack for avs_check_file
         d->filename = strdup(filename);
+    return d;
+}
+
+demuxer_t *new_demuxer(stream_t *stream, int type, int a_id, int v_id,
+                       int s_id, char *filename)
+{
+    demuxer_t *d = alloc_demuxer(stream, type, filename);
+    d->audio = new_demuxer_stream(d, a_id);
+    d->video = new_demuxer_stream(d, v_id);
+    d->sub = new_demuxer_stream(d, s_id);
     stream->eof = 0;
     stream_seek(stream, stream->start_pos);
     return d;

Modified: trunk/libmpdemux/demuxer.h
==============================================================================
--- trunk/libmpdemux/demuxer.h	Sun Apr 24 23:32:36 2011	(r33323)
+++ trunk/libmpdemux/demuxer.h	Mon Apr 25 01:06:38 2011	(r33324)
@@ -358,6 +358,7 @@ static inline void *realloc_struct(void 
 }
 
 demux_stream_t* new_demuxer_stream(struct demuxer *demuxer,int id);
+demuxer_t *alloc_demuxer(stream_t *stream, int type, const char *filename);
 demuxer_t* new_demuxer(stream_t *stream,int type,int a_id,int v_id,int s_id,char *filename);
 void free_demuxer_stream(demux_stream_t *ds);
 void free_demuxer(demuxer_t *demuxer);


More information about the MPlayer-cvslog mailing list