dxgi: Return actual swap effect for D3D11 swapchains.
[wine.git] / dlls / dpvoice / server.c
blob80ef19999077a6ef513f30328be4ceada8121cd2
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
20 #include "config.h"
22 #include <stdarg.h>
24 #define COBJMACROS
25 #include "windef.h"
26 #include "winbase.h"
27 #include "wingdi.h"
28 #include "winuser.h"
29 #include "objbase.h"
31 #include "wine/unicode.h"
32 #include "wine/debug.h"
34 #include "dvoice.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(dpvoice);
38 typedef struct IDirectPlayVoiceServerImpl
40 IDirectPlayVoiceServer IDirectPlayVoiceServer_iface;
41 LONG ref;
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};
51 HRESULT ret;
52 LPWSTR string_loc;
54 if (!pdwDataSize || !pdwNumElements)
55 return DVERR_INVALIDPOINTER;
57 if (dwFlags)
58 return DVERR_INVALIDFLAGS;
60 *pdwNumElements = 1;
62 if (*pdwDataSize < sizeof(pcm_type) + sizeof(pcm_name))
64 ret = DVERR_BUFFERTOOSMALL;
66 else if (!pData)
68 ret = DVERR_INVALIDPOINTER;
70 else
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;
76 ret = DV_OK;
79 *pdwDataSize = sizeof(pcm_type) + sizeof(pcm_name);
80 return ret;
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);
93 *ppv = iface;
94 return S_OK;
97 WARN("(%p)->(%s,%p),not found\n", iface, debugstr_guid(riid), ppv);
98 return E_NOINTERFACE;
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);
108 return 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);
118 if (!ref)
120 HeapFree(GetProcessHeap(), 0, This);
122 return ref;
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);
130 return E_NOTIMPL;
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);
137 return E_NOTIMPL;
140 static HRESULT WINAPI dpvserver_StopSession(IDirectPlayVoiceServer *iface, DWORD dwFlags)
142 IDirectPlayVoiceServerImpl *This = impl_from_IDirectPlayVoiceServer(iface);
143 FIXME("%p %d\n", This, dwFlags);
144 return E_NOTIMPL;
147 static HRESULT WINAPI dpvserver_GetSessionDesc(IDirectPlayVoiceServer *iface, PDVSESSIONDESC pvSessionDesc)
149 IDirectPlayVoiceServerImpl *This = impl_from_IDirectPlayVoiceServer(iface);
150 FIXME("%p %p\n", This, pvSessionDesc);
151 return E_NOTIMPL;
154 static HRESULT WINAPI dpvserver_SetSessionDesc(IDirectPlayVoiceServer *iface, PDVSESSIONDESC pSessionDesc)
156 IDirectPlayVoiceServerImpl *This = impl_from_IDirectPlayVoiceServer(iface);
157 FIXME("%p %p\n", This, pSessionDesc);
158 return E_NOTIMPL;
161 static HRESULT WINAPI dpvserver_GetCaps(IDirectPlayVoiceServer *iface, PDVCAPS pDVCaps)
163 IDirectPlayVoiceServerImpl *This = impl_from_IDirectPlayVoiceServer(iface);
164 FIXME("%p %p\n", This, pDVCaps);
165 return E_NOTIMPL;
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);
181 return E_NOTIMPL;
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);
189 return E_NOTIMPL;
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);
196 return E_NOTIMPL;
199 static const IDirectPlayVoiceServerVtbl DirectPlayVoiceServer_Vtbl =
201 dpvserver_QueryInterface,
202 dpvserver_AddRef,
203 dpvserver_Release,
204 dpvserver_Initialize,
205 dpvserver_StartSession,
206 dpvserver_StopSession,
207 dpvserver_GetSessionDesc,
208 dpvserver_SetSessionDesc,
209 dpvserver_GetCaps,
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;
219 HRESULT ret;
221 TRACE("(%p, %s, %p)\n", pUnkOuter, debugstr_guid(riid), ppobj);
223 *ppobj = NULL;
225 server = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectPlayVoiceServerImpl));
226 if (!server)
227 return E_OUTOFMEMORY;
229 server->IDirectPlayVoiceServer_iface.lpVtbl = &DirectPlayVoiceServer_Vtbl;
230 server->ref = 1;
232 ret = IDirectPlayVoiceServer_QueryInterface(&server->IDirectPlayVoiceServer_iface, riid, ppobj);
233 IDirectPlayVoiceServer_Release(&server->IDirectPlayVoiceServer_iface);
235 return ret;