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
30 #include "wine/debug.h"
34 WINE_DEFAULT_DEBUG_CHANNEL(dpvoice
);
36 typedef struct IDirectPlayVoiceServerImpl
38 IDirectPlayVoiceServer IDirectPlayVoiceServer_iface
;
40 } IDirectPlayVoiceServerImpl
;
42 HRESULT
DPVOICE_GetCompressionTypes(DVCOMPRESSIONINFO
*pData
, DWORD
*pdwDataSize
, DWORD
*pdwNumElements
, DWORD dwFlags
)
44 static const DVCOMPRESSIONINFO pcm_type
=
45 {80, {0x8de12fd4,0x7cb3,0x48ce,{0xa7,0xe8,0x9c,0x47,0xa2,0x2e,0x8a,0xc5}}, NULL
, NULL
, 0, 64000};
46 static const WCHAR pcm_name
[] = L
"MS-PCM 64 kbit/s";
51 if (!pdwDataSize
|| !pdwNumElements
)
52 return DVERR_INVALIDPOINTER
;
55 return DVERR_INVALIDFLAGS
;
59 if (*pdwDataSize
< sizeof(pcm_type
) + sizeof(pcm_name
))
61 ret
= DVERR_BUFFERTOOSMALL
;
65 ret
= DVERR_INVALIDPOINTER
;
69 string_loc
= (LPWSTR
)((char*)pData
+ sizeof(pcm_type
));
70 memcpy(pData
, &pcm_type
, sizeof(pcm_type
));
71 memcpy(string_loc
, pcm_name
, sizeof(pcm_name
));
72 pData
->lpszName
= string_loc
;
76 *pdwDataSize
= sizeof(pcm_type
) + sizeof(pcm_name
);
80 static inline IDirectPlayVoiceServerImpl
*impl_from_IDirectPlayVoiceServer(IDirectPlayVoiceServer
*iface
)
82 return CONTAINING_RECORD(iface
, IDirectPlayVoiceServerImpl
, IDirectPlayVoiceServer_iface
);
85 static HRESULT WINAPI
dpvserver_QueryInterface(IDirectPlayVoiceServer
*iface
, REFIID riid
, void **ppv
)
87 if (IsEqualGUID(riid
, &IID_IUnknown
) || IsEqualGUID(riid
, &IID_IDirectPlayVoiceServer
))
89 IUnknown_AddRef(iface
);
94 WARN("(%p)->(%s,%p),not found\n", iface
, debugstr_guid(riid
), ppv
);
98 static ULONG WINAPI
dpvserver_AddRef(IDirectPlayVoiceServer
*iface
)
100 IDirectPlayVoiceServerImpl
*This
= impl_from_IDirectPlayVoiceServer(iface
);
101 ULONG ref
= InterlockedIncrement(&This
->ref
);
103 TRACE("(%p) ref=%u\n", This
, ref
);
108 static ULONG WINAPI
dpvserver_Release(IDirectPlayVoiceServer
*iface
)
110 IDirectPlayVoiceServerImpl
*This
= impl_from_IDirectPlayVoiceServer(iface
);
111 ULONG ref
= InterlockedDecrement(&This
->ref
);
113 TRACE("(%p) ref=%u\n", This
, ref
);
117 HeapFree(GetProcessHeap(), 0, This
);
122 static HRESULT WINAPI
dpvserver_Initialize(IDirectPlayVoiceServer
*iface
, IUnknown
*lpVoid
, PDVMESSAGEHANDLER pMessageHandler
,
123 void *pUserContext
, DWORD
*lpdwMessageMask
, DWORD dwMessageMaskElements
)
125 IDirectPlayVoiceServerImpl
*This
= impl_from_IDirectPlayVoiceServer(iface
);
126 FIXME("%p %p %p %p %p %d\n", This
, lpVoid
, pMessageHandler
, pUserContext
,lpdwMessageMask
, dwMessageMaskElements
);
130 static HRESULT WINAPI
dpvserver_StartSession(IDirectPlayVoiceServer
*iface
, PDVSESSIONDESC pSessionDesc
, DWORD dwFlags
)
132 IDirectPlayVoiceServerImpl
*This
= impl_from_IDirectPlayVoiceServer(iface
);
133 FIXME("%p %p %d\n", This
, pSessionDesc
, dwFlags
);
137 static HRESULT WINAPI
dpvserver_StopSession(IDirectPlayVoiceServer
*iface
, DWORD dwFlags
)
139 IDirectPlayVoiceServerImpl
*This
= impl_from_IDirectPlayVoiceServer(iface
);
140 FIXME("%p %d\n", This
, dwFlags
);
144 static HRESULT WINAPI
dpvserver_GetSessionDesc(IDirectPlayVoiceServer
*iface
, PDVSESSIONDESC pvSessionDesc
)
146 IDirectPlayVoiceServerImpl
*This
= impl_from_IDirectPlayVoiceServer(iface
);
147 FIXME("%p %p\n", This
, pvSessionDesc
);
151 static HRESULT WINAPI
dpvserver_SetSessionDesc(IDirectPlayVoiceServer
*iface
, PDVSESSIONDESC pSessionDesc
)
153 IDirectPlayVoiceServerImpl
*This
= impl_from_IDirectPlayVoiceServer(iface
);
154 FIXME("%p %p\n", This
, pSessionDesc
);
158 static HRESULT WINAPI
dpvserver_GetCaps(IDirectPlayVoiceServer
*iface
, PDVCAPS pDVCaps
)
160 IDirectPlayVoiceServerImpl
*This
= impl_from_IDirectPlayVoiceServer(iface
);
161 FIXME("%p %p\n", This
, pDVCaps
);
165 static HRESULT WINAPI
dpvserver_GetCompressionTypes(IDirectPlayVoiceServer
*iface
, void *pData
, DWORD
*pdwDataSize
,
166 DWORD
*pdwNumElements
, DWORD dwFlags
)
168 IDirectPlayVoiceServerImpl
*This
= impl_from_IDirectPlayVoiceServer(iface
);
169 FIXME("%p %p %p %p %d semi-stub\n", This
, pData
, pdwDataSize
, pdwNumElements
, dwFlags
);
170 return DPVOICE_GetCompressionTypes(pData
, pdwDataSize
, pdwNumElements
, dwFlags
);
173 static HRESULT WINAPI
dpvserver_SetTransmitTargets(IDirectPlayVoiceServer
*iface
, DVID dvSource
, PDVID pdvIDTargets
,
174 DWORD dwNumTargets
, DWORD dwFlags
)
176 IDirectPlayVoiceServerImpl
*This
= impl_from_IDirectPlayVoiceServer(iface
);
177 FIXME("%p %d %p %d %d\n", This
, dvSource
, pdvIDTargets
, dwNumTargets
, dwFlags
);
181 static HRESULT WINAPI
dpvserver_GetTransmitTargets(IDirectPlayVoiceServer
*iface
, DVID dvSource
, PDVID pdvIDTargets
,
182 DWORD
*pdwNumTargets
, DWORD dwFlags
)
184 IDirectPlayVoiceServerImpl
*This
= impl_from_IDirectPlayVoiceServer(iface
);
185 FIXME("%p %d %p %p %d\n", This
, dvSource
, pdvIDTargets
, pdwNumTargets
, dwFlags
);
189 static HRESULT WINAPI
dpvserver_SetNotifyMask(IDirectPlayVoiceServer
*iface
, DWORD
*pdwMessageMask
, DWORD dwMessageMaskElements
)
191 IDirectPlayVoiceServerImpl
*This
= impl_from_IDirectPlayVoiceServer(iface
);
192 FIXME("%p %p %d\n", This
, pdwMessageMask
, dwMessageMaskElements
);
196 static const IDirectPlayVoiceServerVtbl DirectPlayVoiceServer_Vtbl
=
198 dpvserver_QueryInterface
,
201 dpvserver_Initialize
,
202 dpvserver_StartSession
,
203 dpvserver_StopSession
,
204 dpvserver_GetSessionDesc
,
205 dpvserver_SetSessionDesc
,
207 dpvserver_GetCompressionTypes
,
208 dpvserver_SetTransmitTargets
,
209 dpvserver_GetTransmitTargets
,
210 dpvserver_SetNotifyMask
213 HRESULT
DPVOICE_CreateDirectPlayVoiceServer(IClassFactory
*iface
, IUnknown
*pUnkOuter
, REFIID riid
, void **ppobj
)
215 IDirectPlayVoiceServerImpl
* server
;
218 TRACE("(%p, %s, %p)\n", pUnkOuter
, debugstr_guid(riid
), ppobj
);
222 server
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(IDirectPlayVoiceServerImpl
));
224 return E_OUTOFMEMORY
;
226 server
->IDirectPlayVoiceServer_iface
.lpVtbl
= &DirectPlayVoiceServer_Vtbl
;
229 ret
= IDirectPlayVoiceServer_QueryInterface(&server
->IDirectPlayVoiceServer_iface
, riid
, ppobj
);
230 IDirectPlayVoiceServer_Release(&server
->IDirectPlayVoiceServer_iface
);