winewayland.drv: Update desktop window size on display changes.
[wine.git] / dlls / qcap / qcap_main.c
blobcd4a6ebc0ab72a699a2bacc46d00ede57c165672
1 /*
2 * DirectShow capture
4 * Copyright (C) 2003 Dominik Strasser
5 * Copyright (C) 2005 Rolf Kalbermatter
6 * Copyright (C) 2019 Zebediah Figura
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.
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.
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
23 #define WINE_NO_NAMELESS_EXTENSION
25 #include "qcap_private.h"
26 #include "rpcproxy.h"
28 WINE_DEFAULT_DEBUG_CHANNEL(quartz);
30 struct class_factory
32 IClassFactory IClassFactory_iface;
33 HRESULT (*create_instance)(IUnknown *outer, IUnknown **out);
36 static inline struct class_factory *impl_from_IClassFactory(IClassFactory *iface)
38 return CONTAINING_RECORD(iface, struct class_factory, IClassFactory_iface);
41 static HRESULT WINAPI class_factory_QueryInterface(IClassFactory *iface, REFIID iid, void **out)
43 TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out);
45 if (IsEqualGUID(iid, &IID_IUnknown) || IsEqualGUID(iid, &IID_IClassFactory))
47 *out = iface;
48 IClassFactory_AddRef(iface);
49 return S_OK;
52 *out = NULL;
53 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid));
54 return E_NOINTERFACE;
57 static ULONG WINAPI class_factory_AddRef(IClassFactory *iface)
59 return 2;
62 static ULONG WINAPI class_factory_Release(IClassFactory *iface)
64 return 1;
67 static HRESULT WINAPI class_factory_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID iid, void **out)
69 struct class_factory *factory = impl_from_IClassFactory(iface);
70 IUnknown *unk;
71 HRESULT hr;
73 TRACE("iface %p, outer %p, iid %s, out %p.\n", iface, outer, debugstr_guid(iid), out);
75 if (outer && !IsEqualGUID(iid, &IID_IUnknown))
76 return E_NOINTERFACE;
78 *out = NULL;
79 if (SUCCEEDED(hr = factory->create_instance(outer, &unk)))
81 hr = IUnknown_QueryInterface(unk, iid, out);
82 IUnknown_Release(unk);
84 return hr;
87 static HRESULT WINAPI class_factory_LockServer(IClassFactory *iface, BOOL lock)
89 TRACE("iface %p, lock %d.\n", iface, lock);
90 return S_OK;
93 static const IClassFactoryVtbl class_factory_vtbl =
95 class_factory_QueryInterface,
96 class_factory_AddRef,
97 class_factory_Release,
98 class_factory_CreateInstance,
99 class_factory_LockServer,
102 static struct class_factory audio_record_cf = {{&class_factory_vtbl}, audio_record_create};
103 static struct class_factory avi_compressor_cf = {{&class_factory_vtbl}, avi_compressor_create};
104 static struct class_factory avi_mux_cf = {{&class_factory_vtbl}, avi_mux_create};
105 static struct class_factory capture_graph_cf = {{&class_factory_vtbl}, capture_graph_create};
106 static struct class_factory file_writer_cf = {{&class_factory_vtbl}, file_writer_create};
107 static struct class_factory smart_tee_cf = {{&class_factory_vtbl}, smart_tee_create};
108 static struct class_factory vfw_capture_cf = {{&class_factory_vtbl}, vfw_capture_create};
110 HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID iid, void **out)
112 struct class_factory *factory;
114 TRACE("clsid %s, iid %s, out %p.\n", debugstr_guid(clsid), debugstr_guid(iid), out);
116 if (IsEqualGUID(clsid, &CLSID_AudioRecord))
117 factory = &audio_record_cf;
118 else if (IsEqualGUID(clsid, &CLSID_AVICo))
119 factory = &avi_compressor_cf;
120 else if (IsEqualGUID(clsid, &CLSID_AviDest))
121 factory = &avi_mux_cf;
122 else if (IsEqualGUID(clsid, &CLSID_CaptureGraphBuilder))
123 factory = &capture_graph_cf;
124 else if (IsEqualGUID(clsid, &CLSID_CaptureGraphBuilder2))
125 factory = &capture_graph_cf;
126 else if (IsEqualGUID(clsid, &CLSID_FileWriter))
127 factory = &file_writer_cf;
128 else if (IsEqualGUID(clsid, &CLSID_SmartTee))
129 factory = &smart_tee_cf;
130 else if (IsEqualGUID(clsid, &CLSID_VfwCapture))
131 factory = &vfw_capture_cf;
132 else
134 FIXME("%s not implemented, returning CLASS_E_CLASSNOTAVAILABLE.\n", debugstr_guid(clsid));
135 return CLASS_E_CLASSNOTAVAILABLE;
138 return IClassFactory_QueryInterface(&factory->IClassFactory_iface, iid, out);
141 static const REGPINTYPES reg_avi_mux_sink_mt = {&MEDIATYPE_Stream, &MEDIASUBTYPE_Avi};
143 static const REGFILTERPINS2 reg_avi_mux_pins[1] =
146 .cInstances = 1,
147 .nMediaTypes = 1,
148 .lpMediaType = &reg_avi_mux_sink_mt,
152 static const REGFILTER2 reg_avi_mux =
154 .dwVersion = 2,
155 .dwMerit = MERIT_DO_NOT_USE,
156 .u.s2.cPins2 = 1,
157 .u.s2.rgPins2 = reg_avi_mux_pins,
160 static const REGPINTYPES reg_video_mt = {&MEDIATYPE_Video, &GUID_NULL};
162 static const REGFILTERPINS2 reg_smart_tee_pins[3] =
165 .cInstances = 1,
166 .nMediaTypes = 1,
167 .lpMediaType = &reg_video_mt,
170 .dwFlags = REG_PINFLAG_B_OUTPUT,
171 .cInstances = 1,
172 .nMediaTypes = 1,
173 .lpMediaType = &reg_video_mt,
176 .dwFlags = REG_PINFLAG_B_OUTPUT,
177 .cInstances = 1,
178 .nMediaTypes = 1,
179 .lpMediaType = &reg_video_mt,
183 static const REGFILTER2 reg_smart_tee =
185 .dwVersion = 2,
186 .dwMerit = MERIT_DO_NOT_USE,
187 .u.s2.cPins2 = 3,
188 .u.s2.rgPins2 = reg_smart_tee_pins,
191 static const REGPINTYPES reg_file_writer_sink_mt = {&GUID_NULL, &GUID_NULL};
193 static const REGFILTERPINS2 reg_file_writer_pins[1] =
196 .cInstances = 1,
197 .nMediaTypes = 1,
198 .lpMediaType = &reg_file_writer_sink_mt,
202 static const REGFILTER2 reg_file_writer =
204 .dwVersion = 2,
205 .dwMerit = MERIT_DO_NOT_USE,
206 .u.s2.cPins2 = 1,
207 .u.s2.rgPins2 = reg_file_writer_pins,
210 /***********************************************************************
211 * DllRegisterServer (QCAP.@)
213 HRESULT WINAPI DllRegisterServer(void)
215 IFilterMapper2 *mapper;
216 HRESULT hr;
218 if (FAILED(hr = __wine_register_resources()))
219 return hr;
221 if (FAILED(hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER,
222 &IID_IFilterMapper2, (void **)&mapper)))
223 return hr;
225 IFilterMapper2_RegisterFilter(mapper, &CLSID_AviDest, L"AVI Mux",
226 NULL, NULL, NULL, &reg_avi_mux);
227 IFilterMapper2_RegisterFilter(mapper, &CLSID_FileWriter, L"File writer",
228 NULL, NULL, NULL, &reg_file_writer);
229 IFilterMapper2_RegisterFilter(mapper, &CLSID_SmartTee, L"Smart Tee",
230 NULL, NULL, NULL, &reg_smart_tee);
232 IFilterMapper2_Release(mapper);
233 return S_OK;
236 /***********************************************************************
237 * DllUnregisterServer (QCAP.@)
239 HRESULT WINAPI DllUnregisterServer(void)
241 IFilterMapper2 *mapper;
242 HRESULT hr;
244 if (FAILED(hr = __wine_unregister_resources()))
245 return hr;
247 if (FAILED(hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER,
248 &IID_IFilterMapper2, (void **)&mapper)))
249 return hr;
251 IFilterMapper2_UnregisterFilter(mapper, NULL, NULL, &CLSID_AviDest);
252 IFilterMapper2_UnregisterFilter(mapper, NULL, NULL, &CLSID_FileWriter);
253 IFilterMapper2_UnregisterFilter(mapper, NULL, NULL, &CLSID_SmartTee);
255 IFilterMapper2_Release(mapper);
256 return S_OK;