2003-06-13 20:06:44 +02:00
|
|
|
/* DirectShow Base Functions (QUARTZ.DLL)
|
|
|
|
*
|
|
|
|
* Copyright 2002 Lionel Ulmer
|
|
|
|
*
|
|
|
|
* This file contains the (internal) driver registration functions,
|
|
|
|
* driver enumeration APIs and DirectDraw creation functions.
|
|
|
|
*
|
|
|
|
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
2003-01-02 18:55:45 +01:00
|
|
|
#include "wine/debug.h"
|
|
|
|
|
2003-06-13 20:06:44 +02:00
|
|
|
#include "quartz_private.h"
|
2003-01-02 18:55:45 +01:00
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
|
|
|
|
|
2003-06-13 20:06:44 +02:00
|
|
|
static DWORD dll_ref = 0;
|
2003-01-02 18:55:45 +01:00
|
|
|
|
2003-06-13 20:06:44 +02:00
|
|
|
/* For the moment, do nothing here. */
|
|
|
|
BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
|
|
|
|
{
|
|
|
|
switch(fdwReason) {
|
|
|
|
case DLL_PROCESS_ATTACH:
|
2003-06-30 22:53:48 +02:00
|
|
|
DisableThreadLibraryCalls(hInstDLL);
|
2003-06-13 20:06:44 +02:00
|
|
|
break;
|
|
|
|
case DLL_PROCESS_DETACH:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* DirectShow ClassFactory
|
2003-01-02 18:55:45 +01:00
|
|
|
*/
|
2003-06-13 20:06:44 +02:00
|
|
|
typedef struct {
|
|
|
|
IClassFactory ITF_IClassFactory;
|
|
|
|
|
|
|
|
DWORD ref;
|
|
|
|
HRESULT (*pfnCreateInstance)(IUnknown *pUnkOuter, LPVOID *ppObj);
|
|
|
|
} IClassFactoryImpl;
|
|
|
|
|
|
|
|
struct object_creation_info
|
|
|
|
{
|
|
|
|
const CLSID *clsid;
|
|
|
|
HRESULT (*pfnCreateInstance)(IUnknown *pUnkOuter, LPVOID *ppObj);
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct object_creation_info object_creation[] =
|
|
|
|
{
|
2005-05-05 11:50:35 +02:00
|
|
|
{ &CLSID_FilterGraph, FilterGraph_create },
|
|
|
|
{ &CLSID_FilterGraphNoThread, FilterGraphNoThread_create },
|
2003-07-01 06:29:48 +02:00
|
|
|
{ &CLSID_FilterMapper, FilterMapper2_create },
|
|
|
|
{ &CLSID_FilterMapper2, FilterMapper2_create },
|
2003-08-07 01:00:14 +02:00
|
|
|
{ &CLSID_AsyncReader, AsyncReader_create },
|
2003-09-11 23:18:36 +02:00
|
|
|
{ &CLSID_MemoryAllocator, StdMemAllocator_create },
|
2003-11-18 21:47:48 +01:00
|
|
|
{ &CLSID_AviSplitter, AVISplitter_create },
|
2004-08-24 04:28:35 +02:00
|
|
|
{ &CLSID_VideoRenderer, VideoRenderer_create },
|
|
|
|
{ &CLSID_DSoundRender, DSoundRender_create },
|
|
|
|
{ &CLSID_AVIDec, AVIDec_create },
|
2005-02-01 15:22:00 +01:00
|
|
|
{ &CLSID_SystemClock, &QUARTZ_CreateSystemClock },
|
2005-02-10 18:13:18 +01:00
|
|
|
{ &CLSID_ACMWrapper, &ACMWrapper_create },
|
|
|
|
{ &CLSID_WAVEParser, &WAVEParser_create }
|
2003-06-13 20:06:44 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
static HRESULT WINAPI
|
|
|
|
DSCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj)
|
2003-01-02 18:55:45 +01:00
|
|
|
{
|
2004-09-08 03:50:37 +02:00
|
|
|
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
|
|
|
if (IsEqualGUID(riid, &IID_IUnknown)
|
|
|
|
|| IsEqualGUID(riid, &IID_IClassFactory))
|
|
|
|
{
|
|
|
|
IClassFactory_AddRef(iface);
|
|
|
|
*ppobj = This;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
2004-09-28 21:19:27 +02:00
|
|
|
static ULONG WINAPI DSCF_AddRef(LPCLASSFACTORY iface)
|
|
|
|
{
|
2004-09-08 03:50:37 +02:00
|
|
|
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
2004-09-28 21:19:27 +02:00
|
|
|
return InterlockedIncrement(&This->ref);
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2004-09-28 21:19:27 +02:00
|
|
|
static ULONG WINAPI DSCF_Release(LPCLASSFACTORY iface)
|
|
|
|
{
|
2004-09-08 03:50:37 +02:00
|
|
|
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2004-09-28 21:19:27 +02:00
|
|
|
ULONG ref = InterlockedDecrement(&This->ref);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
|
|
|
if (ref == 0)
|
|
|
|
HeapFree(GetProcessHeap(), 0, This);
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI DSCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter,
|
2004-09-28 21:19:27 +02:00
|
|
|
REFIID riid, LPVOID *ppobj)
|
|
|
|
{
|
2004-09-08 03:50:37 +02:00
|
|
|
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
2003-06-13 20:06:44 +02:00
|
|
|
HRESULT hres;
|
|
|
|
LPUNKNOWN punk;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
|
|
|
|
|
2004-09-28 21:19:27 +02:00
|
|
|
*ppobj = NULL;
|
2003-06-13 20:06:44 +02:00
|
|
|
hres = This->pfnCreateInstance(pOuter, (LPVOID *) &punk);
|
2004-09-28 21:19:27 +02:00
|
|
|
if (SUCCEEDED(hres)) {
|
|
|
|
hres = IUnknown_QueryInterface(punk, riid, ppobj);
|
|
|
|
IUnknown_Release(punk);
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
return hres;
|
|
|
|
}
|
|
|
|
|
2004-09-28 21:19:27 +02:00
|
|
|
static HRESULT WINAPI DSCF_LockServer(LPCLASSFACTORY iface,BOOL dolock)
|
|
|
|
{
|
2004-09-08 03:50:37 +02:00
|
|
|
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
2003-06-13 20:06:44 +02:00
|
|
|
FIXME("(%p)->(%d),stub!\n",This,dolock);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2004-08-13 01:00:51 +02:00
|
|
|
static IClassFactoryVtbl DSCF_Vtbl =
|
2003-06-13 20:06:44 +02:00
|
|
|
{
|
|
|
|
DSCF_QueryInterface,
|
|
|
|
DSCF_AddRef,
|
|
|
|
DSCF_Release,
|
|
|
|
DSCF_CreateInstance,
|
|
|
|
DSCF_LockServer
|
|
|
|
};
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
* DllGetClassObject [QUARTZ.@]
|
|
|
|
* Retrieves class object from a DLL object
|
|
|
|
*
|
|
|
|
* NOTES
|
|
|
|
* Docs say returns STDAPI
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* rclsid [I] CLSID for the class object
|
|
|
|
* riid [I] Reference to identifier of interface for class object
|
|
|
|
* ppv [O] Address of variable to receive interface pointer for riid
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: S_OK
|
|
|
|
* Failure: CLASS_E_CLASSNOTAVAILABLE, E_OUTOFMEMORY, E_INVALIDARG,
|
|
|
|
* E_UNEXPECTED
|
|
|
|
*/
|
2005-05-17 16:41:37 +02:00
|
|
|
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
|
2003-06-13 20:06:44 +02:00
|
|
|
{
|
2004-09-22 04:46:38 +02:00
|
|
|
unsigned int i;
|
2003-06-13 20:06:44 +02:00
|
|
|
IClassFactoryImpl *factory;
|
|
|
|
|
|
|
|
TRACE("(%s,%s,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
|
|
|
|
|
|
|
|
if ( !IsEqualGUID( &IID_IClassFactory, riid )
|
|
|
|
&& ! IsEqualGUID( &IID_IUnknown, riid) )
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
|
|
|
|
for (i=0; i < sizeof(object_creation)/sizeof(object_creation[0]); i++)
|
|
|
|
{
|
|
|
|
if (IsEqualGUID(object_creation[i].clsid, rclsid))
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i == sizeof(object_creation)/sizeof(object_creation[0]))
|
|
|
|
{
|
|
|
|
FIXME("%s: no class found.\n", debugstr_guid(rclsid));
|
|
|
|
return CLASS_E_CLASSNOTAVAILABLE;
|
|
|
|
}
|
|
|
|
|
|
|
|
factory = HeapAlloc(GetProcessHeap(), 0, sizeof(*factory));
|
|
|
|
if (factory == NULL) return E_OUTOFMEMORY;
|
|
|
|
|
|
|
|
factory->ITF_IClassFactory.lpVtbl = &DSCF_Vtbl;
|
|
|
|
factory->ref = 1;
|
|
|
|
|
|
|
|
factory->pfnCreateInstance = object_creation[i].pfnCreateInstance;
|
|
|
|
|
|
|
|
*ppv = &(factory->ITF_IClassFactory);
|
|
|
|
return S_OK;
|
2003-01-02 18:55:45 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2003-06-13 20:06:44 +02:00
|
|
|
* DllCanUnloadNow (QUARTZ.@)
|
2003-01-02 18:55:45 +01:00
|
|
|
*/
|
2005-05-17 16:41:37 +02:00
|
|
|
HRESULT WINAPI DllCanUnloadNow()
|
2003-01-02 18:55:45 +01:00
|
|
|
{
|
|
|
|
return dll_ref != 0 ? S_FALSE : S_OK;
|
|
|
|
}
|
2003-08-07 00:04:45 +02:00
|
|
|
|
|
|
|
|
2005-03-02 13:23:20 +01:00
|
|
|
#define OUR_GUID_ENTRY(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
|
|
|
|
{ { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } } , #name },
|
|
|
|
|
2003-08-07 00:04:45 +02:00
|
|
|
static struct {
|
|
|
|
const GUID riid;
|
2003-10-08 00:54:17 +02:00
|
|
|
const char *name;
|
2003-08-07 00:04:45 +02:00
|
|
|
} InterfaceDesc[] =
|
|
|
|
{
|
2005-03-02 13:23:20 +01:00
|
|
|
#include "uuids.h"
|
|
|
|
{ { 0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0} }, NULL }
|
2003-08-07 00:04:45 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* qzdebugstr_guid (internal)
|
|
|
|
*
|
|
|
|
* Gives a text version of DirectShow GUIDs
|
|
|
|
*/
|
|
|
|
const char * qzdebugstr_guid( const GUID * id )
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
char * name = NULL;
|
|
|
|
|
|
|
|
for (i=0;InterfaceDesc[i].name && !name;i++) {
|
|
|
|
if (IsEqualGUID(&InterfaceDesc[i].riid, id)) return InterfaceDesc[i].name;
|
|
|
|
}
|
|
|
|
return debugstr_guid(id);
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* qzdebugstr_State (internal)
|
|
|
|
*
|
|
|
|
* Gives a text version of the FILTER_STATE enumeration
|
|
|
|
*/
|
|
|
|
const char * qzdebugstr_State(FILTER_STATE state)
|
|
|
|
{
|
|
|
|
switch (state)
|
|
|
|
{
|
|
|
|
case State_Stopped:
|
|
|
|
return "State_Stopped";
|
|
|
|
case State_Running:
|
|
|
|
return "State_Running";
|
|
|
|
case State_Paused:
|
|
|
|
return "State_Paused";
|
|
|
|
default:
|
|
|
|
return "State_Unknown";
|
|
|
|
}
|
|
|
|
}
|
2004-09-06 22:23:42 +02:00
|
|
|
|
2004-10-08 23:01:44 +02:00
|
|
|
LONG WINAPI AmpFactorToDB(LONG ampfactor)
|
2004-09-06 22:23:42 +02:00
|
|
|
{
|
|
|
|
FIXME("(%ld) Stub!\n", ampfactor);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2004-10-08 23:01:44 +02:00
|
|
|
LONG WINAPI DBToAmpFactor(LONG db)
|
2004-09-06 22:23:42 +02:00
|
|
|
{
|
|
|
|
FIXME("(%ld) Stub!\n", db);
|
|
|
|
/* Avoid divide by zero (probably during range computation) in Windows Media Player 6.4 */
|
|
|
|
if (db < -1000)
|
|
|
|
return 0;
|
|
|
|
return 100;
|
|
|
|
}
|