2 * DirectPlay Voice Server Interface
4 * Copyright (C) 2014 Alistair Leslie-Hughes
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
31 #include "wine/unicode.h"
32 #include "wine/debug.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(dpvoice
);
38 typedef struct IDirectPlayVoiceServerImpl
40 IDirectPlayVoiceServer IDirectPlayVoiceServer_iface
;
42 } IDirectPlayVoiceServerImpl
;
44 HRESULT
DPVOICE_GetCompressionTypes(DVCOMPRESSIONINFO
*pData
, DWORD
*pdwDataSize
, DWORD
*pdwNumElements
, DWORD dwFlags
)
46 static const DVCOMPRESSIONINFO pcm_type
=
47 {80, {0x8de12fd4,0x7cb3,0x48ce,{0xa7,0xe8,0x9c,0x47,0xa2,0x2e,0x8a,0xc5}}, NULL
, NULL
, 0, 64000};
48 static const WCHAR pcm_name
[] =
49 {'M','S','-','P','C','M',' ','6','4',' ','k','b','i','t','/','s',0};
54 if (!pdwDataSize
|| !pdwNumElements
)
55 return DVERR_INVALIDPOINTER
;
58 return DVERR_INVALIDFLAGS
;
62 if (*pdwDataSize
< sizeof(pcm_type
) + sizeof(pcm_name
))
64 ret
= DVERR_BUFFERTOOSMALL
;
68 ret
= DVERR_INVALIDPOINTER
;
72 string_loc
= (LPWSTR
)((char*)pData
+ sizeof(pcm_type
));
73 memcpy(pData
, &pcm_type
, sizeof(pcm_type
));
74 memcpy(string_loc
, pcm_name
, sizeof(pcm_name
));
75 pData
->lpszName
= string_loc
;
79 *pdwDataSize
= sizeof(pcm_type
) + sizeof(pcm_name
);
83 static inline IDirectPlayVoiceServerImpl
*impl_from_IDirectPlayVoiceServer(IDirectPlayVoiceServer
*iface
)
85 return CONTAINING_RECORD(iface
, IDirectPlayVoiceServerImpl
, IDirectPlayVoiceServer_iface
);
88 static HRESULT WINAPI
dpvserver_QueryInterface(IDirectPlayVoiceServer
*iface
, REFIID riid
, void **ppv
)
90 if (IsEqualGUID(riid
, &IID_IUnknown
) || IsEqualGUID(riid
, &IID_IDirectPlayVoiceServer
))
92 IUnknown_AddRef(iface
);
97 WARN("(%p)->(%s,%p),not found\n", iface
, debugstr_guid(riid
), ppv
);
101 static ULONG WINAPI
dpvserver_AddRef(IDirectPlayVoiceServer
*iface
)
103 IDirectPlayVoiceServerImpl
*This
= impl_from_IDirectPlayVoiceServer(iface
);
104 ULONG ref
= InterlockedIncrement(&This
->ref
);
106 TRACE("(%p) ref=%u\n", This
, ref
);
111 static ULONG WINAPI
dpvserver_Release(IDirectPlayVoiceServer
*iface
)
113 IDirectPlayVoiceServerImpl
*This
= impl_from_IDirectPlayVoiceServer(iface
);
114 ULONG ref
= InterlockedDecrement(&This
->ref
);
116 TRACE("(%p) ref=%u\n", This
, ref
);
120 HeapFree(GetProcessHeap(), 0, This
);
125 static HRESULT WINAPI
dpvserver_Initialize(IDirectPlayVoiceServer
*iface
, IUnknown
*lpVoid
, PDVMESSAGEHANDLER pMessageHandler
,
126 void *pUserContext
, DWORD
*lpdwMessageMask
, DWORD dwMessageMaskElements
)
128 IDirectPlayVoiceServerImpl
*This
= impl_from_IDirectPlayVoiceServer(iface
);
129 FIXME("%p %p %p %p %p %d\n", This
, lpVoid
, pMessageHandler
, pUserContext
,lpdwMessageMask
, dwMessageMaskElements
);
133 static HRESULT WINAPI
dpvserver_StartSession(IDirectPlayVoiceServer
*iface
, PDVSESSIONDESC pSessionDesc
, DWORD dwFlags
)
135 IDirectPlayVoiceServerImpl
*This
= impl_from_IDirectPlayVoiceServer(iface
);
136 FIXME("%p %p %d\n", This
, pSessionDesc
, dwFlags
);
140 static HRESULT WINAPI
dpvserver_StopSession(IDirectPlayVoiceServer
*iface
, DWORD dwFlags
)
142 IDirectPlayVoiceServerImpl
*This
= impl_from_IDirectPlayVoiceServer(iface
);
143 FIXME("%p %d\n", This
, dwFlags
);
147 static HRESULT WINAPI
dpvserver_GetSessionDesc(IDirectPlayVoiceServer
*iface
, PDVSESSIONDESC pvSessionDesc
)
149 IDirectPlayVoiceServerImpl
*This
= impl_from_IDirectPlayVoiceServer(iface
);
150 FIXME("%p %p\n", This
, pvSessionDesc
);
154 static HRESULT WINAPI
dpvserver_SetSessionDesc(IDirectPlayVoiceServer
*iface
, PDVSESSIONDESC pSessionDesc
)
156 IDirectPlayVoiceServerImpl
*This
= impl_from_IDirectPlayVoiceServer(iface
);
157 FIXME("%p %p\n", This
, pSessionDesc
);
161 static HRESULT WINAPI
dpvserver_GetCaps(IDirectPlayVoiceServer
*iface
, PDVCAPS pDVCaps
)
163 IDirectPlayVoiceServerImpl
*This
= impl_from_IDirectPlayVoiceServer(iface
);
164 FIXME("%p %p\n", This
, pDVCaps
);
168 static HRESULT WINAPI
dpvserver_GetCompressionTypes(IDirectPlayVoiceServer
*iface
, void *pData
, DWORD
*pdwDataSize
,
169 DWORD
*pdwNumElements
, DWORD dwFlags
)
171 IDirectPlayVoiceServerImpl
*This
= impl_from_IDirectPlayVoiceServer(iface
);
172 FIXME("%p %p %p %p %d semi-stub\n", This
, pData
, pdwDataSize
, pdwNumElements
, dwFlags
);
173 return DPVOICE_GetCompressionTypes(pData
, pdwDataSize
, pdwNumElements
, dwFlags
);
176 static HRESULT WINAPI
dpvserver_SetTransmitTargets(IDirectPlayVoiceServer
*iface
, DVID dvSource
, PDVID pdvIDTargets
,
177 DWORD dwNumTargets
, DWORD dwFlags
)
179 IDirectPlayVoiceServerImpl
*This
= impl_from_IDirectPlayVoiceServer(iface
);
180 FIXME("%p %d %p %d %d\n", This
, dvSource
, pdvIDTargets
, dwNumTargets
, dwFlags
);
184 static HRESULT WINAPI
dpvserver_GetTransmitTargets(IDirectPlayVoiceServer
*iface
, DVID dvSource
, PDVID pdvIDTargets
,
185 DWORD
*pdwNumTargets
, DWORD dwFlags
)
187 IDirectPlayVoiceServerImpl
*This
= impl_from_IDirectPlayVoiceServer(iface
);
188 FIXME("%p %d %p %p %d\n", This
, dvSource
, pdvIDTargets
, pdwNumTargets
, dwFlags
);
192 static HRESULT WINAPI
dpvserver_SetNotifyMask(IDirectPlayVoiceServer
*iface
, DWORD
*pdwMessageMask
, DWORD dwMessageMaskElements
)
194 IDirectPlayVoiceServerImpl
*This
= impl_from_IDirectPlayVoiceServer(iface
);
195 FIXME("%p %p %d\n", This
, pdwMessageMask
, dwMessageMaskElements
);
199 static const IDirectPlayVoiceServerVtbl DirectPlayVoiceServer_Vtbl
=
201 dpvserver_QueryInterface
,
204 dpvserver_Initialize
,
205 dpvserver_StartSession
,
206 dpvserver_StopSession
,
207 dpvserver_GetSessionDesc
,
208 dpvserver_SetSessionDesc
,
210 dpvserver_GetCompressionTypes
,
211 dpvserver_SetTransmitTargets
,
212 dpvserver_GetTransmitTargets
,
213 dpvserver_SetNotifyMask
216 HRESULT
DPVOICE_CreateDirectPlayVoiceServer(IClassFactory
*iface
, IUnknown
*pUnkOuter
, REFIID riid
, void **ppobj
)
218 IDirectPlayVoiceServerImpl
* server
;
221 TRACE("(%p, %s, %p)\n", pUnkOuter
, debugstr_guid(riid
), ppobj
);
225 server
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(IDirectPlayVoiceServerImpl
));
227 return E_OUTOFMEMORY
;
229 server
->IDirectPlayVoiceServer_iface
.lpVtbl
= &DirectPlayVoiceServer_Vtbl
;
232 ret
= IDirectPlayVoiceServer_QueryInterface(&server
->IDirectPlayVoiceServer_iface
, riid
, ppobj
);
233 IDirectPlayVoiceServer_Release(&server
->IDirectPlayVoiceServer_iface
);