[PATCH 1/5] winegstreamer: Move the IWMProfile3 implementation to a separate object.

Zebediah Figura zfigura at codeweavers.com
Wed Oct 20 11:09:45 CDT 2021


Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
---
 dlls/winegstreamer/Makefile.in      |   3 +-
 dlls/winegstreamer/gst_private.h    |  17 +
 dlls/winegstreamer/main.c           |   6 +-
 dlls/winegstreamer/mfplat.c         |   3 +-
 dlls/winegstreamer/wm_asyncreader.c | 471 +++++-----------------------
 dlls/winegstreamer/wm_reader.c      | 308 ++++++++++++++++++
 dlls/winegstreamer/wm_syncreader.c  |   2 -
 7 files changed, 418 insertions(+), 392 deletions(-)
 create mode 100644 dlls/winegstreamer/wm_reader.c

diff --git a/dlls/winegstreamer/Makefile.in b/dlls/winegstreamer/Makefile.in
index 17311cd663c..76e6aeed54d 100644
--- a/dlls/winegstreamer/Makefile.in
+++ b/dlls/winegstreamer/Makefile.in
@@ -1,7 +1,7 @@
 MODULE    = winegstreamer.dll
 UNIXLIB   = winegstreamer.so
 IMPORTLIB = winegstreamer
-IMPORTS   = strmbase strmiids uuid ole32 mfuuid
+IMPORTS   = strmbase ole32
 DELAYIMPORTS = mfplat
 EXTRAINCL = $(GSTREAMER_CFLAGS)
 EXTRALIBS = $(GSTREAMER_LIBS) $(PTHREAD_LIBS)
@@ -14,6 +14,7 @@ C_SRCS = \
 	quartz_parser.c \
 	wg_parser.c \
 	wm_asyncreader.c \
+	wm_reader.c \
 	wm_syncreader.c
 
 IDL_SRCS = \
diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h
index 986c8ca695d..6c86031897e 100644
--- a/dlls/winegstreamer/gst_private.h
+++ b/dlls/winegstreamer/gst_private.h
@@ -33,6 +33,7 @@
 #define NONAMELESSUNION
 #include "dshow.h"
 #include "mfidl.h"
+#include "wmsdk.h"
 #include "wine/debug.h"
 #include "wine/strmbase.h"
 
@@ -112,4 +113,20 @@ HRESULT winegstreamer_stream_handler_create(REFIID riid, void **obj) DECLSPEC_HI
 
 HRESULT audio_converter_create(REFIID riid, void **ret) DECLSPEC_HIDDEN;
 
+struct wm_reader
+{
+    IWMProfile3 IWMProfile3_iface;
+    LONG refcount;
+
+    const struct wm_reader_ops *ops;
+};
+
+struct wm_reader_ops
+{
+    void *(*query_interface)(struct wm_reader *reader, REFIID iid);
+    void (*destroy)(struct wm_reader *reader);
+};
+
+void wm_reader_init(struct wm_reader *reader, const struct wm_reader_ops *ops);
+
 #endif /* __GST_PRIVATE_INCLUDED__ */
diff --git a/dlls/winegstreamer/main.c b/dlls/winegstreamer/main.c
index d6f19fb4ad1..ac9a3201792 100644
--- a/dlls/winegstreamer/main.c
+++ b/dlls/winegstreamer/main.c
@@ -20,17 +20,19 @@
 
 #define WINE_NO_NAMELESS_EXTENSION
 
+#define EXTERN_GUID DEFINE_GUID
+#include "initguid.h"
 #include "gst_private.h"
 #include "winternl.h"
 #include "rpcproxy.h"
-
-#include "initguid.h"
 #include "gst_guids.h"
 
 static unixlib_handle_t unix_handle;
 
 WINE_DEFAULT_DEBUG_CHANNEL(quartz);
 
