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(qasf
);
25 static HINSTANCE qasf_instance
;
29 IClassFactory IClassFactory_iface
;
30 HRESULT (*create_instance
)(IUnknown
*outer
, IUnknown
**out
);
33 static struct class_factory
*impl_from_IClassFactory(IClassFactory
*iface
)
35 return CONTAINING_RECORD(iface
, struct class_factory
, IClassFactory_iface
);
38 static HRESULT WINAPI
class_factory_QueryInterface(IClassFactory
*iface
, REFIID iid
, void **out
)
40 TRACE("iface %p, iid %s, out %p.\n", iface
, debugstr_guid(iid
), out
);
42 if (IsEqualGUID(iid
, &IID_IUnknown
) || IsEqualGUID(iid
, &IID_IClassFactory
))
44 IClassFactory_AddRef(iface
);
50 WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(iid
));
54 static ULONG WINAPI
class_factory_AddRef(IClassFactory
*iface
)
59 static ULONG WINAPI
class_factory_Release(IClassFactory
*iface
)
64 static HRESULT WINAPI
class_factory_CreateInstance(IClassFactory
*iface
,
65 IUnknown
*outer
, REFIID iid
, void **out
)
67 struct class_factory
*factory
= impl_from_IClassFactory(iface
);
71 TRACE("iface %p, outer %p, iid %s, out %p.\n", iface
, outer
, debugstr_guid(iid
), out
);
75 if (outer
&& !IsEqualGUID(iid
, &IID_IUnknown
))
78 if (SUCCEEDED(hr
= factory
->create_instance(outer
, &unk
)))
80 hr
= IUnknown_QueryInterface(unk
, iid
, out
);
81 IUnknown_Release(unk
);
86 static HRESULT WINAPI
class_factory_LockServer(IClassFactory
*iface
, BOOL lock
)
88 FIXME("lock %d, stub!\n", lock
);
92 static const IClassFactoryVtbl class_factory_vtbl
=
94 class_factory_QueryInterface
,
96 class_factory_Release
,
97 class_factory_CreateInstance
,
98 class_factory_LockServer
,
101 static struct class_factory asf_reader_cf
= {{&class_factory_vtbl
}, asf_reader_create
};
102 static struct class_factory dmo_wrapper_cf
= {{&class_factory_vtbl
}, dmo_wrapper_create
};
104 BOOL WINAPI
DllMain(HINSTANCE instance
, DWORD reason
, void *reserved
)
106 if (reason
== DLL_PROCESS_ATTACH
)
108 DisableThreadLibraryCalls(instance
);
109 qasf_instance
= instance
;
111 else if (reason
== DLL_PROCESS_DETACH
&& !reserved
)
113 strmbase_release_typelibs();
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_DMOWrapperFilter
))
123 return IClassFactory_QueryInterface(&dmo_wrapper_cf
.IClassFactory_iface
, iid
, out
);
124 if (IsEqualGUID(clsid
, &CLSID_WMAsfReader
))
125 return IClassFactory_QueryInterface(&asf_reader_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
DllCanUnloadNow(void)
136 HRESULT WINAPI
DllRegisterServer(void)
138 return __wine_register_resources(qasf_instance
);
141 HRESULT WINAPI
DllUnregisterServer(void)
143 return __wine_unregister_resources(qasf_instance
);