[MPlayer-cvslog] r26722 - trunk/libmpdemux/muxer_lavf.c

michael subversion at mplayerhq.hu
Sat May 10 19:19:18 CEST 2008


Author: michael
Date: Sat May 10 19:19:18 2008
New Revision: 26722

Log:
Replace a really ugly hack by a clean but not thread safe solution.
(no threads so no problem anyway ...)
This fixes the segfault with lavf muxing.


Modified:
   trunk/libmpdemux/muxer_lavf.c

Modified: trunk/libmpdemux/muxer_lavf.c
==============================================================================
--- trunk/libmpdemux/muxer_lavf.c	(original)
+++ trunk/libmpdemux/muxer_lavf.c	Sat May 10 19:19:18 2008
@@ -61,8 +61,14 @@ m_option_t lavfopts_conf[] = {
 	{NULL, NULL, 0, 0, 0, 0, NULL}
 };
 
+static muxer_t *priv_data; // This should be transmitted to mp_open() through the filename
+                           // when thread saftey is needed but mplayer == no threads and
+                           // especially not multiple muxers being inited at once so theres
+                           // no point in the extra complexity, a static is simpler.
+
 static int mp_open(URLContext *h, const char *filename, int flags)
 {
+        h->priv_data= priv_data;
 	return 0;
 }
 
@@ -388,14 +394,13 @@ int muxer_init_muxer_lavf(muxer_t *muxer
             av_strlcpy(priv->oc->comment  , info_comment,   sizeof(priv->oc->comment  ));
 	register_protocol(&mp_protocol);
 
+        priv_data= muxer;
 	if(url_fopen(&priv->oc->pb, mp_filename, URL_WRONLY))
 	{
 		mp_msg(MSGT_MUXER, MSGL_FATAL, "Could not open outfile\n");
 		goto fail;
         }
 	
-	((URLContext*)(priv->oc->pb->opaque))->priv_data= muxer;
-	
 	muxer->priv = (void *) priv;
 	muxer->cont_new_stream = &lavf_new_stream;
 	muxer->cont_write_chunk = &write_chunk;



More information about the MPlayer-cvslog mailing list