Jacek Caban : wmvcore: Added WMCreateWriter implementation.
Alexandre Julliard
julliard at wine.codeweavers.com
Thu Mar 12 10:48:18 CDT 2015
Module: wine
Branch: master
Commit: f0aff23dddc1b0935d9350519de1cd892a297896
URL: http://source.winehq.org/git/wine.git/?a=commit;h=f0aff23dddc1b0935d9350519de1cd892a297896
Author: Jacek Caban <jacek at codeweavers.com>
Date: Wed Mar 11 15:29:51 2015 +0100
wmvcore: Added WMCreateWriter implementation.
---
dlls/wmvcore/Makefile.in | 3 +-
dlls/wmvcore/wmvcore.h | 36 ++++++++
dlls/wmvcore/wmvcore.spec | 2 +-
dlls/wmvcore/wmvcore_main.c | 18 +---
dlls/wmvcore/writer.c | 206 ++++++++++++++++++++++++++++++++++++++++++++
include/wmsdkidl.idl | 2 +
6 files changed, 248 insertions(+), 19 deletions(-)
diff --git a/dlls/wmvcore/Makefile.in b/dlls/wmvcore/Makefile.in
index 354ae83..bec1032 100644
--- a/dlls/wmvcore/Makefile.in
+++ b/dlls/wmvcore/Makefile.in
@@ -2,4 +2,5 @@ MODULE = wmvcore.dll
IMPORTS = kernel32
C_SRCS = \
- wmvcore_main.c
+ wmvcore_main.c \
+ writer.c
diff --git a/dlls/wmvcore/wmvcore.h b/dlls/wmvcore/wmvcore.h
new file mode 100644
index 0000000..f4b0963
--- /dev/null
+++ b/dlls/wmvcore/wmvcore.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2015 Jacek Caban for CodeWeavers
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <stdarg.h>
+
+#define COBJMACROS
+
+#define EXTERN_GUID DEFINE_GUID
+
+#include "windef.h"
+#include "winbase.h"
+
+static inline void *heap_alloc(size_t len)
+{
+ return HeapAlloc(GetProcessHeap(), 0, len);
+}
+
+static inline BOOL heap_free(void *mem)
+{
+ return HeapFree(GetProcessHeap(), 0, mem);
+}
diff --git a/dlls/wmvcore/wmvcore.spec b/dlls/wmvcore/wmvcore.spec
index 3799865..a3f23eb 100644
--- a/dlls/wmvcore/wmvcore.spec
+++ b/dlls/wmvcore/wmvcore.spec
@@ -12,7 +12,7 @@
@ stdcall WMCreateReader(ptr long ptr)
@ stub WMCreateReaderPriv
@ stdcall WMCreateSyncReader(ptr long ptr)
-@ stub WMCreateWriter
+@ stdcall WMCreateWriter(ptr ptr)
@ stub WMCreateWriterFileSink
@ stub WMCreateWriterNetworkSink
@ stub WMCreateWriterPriv
diff --git a/dlls/wmvcore/wmvcore_main.c b/dlls/wmvcore/wmvcore_main.c
index 3382542..4698e62 100644
--- a/dlls/wmvcore/wmvcore_main.c
+++ b/dlls/wmvcore/wmvcore_main.c
@@ -16,30 +16,14 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
-#include "config.h"
+#include "wmvcore.h"
-#include <stdarg.h>
-
-#define COBJMACROS
-
-#include "windef.h"
-#include "winbase.h"
#include "initguid.h"
#include "wmsdkidl.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(wmvcore);
-static inline void *heap_alloc(size_t len)
-{
- return HeapAlloc(GetProcessHeap(), 0, len);
-}
-
-static inline BOOL heap_free(void *mem)
-{
- return HeapFree(GetProcessHeap(), 0, mem);
-}
-
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
TRACE("(0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved);
diff --git a/dlls/wmvcore/writer.c b/dlls/wmvcore/writer.c
new file mode 100644
index 0000000..3629d4d
--- /dev/null
+++ b/dlls/wmvcore/writer.c
@@ -0,0 +1,206 @@
+/*
+ * Copyright 2015 Jacek Caban for CodeWeavers
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "wmvcore.h"
+#include "wmsdkidl.h"
+
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(wmvcore);
+
+typedef struct {
+ IWMWriter IWMWriter_iface;
+ LONG ref;
+} WMWriter;
+
+static inline WMWriter *impl_from_IWMWriter(IWMWriter *iface)
+{
+ return CONTAINING_RECORD(iface, WMWriter, IWMWriter_iface);
+}
+
+static HRESULT WINAPI WMWriter_QueryInterface(IWMWriter *iface, REFIID riid, void **ppv)
+{
+ WMWriter *This = impl_from_IWMWriter(iface);
+
+ if(IsEqualGUID(&IID_IUnknown, riid)) {
+ TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
+ *ppv = &This->IWMWriter_iface;
+ }else if(IsEqualGUID(&IID_IWMWriter, riid)) {
+ TRACE("(%p)->(IID_IWMWriter %p)\n", This, ppv);
+ *ppv = &This->IWMWriter_iface;
+ }else {
+ FIXME("Unsupported iface %s\n", debugstr_guid(riid));
+ *ppv = NULL;
+ return E_NOINTERFACE;
+ }
+
+ IUnknown_AddRef((IUnknown*)*ppv);
+ return S_OK;
+}
+
+static ULONG WINAPI WMWriter_AddRef(IWMWriter *iface)
+{
+ WMWriter *This = impl_from_IWMWriter(iface);
+ LONG ref = InterlockedIncrement(&This->ref);
+
+ TRACE("(%p) ref=%d\n", This, ref);
+
+ return ref;
+}
+
+static ULONG WINAPI WMWriter_Release(IWMWriter *iface)
+{
+ WMWriter *This = impl_from_IWMWriter(iface);
+ LONG ref = InterlockedDecrement(&This->ref);
+
+ TRACE("(%p) ref=%d\n", This, ref);
+
+ if(!ref)
+ heap_free(This);
+
+ return ref;
+}
+
+static HRESULT WINAPI WMWriter_SetProfileByID(IWMWriter *iface, REFGUID guidProfile)
+{
+ WMWriter *This = impl_from_IWMWriter(iface);
+ FIXME("(%p)->(%s)\n", This, debugstr_guid(guidProfile));
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI WMWriter_SetProfile(IWMWriter *iface, IWMProfile *profile)
+{
+ WMWriter *This = impl_from_IWMWriter(iface);
+ FIXME("(%p)->(%p)\n", This, profile);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI WMWriter_SetOutputFilename(IWMWriter *iface, const WCHAR *filename)
+{
+ WMWriter *This = impl_from_IWMWriter(iface);
+ FIXME("(%p)->(%s)\n", This, debugstr_w(filename));
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI WMWriter_GetInputCount(IWMWriter *iface, DWORD *pcInputs)
+{
+ WMWriter *This = impl_from_IWMWriter(iface);
+ FIXME("(%p)->(%p)\n", This, pcInputs);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI WMWriter_GetInputProps(IWMWriter *iface, DWORD dwInputNum, IWMInputMediaProps **input)
+{
+ WMWriter *This = impl_from_IWMWriter(iface);
+ FIXME("(%p)->(%d %p)\n", This, dwInputNum, input);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI WMWriter_SetInputProps(IWMWriter *iface, DWORD dwInputNum, IWMInputMediaProps *input)
+{
+ WMWriter *This = impl_from_IWMWriter(iface);
+ FIXME("(%p)->(%d %p)\n", This, dwInputNum, input);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI WMWriter_GetInputFormatCount(IWMWriter *iface, DWORD dwInputNumber, DWORD *pcFormat)
+{
+ WMWriter *This = impl_from_IWMWriter(iface);
+ FIXME("(%p)->(%d %p)\n", This, dwInputNumber, pcFormat);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI WMWriter_GetInputFormat(IWMWriter *iface, DWORD dwInputNumber, DWORD dwFormatNumber,
+ IWMInputMediaProps **props)
+{
+ WMWriter *This = impl_from_IWMWriter(iface);
+ FIXME("(%p)->(%d %d %p)\n", This, dwInputNumber, dwFormatNumber, props);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI WMWriter_BeginWriting(IWMWriter *iface)
+{
+ WMWriter *This = impl_from_IWMWriter(iface);
+ FIXME("(%p)\n", This);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI WMWriter_EndWriting(IWMWriter *iface)
+{
+ WMWriter *This = impl_from_IWMWriter(iface);
+ FIXME("(%p)\n", This);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI WMWriter_AllocateSample(IWMWriter *iface, DWORD size, INSSBuffer **sample)
+{
+ WMWriter *This = impl_from_IWMWriter(iface);
+ FIXME("(%p)->(%d %p)\n", This, size, sample);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI WMWriter_WriteSample(IWMWriter *iface, DWORD dwInputNum, QWORD cnsSampleTime,
+ DWORD flags, INSSBuffer *sample)
+{
+ WMWriter *This = impl_from_IWMWriter(iface);
+ FIXME("(%p)->(%d %s %x %p)\n", This, dwInputNum, wine_dbgstr_longlong(cnsSampleTime), flags, sample);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI WMWriter_Flush(IWMWriter *iface)
+{
+ WMWriter *This = impl_from_IWMWriter(iface);
+ FIXME("(%p)\n", This);
+ return E_NOTIMPL;
+}
+
+static const IWMWriterVtbl WMWriterVtbl = {
+ WMWriter_QueryInterface,
+ WMWriter_AddRef,
+ WMWriter_Release,
+ WMWriter_SetProfileByID,
+ WMWriter_SetProfile,
+ WMWriter_SetOutputFilename,
+ WMWriter_GetInputCount,
+ WMWriter_GetInputProps,
+ WMWriter_SetInputProps,
+ WMWriter_GetInputFormatCount,
+ WMWriter_GetInputFormat,
+ WMWriter_BeginWriting,
+ WMWriter_EndWriting,
+ WMWriter_AllocateSample,
+ WMWriter_WriteSample,
+ WMWriter_Flush
+};
+
+HRESULT WINAPI WMCreateWriter(IUnknown *reserved, IWMWriter **writer)
+{
+ WMWriter *ret;
+
+ TRACE("(%p %p)\n", reserved, writer);
+
+ ret = heap_alloc(sizeof(*ret));
+ if(!ret)
+ return E_OUTOFMEMORY;
+
+ ret->IWMWriter_iface.lpVtbl = &WMWriterVtbl;
+ ret->ref = 1;
+
+ *writer = &ret->IWMWriter_iface;
+ return S_OK;
+}
diff --git a/include/wmsdkidl.idl b/include/wmsdkidl.idl
index 4e2dba7..da228e7 100644
--- a/include/wmsdkidl.idl
+++ b/include/wmsdkidl.idl
@@ -587,6 +587,8 @@ interface IWMWriter : IUnknown
HRESULT Flush();
}
+cpp_quote("HRESULT WINAPI WMCreateWriter(IUnknown*,IWMWriter**);")
+
cpp_quote("EXTERN_GUID(WMMEDIASUBTYPE_Base, 0x00000000,0x0000,0x0010,0x80,0x00,0x00,0xaa,0x00,0x38,0x9b,0x71);")
cpp_quote("EXTERN_GUID(WMMEDIATYPE_Video, 0x73646976,0x0000,0x0010,0x80,0x00,0x00,0xaa,0x00,0x38,0x9b,0x71);")
cpp_quote("EXTERN_GUID(WMMEDIASUBTYPE_RGB1, 0xe436eb78,0x524f,0x11ce,0x9f,0x53,0x00,0x20,0xaf,0x0b,0xa7,0x70);")
More information about the wine-cvs
mailing list