maintainers: Update the Direct3D section.
[wine.git] / dlls / qasf / qasf_main.c
blobd32a9da12b5dfe1d05fd1a9e9c62c1c4a7ea92ca
1 /*
2 * DirectShow ASF filters
4 * Copyright (C) 2019 Zebediah Figura
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "qasf_private.h"
23 WINE_DEFAULT_DEBUG_CHANNEL(quartz);
25 struct class_factory
27 IClassFactory IClassFactory_iface;
28 HRESULT (*create_instance)(IUnknown *outer, IUnknown **out);
31 static struct class_factory *impl_from_IClassFactory(IClassFactory *iface)
33 return CONTAINING_RECORD(iface, struct class_factory, IClassFactory_iface);
36 static HRESULT WINAPI class_factory_QueryInterface(IClassFactory *iface, REFIID iid, void **out)
38 TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out);
40 if (IsEqualGUID(iid, &IID_IUnknown) || IsEqualGUID(iid, &IID_IClassFactory))
42 IClassFactory_AddRef(iface);
43 *out = iface;
44 return S_OK;
47 *out = NULL;
48 WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(iid));
49 return E_NOINTERFACE;
52 static ULONG WINAPI class_factory_AddRef(IClassFactory *iface)
54 return 2;
57 static ULONG WINAPI class_factory_Release(IClassFactory *iface)
59 return 1;
62 static HRESULT WINAPI class_factory_CreateInstance(IClassFactory *iface,
63 IUnknown *outer, REFIID iid, void **out)
65 struct class_factory *factory = impl_from_IClassFactory(iface);
66 IUnknown *unk;
67 HRESULT hr;
69 TRACE("iface %p, outer %p, iid %s, out %p.\n", iface, outer, debugstr_guid(iid), out);
71 *out = NULL;
73 if (outer && !IsEqualGUID(iid, &IID_IUnknown))
74 return E_NOINTERFACE;
76 if (SUCCEEDED(hr = factory->create_instance(outer, &unk)))
78 hr = IUnknown_QueryInterface(unk, iid, out);
79 IUnknown_Release(unk);
81 return hr;
84 static HRESULT WINAPI class_factory_LockServer(IClassFactory *iface, BOOL lock)
86 FIXME("lock %d, stub!\n", lock);
87 return S_OK;
90 static const IClassFactoryVtbl class_factory_vtbl =
92 class_factory_QueryInterface,
93 class_factory_AddRef,
94 class_factory_Release,
95 class_factory_CreateInstance,
96 class_factory_LockServer,
99 static struct class_factory asf_reader_cf = {{&class_factory_vtbl}, asf_reader_create};
100 static struct class_factory dmo_wrapper_cf = {{&class_factory_vtbl}, dmo_wrapper_create};
102 BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved)
104 if (reason == DLL_PROCESS_ATTACH)
106 DisableThreadLibraryCalls(instance);
108 else if (reason == DLL_PROCESS_DETACH && !reserved)
110 strmbase_release_typelibs();
112 return TRUE;
115 HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID iid, void **out)
117 TRACE("clsid %s, iid %s, out %p.\n", debugstr_guid(clsid), debugstr_guid(iid), out);
119 if (IsEqualGUID(clsid, &CLSID_DMOWrapperFilter))
120 return IClassFactory_QueryInterface(&dmo_wrapper_cf.IClassFactory_iface, iid, out);
121 if (IsEqualGUID(clsid, &CLSID_WMAsfReader))
122 return IClassFactory_QueryInterface(&asf_reader_cf.IClassFactory_iface, iid, out);
124 FIXME("%s not available, returning CLASS_E_CLASSNOTAVAILABLE.\n", debugstr_guid(clsid));
125 return CLASS_E_CLASSNOTAVAILABLE;