+DEFINE_GUID(GUID_NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+
 bool array_reserve(void **elements, size_t *capacity, size_t count, size_t size)
 {
     unsigned int new_capacity, max_capacity;
diff --git a/dlls/winegstreamer/mfplat.c b/dlls/winegstreamer/mfplat.c
index 93f4b8d5bd7..58200dc409a 100644
--- a/dlls/winegstreamer/mfplat.c
+++ b/dlls/winegstreamer/mfplat.c
@@ -19,9 +19,10 @@
 
 #include "gst_private.h"
 
-#include "mfapi.h"
 #include "ks.h"
 #include "ksmedia.h"
+#include "initguid.h"
+#include "mfapi.h"
 
 #include "wine/debug.h"
 
diff --git a/dlls/winegstreamer/wm_asyncreader.c b/dlls/winegstreamer/wm_asyncreader.c
index b4ef4851c33..3e341ec41e9 100644
--- a/dlls/winegstreamer/wm_asyncreader.c
+++ b/dlls/winegstreamer/wm_asyncreader.c
@@ -17,12 +17,13 @@
  */
 
 #include "gst_private.h"
-#include "wmsdk.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(wmvcore);
 
 struct async_reader
 {
+    struct wm_reader reader;
+
     IWMReader IWMReader_iface;
     IWMReaderAdvanced6 IWMReaderAdvanced6_iface;
     IWMReaderAccelerator IWMReaderAccelerator_iface;
@@ -34,9 +35,7 @@ struct async_reader
     IWMHeaderInfo3 IWMHeaderInfo3_iface;
     IWMLanguageList IWMLanguageList_iface;
     IReferenceClock IReferenceClock_iface;
-    IWMProfile3 IWMProfile3_iface;
     IWMPacketSize2 IWMPacketSize2_iface;
-    LONG ref;
 };
 
 static struct async_reader *impl_from_IWMReader(IWMReader *iface)
@@ -44,116 +43,25 @@ static struct async_reader *impl_from_IWMReader(IWMReader *iface)
     return CONTAINING_RECORD(iface, struct async_reader, IWMReader_iface);
 }
 
-static HRESULT WINAPI WMReader_QueryInterface(IWMReader *iface, REFIID riid, void **ppv)
+static HRESULT WINAPI WMReader_QueryInterface(IWMReader *iface, REFIID iid, void **out)
 {
-    struct async_reader *This = impl_from_IWMReader(iface);
+    struct async_reader *reader = impl_from_IWMReader(iface);
 
-    if(IsEqualGUID(riid, &IID_IUnknown)) {
-        TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
-        *ppv = &This->IWMReader_iface;
-    }else if(IsEqualGUID(riid, &IID_IWMReader)) {
-        TRACE("(%p)->(IID_IWMReader %p)\n", This, ppv);
-        *ppv = &This->IWMReader_iface;
-    }else if(IsEqualGUID(riid, &IID_IWMReaderAdvanced)) {
-        TRACE("(%p)->(IID_IWMReaderAdvanced %p)\n", This, ppv);
-        *ppv = &This->IWMReaderAdvanced6_iface;
-    }else if(IsEqualGUID(riid, &IID_IWMReaderAdvanced2)) {
-        TRACE("(%p)->(IID_IWMReaderAdvanced2 %p)\n", This, ppv);
-        *ppv = &This->IWMReaderAdvanced6_iface;
-    }else if(IsEqualGUID(riid, &IID_IWMReaderAdvanced3)) {
-        TRACE("(%p)->(IID_IWMReaderAdvanced3 %p)\n", This, ppv);
-        *ppv = &This->IWMReaderAdvanced6_iface;
-    }else if(IsEqualGUID(riid, &IID_IWMReaderAdvanced4)) {
-        TRACE("(%p)->(IID_IWMReaderAdvanced4 %p)\n", This, ppv);
-        *ppv = &This->IWMReaderAdvanced6_iface;
-    }else if(IsEqualGUID(riid, &IID_IWMReaderAdvanced5)) {
-        TRACE("(%p)->(IID_IWMReaderAdvanced5 %p)\n", This, ppv);
-        *ppv = &This->IWMReaderAdvanced6_iface;
-    }else if(IsEqualGUID(riid, &IID_IWMReaderAdvanced6)) {
-        TRACE("(%p)->(IID_IWMReaderAdvanced6 %p)\n", This, ppv);
-        *ppv = &This->IWMReaderAdvanced6_iface;
-    }else if(IsEqualGUID(riid, &IID_IWMReaderAccelerator)) {
-        TRACE("(%p)->(IID_IWMReaderAccelerator %p)\n", This, ppv);
-        *ppv = &This->IWMReaderAccelerator_iface;
-    }else if(IsEqualGUID(riid, &IID_IWMReaderNetworkConfig)) {
-        TRACE("(%p)->(IWMReaderNetworkConfig %p)\n", This, ppv);
-        *ppv = &This->IWMReaderNetworkConfig2_iface;
-    }else if(IsEqualGUID(riid, &IID_IWMReaderNetworkConfig2)) {
-        TRACE("(%p)->(IWMReaderNetworkConfig2 %p)\n", This, ppv);
-        *ppv = &This->IWMReaderNetworkConfig2_iface;
-    }else if(IsEqualGUID(riid, &IID_IWMReaderStreamClock)) {
-        TRACE("(%p)->(IWMReaderStreamClock %p)\n", This, ppv);
-        *ppv = &This->IWMReaderStreamClock_iface;
-    }else if(IsEqualGUID(riid, &IID_IWMReaderTypeNegotiation)) {
-        TRACE("(%p)->(IWMReaderTypeNegotiation %p)\n", This, ppv);
-        *ppv = &This->IWMReaderTypeNegotiation_iface;
-    }else if(IsEqualGUID(riid, &IID_IWMReaderTimecode)) {
-        TRACE("(%p)->(IWMReaderTimecode %p)\n", This, ppv);
-        *ppv = &This->IWMReaderTimecode_iface;
-    }else if(IsEqualGUID(riid, &IID_IWMReaderPlaylistBurn)) {
-        TRACE("(%p)->(IWMReaderPlaylistBurn %p)\n", This, ppv);
-        *ppv = &This->IWMReaderPlaylistBurn_iface;
-    }else if(IsEqualGUID(riid, &IID_IWMHeaderInfo)) {
-        TRACE("(%p)->(IWMHeaderInfo %p)\n", This, ppv);
-        *ppv = &This->IWMHeaderInfo3_iface;
-    }else if(IsEqualGUID(riid, &IID_IWMHeaderInfo2)) {
-        TRACE("(%p)->(IWMHeaderInfo2 %p)\n", This, ppv);
-        *ppv = &This->IWMHeaderInfo3_iface;
-    }else if(IsEqualGUID(riid, &IID_IWMHeaderInfo3)) {
-        TRACE("(%p)->(IWMHeaderInfo3 %p)\n", This, ppv);
-        *ppv = &This->IWMHeaderInfo3_iface;
-    }else if(IsEqualGUID(riid, &IID_IWMLanguageList)) {
-        TRACE("(%p)->(IWMLanguageList %p)\n", This, ppv);
-        *ppv = &This->IWMLanguageList_iface;
-    }else if(IsEqualGUID(riid, &IID_IReferenceClock)) {
-        TRACE("(%p)->(IWMLanguageList %p)\n", This, ppv);
-        *ppv = &This->IReferenceClock_iface;
-    }else if(IsEqualGUID(riid, &IID_IWMProfile)) {
-        TRACE("(%p)->(IWMProfile %p)\n", This, ppv);
-        *ppv = &This->IWMProfile3_iface;
-    }else if(IsEqualGUID(riid, &IID_IWMProfile2)) {
-        TRACE("(%p)->(IWMProfile2 %p)\n", This, ppv);
-        *ppv = &This->IWMProfile3_iface;
-    }else if(IsEqualGUID(riid, &IID_IWMProfile3)) {
-        TRACE("(%p)->(IWMProfile3 %p)\n", This, ppv);
-        *ppv = &This->IWMProfile3_iface;
-    }else if(IsEqualGUID(riid, &IID_IWMPacketSize)) {
-        TRACE("(%p)->(IWMPacketSize %p)\n", This, ppv);
-        *ppv = &This->IWMPacketSize2_iface;
-    }else if(IsEqualGUID(riid, &IID_IWMPacketSize2)) {
-        TRACE("(%p)->(IWMPacketSize2 %p)\n", This, ppv);
-        *ppv = &This->IWMPacketSize2_iface;
-    }else {
-        *ppv = NULL;
-        FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
-        return E_NOINTERFACE;
-    }
-
-    IUnknown_AddRef((IUnknown*)*ppv);
-    return S_OK;
+    return IWMProfile3_QueryInterface(&reader->reader.IWMProfile3_iface, iid, out);
 }
 
 static ULONG WINAPI WMReader_AddRef(IWMReader *iface)
 {
-    struct async_reader *This = impl_from_IWMReader(iface);
-    LONG ref = InterlockedIncrement(&This->ref);
+    struct async_reader *reader = impl_from_IWMReader(iface);
 
-    TRACE("(%p) ref=%d\n", This, ref);
-
-    return ref;
+    return IWMProfile3_AddRef(&reader->reader.IWMProfile3_iface);
 }
 
 static ULONG WINAPI WMReader_Release(IWMReader *iface)
 {
-    struct async_reader *This = impl_from_IWMReader(iface);
-    LONG ref = InterlockedDecrement(&This->ref);
+    struct async_reader *reader = impl_from_IWMReader(iface);
 
-    TRACE("(%p) ref=%d\n", This, ref);
-
-    if(!ref)
-        free(This);
-
-    return ref;
+    return IWMProfile3_Release(&reader->reader.IWMProfile3_iface);
 }
 
 static HRESULT WINAPI WMReader_Open(IWMReader *iface, const WCHAR *url, IWMReaderCallback *callback, void *context)
@@ -1692,289 +1600,6 @@ static const IReferenceClockVtbl ReferenceClockVtbl =
     refclock_Unadvise
 };
 
