2 * Copyright 2022 Nikolay Sivov for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include "wine/mfinternal.h"
24 #include "mfsrcsnk_private.h"
26 #include "wine/debug.h"
28 WINE_DEFAULT_DEBUG_CHANNEL(mfplat
);
32 IClassFactory IClassFactory_iface
;
33 HRESULT (*create_instance
)(REFIID riid
, void **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 riid
, void **out
)
43 if (IsEqualGUID(riid
, &IID_IClassFactory
) ||
44 IsEqualGUID(riid
, &IID_IUnknown
))
46 IClassFactory_AddRef(iface
);
52 WARN("Interface %s is not supported.\n", debugstr_guid(riid
));
56 static ULONG WINAPI
class_factory_AddRef(IClassFactory
*iface
)
61 static ULONG WINAPI
class_factory_Release(IClassFactory
*iface
)
66 static HRESULT WINAPI
class_factory_CreateInstance(IClassFactory
*iface
, IUnknown
*outer
,
67 REFIID riid
, void **out
)
69 struct class_factory
*factory
= impl_from_IClassFactory(iface
);
71 TRACE("%p, %s, %p.\n", outer
, debugstr_guid(riid
), out
);
76 return CLASS_E_NOAGGREGATION
;
78 return factory
->create_instance(riid
, out
);
81 static HRESULT WINAPI
class_factory_LockServer(IClassFactory
*iface
, BOOL dolock
)
83 FIXME("%p, %d.\n", iface
, dolock
);
88 static const IClassFactoryVtbl class_factory_vtbl
=
90 class_factory_QueryInterface
,
92 class_factory_Release
,
93 class_factory_CreateInstance
,
94 class_factory_LockServer
,
97 static struct class_factory wave_sink_factory
= { { &class_factory_vtbl
}, wave_sink_factory_create
};
99 /***********************************************************************
100 * DllGetClassObject (mfsrcsnk.@)
102 HRESULT WINAPI
DllGetClassObject(REFCLSID clsid
, REFIID riid
, void **out
)
106 if (IsEqualGUID(clsid
, &CLSID_MFWAVESinkClassFactory
))
108 return IClassFactory_QueryInterface(&wave_sink_factory
.IClassFactory_iface
, riid
, out
);
112 FIXME("Unknown clsid %s.\n", debugstr_guid(clsid
));
113 return CLASS_E_CLASSNOTAVAILABLE
;