[MPlayer-dev-eng] [PATCH] vp7vfw encoding with compdata

Gianluigi Tiesi mplayer at netfarm.it
Sat Mar 31 05:18:00 CEST 2007


vp7vfw needs a call to CoUninitialize()
to work when compdata is passed.
Attached a patch that calls coinit/uninit
I've restricted it to win32 since I think it will break something
on unix.
And yes it's not the better place to call it but calling it from
ve_vfw.c crashes and messes up a lot of variable, I think it's
related to the fact that gcc says something about calling convention
(maybe not correctly defined in ve_vfw and correctly in mencoder.c?)

-->
Warning: resolving _CoInitialize by linking to _CoInitialize at 4
Use --enable-stdcall-fixup to disable these warnings
Use --disable-stdcall-fixup to disable these fixups

when in mencoder.c no warning is issued

This makes also compdata=dialog work

the coinit call would be better in vfw_open_encoder()
but at this point vfw encoder hasn't a close_encoder()
to be able to call CoUninitialize()

The code is tested agains vp7vfw 7,0,10,0 the latest
available for "free" personal use on on2 web site,
it seams that mplayer codec pack has 7,0,8,0 but anyway
this patch works with this version too

Regards

-- 
Gianluigi Tiesi <sherpya at netfarm.it>
EDP Project Leader
Netfarm S.r.l. - http://www.netfarm.it/
Free Software: http://oss.netfarm.it/
-------------- next part --------------
diff -NuBr -x.svn -xhelp_mp.h -xlibdha -x'*.so' -x'*.log' -x'*.a' -x'*.exe' -x'*.o' -xconfigure.log -xconfig.mak -x.cvsignore -xconfig.h -xcodecs.conf.h -xversion.h -x.depend main/mencoder.c sherpya/mencoder.c
--- main/mencoder.c	2007-02-26 02:49:42.804203200 +0100
+++ sherpya/mencoder.c	2007-03-31 05:09:08.421600000 +0200
@@ -147,6 +147,7 @@
 
 #ifdef WIN32
 char * proc_priority=NULL;
+static long coinit = 0;
 #endif
 
 // A-V sync:
@@ -306,6 +307,9 @@
     else
 	mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_Exiting);
 
+#ifdef WIN32
+    if (coinit) CoUninitialize();
+#endif
     exit(level);
 }
 
@@ -831,6 +835,9 @@
     case VCODEC_RAW:
         sh_video->vfilter=vf_open_encoder(NULL,"raw",(char *)mux_v); break;
     case VCODEC_VFW:
+#ifdef WIN32
+        coinit = CoInitialize(NULL);
+#endif
         sh_video->vfilter=vf_open_encoder(NULL,"vfw",(char *)mux_v); break;
     case VCODEC_LIBDV:
         sh_video->vfilter=vf_open_encoder(NULL,"libdv",(char *)mux_v); break;


More information about the MPlayer-dev-eng mailing list