-static struct async_reader *impl_from_IWMProfile3(IWMProfile3 *iface)
-{
-    return CONTAINING_RECORD(iface, struct async_reader, IWMProfile3_iface);
-}
-
-static HRESULT WINAPI profile3_QueryInterface(IWMProfile3 *iface, REFIID riid, void **ppv)
-{
-    struct async_reader *This = impl_from_IWMProfile3(iface);
-    return IWMReader_QueryInterface(&This->IWMReader_iface, riid, ppv);
-}
-
-static ULONG WINAPI profile3_AddRef(IWMProfile3 *iface)
-{
-    struct async_reader *This = impl_from_IWMProfile3(iface);
-    return IWMReader_AddRef(&This->IWMReader_iface);
-}
-
-static ULONG WINAPI profile3_Release(IWMProfile3 *iface)
-{
-    struct async_reader *This = impl_from_IWMProfile3(iface);
-    return IWMReader_Release(&This->IWMReader_iface);
-}
-
-static HRESULT WINAPI profile3_GetVersion(IWMProfile3 *iface, WMT_VERSION *version)
-{
-    struct async_reader *This = impl_from_IWMProfile3(iface);
-    FIXME("%p, %p\n", This, version);
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI profile3_GetName(IWMProfile3 *iface, WCHAR *name, DWORD *length)
-{
-    struct async_reader *This = impl_from_IWMProfile3(iface);
-    FIXME("%p, %p, %p\n", This, name, length);
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI profile3_SetName(IWMProfile3 *iface, const WCHAR *name)
-{
-    struct async_reader *This = impl_from_IWMProfile3(iface);
-    FIXME("%p, %s\n", This, debugstr_w(name));
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI profile3_GetDescription(IWMProfile3 *iface, WCHAR *description, DWORD *length)
-{
-    struct async_reader *This = impl_from_IWMProfile3(iface);
-    FIXME("%p, %p, %p\n", This, description, length);
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI profile3_SetDescription(IWMProfile3 *iface, const WCHAR *description)
-{
-    struct async_reader *This = impl_from_IWMProfile3(iface);
-    FIXME("%p, %s\n", This, debugstr_w(description));
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI profile3_GetStreamCount(IWMProfile3 *iface, DWORD *count)
-{
-    struct async_reader *This = impl_from_IWMProfile3(iface);
-    FIXME("%p, %p\n", This, count);
-
-    if (!count)
-        return E_INVALIDARG;
-
-    *count = 0;
-    return S_OK;
-}
-
-static HRESULT WINAPI profile3_GetStream(IWMProfile3 *iface, DWORD index, IWMStreamConfig **config)
-{
-    struct async_reader *This = impl_from_IWMProfile3(iface);
-    FIXME("%p, %d, %p\n", This, index, config);
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI profile3_GetStreamByNumber(IWMProfile3 *iface, WORD stream, IWMStreamConfig **config)
-{
-    struct async_reader *This = impl_from_IWMProfile3(iface);
-    FIXME("%p, %d, %p\n", This, stream, config);
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI profile3_RemoveStream(IWMProfile3 *iface, IWMStreamConfig *config)
-{
-    struct async_reader *This = impl_from_IWMProfile3(iface);
-    FIXME("%p, %p\n", This, config);
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI profile3_RemoveStreamByNumber(IWMProfile3 *iface, WORD stream)
-{
-    struct async_reader *This = impl_from_IWMProfile3(iface);
-    FIXME("%p, %d\n", This, stream);
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI profile3_AddStream(IWMProfile3 *iface, IWMStreamConfig *config)
-{
-    struct async_reader *This = impl_from_IWMProfile3(iface);
-    FIXME("%p, %p\n", This, config);
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI profile3_ReconfigStream(IWMProfile3 *iface, IWMStreamConfig *config)
-{
-    struct async_reader *This = impl_from_IWMProfile3(iface);
-    FIXME("%p, %p\n", This, config);
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI profile3_CreateNewStream(IWMProfile3 *iface, REFGUID type, IWMStreamConfig **config)
-{
-    struct async_reader *This = impl_from_IWMProfile3(iface);
-    FIXME("%p, %s, %p\n", This, debugstr_guid(type), config);
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI profile3_GetMutualExclusionCount(IWMProfile3 *iface, DWORD *count)
-{
-    struct async_reader *This = impl_from_IWMProfile3(iface);
-    FIXME("%p, %p\n", This, count);
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI profile3_GetMutualExclusion(IWMProfile3 *iface, DWORD index, IWMMutualExclusion **mutual)
-{
-    struct async_reader *This = impl_from_IWMProfile3(iface);
-    FIXME("%p, %d, %p\n", This, index, mutual);
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI profile3_RemoveMutualExclusion(IWMProfile3 *iface, IWMMutualExclusion *mutual)
-{
-    struct async_reader *This = impl_from_IWMProfile3(iface);
-    FIXME("%p, %p\n", This, mutual);
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI profile3_AddMutualExclusion(IWMProfile3 *iface, IWMMutualExclusion *mutual)
-{
-    struct async_reader *This = impl_from_IWMProfile3(iface);
-    FIXME("%p, %p\n", This, mutual);
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI profile3_CreateNewMutualExclusion(IWMProfile3 *iface, IWMMutualExclusion **mutual)
-{
-    struct async_reader *This = impl_from_IWMProfile3(iface);
-    FIXME("%p, %p\n", This, mutual);
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI profile3_GetProfileID(IWMProfile3 *iface, GUID *guid)
-{
-    struct async_reader *This = impl_from_IWMProfile3(iface);
-    FIXME("%p, %p\n", This, guid);
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI profile3_GetStorageFormat(IWMProfile3 *iface, WMT_STORAGE_FORMAT *storage)
-{
-    struct async_reader *This = impl_from_IWMProfile3(iface);
-    FIXME("%p, %p\n", This, storage);
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI profile3_SetStorageFormat(IWMProfile3 *iface, WMT_STORAGE_FORMAT storage)
-{
-    struct async_reader *This = impl_from_IWMProfile3(iface);
-    FIXME("%p, %d\n", This, storage);
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI profile3_GetBandwidthSharingCount(IWMProfile3 *iface, DWORD *count)
-{
-    struct async_reader *This = impl_from_IWMProfile3(iface);
-    FIXME("%p, %p\n", This, count);
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI profile3_GetBandwidthSharing(IWMProfile3 *iface, DWORD index, IWMBandwidthSharing **bandwidth)
-{
-    struct async_reader *This = impl_from_IWMProfile3(iface);
-    FIXME("%p, %d, %p\n", This, index, bandwidth);
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI profile3_RemoveBandwidthSharing( IWMProfile3 *iface, IWMBandwidthSharing *bandwidth)
-{
-    struct async_reader *This = impl_from_IWMProfile3(iface);
-    FIXME("%p, %p\n", This, bandwidth);
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI profile3_AddBandwidthSharing(IWMProfile3 *iface, IWMBandwidthSharing *bandwidth)
-{
-    struct async_reader *This = impl_from_IWMProfile3(iface);
-    FIXME("%p, %p\n", This, bandwidth);
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI profile3_CreateNewBandwidthSharing( IWMProfile3 *iface, IWMBandwidthSharing **bandwidth)
-{
-    struct async_reader *This = impl_from_IWMProfile3(iface);
-    FIXME("%p, %p\n", This, bandwidth);
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI profile3_GetStreamPrioritization(IWMProfile3 *iface, IWMStreamPrioritization **stream)
-{
-    struct async_reader *This = impl_from_IWMProfile3(iface);
-    FIXME("%p, %p\n", This, stream);
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI profile3_SetStreamPrioritization(IWMProfile3 *iface, IWMStreamPrioritization *stream)
-{
-    struct async_reader *This = impl_from_IWMProfile3(iface);
-    FIXME("%p, %p\n", This, stream);
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI profile3_RemoveStreamPrioritization(IWMProfile3 *iface)
-{
-    struct async_reader *This = impl_from_IWMProfile3(iface);
-    FIXME("%p\n", This);
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI profile3_CreateNewStreamPrioritization(IWMProfile3 *iface, IWMStreamPrioritization **stream)
-{
-    struct async_reader *This = impl_from_IWMProfile3(iface);
-    FIXME("%p, %p\n", This, stream);
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI profile3_GetExpectedPacketCount(IWMProfile3 *iface, QWORD duration, QWORD *packets)
-{
-    struct async_reader *This = impl_from_IWMProfile3(iface);
-    FIXME("%p, %s, %p\n", This, wine_dbgstr_longlong(duration), packets);
-    return E_NOTIMPL;
-}
-
-static const IWMProfile3Vtbl WMProfile3Vtbl =
-{
-    profile3_QueryInterface,
-    profile3_AddRef,
-    profile3_Release,
-    profile3_GetVersion,
-    profile3_GetName,
-    profile3_SetName,
-    profile3_GetDescription,
-    profile3_SetDescription,
-    profile3_GetStreamCount,
-    profile3_GetStream,
-    profile3_GetStreamByNumber,
-    profile3_RemoveStream,
-    profile3_RemoveStreamByNumber,
-    profile3_AddStream,
-    profile3_ReconfigStream,
-    profile3_CreateNewStream,
-    profile3_GetMutualExclusionCount,
-    profile3_GetMutualExclusion,
-    profile3_RemoveMutualExclusion,
-    profile3_AddMutualExclusion,
-    profile3_CreateNewMutualExclusion,
-    profile3_GetProfileID,
-    profile3_GetStorageFormat,
-    profile3_SetStorageFormat,
-    profile3_GetBandwidthSharingCount,
-    profile3_GetBandwidthSharing,
-    profile3_RemoveBandwidthSharing,
-    profile3_AddBandwidthSharing,
-    profile3_CreateNewBandwidthSharing,
-    profile3_GetStreamPrioritization,
-    profile3_SetStreamPrioritization,
-    profile3_RemoveStreamPrioritization,
-    profile3_CreateNewStreamPrioritization,
-    profile3_GetExpectedPacketCount
-};
-
 static struct async_reader *impl_from_IWMPacketSize2(IWMPacketSize2 *iface)
 {
     return CONTAINING_RECORD(iface, struct async_reader, IWMPacketSize2_iface);
@@ -2037,6 +1662,80 @@ static const IWMPacketSize2Vtbl WMPacketSize2Vtbl =
     packetsize_SetMinPacketSize
 };
 
+static struct async_reader *impl_from_wm_reader(struct wm_reader *iface)
+{
+    return CONTAINING_RECORD(iface, struct async_reader, reader);
+}
+
+static void *async_reader_query_interface(struct wm_reader *iface, REFIID iid)
+{
+    struct async_reader *reader = impl_from_wm_reader(iface);
+
+    TRACE("reader %p, iid %s.\n", reader, debugstr_guid(iid));
+
+    if (IsEqualIID(iid, &IID_IReferenceClock))
+        return &reader->IReferenceClock_iface;
+
+    if (IsEqualIID(iid, &IID_IWMHeaderInfo)
+            || IsEqualIID(iid, &IID_IWMHeaderInfo2)
+            || IsEqualIID(iid, &IID_IWMHeaderInfo3))
+        return &reader->IWMHeaderInfo3_iface;
+
+    if (IsEqualIID(iid, &IID_IWMLanguageList))
+        return &reader->IWMLanguageList_iface;
+
+    if (IsEqualIID(iid, &IID_IWMPacketSize)
+            || IsEqualIID(iid, &IID_IWMPacketSize2))
+        return &reader->IWMPacketSize2_iface;
+
+    if (IsEqualIID(iid, &IID_IWMReader))
+        return &reader->IWMReader_iface;
+
+    if (IsEqualIID(iid, &IID_IWMReaderAccelerator))
+        return &reader->IWMReaderAccelerator_iface;
+
+    if (IsEqualIID(iid, &IID_IWMReaderAdvanced)
+            || IsEqualIID(iid, &IID_IWMReaderAdvanced2)
+            || IsEqualIID(iid, &IID_IWMReaderAdvanced3)
+            || IsEqualIID(iid, &IID_IWMReaderAdvanced4)
+            || IsEqualIID(iid, &IID_IWMReaderAdvanced5)
+            || IsEqualIID(iid, &IID_IWMReaderAdvanced6))
+        return &reader->IWMReaderAdvanced6_iface;
+
+    if (IsEqualIID(iid, &IID_IWMReaderNetworkConfig)
+            || IsEqualIID(iid, &IID_IWMReaderNetworkConfig2))
+        return &reader->IWMReaderNetworkConfig2_iface;
+
+    if (IsEqualIID(iid, &IID_IWMReaderPlaylistBurn))
+        return &reader->IWMReaderPlaylistBurn_iface;
+
+    if (IsEqualIID(iid, &IID_IWMReaderStreamClock))
+        return &reader->IWMReaderStreamClock_iface;
+
+    if (IsEqualIID(iid, &IID_IWMReaderTimecode))
+        return &reader->IWMReaderTimecode_iface;
+
+    if (IsEqualIID(iid, &IID_IWMReaderTypeNegotiation))
+        return &reader->IWMReaderTypeNegotiation_iface;
+
+    return NULL;
+}
+
+static void async_reader_destroy(struct wm_reader *iface)
+{
+    struct async_reader *reader = impl_from_wm_reader(iface);
+
+    TRACE("reader %p.\n", reader);
+
+    free(reader);
+}
+
+static const struct wm_reader_ops async_reader_ops =
+{
+    .query_interface = async_reader_query_interface,
+    .destroy = async_reader_destroy,
+};
+
 HRESULT WINAPI winegstreamer_create_wm_async_reader(IWMReader **reader)
 {
     struct async_reader *object;
@@ -2046,11 +1745,12 @@ HRESULT WINAPI winegstreamer_create_wm_async_reader(IWMReader **reader)
     if (!(object = calloc(1, sizeof(*object))))
         return E_OUTOFMEMORY;
 
+    wm_reader_init(&object->reader, &async_reader_ops);
+
     object->IReferenceClock_iface.lpVtbl = &ReferenceClockVtbl;
     object->IWMHeaderInfo3_iface.lpVtbl = &WMHeaderInfo3Vtbl;
     object->IWMLanguageList_iface.lpVtbl = &WMLanguageListVtbl;
     object->IWMPacketSize2_iface.lpVtbl = &WMPacketSize2Vtbl;
-    object->IWMProfile3_iface.lpVtbl = &WMProfile3Vtbl;
     object->IWMReader_iface.lpVtbl = &WMReaderVtbl;
     object->IWMReaderAdvanced6_iface.lpVtbl = &WMReaderAdvanced6Vtbl;
     object->IWMReaderAccelerator_iface.lpVtbl = &WMReaderAcceleratorVtbl;
@@ -2059,7 +1759,6 @@ HRESULT WINAPI winegstreamer_create_wm_async_reader(IWMReader **reader)
     object->IWMReaderStreamClock_iface.lpVtbl = &WMReaderStreamClockVtbl;
     object->IWMReaderTimecode_iface.lpVtbl = &WMReaderTimecodeVtbl;
     object->IWMReaderTypeNegotiation_iface.lpVtbl = &WMReaderTypeNegotiationVtbl;
-    object->ref = 1;
 
     TRACE("Created async reader %p.\n", object);
     *reader = (IWMReader *)&object->IWMReader_iface;
diff --git a/dlls/winegstreamer/wm_reader.c b/dlls/winegstreamer/wm_reader.c
new file mode 100644
index 00000000000..2bab6eb462d
--- /dev/null
+++ b/dlls/winegstreamer/wm_reader.c
@@ -0,0 +1,308 @@
+/*
+ * Copyright 2012 Austin English
+ *
+ * reader 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.
+ *
+ * reader 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 "gst_private.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(wmvcore);
+
+static struct wm_reader *impl_from_IWMProfile3(IWMProfile3 *iface)
+{
+    return CONTAINING_RECORD(iface, struct wm_reader, IWMProfile3_iface);
+}
+
+static HRESULT WINAPI profile_QueryInterface(IWMProfile3 *iface, REFIID iid, void **out)
+{
+    struct wm_reader *reader = impl_from_IWMProfile3(iface);
+
+    TRACE("reader %p, iid %s, out %p.\n", reader, debugstr_guid(iid), out);
+
+    if (IsEqualIID(iid, &IID_IUnknown)
+            || IsEqualIID(iid, &IID_IWMProfile)
+            || IsEqualIID(iid, &IID_IWMProfile2)
+            || IsEqualIID(iid, &IID_IWMProfile3))
+    {
+        *out = &reader->IWMProfile3_iface;
+    }
+    else if (!(*out = reader->ops->query_interface(reader, iid)))
+    {
+        WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid));
+        return E_NOINTERFACE;
+    }
+
+    IUnknown_AddRef((IUnknown *)*out);
+    return S_OK;
+}
+
+static ULONG WINAPI profile_AddRef(IWMProfile3 *iface)
+{
+    struct wm_reader *reader = impl_from_IWMProfile3(iface);
+    ULONG refcount = InterlockedIncrement(&reader->refcount);
+
+    TRACE("%p increasing refcount to %u.\n", reader, refcount);
+
+    return refcount;
+}
+
+static ULONG WINAPI profile_Release(IWMProfile3 *iface)
+{
+    struct wm_reader *reader = impl_from_IWMProfile3(iface);
+    ULONG refcount = InterlockedDecrement(&reader->refcount);
+
+    TRACE("%p decreasing refcount to %u.\n", reader, refcount);
+
+    if (!refcount)
+        reader->ops->destroy(reader);
+
+    return refcount;
+}
+
+static HRESULT WINAPI profile_GetVersion(IWMProfile3 *iface, WMT_VERSION *version)
+{
+    FIXME("iface %p, version %p, stub!\n", iface, version);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI profile_GetName(IWMProfile3 *iface, WCHAR *name, DWORD *length)
+{
+    FIXME("iface %p, name %p, length %p, stub!\n", iface, name, length);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI profile_SetName(IWMProfile3 *iface, const WCHAR *name)
+{
+    FIXME("iface %p, name %s, stub!\n", iface, debugstr_w(name));
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI profile_GetDescription(IWMProfile3 *iface, WCHAR *description, DWORD *length)
+{
+    FIXME("iface %p, description %p, length %p, stub!\n", iface, description, length);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI profile_SetDescription(IWMProfile3 *iface, const WCHAR *description)
+{
+    FIXME("iface %p, description %s, stub!\n", iface, debugstr_w(description));
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI profile_GetStreamCount(IWMProfile3 *iface, DWORD *count)
+{
+    FIXME("iface %p, count %p, stub!\n", iface, count);
+
+    if (!count)
+        return E_INVALIDARG;
+
+    *count = 0;
+    return S_OK;
+}
+
+static HRESULT WINAPI profile_GetStream(IWMProfile3 *iface, DWORD index, IWMStreamConfig **config)
+{
+    FIXME("iface %p, index %d, config %p, stub!\n", iface, index, config);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI profile_GetStreamByNumber(IWMProfile3 *iface, WORD stream_number, IWMStreamConfig **config)
+{
+    FIXME("iface %p, stream_number %u, config %p, stub!\n", iface, stream_number, config);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI profile_RemoveStream(IWMProfile3 *iface, IWMStreamConfig *config)
+{
+    FIXME("iface %p, config %p, stub!\n", iface, config);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI profile_RemoveStreamByNumber(IWMProfile3 *iface, WORD stream_number)
+{
+    FIXME("iface %p, stream_number %u, stub!\n", iface, stream_number);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI profile_AddStream(IWMProfile3 *iface, IWMStreamConfig *config)
+{
+    FIXME("iface %p, config %p, stub!\n", iface, config);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI profile_ReconfigStream(IWMProfile3 *iface, IWMStreamConfig *config)
+{
+    FIXME("iface %p, config %p, stub!\n", iface, config);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI profile_CreateNewStream(IWMProfile3 *iface, REFGUID type, IWMStreamConfig **config)
+{
+    FIXME("iface %p, type %s, config %p, stub!\n", iface, debugstr_guid(type), config);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI profile_GetMutualExclusionCount(IWMProfile3 *iface, DWORD *count)
+{
+    FIXME("iface %p, count %p, stub!\n", iface, count);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI profile_GetMutualExclusion(IWMProfile3 *iface, DWORD index, IWMMutualExclusion **excl)
+{
+    FIXME("iface %p, index %u, excl %p, stub!\n", iface, index, excl);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI profile_RemoveMutualExclusion(IWMProfile3 *iface, IWMMutualExclusion *excl)
+{
+    FIXME("iface %p, excl %p, stub!\n", iface, excl);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI profile_AddMutualExclusion(IWMProfile3 *iface, IWMMutualExclusion *excl)
+{
+    FIXME("iface %p, excl %p, stub!\n", iface, excl);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI profile_CreateNewMutualExclusion(IWMProfile3 *iface, IWMMutualExclusion **excl)
+{
+    FIXME("iface %p, excl %p, stub!\n", iface, excl);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI profile_GetProfileID(IWMProfile3 *iface, GUID *id)
+{
+    FIXME("iface %p, id %p, stub!\n", iface, id);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI profile_GetStorageFormat(IWMProfile3 *iface, WMT_STORAGE_FORMAT *format)
+{
+    FIXME("iface %p, format %p, stub!\n", iface, format);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI profile_SetStorageFormat(IWMProfile3 *iface, WMT_STORAGE_FORMAT format)
+{
+    FIXME("iface %p, format %#x, stub!\n", iface, format);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI profile_GetBandwidthSharingCount(IWMProfile3 *iface, DWORD *count)
+{
+    FIXME("iface %p, count %p, stub!\n", iface, count);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI profile_GetBandwidthSharing(IWMProfile3 *iface, DWORD index, IWMBandwidthSharing **sharing)
+{
+    FIXME("iface %p, index %d, sharing %p, stub!\n", iface, index, sharing);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI profile_RemoveBandwidthSharing( IWMProfile3 *iface, IWMBandwidthSharing *sharing)
+{
+    FIXME("iface %p, sharing %p, stub!\n", iface, sharing);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI profile_AddBandwidthSharing(IWMProfile3 *iface, IWMBandwidthSharing *sharing)
+{
+    FIXME("iface %p, sharing %p, stub!\n", iface, sharing);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI profile_CreateNewBandwidthSharing( IWMProfile3 *iface, IWMBandwidthSharing **sharing)
+{
+    FIXME("iface %p, sharing %p, stub!\n", iface, sharing);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI profile_GetStreamPrioritization(IWMProfile3 *iface, IWMStreamPrioritization **stream)
+{
+    FIXME("iface %p, stream %p, stub!\n", iface, stream);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI profile_SetStreamPrioritization(IWMProfile3 *iface, IWMStreamPrioritization *stream)
+{
+    FIXME("iface %p, stream %p, stub!\n", iface, stream);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI profile_RemoveStreamPrioritization(IWMProfile3 *iface)
+{
+    FIXME("iface %p, stub!\n", iface);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI profile_CreateNewStreamPrioritization(IWMProfile3 *iface, IWMStreamPrioritization **stream)
+{
+    FIXME("iface %p, stream %p, stub!\n", iface, stream);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI profile_GetExpectedPacketCount(IWMProfile3 *iface, QWORD duration, QWORD *count)
+{
+    FIXME("iface %p, duration %s, count %p, stub!\n", iface, debugstr_time(duration), count);
+    return E_NOTIMPL;
+}
+
+static const IWMProfile3Vtbl profile_vtbl =
+{
+    profile_QueryInterface,
+    profile_AddRef,
+    profile_Release,
+    profile_GetVersion,
+    profile_GetName,
+    profile_SetName,
+    profile_GetDescription,
+    profile_SetDescription,
+    profile_GetStreamCount,
+    profile_GetStream,
+    profile_GetStreamByNumber,
+    profile_RemoveStream,
+    profile_RemoveStreamByNumber,
+    profile_AddStream,
+    profile_ReconfigStream,
+    profile_CreateNewStream,
+    profile_GetMutualExclusionCount,
+    profile_GetMutualExclusion,
+    profile_RemoveMutualExclusion,
+    profile_AddMutualExclusion,
+    profile_CreateNewMutualExclusion,
+    profile_GetProfileID,
+    profile_GetStorageFormat,
+    profile_SetStorageFormat,
+    profile_GetBandwidthSharingCount,
+    profile_GetBandwidthSharing,
+    profile_RemoveBandwidthSharing,
+    profile_AddBandwidthSharing,
+    profile_CreateNewBandwidthSharing,
+    profile_GetStreamPrioritization,
+    profile_SetStreamPrioritization,
+    profile_RemoveStreamPrioritization,
+    profile_CreateNewStreamPrioritization,
+    profile_GetExpectedPacketCount,
+};
+
+void wm_reader_init(struct wm_reader *reader, const struct wm_reader_ops *ops)
+{
+    reader->IWMProfile3_iface.lpVtbl = &profile_vtbl;
+    reader->refcount = 1;
+    reader->ops = ops;
+}
diff --git a/dlls/winegstreamer/wm_syncreader.c b/dlls/winegstreamer/wm_syncreader.c
index 1d65820aa02..f4a5c9503ca 100644
--- a/dlls/winegstreamer/wm_syncreader.c
+++ b/dlls/winegstreamer/wm_syncreader.c
@@ -17,8 +17,6 @@
  */
 
 #include "gst_private.h"
-#include "initguid.h"
-#include "wmsdk.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(wmvcore);
 
-- 
2.33.0




More information about the wine-devel mailing list