[MPlayer-dev-eng] [PATCH] vfw fixes [REMINDER]
Gianluigi Tiesi
mplayer at netfarm.it
Sun Sep 23 17:33:53 CEST 2007
I've made two different patches, the first fixes coinit stuff in
ve_vfw.c the second adds dummy functions in win32 loader
mainly standalone but ve_vfw.c needs to include objbase.
that is in win32 loader patch
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 -xvidix -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-09-13 20:41:05.750000000 +0200
+++ sherpya/libmpcodecs/ve_vfw.c 2007-09-23 17:13:02.468750000 +0200
@@ -19,6 +19,8 @@
//#include "loader/wine/mmreg.h"
#include "loader/wine/vfw.h"
#include "loader/wine/avifmt.h"
+#include "loader/wine/winerror.h"
+#include "loader/wine/objbase.h"
#include "img_format.h"
#include "mp_image.h"
@@ -31,6 +33,7 @@
static char *vfw_param_codec = NULL;
static char *vfw_param_compdata = NULL;
+static HRESULT CoInitRes = S_OK;
#include "m_option.h"
@@ -63,7 +66,7 @@
//sh_video = malloc(sizeof(sh_video_t));
mp_msg(MSGT_WIN32,MSGL_V,"======= Win32 (VFW) VIDEO Encoder init =======\n");
-
+ CoInitRes = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
// memset(&sh_video->o_bih, 0, sizeof(BITMAPINFOHEADER));
// output_bih->biSize = sizeof(BITMAPINFOHEADER);
@@ -295,6 +298,24 @@
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);
+ free(encoder_buf);
+ encoder_buf=NULL;
+ }
+ ret=ICClose(encoder_hic);
+ if(ret) mp_msg(MSGT_WIN32, MSGL_WARN, "ICClose failed: %ld\n", ret);
+ encoder_hic=0;
+ if ((CoInitRes == S_OK) || (CoInitRes == S_FALSE)) CoUninitialize();
+ }
+}
+
//===========================================================================//
static int vf_open(vf_instance_t *vf, char* args){
@@ -303,6 +324,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 -xvidix -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/loader/win32.c sherpya/loader/win32.c
--- main/loader/win32.c 2007-09-13 20:43:22.671875000 +0200
+++ sherpya/loader/win32.c 2007-09-23 17:08:28.500000000 +0200
@@ -38,6 +38,7 @@
#include "wine/debugtools.h"
#include "wine/module.h"
#include "wine/winuser.h"
+#include "wine/objbase.h"
#include <stdio.h>
#include "win32.h"
@@ -3816,6 +3817,12 @@
return 1;
}
+static HRESULT WINAPI expCoInitializeEx(LPVOID lpReserved, DWORD dwCoInit)
+{
+ dbgprintf("CoInitializeEx(%p, %d) called\n", lpReserved, dwCoInit);
+ return S_OK;
+}
+
// required by PIM1 codec (used by win98 PCTV Studio capture sw)
static HRESULT WINAPI expCoInitialize(
LPVOID lpReserved /* [in] pointer to win32 malloc interface
@@ -3825,7 +3832,26 @@
/*
* Just delegate to the newer method.
*/
- return 0; //CoInitializeEx(lpReserved, COINIT_APARTMENTTHREADED);
+ return expCoInitializeEx(lpReserved, COINIT_APARTMENTTHREADED);
+}
+
+static void WINAPI expCoUninitialize(void)
+{
+ dbgprintf("CoUninitialize() called\n");
+}
+
+/* allow static linking */
+HRESULT WINAPI CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit)
+{
+ return expCoInitializeEx(lpReserved, dwCoInit);
+}
+HRESULT WINAPI CoInitialize(LPVOID lpReserved)
+{
+ return expCoInitialize(lpReserved);
+}
+void WINAPI CoUninitialize(void)
+{
+ return expCoUninitialize();
}
static DWORD WINAPI expSetThreadAffinityMask
@@ -5132,6 +5158,8 @@
FF(CoCreateFreeThreadedMarshaler,-1)
FF(CoCreateInstance, -1)
FF(CoInitialize, -1)
+ FF(CoInitializeEx, -1)
+ FF(CoUninitialize, -1)
FF(CoTaskMemAlloc, -1)
FF(CoTaskMemFree, -1)
FF(StringFromGUID2, -1)
diff -NuBr -x.svn -xvidix -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/loader/wine/objbase.h sherpya/loader/wine/objbase.h
--- main/loader/wine/objbase.h 1970-01-01 01:00:00.000000000 +0100
+++ sherpya/loader/wine/objbase.h 2007-09-23 16:03:05.500000000 +0200
@@ -0,0 +1,19 @@
+#ifndef WINE_OBJBASE_H
+#define WINE_OBJBASE_H
+
+#ifndef STDCALL
+#define STDCALL __attribute__((__stdcall__))
+#endif
+
+/* from objbase.h needed for ve_vfw.c */
+typedef enum tagCOINIT {
+ COINIT_APARTMENTTHREADED = 0x2,
+ COINIT_MULTITHREADED = 0x0,
+ COINIT_DISABLE_OLE1DDE = 0x4,
+ COINIT_SPEED_OVER_MEMORY = 0x8
+} COINIT;
+
+HRESULT STDCALL CoInitialize(LPVOID pvReserved);
+HRESULT STDCALL CoInitializeEx(LPVOID pvReserved, DWORD dwCoinit);
+void STDCALL CoUninitialize(void);
+#endif
More information about the MPlayer-dev-eng
mailing list