mf: Subscribe standard quality manager to clock state change events.
[wine/zf.git] / dlls / qdvd / qdvd_main.c
blob2fdb108877da33684e777961297f86764b79b8df
1 /*
2 * DirectShow DVD support
4 * Copyright 2009 Austin English
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 "qdvd_private.h"
22 #include "rpcproxy.h"
24 WINE_DEFAULT_DEBUG_CHANNEL(qdvd);
26 static HINSTANCE qdvd_instance;
28 struct class_factory
30 IClassFactory IClassFactory_iface;
31 HRESULT (*create_instance)(IUnknown *outer, IUnknown **out);
34 static struct class_factory *impl_from_IClassFactory(IClassFactory *iface)
36 return CONTAINING_RECORD(iface, struct class_factory, IClassFactory_iface);
39 static HRESULT WINAPI class_factory_QueryInterface(IClassFactory *iface, REFIID iid, void **out)
41 TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out);
43 if (IsEqualGUID(iid, &IID_IUnknown) || IsEqualGUID(iid, &IID_IClassFactory))
45 IClassFactory_AddRef(iface);
46 *out = iface;
47 return S_OK;
50 *out = NULL;
51 WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(iid));
52 return E_NOINTERFACE;
55 static ULONG WINAPI class_factory_AddRef(IClassFactory *iface)
57 return 2;
60 static ULONG WINAPI class_factory_Release(IClassFactory *iface)
62 return 1;
65 static HRESULT WINAPI class_factory_CreateInstance(IClassFactory *iface,
66 IUnknown *outer, REFIID iid, void **out)
68 struct class_factory *factory = impl_from_IClassFactory(iface);
69 IUnknown *unk;
70 HRESULT hr;
72 TRACE("iface %p, outer %p, iid %s, out %p.\n", iface, outer, debugstr_guid(iid), out);
74 *out = NULL;
76 if (outer && !IsEqualGUID(iid, &IID_IUnknown))
77 return E_NOINTERFACE;
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 FIXME("lock %d, stub!\n", 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 graph_builder_cf = {{&class_factory_vtbl}, graph_builder_create};
103 static struct class_factory navigator_cf = {{&class_factory_vtbl}, navigator_create};
105 BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved)
107 if (reason == DLL_WINE_PREATTACH)
108 return FALSE; /* prefer native version */
110 if (reason == DLL_PROCESS_ATTACH)
112 qdvd_instance = instance;
113 DisableThreadLibraryCalls(instance);
115 return TRUE;
118 HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID iid, void **out)
120 TRACE("clsid %s, iid %s, out %p.\n", debugstr_guid(clsid), debugstr_guid(iid), out);
122 if (IsEqualGUID(clsid, &CLSID_DvdGraphBuilder))
123 return IClassFactory_QueryInterface(&graph_builder_cf.IClassFactory_iface, iid, out);
124 if (IsEqualGUID(clsid, &CLSID_DVDNavigator))
125 return IClassFactory_QueryInterface(&navigator_cf.IClassFactory_iface, iid, out);
127 FIXME("%s not available, returning CLASS_E_CLASSNOTAVAILABLE.\n", debugstr_guid(clsid));
128 return CLASS_E_CLASSNOTAVAILABLE;
131 HRESULT WINAPI DllRegisterServer(void)
133 return __wine_register_resources(qdvd_instance);
136 HRESULT WINAPI DllUnregisterServer(void)
138 return __wine_unregister_resources(qdvd_instance);
141 HRESULT WINAPI DllCanUnloadNow(void)
143 return S_FALSE;