d2d1: Create feature level 10.0 device context state objects.
[wine.git] / dlls / dpvoice / server.c
bloba476a2e585d5dd22b5e17e945516d4a4e3d0f0f2
1 /*
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
21 #include <stdarg.h>
23 #define COBJMACROS
24 #include "windef.h"
25 #include "winbase.h"
26 #include "wingdi.h"
27 #include "winuser.h"
28 #include "objbase.h"
30 #include "wine/debug.h"
32 #include "dvoice.h"
34 WINE_DEFAULT_DEBUG_CHANNEL(dpvoice);
36 typedef struct IDirectPlayVoiceServerImpl
38 IDirectPlayVoiceServer IDirectPlayVoiceServer_iface;
39 LONG ref;
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";
48 HRESULT ret;
49 LPWSTR string_loc;
51 if (!pdwDataSize || !pdwNumElements)
52 return DVERR_INVALIDPOINTER;
54 if (dwFlags)
55 return DVERR_INVALIDFLAGS;
57 *pdwNumElements = 1;
59 if (*pdwDataSize < sizeof(pcm_type) + sizeof(pcm_name))
61 ret = DVERR_BUFFERTOOSMALL;
63 else if (!pData)
65 ret = DVERR_INVALIDPOINTER;
67 else
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;
73 ret = DV_OK;
76 *pdwDataSize = sizeof(pcm_type) + sizeof(pcm_name);
77 return ret;
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);
90 *ppv = iface;
91 return S_OK;
94 WARN("(%p)->(%s,%p),not found\n", iface, debugstr_guid(riid), ppv);
95 return E_NOINTERFACE;
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);
105 return 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);
115 if (!ref)
117 HeapFree(GetProcessHeap(), 0, This);
119 return ref;
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);
127 return E_NOTIMPL;
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);
134 return E_NOTIMPL;
137 static HRESULT WINAPI dpvserver_StopSession(IDirectPlayVoiceServer *iface, DWORD dwFlags)
139 IDirectPlayVoiceServerImpl *This = impl_from_IDirectPlayVoiceServer(iface);
140 FIXME("%p %d\n", This, dwFlags);
141 return E_NOTIMPL;
144 static HRESULT WINAPI dpvserver_GetSessionDesc(IDirectPlayVoiceServer *iface, PDVSESSIONDESC pvSessionDesc)
146 IDirectPlayVoiceServerImpl *This = impl_from_IDirectPlayVoiceServer(iface);
147 FIXME("%p %p\n", This, pvSessionDesc);
148 return E_NOTIMPL;
151 static HRESULT WINAPI dpvserver_SetSessionDesc(IDirectPlayVoiceServer *iface, PDVSESSIONDESC pSessionDesc)
153 IDirectPlayVoiceServerImpl *This = impl_from_IDirectPlayVoiceServer(iface);
154 FIXME("%p %p\n", This, pSessionDesc);
155 return E_NOTIMPL;
158 static HRESULT WINAPI dpvserver_GetCaps(IDirectPlayVoiceServer *iface, PDVCAPS pDVCaps)
160 IDirectPlayVoiceServerImpl *This = impl_from_IDirectPlayVoiceServer(iface);
161 FIXME("%p %p\n", This, pDVCaps);
162 return E_NOTIMPL;
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);
178 return E_NOTIMPL;
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);
186 return E_NOTIMPL;
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);
193 return E_NOTIMPL;
196 static const IDirectPlayVoiceServerVtbl DirectPlayVoiceServer_Vtbl =
198 dpvserver_QueryInterface,
199 dpvserver_AddRef,
200 dpvserver_Release,
201 dpvserver_Initialize,
202 dpvserver_StartSession,
203 dpvserver_StopSession,
204 dpvserver_GetSessionDesc,
205 dpvserver_SetSessionDesc,
206 dpvserver_GetCaps,
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;
216 HRESULT ret;
218 TRACE("(%p, %s, %p)\n", pUnkOuter, debugstr_guid(riid), ppobj);
220 *ppobj = NULL;
222 server = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectPlayVoiceServerImpl));
223 if (!server)
224 return E_OUTOFMEMORY;
226 server->IDirectPlayVoiceServer_iface.lpVtbl = &DirectPlayVoiceServer_Vtbl;
227 server->ref = 1;
229 ret = IDirectPlayVoiceServer_QueryInterface(&server->IDirectPlayVoiceServer_iface, riid, ppobj);
230 IDirectPlayVoiceServer_Release(&server->IDirectPlayVoiceServer_iface);
232 return ret;