psapi/tests: Adjust margin for win10.
[wine/multimedia.git] / dlls / amstream / audiodata.c
blobc3bc1a6e0356736f120ffe5985a9ec2fd15ba5d0
1 /*
2 * Implementation of IAudioData Interface
4 * Copyright 2012 Christian Costa
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 "wine/debug.h"
23 #define COBJMACROS
25 #include "winbase.h"
26 #include "amstream_private.h"
28 WINE_DEFAULT_DEBUG_CHANNEL(amstream);
30 typedef struct {
31 IAudioData IAudioData_iface;
32 LONG ref;
33 } AMAudioDataImpl;
35 static inline AMAudioDataImpl *impl_from_IAudioData(IAudioData *iface)
37 return CONTAINING_RECORD(iface, AMAudioDataImpl, IAudioData_iface);
40 /*** IUnknown methods ***/
41 static HRESULT WINAPI IAudioDataImpl_QueryInterface(IAudioData *iface, REFIID riid, void **ret_iface)
43 TRACE("(%p)->(%s,%p)\n", iface, debugstr_guid(riid), ret_iface);
45 if (IsEqualGUID(riid, &IID_IUnknown) ||
46 IsEqualGUID(riid, &IID_IMemoryData) ||
47 IsEqualGUID(riid, &IID_IAudioData))
49 IAudioData_AddRef(iface);
50 *ret_iface = iface;
51 return S_OK;
54 ERR("(%p)->(%s,%p),not found\n", iface, debugstr_guid(riid), ret_iface);
55 return E_NOINTERFACE;
58 static ULONG WINAPI IAudioDataImpl_AddRef(IAudioData* iface)
60 AMAudioDataImpl *This = impl_from_IAudioData(iface);
61 ULONG ref = InterlockedIncrement(&This->ref);
63 TRACE("(%p)->(): new ref = %u\n", iface, This->ref);
65 return ref;
68 static ULONG WINAPI IAudioDataImpl_Release(IAudioData* iface)
70 AMAudioDataImpl *This = impl_from_IAudioData(iface);
71 ULONG ref = InterlockedDecrement(&This->ref);
73 TRACE("(%p)->(): new ref = %u\n", iface, This->ref);
75 if (!ref)
76 HeapFree(GetProcessHeap(), 0, This);
78 return ref;
81 /*** IMemoryData methods ***/
82 static HRESULT WINAPI IAudioDataImpl_SetBuffer(IAudioData* iface, DWORD size, BYTE *data, DWORD flags)
84 FIXME("(%p)->(%u,%p,%x): stub\n", iface, size, data, flags);
86 return E_NOTIMPL;
89 static HRESULT WINAPI IAudioDataImpl_GetInfo(IAudioData* iface, DWORD *length, BYTE **data, DWORD *actual_data)
91 FIXME("(%p)->(%p,%p,%p): stub\n", iface, length, data, actual_data);
93 return E_NOTIMPL;
96 static HRESULT WINAPI IAudioDataImpl_SetActual(IAudioData* iface, DWORD data_valid)
98 FIXME("(%p)->(%u): stub\n", iface, data_valid);
100 return E_NOTIMPL;
103 /*** IAudioData methods ***/
104 static HRESULT WINAPI IAudioDataImpl_GetFormat(IAudioData* iface, WAVEFORMATEX *wave_format_current)
106 FIXME("(%p)->(%p): stub\n", iface, wave_format_current);
108 return E_NOTIMPL;
111 static HRESULT WINAPI IAudioDataImpl_SetFormat(IAudioData* iface, const WAVEFORMATEX *wave_format)
113 FIXME("(%p)->(%p): stub\n", iface, wave_format);
115 return E_NOTIMPL;
118 static const struct IAudioDataVtbl AudioData_Vtbl =
120 /*** IUnknown methods ***/
121 IAudioDataImpl_QueryInterface,
122 IAudioDataImpl_AddRef,
123 IAudioDataImpl_Release,
124 /*** IMemoryData methods ***/
125 IAudioDataImpl_SetBuffer,
126 IAudioDataImpl_GetInfo,
127 IAudioDataImpl_SetActual,
128 /*** IAudioData methods ***/
129 IAudioDataImpl_GetFormat,
130 IAudioDataImpl_SetFormat
133 HRESULT AMAudioData_create(IUnknown *pUnkOuter, LPVOID *ppObj)
135 AMAudioDataImpl *object;
137 TRACE("(%p,%p)\n", pUnkOuter, ppObj);
139 if (pUnkOuter)
140 return CLASS_E_NOAGGREGATION;
142 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(AMAudioDataImpl));
143 if (!object)
144 return E_OUTOFMEMORY;
146 object->IAudioData_iface.lpVtbl = &AudioData_Vtbl;
147 object->ref = 1;
149 *ppObj = &object->IAudioData_iface;
151 return S_OK;