[MPlayer-dev-eng] [PATCH] hack: make lavf muxing not segfault
- Date: Fri, 09 May 2008 16:03:37 -0700
- From: Corey Hickey <bugfood-ml@xxxxxxxxxx>
- Subject: [MPlayer-dev-eng] [PATCH] hack: make lavf muxing not segfault
Hello,
ffmpeg r13061 broke muxing via lavf, and Michael has professed
reluctance to working on MPlayer at the moment. He suggested a solution
to me on ffmpeg-cvslog, but his wording was terse and I'm not familiar
enough with the code to understand what he meant. See the r13061 thread
on ffmpeg-cvslog.
Anyway, this patch hacks around the problem. Read the comment in the
patch to see what's going on.
I'm hoping this will be rejected, but if it isn't I'll commit the patch
in three days.
-Corey
Index: libmpdemux/muxer_lavf.c
===================================================================
--- libmpdemux/muxer_lavf.c (revision 26672)
+++ libmpdemux/muxer_lavf.c (working copy)
@@ -87,6 +87,21 @@
static offset_t mp_seek(URLContext *h, offset_t pos, int whence)
{
muxer_t *muxer = (muxer_t*)h->priv_data;
+
+ /* Hack:
+ * As of ffmpeg r13061, lavf tests seeking to determine if the output
+ * is streamed. This leads to mp_seek() getting called before
+ * h->priv_data is set. There's a circular dependency.
+ * 1. avio.c:url_fopen() calls muxer_lavf.c:mp_seek()
+ * 2. mp_seek() needs h->priv_data to be set
+ * 3. ...but h doesn't exist before url_fopen() is called, so
+ * h->priv_data cannot be set until afterward
+ * Returning 0 here nullifies lavf's streaming test, but at least it
+ * avoids segfaulting.
+ */
+ if (! muxer)
+ return 0;
+
if(whence == SEEK_CUR)
{
off_t cur = stream_tell(muxer->stream);
_______________________________________________
MPlayer-dev-eng mailing list
MPlayer-dev-eng@xxxxxxxxxxxx
https://lists.mplayerhq.hu/mailman/listinfo/mplayer-dev-eng