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"
28 WINE_DEFAULT_DEBUG_CHANNEL(quartz
);
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
))
48 IClassFactory_AddRef(iface
);
53 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid
));
57 static ULONG WINAPI
class_factory_AddRef(IClassFactory
*iface
)
62 static ULONG WINAPI
class_factory_Release(IClassFactory
*iface
)
67 static HRESULT WINAPI
class_factory_CreateInstance(IClassFactory
*iface
, IUnknown
*outer
, REFIID iid
, void **out
)
69 struct class_factory
*factory
= impl_from_IClassFactory(iface
);
73 TRACE("iface %p, outer %p, iid %s, out %p.\n", iface
, outer
, debugstr_guid(iid
), out
);
75 if (outer
&& !IsEqualGUID(iid
, &IID_IUnknown
))
79 if (SUCCEEDED(hr
= factory
->create_instance(outer
, &unk
)))
81 hr
= IUnknown_QueryInterface(unk
, iid
, out
);
82 IUnknown_Release(unk
);
87 static HRESULT WINAPI
class_factory_LockServer(IClassFactory
*iface
, BOOL lock
)
89 TRACE("iface %p, lock %d.\n", iface
, lock
);
93 static const IClassFactoryVtbl class_factory_vtbl
=
95 class_factory_QueryInterface
,
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
;
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] =
148 .lpMediaType
= ®_avi_mux_sink_mt
,
152 static const REGFILTER2 reg_avi_mux
=
155 .dwMerit
= MERIT_DO_NOT_USE
,
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] =
167 .lpMediaType
= ®_video_mt
,
170 .dwFlags
= REG_PINFLAG_B_OUTPUT
,
173 .lpMediaType
= ®_video_mt
,
176 .dwFlags
= REG_PINFLAG_B_OUTPUT
,
179 .lpMediaType
= ®_video_mt
,
183 static const REGFILTER2 reg_smart_tee
=
186 .dwMerit
= MERIT_DO_NOT_USE
,
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] =
198 .lpMediaType
= ®_file_writer_sink_mt
,
202 static const REGFILTER2 reg_file_writer
=
205 .dwMerit
= MERIT_DO_NOT_USE
,
207 .u
.s2
.rgPins2
= reg_file_writer_pins
,
210 /***********************************************************************
211 * DllRegisterServer (QCAP.@)
213 HRESULT WINAPI
DllRegisterServer(void)
215 IFilterMapper2
*mapper
;
218 if (FAILED(hr
= __wine_register_resources()))
221 if (FAILED(hr
= CoCreateInstance(&CLSID_FilterMapper2
, NULL
, CLSCTX_INPROC_SERVER
,
222 &IID_IFilterMapper2
, (void **)&mapper
)))
225 IFilterMapper2_RegisterFilter(mapper
, &CLSID_AviDest
, L
"AVI Mux",
226 NULL
, NULL
, NULL
, ®_avi_mux
);
227 IFilterMapper2_RegisterFilter(mapper
, &CLSID_FileWriter
, L
"File writer",
228 NULL
, NULL
, NULL
, ®_file_writer
);
229 IFilterMapper2_RegisterFilter(mapper
, &CLSID_SmartTee
, L
"Smart Tee",
230 NULL
, NULL
, NULL
, ®_smart_tee
);
232 IFilterMapper2_Release(mapper
);
236 /***********************************************************************
237 * DllUnregisterServer (QCAP.@)
239 HRESULT WINAPI
DllUnregisterServer(void)
241 IFilterMapper2
*mapper
;
244 if (FAILED(hr
= __wine_unregister_resources()))
247 if (FAILED(hr
= CoCreateInstance(&CLSID_FilterMapper2
, NULL
, CLSCTX_INPROC_SERVER
,
248 &IID_IFilterMapper2
, (void **)&mapper
)))
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
);