[MPlayer-dev-eng] [PATCH] vfw fixes

Gianluigi Tiesi mplayer at netfarm.it
Sun Sep 16 05:04:11 CEST 2007


xx_vfw_icclose.diff adds the proper close routine on the vfw driver
xx_vfw_coinit.diff windows only, calls coinitialize() and
couninitialize() that may be needed for some dlls
coinit is need for most dialogs of vfw codecs

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/libmpcodecs/ve_vfw.c sherpya/libmpcodecs/ve_vfw.c
--- main/libmpcodecs/ve_vfw.c	2007-03-27 04:51:40.729912000 +0200
+++ sherpya/libmpcodecs/ve_vfw.c	2007-05-29 01:43:17.083491200 +0200
@@ -295,6 +295,30 @@
     return 1;
 }
 
+static void uninit(struct vf_instance_s* vf)
+{
+    HRESULT ret;
+
+    if(encoder_hic){
+	if(encoder_buf){
+	    ret=ICCompressEnd(encoder_hic);
+	    if(ret){
+		mp_msg(MSGT_WIN32, MSGL_WARN, "ICCompressEnd failed: %ld\n", ret);
+		/* return; */
+	    }
+	    free(encoder_buf);
+	    encoder_buf=NULL;
+	}
+	
+	ret=ICClose(encoder_hic);
+	if(ret){
+	    mp_msg(MSGT_WIN32, MSGL_WARN, "ICClose failed: %ld\n", ret);
+	    return;
+	}
+	encoder_hic=0;
+    }
+}
+
 //===========================================================================//
 
 static int vf_open(vf_instance_t *vf, char* args){
@@ -303,6 +327,7 @@
     vf->control=control;
     vf->query_format=query_format;
     vf->put_image=put_image;
+    vf->uninit=uninit;
     vf->priv=malloc(sizeof(struct vf_priv_s));
     memset(vf->priv,0,sizeof(struct vf_priv_s));
     vf->priv->mux=(muxer_stream_t*)args;
-------------- 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-09-13 20:43:39.046875000 +0200
+++ sherpya/mencoder.c	2007-09-13 22:43:24.937500000 +0200
@@ -149,6 +149,7 @@
 
 #ifdef WIN32
 char * proc_priority=NULL;
+static long coinit = 0;
 #endif
 
 // A-V sync:
@@ -313,6 +314,9 @@
     else
 	mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_Exiting);
 
+#ifdef WIN32
+    if (coinit) CoUninitialize();
+#endif
     exit(level);
 }
 
@@ -849,6 +853,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