[STRMBASE]
[reactos.git] / reactos / lib / 3rdparty / strmbase / audio.c
1 /*
2 * Generic Implementation of strmbase audio classes
3 *
4 * Copyright 2012 Aric Stewart, CodeWeavers
5 *
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.
10 *
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.
15 *
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
19 */
20
21 #include "strmbase_private.h"
22
23 static inline BasicAudio *impl_from_IBasicAudio(IBasicAudio *iface)
24 {
25 return CONTAINING_RECORD(iface, BasicAudio, IBasicAudio_iface);
26 }
27
28 HRESULT WINAPI BasicAudio_Init(BasicAudio *pBasicAudio, const IBasicAudioVtbl *lpVtbl)
29 {
30 pBasicAudio->IBasicAudio_iface.lpVtbl = lpVtbl;
31 BaseDispatch_Init(&pBasicAudio->baseDispatch, &IID_IBasicAudio);
32
33 return S_OK;
34 }
35
36 HRESULT WINAPI BasicAudio_Destroy(BasicAudio *pBasicAudio)
37 {
38 return BaseDispatch_Destroy(&pBasicAudio->baseDispatch);
39 }
40
41 HRESULT WINAPI BasicAudioImpl_GetTypeInfoCount(IBasicAudio *iface, UINT *pctinfo)
42 {
43 BasicAudio *This = impl_from_IBasicAudio(iface);
44
45 return BaseDispatchImpl_GetTypeInfoCount(&This->baseDispatch, pctinfo);
46 }
47
48 HRESULT WINAPI BasicAudioImpl_GetTypeInfo(IBasicAudio *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
49 {
50 BasicAudio *This = impl_from_IBasicAudio(iface);
51
52 return BaseDispatchImpl_GetTypeInfo(&This->baseDispatch, &IID_NULL, iTInfo, lcid, ppTInfo);
53 }
54
55 HRESULT WINAPI BasicAudioImpl_GetIDsOfNames(IBasicAudio *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
56 {
57 BasicAudio *This = impl_from_IBasicAudio(iface);
58
59 return BaseDispatchImpl_GetIDsOfNames(&This->baseDispatch, riid, rgszNames, cNames, lcid, rgDispId);
60 }
61
62 HRESULT WINAPI BasicAudioImpl_Invoke(IBasicAudio *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExepInfo, UINT *puArgErr)
63 {
64 BasicAudio *This = impl_from_IBasicAudio(iface);
65 HRESULT hr = S_OK;
66 ITypeInfo *pTypeInfo;
67
68 hr = BaseDispatchImpl_GetTypeInfo(&This->baseDispatch, riid, 1, lcid, &pTypeInfo);
69 if (SUCCEEDED(hr))
70 {
71 hr = ITypeInfo_Invoke(pTypeInfo, &This->IBasicAudio_iface, dispIdMember, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
72 ITypeInfo_Release(pTypeInfo);
73 }
74
75 return hr;
76 }