[LWIP] Fix src/core/init.c a bit (#1620)
[reactos.git] / sdk / 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 #define COBJMACROS
22
23 #include <assert.h>
24 #include "dshow.h"
25 #include "uuids.h"
26 #include "vfwmsgs.h"
27 #include "wine/unicode.h"
28 #include "wine/strmbase.h"
29
30
31 static inline BasicAudio *impl_from_IBasicAudio(IBasicAudio *iface)
32 {
33 return CONTAINING_RECORD(iface, BasicAudio, IBasicAudio_iface);
34 }
35
36 HRESULT WINAPI BasicAudio_Init(BasicAudio *pBasicAudio, const IBasicAudioVtbl *lpVtbl)
37 {
38 pBasicAudio->IBasicAudio_iface.lpVtbl = lpVtbl;
39 BaseDispatch_Init(&pBasicAudio->baseDispatch, &IID_IBasicAudio);
40
41 return S_OK;
42 }
43
44 HRESULT WINAPI BasicAudio_Destroy(BasicAudio *pBasicAudio)
45 {
46 return BaseDispatch_Destroy(&pBasicAudio->baseDispatch);
47 }
48
49 HRESULT WINAPI BasicAudioImpl_GetTypeInfoCount(IBasicAudio *iface, UINT *pctinfo)
50 {
51 BasicAudio *This = impl_from_IBasicAudio(iface);
52
53 return BaseDispatchImpl_GetTypeInfoCount(&This->baseDispatch, pctinfo);
54 }
55
56 HRESULT WINAPI BasicAudioImpl_GetTypeInfo(IBasicAudio *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
57 {
58 BasicAudio *This = impl_from_IBasicAudio(iface);
59
60 return BaseDispatchImpl_GetTypeInfo(&This->baseDispatch, &IID_NULL, iTInfo, lcid, ppTInfo);
61 }
62
63 HRESULT WINAPI BasicAudioImpl_GetIDsOfNames(IBasicAudio *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
64 {
65 BasicAudio *This = impl_from_IBasicAudio(iface);
66
67 return BaseDispatchImpl_GetIDsOfNames(&This->baseDispatch, riid, rgszNames, cNames, lcid, rgDispId);
68 }
69
70 HRESULT WINAPI BasicAudioImpl_Invoke(IBasicAudio *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExepInfo, UINT *puArgErr)
71 {
72 BasicAudio *This = impl_from_IBasicAudio(iface);
73 ITypeInfo *pTypeInfo;
74 HRESULT hr;
75
76 hr = BaseDispatchImpl_GetTypeInfo(&This->baseDispatch, riid, 1, lcid, &pTypeInfo);
77 if (SUCCEEDED(hr))
78 {
79 hr = ITypeInfo_Invoke(pTypeInfo, &This->IBasicAudio_iface, dispIdMember, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
80 ITypeInfo_Release(pTypeInfo);
81 }
82
83 return hr;
84 }