mfreadwrite/reader: Enable DXGI device manager path.
[wine/zf.git] / dlls / qcap / audiorecord.c
blob4c5f6646953e2de8387b53c0789d10c794170f6d
1 /* Implementation of the Audio Capture Filter (CLSID_AudioRecord)
3 * Copyright 2015 Damjan Jovanovic
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #include "qcap_private.h"
22 WINE_DEFAULT_DEBUG_CHANNEL(qcap);
24 typedef struct {
25 struct strmbase_filter filter;
26 IPersistPropertyBag IPersistPropertyBag_iface;
27 } AudioRecord;
29 static inline AudioRecord *impl_from_strmbase_filter(struct strmbase_filter *filter)
31 return CONTAINING_RECORD(filter, AudioRecord, filter);
34 static inline AudioRecord *impl_from_IPersistPropertyBag(IPersistPropertyBag *iface)
36 return CONTAINING_RECORD(iface, AudioRecord, IPersistPropertyBag_iface);
39 static struct strmbase_pin *audio_record_get_pin(struct strmbase_filter *iface, unsigned int index)
41 FIXME("iface %p, index %u, stub!\n", iface, index);
42 return NULL;
45 static void audio_record_destroy(struct strmbase_filter *iface)
47 AudioRecord *filter = impl_from_strmbase_filter(iface);
49 strmbase_filter_cleanup(&filter->filter);
50 free(filter);
53 static HRESULT audio_record_query_interface(struct strmbase_filter *iface, REFIID iid, void **out)
55 AudioRecord *filter = impl_from_strmbase_filter(iface);
57 if (IsEqualGUID(iid, &IID_IPersistPropertyBag))
58 *out = &filter->IPersistPropertyBag_iface;
59 else
60 return E_NOINTERFACE;
62 IUnknown_AddRef((IUnknown *)*out);
63 return S_OK;
66 static const struct strmbase_filter_ops filter_ops =
68 .filter_get_pin = audio_record_get_pin,
69 .filter_destroy = audio_record_destroy,
70 .filter_query_interface = audio_record_query_interface,
73 static HRESULT WINAPI PPB_QueryInterface(IPersistPropertyBag *iface, REFIID riid, LPVOID *ppv)
75 AudioRecord *This = impl_from_IPersistPropertyBag(iface);
76 return IUnknown_QueryInterface(This->filter.outer_unk, riid, ppv);
79 static ULONG WINAPI PPB_AddRef(IPersistPropertyBag *iface)
81 AudioRecord *This = impl_from_IPersistPropertyBag(iface);
82 return IUnknown_AddRef(This->filter.outer_unk);
85 static ULONG WINAPI PPB_Release(IPersistPropertyBag *iface)
87 AudioRecord *This = impl_from_IPersistPropertyBag(iface);
88 return IUnknown_Release(This->filter.outer_unk);
91 static HRESULT WINAPI PPB_GetClassID(IPersistPropertyBag *iface, CLSID *pClassID)
93 AudioRecord *This = impl_from_IPersistPropertyBag(iface);
94 TRACE("(%p/%p)->(%p)\n", iface, This, pClassID);
95 return IBaseFilter_GetClassID(&This->filter.IBaseFilter_iface, pClassID);
98 static HRESULT WINAPI PPB_InitNew(IPersistPropertyBag *iface)
100 AudioRecord *This = impl_from_IPersistPropertyBag(iface);
101 FIXME("(%p/%p)->(): stub\n", iface, This);
102 return E_NOTIMPL;
105 static HRESULT WINAPI PPB_Load(IPersistPropertyBag *iface, IPropertyBag *pPropBag,
106 IErrorLog *pErrorLog)
108 AudioRecord *This = impl_from_IPersistPropertyBag(iface);
109 HRESULT hr;
110 VARIANT var;
112 TRACE("(%p/%p)->(%p, %p)\n", iface, This, pPropBag, pErrorLog);
114 V_VT(&var) = VT_I4;
115 hr = IPropertyBag_Read(pPropBag, L"WaveInID", &var, pErrorLog);
116 if (SUCCEEDED(hr))
118 FIXME("FIXME: implement opening waveIn device %d\n", V_I4(&var));
121 return hr;
124 static HRESULT WINAPI PPB_Save(IPersistPropertyBag *iface, IPropertyBag *pPropBag,
125 BOOL fClearDirty, BOOL fSaveAllProperties)
127 AudioRecord *This = impl_from_IPersistPropertyBag(iface);
128 FIXME("(%p/%p)->(%p, %u, %u): stub\n", iface, This, pPropBag, fClearDirty, fSaveAllProperties);
129 return E_NOTIMPL;
132 static const IPersistPropertyBagVtbl PersistPropertyBagVtbl =
134 PPB_QueryInterface,
135 PPB_AddRef,
136 PPB_Release,
137 PPB_GetClassID,
138 PPB_InitNew,
139 PPB_Load,
140 PPB_Save
143 HRESULT audio_record_create(IUnknown *outer, IUnknown **out)
145 AudioRecord *object;
147 if (!(object = calloc(1, sizeof(*object))))
148 return E_OUTOFMEMORY;
150 object->IPersistPropertyBag_iface.lpVtbl = &PersistPropertyBagVtbl;
151 strmbase_filter_init(&object->filter, outer, &CLSID_AudioRecord, &filter_ops);
153 TRACE("Created audio recorder %p.\n", object);
154 *out = &object->filter.IUnknown_inner;
155 return S_OK;