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
);
25 struct strmbase_filter filter
;
26 IPersistPropertyBag IPersistPropertyBag_iface
;
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
);
45 static void audio_record_destroy(struct strmbase_filter
*iface
)
47 AudioRecord
*filter
= impl_from_strmbase_filter(iface
);
49 strmbase_filter_cleanup(&filter
->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
;
62 IUnknown_AddRef((IUnknown
*)*out
);
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
);
105 static HRESULT WINAPI
PPB_Load(IPersistPropertyBag
*iface
, IPropertyBag
*pPropBag
,
106 IErrorLog
*pErrorLog
)
108 AudioRecord
*This
= impl_from_IPersistPropertyBag(iface
);
112 TRACE("(%p/%p)->(%p, %p)\n", iface
, This
, pPropBag
, pErrorLog
);
115 hr
= IPropertyBag_Read(pPropBag
, L
"WaveInID", &var
, pErrorLog
);
118 FIXME("FIXME: implement opening waveIn device %d\n", V_I4(&var
));
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
);
132 static const IPersistPropertyBagVtbl PersistPropertyBagVtbl
=
143 HRESULT
audio_record_create(IUnknown
*outer
, IUnknown
**out
)
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
;