2010-12-03 14:33:08 +01:00
|
|
|
/*
|
2010-12-11 14:25:28 +01:00
|
|
|
* DirectShow filter for QuickTime Toolkit on Mac OS X
|
2010-12-03 14:33:08 +01:00
|
|
|
*
|
|
|
|
* Copyright (C) 2010 Aric Stewart, CodeWeavers
|
2020-03-08 20:05:10 +01:00
|
|
|
* Copyright (C) 2019 Zebediah Figura
|
2010-12-03 14:33:08 +01:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#define COBJMACROS
|
|
|
|
#define NONAMELESSSTRUCT
|
|
|
|
#define NONAMELESSUNION
|
2021-03-25 22:23:11 +01:00
|
|
|
#define WINE_NO_NAMELESS_EXTENSION
|
2010-12-03 14:33:08 +01:00
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "wingdi.h"
|
|
|
|
#include "winerror.h"
|
|
|
|
#include "objbase.h"
|
|
|
|
#include "uuids.h"
|
|
|
|
#include "strmif.h"
|
2012-04-04 19:31:42 +02:00
|
|
|
#include "rpcproxy.h"
|
2010-12-03 14:33:08 +01:00
|
|
|
|
|
|
|
#include "wine/unicode.h"
|
|
|
|
#include "wine/debug.h"
|
|
|
|
#include "wine/strmbase.h"
|
|
|
|
|
2020-03-08 20:05:10 +01:00
|
|
|
#include "wineqtdecoder_classes.h"
|
|
|
|
|
2010-12-03 14:33:08 +01:00
|
|
|
#include "initguid.h"
|
2012-04-04 19:31:42 +02:00
|
|
|
DEFINE_GUID(WINESUBTYPE_QTSplitter, 0xFFFFFFFF, 0x5927, 0x4894, 0xA3,0x86, 0x35,0x94,0x60,0xEE,0x87,0xC9);
|
2010-12-03 14:33:08 +01:00
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(qtdecoder);
|
|
|
|
|
2020-03-08 20:05:10 +01:00
|
|
|
extern HRESULT video_decoder_create(IUnknown *outer, IUnknown **out);
|
|
|
|
extern HRESULT qt_splitter_create(IUnknown *outer, IUnknown **out);
|
2010-12-03 14:33:08 +01:00
|
|
|
|
|
|
|
static const WCHAR wQTVName[] =
|
|
|
|
{'Q','T',' ','V','i','d','e','o',' ','D','e','c','o','d','e','r',0};
|
2011-04-05 19:56:00 +02:00
|
|
|
static const WCHAR wQTDName[] =
|
|
|
|
{'Q','T',' ','V','i','d','e','o',' ','D','e','m','u','x',0};
|
2020-03-08 20:05:10 +01:00
|
|
|
|
|
|
|
struct class_factory
|
|
|
|
{
|
|
|
|
IClassFactory IClassFactory_iface;
|
|
|
|
HRESULT (*create_instance)(IUnknown *outer, IUnknown **out);
|
2010-12-03 14:33:08 +01:00
|
|
|
};
|
|
|
|
|
2020-03-08 20:05:10 +01:00
|
|
|
static inline struct class_factory *impl_from_IClassFactory(IClassFactory *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, struct class_factory, IClassFactory_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI class_factory_QueryInterface(IClassFactory *iface, REFIID iid, void **out)
|
|
|
|
{
|
|
|
|
TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out);
|
|
|
|
|
|
|
|
if (IsEqualGUID(iid, &IID_IUnknown) || IsEqualGUID(iid, &IID_IClassFactory))
|
2011-04-05 19:56:00 +02:00
|
|
|
{
|
2020-03-08 20:05:10 +01:00
|
|
|
*out = iface;
|
|
|
|
IClassFactory_AddRef(iface);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
*out = NULL;
|
|
|
|
WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid));
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI class_factory_AddRef(IClassFactory *iface)
|
|
|
|
{
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI class_factory_Release(IClassFactory *iface)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI class_factory_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID iid, void **out)
|
|
|
|
{
|
|
|
|
struct class_factory *factory = impl_from_IClassFactory(iface);
|
|
|
|
IUnknown *unk;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE("iface %p, outer %p, iid %s, out %p.\n", iface, outer, debugstr_guid(iid), out);
|
|
|
|
|
|
|
|
if (outer && !IsEqualGUID(iid, &IID_IUnknown))
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
|
|
|
|
*out = NULL;
|
|
|
|
if (SUCCEEDED(hr = factory->create_instance(outer, &unk)))
|
2011-04-05 19:56:00 +02:00
|
|
|
{
|
2020-03-08 20:05:10 +01:00
|
|
|
hr = IUnknown_QueryInterface(unk, iid, out);
|
|
|
|
IUnknown_Release(unk);
|
|
|
|
}
|
|
|
|
return hr;
|
|
|
|
}
|
2011-04-05 19:56:00 +02:00
|
|
|
|
2020-03-08 20:05:10 +01:00
|
|
|
static HRESULT WINAPI class_factory_LockServer(IClassFactory *iface, BOOL lock)
|
|
|
|
{
|
|
|
|
TRACE("iface %p, lock %d.\n", iface, lock);
|
|
|
|
return S_OK;
|
|
|
|
}
|
2010-12-03 14:33:08 +01:00
|
|
|
|
2020-03-08 20:05:10 +01:00
|
|
|
static const IClassFactoryVtbl class_factory_vtbl =
|
|
|
|
{
|
|
|
|
class_factory_QueryInterface,
|
|
|
|
class_factory_AddRef,
|
|
|
|
class_factory_Release,
|
|
|
|
class_factory_CreateInstance,
|
|
|
|
class_factory_LockServer,
|
2011-04-05 19:56:00 +02:00
|
|
|
};
|
|
|
|
|
2020-03-08 20:05:10 +01:00
|
|
|
static struct class_factory qt_splitter_cf = {{&class_factory_vtbl}, qt_splitter_create};
|
|
|
|
static struct class_factory video_decoder_cf = {{&class_factory_vtbl}, video_decoder_create};
|
|
|
|
|
|
|
|
HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID iid, void **out)
|
|
|
|
{
|
|
|
|
struct class_factory *factory;
|
|
|
|
|
|
|
|
TRACE("clsid %s, iid %s, out %p.\n", debugstr_guid(clsid), debugstr_guid(iid), out);
|
|
|
|
|
|
|
|
if (IsEqualGUID(clsid, &CLSID_QTSplitter))
|
|
|
|
factory = &qt_splitter_cf;
|
|
|
|
else if (IsEqualGUID(clsid, &CLSID_QTVDecoder))
|
|
|
|
factory = &video_decoder_cf;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
FIXME("%s not implemented, returning CLASS_E_CLASSNOTAVAILABLE.\n", debugstr_guid(clsid));
|
|
|
|
return CLASS_E_CLASSNOTAVAILABLE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return IClassFactory_QueryInterface(&factory->IClassFactory_iface, iid, out);
|
|
|
|
}
|
|
|
|
|
|
|
|
static const REGPINTYPES reg_audio_mt = {&MEDIATYPE_Audio, &GUID_NULL};
|
|
|
|
static const REGPINTYPES reg_stream_mt = {&MEDIATYPE_Stream, &GUID_NULL};
|
|
|
|
static const REGPINTYPES reg_video_mt = {&MEDIATYPE_Video, &GUID_NULL};
|
|
|
|
|
|
|
|
static const REGFILTERPINS2 reg_qt_splitter_pins[3] =
|
|
|
|
{
|
2010-12-03 14:33:08 +01:00
|
|
|
{
|
2020-03-08 20:05:10 +01:00
|
|
|
.nMediaTypes = 1,
|
|
|
|
.lpMediaType = ®_stream_mt,
|
2011-04-05 19:56:00 +02:00
|
|
|
},
|
|
|
|
{
|
2020-03-08 20:05:10 +01:00
|
|
|
.dwFlags = REG_PINFLAG_B_OUTPUT | REG_PINFLAG_B_ZERO,
|
|
|
|
.nMediaTypes = 1,
|
|
|
|
.lpMediaType = ®_audio_mt,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.dwFlags = REG_PINFLAG_B_OUTPUT | REG_PINFLAG_B_ZERO,
|
|
|
|
.nMediaTypes = 1,
|
|
|
|
.lpMediaType = ®_video_mt,
|
|
|
|
},
|
2010-12-03 14:33:08 +01:00
|
|
|
};
|
|
|
|
|
2020-03-08 20:05:10 +01:00
|
|
|
static const REGFILTER2 reg_qt_splitter =
|
|
|
|
{
|
|
|
|
.dwVersion = 2,
|
|
|
|
.dwMerit = MERIT_NORMAL - 1,
|
|
|
|
.u.s2.cPins2 = 3,
|
|
|
|
.u.s2.rgPins2 = reg_qt_splitter_pins,
|
|
|
|
};
|
2010-12-03 14:33:08 +01:00
|
|
|
|
2020-03-11 04:03:27 +01:00
|
|
|
static const REGFILTERPINS2 reg_video_decoder_pins[2] =
|
2010-12-03 14:33:08 +01:00
|
|
|
{
|
2020-03-08 20:05:10 +01:00
|
|
|
{
|
|
|
|
.nMediaTypes = 1,
|
|
|
|
.lpMediaType = ®_video_mt,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.dwFlags = REG_PINFLAG_B_OUTPUT,
|
|
|
|
.nMediaTypes = 1,
|
|
|
|
.lpMediaType = ®_video_mt,
|
|
|
|
},
|
|
|
|
};
|
2010-12-03 14:33:08 +01:00
|
|
|
|
2020-03-08 20:05:10 +01:00
|
|
|
static const REGFILTER2 reg_video_decoder =
|
2010-12-03 14:33:08 +01:00
|
|
|
{
|
2020-03-08 20:05:10 +01:00
|
|
|
.dwVersion = 2,
|
|
|
|
.dwMerit = MERIT_NORMAL - 1,
|
|
|
|
.u.s2.cPins2 = 2,
|
|
|
|
.u.s2.rgPins2 = reg_video_decoder_pins,
|
|
|
|
};
|
2010-12-03 14:33:08 +01:00
|
|
|
|
|
|
|
HRESULT WINAPI DllRegisterServer(void)
|
|
|
|
{
|
2020-03-08 20:05:10 +01:00
|
|
|
IFilterMapper2 *mapper;
|
2012-04-04 19:31:42 +02:00
|
|
|
HRESULT hr;
|
2020-03-08 20:05:10 +01:00
|
|
|
|
|
|
|
TRACE(".\n");
|
|
|
|
|
2021-04-30 13:40:11 +02:00
|
|
|
if (FAILED(hr = __wine_register_resources()))
|
2020-03-08 20:05:10 +01:00
|
|
|
return hr;
|
|
|
|
|
|
|
|
if (FAILED(hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER,
|
|
|
|
&IID_IFilterMapper2, (void **)&mapper)))
|
|
|
|
return hr;
|
|
|
|
|
|
|
|
IFilterMapper2_RegisterFilter(mapper, &CLSID_QTSplitter, wQTDName, NULL, NULL, NULL, ®_qt_splitter);
|
|
|
|
IFilterMapper2_RegisterFilter(mapper, &CLSID_QTVDecoder, wQTVName, NULL, NULL, NULL, ®_video_decoder);
|
|
|
|
|
|
|
|
IFilterMapper2_Release(mapper);
|
|
|
|
return S_OK;
|
2010-12-03 14:33:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI DllUnregisterServer(void)
|
|
|
|
{
|
2020-03-08 20:05:10 +01:00
|
|
|
IFilterMapper2 *mapper;
|
2012-04-04 19:31:42 +02:00
|
|
|
HRESULT hr;
|
2020-03-08 20:05:10 +01:00
|
|
|
|
|
|
|
TRACE(".\n");
|
|
|
|
|
2021-04-30 13:40:11 +02:00
|
|
|
if (FAILED(hr = __wine_unregister_resources()))
|
2020-03-08 20:05:10 +01:00
|
|
|
return hr;
|
|
|
|
|
|
|
|
if (FAILED(hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER,
|
|
|
|
&IID_IFilterMapper2, (void **)&mapper)))
|
|
|
|
return hr;
|
|
|
|
|
|
|
|
IFilterMapper2_UnregisterFilter(mapper, NULL, NULL, &CLSID_QTSplitter);
|
|
|
|
IFilterMapper2_UnregisterFilter(mapper, NULL, NULL, &CLSID_QTVDecoder);
|
|
|
|
|
|
|
|
IFilterMapper2_Release(mapper);
|
|
|
|
return S_OK;
|
2010-12-03 14:33:08 +01:00
|
|
|
}
|