Maarten Lankhorst : mmdevapi: Add IMMEndpoint to IMMDevice.
Alexandre Julliard
julliard at winehq.org
Mon Mar 15 12:19:43 CDT 2010
Module: wine
Branch: master
Commit: 99f3ee3804b85226e7df8332f49747dc6c43928f
URL: http://source.winehq.org/git/wine.git/?a=commit;h=99f3ee3804b85226e7df8332f49747dc6c43928f
Author: Maarten Lankhorst <m.b.lankhorst at gmail.com>
Date: Sun Feb 21 14:16:20 2010 +0100
mmdevapi: Add IMMEndpoint to IMMDevice.
---
dlls/mmdevapi/devenum.c | 45 ++++++++++++++++++++++++++++++++++++++++++++-
dlls/mmdevapi/mmdevapi.h | 1 +
2 files changed, 45 insertions(+), 1 deletions(-)
diff --git a/dlls/mmdevapi/devenum.c b/dlls/mmdevapi/devenum.c
index 452384b..32a337a 100644
--- a/dlls/mmdevapi/devenum.c
+++ b/dlls/mmdevapi/devenum.c
@@ -84,7 +84,7 @@ static const IMMDeviceEnumeratorVtbl MMDevEnumVtbl;
static const IMMDeviceCollectionVtbl MMDevColVtbl;
static const IMMDeviceVtbl MMDeviceVtbl;
static const IPropertyStoreVtbl MMDevPropVtbl;
-
+static const IMMEndpointVtbl MMEndpointVtbl;
typedef struct MMDevColImpl
{
@@ -138,6 +138,7 @@ static void MMDevice_Create(WCHAR *name, GUID *id, EDataFlow flow, DWORD state,
}
lstrcpyW(cur->alname, name);
cur->lpVtbl = &MMDeviceVtbl;
+ cur->lpEndpointVtbl = &MMEndpointVtbl;
cur->ref = 0;
InitializeCriticalSection(&cur->crst);
cur->crst.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": MMDevice.crst");
@@ -215,6 +216,8 @@ static HRESULT WINAPI MMDevice_QueryInterface(IMMDevice *iface, REFIID riid, voi
if (IsEqualIID(riid, &IID_IUnknown)
|| IsEqualIID(riid, &IID_IMMDevice))
*ppv = This;
+ else if (IsEqualIID(riid, &IID_IMMEndpoint))
+ *ppv = &This->lpEndpointVtbl;
if (*ppv)
{
IUnknown_AddRef((IUnknown*)*ppv);
@@ -303,6 +306,46 @@ static const IMMDeviceVtbl MMDeviceVtbl =
MMDevice_GetState
};
+static MMDevice *get_this_from_endpoint(IMMEndpoint *iface)
+{
+ return (MMDevice*)((char*)iface - offsetof(MMDevice,lpEndpointVtbl));
+}
+
+static HRESULT WINAPI MMEndpoint_QueryInterface(IMMEndpoint *iface, REFIID riid, void **ppv)
+{
+ MMDevice *This = get_this_from_endpoint(iface);
+ return IMMDevice_QueryInterface((IMMDevice*)This, riid, ppv);
+}
+
+static ULONG WINAPI MMEndpoint_AddRef(IMMEndpoint *iface)
+{
+ MMDevice *This = get_this_from_endpoint(iface);
+ return IMMDevice_AddRef((IMMDevice*)This);
+}
+
+static ULONG WINAPI MMEndpoint_Release(IMMEndpoint *iface)
+{
+ MMDevice *This = get_this_from_endpoint(iface);
+ return IMMDevice_Release((IMMDevice*)This);
+}
+
+static HRESULT WINAPI MMEndpoint_GetDataFlow(IMMEndpoint *iface, EDataFlow *flow)
+{
+ MMDevice *This = get_this_from_endpoint(iface);
+ if (!flow)
+ return E_POINTER;
+ *flow = This->flow;
+ return S_OK;
+}
+
+static const IMMEndpointVtbl MMEndpointVtbl =
+{
+ MMEndpoint_QueryInterface,
+ MMEndpoint_AddRef,
+ MMEndpoint_Release,
+ MMEndpoint_GetDataFlow
+};
+
static HRESULT MMDevCol_Create(IMMDeviceCollection **ppv, EDataFlow flow, DWORD state)
{
MMDevColImpl *This;
diff --git a/dlls/mmdevapi/mmdevapi.h b/dlls/mmdevapi/mmdevapi.h
index 15ba4ae..cc4b3f2 100644
--- a/dlls/mmdevapi/mmdevapi.h
+++ b/dlls/mmdevapi/mmdevapi.h
@@ -24,6 +24,7 @@ extern HRESULT MMDevice_SetPropValue(const GUID *devguid, DWORD flow, REFPROPERT
typedef struct MMDevice {
const IMMDeviceVtbl *lpVtbl;
+ const IMMEndpointVtbl *lpEndpointVtbl;
LONG ref;
CRITICAL_SECTION crst;
More information about the wine-cvs
mailing list