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"
26 #include "amstream_private.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(amstream
);
33 IAudioData IAudioData_iface
;
37 static inline AMAudioDataImpl
*impl_from_IAudioData(IAudioData
*iface
)
39 return CONTAINING_RECORD(iface
, AMAudioDataImpl
, IAudioData_iface
);
42 /*** IUnknown methods ***/
43 static HRESULT WINAPI
IAudioDataImpl_QueryInterface(IAudioData
*iface
, REFIID riid
, void **ret_iface
)
45 TRACE("(%p)->(%s,%p)\n", iface
, debugstr_guid(riid
), ret_iface
);
47 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
48 IsEqualGUID(riid
, &IID_IMemoryData
) ||
49 IsEqualGUID(riid
, &IID_IAudioData
))
51 IAudioData_AddRef(iface
);
56 ERR("(%p)->(%s,%p),not found\n", iface
, debugstr_guid(riid
), ret_iface
);
60 static ULONG WINAPI
IAudioDataImpl_AddRef(IAudioData
* iface
)
62 AMAudioDataImpl
*This
= impl_from_IAudioData(iface
);
63 ULONG ref
= InterlockedIncrement(&This
->ref
);
65 TRACE("(%p)->(): new ref = %u\n", iface
, This
->ref
);
70 static ULONG WINAPI
IAudioDataImpl_Release(IAudioData
* iface
)
72 AMAudioDataImpl
*This
= impl_from_IAudioData(iface
);
73 ULONG ref
= InterlockedDecrement(&This
->ref
);
75 TRACE("(%p)->(): new ref = %u\n", iface
, This
->ref
);
78 HeapFree(GetProcessHeap(), 0, This
);
83 /*** IMemoryData methods ***/
84 static HRESULT WINAPI
IAudioDataImpl_SetBuffer(IAudioData
* iface
, DWORD size
, BYTE
*data
, DWORD flags
)
86 FIXME("(%p)->(%u,%p,%x): stub\n", iface
, size
, data
, flags
);
91 static HRESULT WINAPI
IAudioDataImpl_GetInfo(IAudioData
* iface
, DWORD
*length
, BYTE
**data
, DWORD
*actual_data
)
93 FIXME("(%p)->(%p,%p,%p): stub\n", iface
, length
, data
, actual_data
);
98 static HRESULT WINAPI
IAudioDataImpl_SetActual(IAudioData
* iface
, DWORD data_valid
)
100 FIXME("(%p)->(%u): stub\n", iface
, data_valid
);
105 /*** IAudioData methods ***/
106 static HRESULT WINAPI
IAudioDataImpl_GetFormat(IAudioData
* iface
, WAVEFORMATEX
*wave_format_current
)
108 FIXME("(%p)->(%p): stub\n", iface
, wave_format_current
);
113 static HRESULT WINAPI
IAudioDataImpl_SetFormat(IAudioData
* iface
, const WAVEFORMATEX
*wave_format
)
115 FIXME("(%p)->(%p): stub\n", iface
, wave_format
);
120 static const struct IAudioDataVtbl AudioData_Vtbl
=
122 /*** IUnknown methods ***/
123 IAudioDataImpl_QueryInterface
,
124 IAudioDataImpl_AddRef
,
125 IAudioDataImpl_Release
,
126 /*** IMemoryData methods ***/
127 IAudioDataImpl_SetBuffer
,
128 IAudioDataImpl_GetInfo
,
129 IAudioDataImpl_SetActual
,
130 /*** IAudioData methods ***/
131 IAudioDataImpl_GetFormat
,
132 IAudioDataImpl_SetFormat
135 HRESULT
AMAudioData_create(IUnknown
*pUnkOuter
, LPVOID
*ppObj
)
137 AMAudioDataImpl
*object
;
139 TRACE("(%p,%p)\n", pUnkOuter
, ppObj
);
142 return CLASS_E_NOAGGREGATION
;
144 object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(AMAudioDataImpl
));
147 ERR("Out of memory\n");
148 return E_OUTOFMEMORY
;
151 object
->IAudioData_iface
.lpVtbl
= &AudioData_Vtbl
;
154 *ppObj
= &object
->IAudioData_iface
;