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
);
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
);
48 WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(iid
));
52 static ULONG WINAPI
class_factory_AddRef(IClassFactory
*iface
)
57 static ULONG WINAPI
class_factory_Release(IClassFactory
*iface
)
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
);
69 TRACE("iface %p, outer %p, iid %s, out %p.\n", iface
, outer
, debugstr_guid(iid
), out
);
73 if (outer
&& !IsEqualGUID(iid
, &IID_IUnknown
))
76 if (SUCCEEDED(hr
= factory
->create_instance(outer
, &unk
)))
78 hr
= IUnknown_QueryInterface(unk
, iid
, out
);
79 IUnknown_Release(unk
);
84 static HRESULT WINAPI
class_factory_LockServer(IClassFactory
*iface
, BOOL lock
)
86 FIXME("lock %d, stub!\n", lock
);
90 static const IClassFactoryVtbl class_factory_vtbl
=
92 class_factory_QueryInterface
,
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();
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
;