ReactOS 0.4.17-dev-966-gf06eace
qcap_main.c
Go to the documentation of this file.
1/*
2 * DirectShow capture
3 *
4 * Copyright (C) 2003 Dominik Strasser
5 * Copyright (C) 2005 Rolf Kalbermatter
6 * Copyright (C) 2019 Zebediah Figura
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 */
22
23#define WINE_NO_NAMELESS_EXTENSION
24
25#include "qcap_private.h"
26#include "rpcproxy.h"
27
29
30struct class_factory
31{
34};
35
37{
39}
40
42{
43 TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out);
44
46 {
47 *out = iface;
48 IClassFactory_AddRef(iface);
49 return S_OK;
50 }
51
52 *out = NULL;
53 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid));
54 return E_NOINTERFACE;
55}
56
58{
59 return 2;
60}
61
63{
64 return 1;
65}
66
68{
70 IUnknown *unk;
71 HRESULT hr;
72
73 TRACE("iface %p, outer %p, iid %s, out %p.\n", iface, outer, debugstr_guid(iid), out);
74
75 if (outer && !IsEqualGUID(iid, &IID_IUnknown))
76 return E_NOINTERFACE;
77
78 *out = NULL;
79 if (SUCCEEDED(hr = factory->create_instance(outer, &unk)))
80 {
81 hr = IUnknown_QueryInterface(unk, iid, out);
82 IUnknown_Release(unk);
83 }
84 return hr;
85}
86
88{
89 TRACE("iface %p, lock %d.\n", iface, lock);
90 return S_OK;
91}
92
93static const IClassFactoryVtbl class_factory_vtbl =
94{
100};
101
109
111{
112 struct class_factory *factory;
113
114 TRACE("clsid %s, iid %s, out %p.\n", debugstr_guid(clsid), debugstr_guid(iid), out);
115
116 if (IsEqualGUID(clsid, &CLSID_AudioRecord))
118 else if (IsEqualGUID(clsid, &CLSID_AVICo))
120 else if (IsEqualGUID(clsid, &CLSID_AviDest))
122 else if (IsEqualGUID(clsid, &CLSID_CaptureGraphBuilder))
124 else if (IsEqualGUID(clsid, &CLSID_CaptureGraphBuilder2))
126 else if (IsEqualGUID(clsid, &CLSID_FileWriter))
128 else if (IsEqualGUID(clsid, &CLSID_SmartTee))
130 else if (IsEqualGUID(clsid, &CLSID_VfwCapture))
132 else
133 {
134 FIXME("%s not implemented, returning CLASS_E_CLASSNOTAVAILABLE.\n", debugstr_guid(clsid));
136 }
137
138 return IClassFactory_QueryInterface(&factory->IClassFactory_iface, iid, out);
139}
140
141static const REGPINTYPES reg_avi_mux_sink_mt = {&MEDIATYPE_Stream, &MEDIASUBTYPE_Avi};
142
144{
145 {
146 .cInstances = 1,
147 .nMediaTypes = 1,
148 .lpMediaType = &reg_avi_mux_sink_mt,
149 },
150};
151
153{
154 .dwVersion = 2,
155 .dwMerit = MERIT_DO_NOT_USE,
156 .u.s2.cPins2 = 1,
157 .u.s2.rgPins2 = reg_avi_mux_pins,
158};
159
160static const REGPINTYPES reg_video_mt = {&MEDIATYPE_Video, &GUID_NULL};
161
163{
164 {
165 .cInstances = 1,
166 .nMediaTypes = 1,
167 .lpMediaType = &reg_video_mt,
168 },
169 {
170 .dwFlags = REG_PINFLAG_B_OUTPUT,
171 .cInstances = 1,
172 .nMediaTypes = 1,
173 .lpMediaType = &reg_video_mt,
174 },
175 {
176 .dwFlags = REG_PINFLAG_B_OUTPUT,
177 .cInstances = 1,
178 .nMediaTypes = 1,
179 .lpMediaType = &reg_video_mt,
180 },
181};
182
184{
185 .dwVersion = 2,
186 .dwMerit = MERIT_DO_NOT_USE,
187 .u.s2.cPins2 = 3,
188 .u.s2.rgPins2 = reg_smart_tee_pins,
189};
190
192
194{
195 {
196 .cInstances = 1,
197 .nMediaTypes = 1,
198 .lpMediaType = &reg_file_writer_sink_mt,
199 },
200};
201
203{
204 .dwVersion = 2,
205 .dwMerit = MERIT_DO_NOT_USE,
206 .u.s2.cPins2 = 1,
207 .u.s2.rgPins2 = reg_file_writer_pins,
208};
209
210/***********************************************************************
211 * DllRegisterServer (QCAP.@)
212 */
214{
215 IFilterMapper2 *mapper;
216 HRESULT hr;
217
219 return hr;
220
221 if (FAILED(hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER,
222 &IID_IFilterMapper2, (void **)&mapper)))
223 return hr;
224
225 IFilterMapper2_RegisterFilter(mapper, &CLSID_AviDest, L"AVI Mux",
227 IFilterMapper2_RegisterFilter(mapper, &CLSID_FileWriter, L"File writer",
229 IFilterMapper2_RegisterFilter(mapper, &CLSID_SmartTee, L"Smart Tee",
231
232 IFilterMapper2_Release(mapper);
233 return S_OK;
234}
235
236/***********************************************************************
237 * DllUnregisterServer (QCAP.@)
238 */
240{
241 IFilterMapper2 *mapper;
242 HRESULT hr;
243
245 return hr;
246
247 if (FAILED(hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER,
248 &IID_IFilterMapper2, (void **)&mapper)))
249 return hr;
250
251 IFilterMapper2_UnregisterFilter(mapper, NULL, NULL, &CLSID_AviDest);
252 IFilterMapper2_UnregisterFilter(mapper, NULL, NULL, &CLSID_FileWriter);
253 IFilterMapper2_UnregisterFilter(mapper, NULL, NULL, &CLSID_SmartTee);
254
255 IFilterMapper2_Release(mapper);
256 return S_OK;
257}
HRESULT audio_record_create(IUnknown *outer, IUnknown **out)
Definition: audiorecord.c:791
HRESULT avi_compressor_create(IUnknown *outer, IUnknown **out)
Definition: avico.c:472
HRESULT avi_mux_create(IUnknown *outer, IUnknown **out)
Definition: avimux.c:1842
REGPINTYPES
Definition: axextend.idl:194
@ REG_PINFLAG_B_OUTPUT
Definition: axextend.idl:221
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
HRESULT __wine_unregister_resources(HMODULE module)
Definition: register.c:124
HRESULT __wine_register_resources(HMODULE module)
Definition: register.c:112
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
const GUID IID_IUnknown
const GUID IID_IClassFactory
HRESULT capture_graph_create(IUnknown *outer, IUnknown **out)
Definition: capturegraph.c:51
HRESULT hr
Definition: delayimp.cpp:582
#define NULL
Definition: types.h:112
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, IUnknown *outer, DWORD cls_context, REFIID riid, void **obj)
Definition: combase.c:1685
#define L(x)
Definition: resources.c:13
#define MERIT_DO_NOT_USE
Definition: precomp.h:18
unsigned int BOOL
Definition: ntddk_ex.h:94
HRESULT file_writer_create(IUnknown *outer, IUnknown **out)
Definition: filewriter.c:316
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
#define debugstr_guid
Definition: kernel32.h:35
#define GUID_NULL
Definition: ks.h:106
static IUnknown * outer
Definition: compobj.c:82
const CLSID * clsid
Definition: msctf.cpp:50
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define REFIID
Definition: guiddef.h:118
#define REFCLSID
Definition: guiddef.h:117
static struct class_factory avi_compressor_cf
Definition: qcap_main.c:103
static struct class_factory capture_graph_cf
Definition: qcap_main.c:105
HRESULT WINAPI DllRegisterServer(void)
Definition: qcap_main.c:213
static struct class_factory audio_record_cf
Definition: qcap_main.c:102
HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID iid, void **out)
Definition: qcap_main.c:110
static const IClassFactoryVtbl class_factory_vtbl
Definition: qcap_main.c:93
static const REGFILTERPINS2 reg_file_writer_pins[1]
Definition: qcap_main.c:193
static const REGFILTERPINS2 reg_avi_mux_pins[1]
Definition: qcap_main.c:143
HRESULT WINAPI DllUnregisterServer(void)
Definition: qcap_main.c:239
static struct class_factory smart_tee_cf
Definition: qcap_main.c:107
static ULONG WINAPI class_factory_Release(IClassFactory *iface)
Definition: qcap_main.c:62
static const REGFILTER2 reg_avi_mux
Definition: qcap_main.c:152
static const REGFILTERPINS2 reg_smart_tee_pins[3]
Definition: qcap_main.c:162
static struct class_factory file_writer_cf
Definition: qcap_main.c:106
static const REGFILTER2 reg_file_writer
Definition: qcap_main.c:202
static struct class_factory vfw_capture_cf
Definition: qcap_main.c:108
static HRESULT WINAPI class_factory_LockServer(IClassFactory *iface, BOOL lock)
Definition: qcap_main.c:87
static HRESULT WINAPI class_factory_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID iid, void **out)
Definition: qcap_main.c:67
static struct class_factory avi_mux_cf
Definition: qcap_main.c:104
static const REGPINTYPES reg_video_mt
Definition: qcap_main.c:160
static const REGPINTYPES reg_file_writer_sink_mt
Definition: qcap_main.c:191
static const REGFILTER2 reg_smart_tee
Definition: qcap_main.c:183
static ULONG WINAPI class_factory_AddRef(IClassFactory *iface)
Definition: qcap_main.c:57
static struct class_factory * impl_from_IClassFactory(IClassFactory *iface)
Definition: qcap_main.c:36
static HRESULT WINAPI class_factory_QueryInterface(IClassFactory *iface, REFIID iid, void **out)
Definition: qcap_main.c:41
static const REGPINTYPES reg_avi_mux_sink_mt
Definition: qcap_main.c:141
HRESULT vfw_capture_create(IUnknown *outer, IUnknown **out)
Definition: vfwcapture.c:984
HRESULT smart_tee_create(IUnknown *outer, IUnknown **out)
#define TRACE(s)
Definition: solgame.cpp:4
DWORD dwVersion
Definition: axextend.idl:238
HRESULT(* create_instance)(IUnknown *outer, IUnknown **out)
Definition: qcap_main.c:33
IClassFactory IClassFactory_iface
Definition: devenum_main.c:30
Definition: main.c:439
IClassFactory IClassFactory_iface
Definition: main.c:440
rwlock_t lock
Definition: tcpcore.h:0
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383
#define HRESULT
Definition: msvc.h:7
#define WINAPI
Definition: msvc.h:6
#define E_NOINTERFACE
Definition: winerror.h:3479
#define CLASS_E_CLASSNOTAVAILABLE
Definition: winerror.h:3772