Added some stubs for quartz dll.

This commit is contained in:
Hidenori Takeshima 2001-08-15 19:26:52 +00:00 committed by Alexandre Julliard
parent 14366a927a
commit fb96436931
16 changed files with 1093 additions and 19 deletions

View File

@ -9,7 +9,14 @@ LDDLLFLAGS = @LDDLLFLAGS@
SYMBOLFILE = $(MODULE).tmp.o
C_SRCS = \
main.c
fgraph.c \
ifgraph.c \
imem.c \
irclock.c \
iunk.c \
main.c \
memalloc.c \
sysclock.c
@MAKE_DLL_RULES@

52
dlls/quartz/fgraph.c Normal file
View File

@ -0,0 +1,52 @@
/*
* Implementation of CLSID_FilterGraph.
*
* FIXME - stub.
*
* hidenori@a2.ctktv.ne.jp
*/
#include "config.h"
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winerror.h"
#include "wine/obj_base.h"
#include "strmif.h"
#include "uuids.h"
#include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(quartz);
#include "quartz_private.h"
#include "fgraph.h"
/* can I use offsetof safely? - FIXME? */
static QUARTZ_IFEntry IFEntries[] =
{
{ &IID_IFilterGraph, offsetof(CFilterGraph,fgraph)-offsetof(CFilterGraph,unk) },
{ &IID_IGraphBuilder, offsetof(CFilterGraph,fgraph)-offsetof(CFilterGraph,unk) },
{ &IID_IFilterGraph2, offsetof(CFilterGraph,fgraph)-offsetof(CFilterGraph,unk) },
};
HRESULT QUARTZ_CreateFilterGraph(IUnknown* punkOuter,void** ppobj)
{
CFilterGraph* pfg;
TRACE("(%p,%p)\n",punkOuter,ppobj);
pfg = (CFilterGraph*)QUARTZ_AllocObj( sizeof(CFilterGraph) );
if ( pfg == NULL )
return E_OUTOFMEMORY;
QUARTZ_IUnkInit( &pfg->unk );
CFilterGraph_InitIFilterGraph2( pfg );
pfg->unk.pEntries = IFEntries;
pfg->unk.dwEntries = sizeof(IFEntries)/sizeof(IFEntries[0]);
*ppobj = (void*)pfg;
return S_OK;
}

41
dlls/quartz/fgraph.h Normal file
View File

@ -0,0 +1,41 @@
#ifndef WINE_DSHOW_FGRAPH_H
#define WINE_DSHOW_FGRAPH_H
/*
implements CLSID_FilterGraph.
- At least, the following interfaces should be implemented:
IUnknown
+ IFilterGraph - IGraphBuilder - IFilterGraph2
+ IDispatch - IMediaControl
+ IDispatch - IMediaEvent - IMediaEventEx
+ IMediaSeeking
+ IDispatch - IBasicVideo (pass to a renderer)
+ IDispatch - IBasicAudio (pass to a renderer)
+ IDispatch - IVideoWindow (pass to a renderer)
*/
#include "iunk.h"
typedef struct FG_IFilterGraph2Impl
{
ICOM_VFIELD(IFilterGraph2);
} FG_IFilterGraph2Impl;
typedef struct CFilterGraph
{
QUARTZ_IUnkImpl unk;
FG_IFilterGraph2Impl fgraph;
/* IFilterGraph2 fields. */
} CFilterGraph;
#define CFilterGraph_THIS(iface,member) CFilterGraph* This = ((CFilterGraph*)(((char*)iface)-offsetof(CFilterGraph,member)))
HRESULT QUARTZ_CreateFilterGraph(IUnknown* punkOuter,void** ppobj);
void CFilterGraph_InitIFilterGraph2( CFilterGraph* pfg );
#endif /* WINE_DSHOW_FGRAPH_H */

260
dlls/quartz/ifgraph.c Normal file
View File

@ -0,0 +1,260 @@
/*
* Implementation of IFilterGraph.
*
* FIXME - stub.
* FIXME - implement IGraphBuilder / IFilterGraph2.
*
* hidenori@a2.ctktv.ne.jp
*/
#include "config.h"
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winerror.h"
#include "wine/obj_base.h"
#include "strmif.h"
#include "uuids.h"
#include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(quartz);
#include "quartz_private.h"
#include "fgraph.h"
static HRESULT WINAPI
IFilterGraph2_fnQueryInterface(IFilterGraph2* iface,REFIID riid,void** ppobj)
{
CFilterGraph_THIS(iface,fgraph);
TRACE("(%p)->()\n",This);
return IUnknown_QueryInterface((IUnknown*)(&This->unk),riid,ppobj);
}
static ULONG WINAPI
IFilterGraph2_fnAddRef(IFilterGraph2* iface)
{
CFilterGraph_THIS(iface,fgraph);
TRACE("(%p)->()\n",This);
return IUnknown_AddRef((IUnknown*)(&This->unk));
}
static ULONG WINAPI
IFilterGraph2_fnRelease(IFilterGraph2* iface)
{
CFilterGraph_THIS(iface,fgraph);
TRACE("(%p)->()\n",This);
return IUnknown_Release((IUnknown*)(&This->unk));
}
static HRESULT WINAPI
IFilterGraph2_fnAddFilter(IFilterGraph2* iface,IBaseFilter* pFilter, LPCWSTR pName)
{
CFilterGraph_THIS(iface,fgraph);
FIXME( "(%p)->() stub!\n", This );
return E_NOTIMPL;
}
static HRESULT WINAPI
IFilterGraph2_fnRemoveFilter(IFilterGraph2* iface,IBaseFilter* pFilter)
{
CFilterGraph_THIS(iface,fgraph);
FIXME( "(%p)->() stub!\n", This );
return E_NOTIMPL;
}
static HRESULT WINAPI
IFilterGraph2_fnEnumFilters(IFilterGraph2* iface,IEnumFilters** ppEnum)
{
CFilterGraph_THIS(iface,fgraph);
FIXME( "(%p)->() stub!\n", This );
return E_NOTIMPL;
}
static HRESULT WINAPI
IFilterGraph2_fnFindFilterByName(IFilterGraph2* iface,LPCWSTR pName,IBaseFilter** ppFilter)
{
CFilterGraph_THIS(iface,fgraph);
FIXME( "(%p)->() stub!\n", This );
return E_NOTIMPL;
}
static HRESULT WINAPI
IFilterGraph2_fnConnectDirect(IFilterGraph2* iface,IPin* pOut,IPin* pIn,const AM_MEDIA_TYPE* pmt)
{
CFilterGraph_THIS(iface,fgraph);
FIXME( "(%p)->() stub!\n", This );
return E_NOTIMPL;
}
static HRESULT WINAPI
IFilterGraph2_fnReconnect(IFilterGraph2* iface,IPin* pPin)
{
CFilterGraph_THIS(iface,fgraph);
FIXME( "(%p)->() stub!\n", This );
return E_NOTIMPL;
}
static HRESULT WINAPI
IFilterGraph2_fnDisconnect(IFilterGraph2* iface,IPin* pPin)
{
CFilterGraph_THIS(iface,fgraph);
FIXME( "(%p)->() stub!\n", This );
return E_NOTIMPL;
}
static HRESULT WINAPI
IFilterGraph2_fnSetDefaultSyncSource(IFilterGraph2* iface)
{
CFilterGraph_THIS(iface,fgraph);
FIXME( "(%p)->() stub!\n", This );
return E_NOTIMPL;
}
static HRESULT WINAPI
IFilterGraph2_fnConnect(IFilterGraph2* iface,IPin* pOut,IPin* pIn)
{
CFilterGraph_THIS(iface,fgraph);
FIXME( "(%p)->() stub!\n", This );
return E_NOTIMPL;
}
static HRESULT WINAPI
IFilterGraph2_fnRender(IFilterGraph2* iface,IPin* pOut)
{
CFilterGraph_THIS(iface,fgraph);
FIXME( "(%p)->() stub!\n", This );
return E_NOTIMPL;
}
static HRESULT WINAPI
IFilterGraph2_fnRenderFile(IFilterGraph2* iface,LPCWSTR lpFileName,LPCWSTR lpPlayList)
{
CFilterGraph_THIS(iface,fgraph);
FIXME( "(%p)->() stub!\n", This );
return E_NOTIMPL;
}
static HRESULT WINAPI
IFilterGraph2_fnAddSourceFilter(IFilterGraph2* iface,LPCWSTR lpFileName,LPCWSTR lpFilterName,IBaseFilter** ppBaseFilter)
{
CFilterGraph_THIS(iface,fgraph);
FIXME( "(%p)->() stub!\n", This );
return E_NOTIMPL;
}
static HRESULT WINAPI
IFilterGraph2_fnSetLogFile(IFilterGraph2* iface,DWORD_PTR hFile)
{
CFilterGraph_THIS(iface,fgraph);
FIXME( "(%p)->() stub!\n", This );
return E_NOTIMPL;
}
static HRESULT WINAPI
IFilterGraph2_fnAbort(IFilterGraph2* iface)
{
CFilterGraph_THIS(iface,fgraph);
/* undoc. */
FIXME( "(%p)->() stub!\n", This );
return E_NOTIMPL;
}
static HRESULT WINAPI
IFilterGraph2_fnShouldOperationContinue(IFilterGraph2* iface)
{
CFilterGraph_THIS(iface,fgraph);
/* undoc. */
FIXME( "(%p)->() stub!\n", This );
return E_NOTIMPL;
}
static HRESULT WINAPI
IFilterGraph2_fnAddSourceFilterForMoniker(IFilterGraph2* iface,IMoniker* pMon,IBindCtx* pCtx,LPCWSTR pFilterName,IBaseFilter** ppFilter)
{
CFilterGraph_THIS(iface,fgraph);
FIXME( "(%p)->() stub!\n", This );
return E_NOTIMPL;
}
static HRESULT WINAPI
IFilterGraph2_fnReconnectEx(IFilterGraph2* iface,IPin* pPin,const AM_MEDIA_TYPE* pmt)
{
CFilterGraph_THIS(iface,fgraph);
FIXME( "(%p)->() stub!\n", This );
return E_NOTIMPL;
}
static HRESULT WINAPI
IFilterGraph2_fnRenderEx(IFilterGraph2* iface,IPin* pPin,DWORD dwParam1,DWORD* pdwParam2)
{
CFilterGraph_THIS(iface,fgraph);
/* undoc. */
FIXME( "(%p)->() stub!\n", This );
return E_NOTIMPL;
}
static ICOM_VTABLE(IFilterGraph2) ifgraph =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
/* IUnknown fields */
IFilterGraph2_fnQueryInterface,
IFilterGraph2_fnAddRef,
IFilterGraph2_fnRelease,
/* IFilterGraph fields */
IFilterGraph2_fnAddFilter,
IFilterGraph2_fnRemoveFilter,
IFilterGraph2_fnEnumFilters,
IFilterGraph2_fnFindFilterByName,
IFilterGraph2_fnConnectDirect,
IFilterGraph2_fnReconnect,
IFilterGraph2_fnDisconnect,
IFilterGraph2_fnSetDefaultSyncSource,
/* IGraphBuilder fields */
IFilterGraph2_fnConnect,
IFilterGraph2_fnRender,
IFilterGraph2_fnRenderFile,
IFilterGraph2_fnAddSourceFilter,
IFilterGraph2_fnSetLogFile,
IFilterGraph2_fnAbort,
IFilterGraph2_fnShouldOperationContinue,
/* IFilterGraph2 fields */
IFilterGraph2_fnAddSourceFilterForMoniker,
IFilterGraph2_fnReconnectEx,
IFilterGraph2_fnRenderEx,
};
void CFilterGraph_InitIFilterGraph2( CFilterGraph* pfg )
{
TRACE("(%p)\n",pfg);
ICOM_VTBL(&pfg->fgraph) = &ifgraph;
}

133
dlls/quartz/imem.c Normal file
View File

@ -0,0 +1,133 @@
/*
* Implementation of CLSID_MemoryAllocator.
*
* FIXME - stub.
*
* hidenori@a2.ctktv.ne.jp
*/
#include "config.h"
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winerror.h"
#include "wine/obj_base.h"
#include "strmif.h"
#include "uuids.h"
#include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(quartz);
#include "quartz_private.h"
#include "memalloc.h"
static HRESULT WINAPI
IMemAllocator_fnQueryInterface(IMemAllocator* iface,REFIID riid,void** ppobj)
{
CMemoryAllocator_THIS(iface,memalloc);
TRACE("(%p)->()\n",This);
return IUnknown_QueryInterface((IUnknown*)(&This->unk),riid,ppobj);
}
static ULONG WINAPI
IMemAllocator_fnAddRef(IMemAllocator* iface)
{
CMemoryAllocator_THIS(iface,memalloc);
TRACE("(%p)->()\n",This);
return IUnknown_AddRef((IUnknown*)(&This->unk));
}
static ULONG WINAPI
IMemAllocator_fnRelease(IMemAllocator* iface)
{
CMemoryAllocator_THIS(iface,memalloc);
TRACE("(%p)->()\n",This);
return IUnknown_Release((IUnknown*)(&This->unk));
}
static HRESULT WINAPI
IMemAllocator_fnSetProperties(IMemAllocator* iface,ALLOCATOR_PROPERTIES* pPropReq,ALLOCATOR_PROPERTIES* pPropActual)
{
CMemoryAllocator_THIS(iface,memalloc);
FIXME( "(%p)->() stub!\n", This );
return E_NOTIMPL;
}
static HRESULT WINAPI
IMemAllocator_fnGetProperties(IMemAllocator* iface,ALLOCATOR_PROPERTIES* pProp)
{
CMemoryAllocator_THIS(iface,memalloc);
FIXME( "(%p)->() stub!\n", This );
return E_NOTIMPL;
}
static HRESULT WINAPI
IMemAllocator_fnCommit(IMemAllocator* iface)
{
CMemoryAllocator_THIS(iface,memalloc);
FIXME( "(%p)->() stub!\n", This );
return E_NOTIMPL;
}
static HRESULT WINAPI
IMemAllocator_fnDecommit(IMemAllocator* iface)
{
CMemoryAllocator_THIS(iface,memalloc);
FIXME( "(%p)->() stub!\n", This );
return E_NOTIMPL;
}
static HRESULT WINAPI
IMemAllocator_fnGetBuffer(IMemAllocator* iface,IMediaSample** ppSample,REFERENCE_TIME* prtStart,REFERENCE_TIME* prtEnd,DWORD dwFlags)
{
CMemoryAllocator_THIS(iface,memalloc);
FIXME( "(%p)->() stub!\n", This );
return E_NOTIMPL;
}
static HRESULT WINAPI
IMemAllocator_fnReleaseBuffer(IMemAllocator* iface,IMediaSample* pSample)
{
CMemoryAllocator_THIS(iface,memalloc);
FIXME( "(%p)->() stub!\n", This );
return E_NOTIMPL;
}
static ICOM_VTABLE(IMemAllocator) imemalloc =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
/* IUnknown fields */
IMemAllocator_fnQueryInterface,
IMemAllocator_fnAddRef,
IMemAllocator_fnRelease,
/* IMemAllocator fields */
IMemAllocator_fnSetProperties,
IMemAllocator_fnGetProperties,
IMemAllocator_fnCommit,
IMemAllocator_fnDecommit,
IMemAllocator_fnGetBuffer,
IMemAllocator_fnReleaseBuffer,
};
void CMemoryAllocator_InitIMemAllocator( CMemoryAllocator* pma )
{
TRACE("(%p)\n",pma);
ICOM_VTBL(&pma->memalloc) = &imemalloc;
}

111
dlls/quartz/irclock.c Normal file
View File

@ -0,0 +1,111 @@
/*
* Implementation of CLSID_SystemClock.
*
* FIXME - stub.
*
* hidenori@a2.ctktv.ne.jp
*/
#include "config.h"
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winerror.h"
#include "wine/obj_base.h"
#include "strmif.h"
#include "uuids.h"
#include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(quartz);
#include "quartz_private.h"
#include "sysclock.h"
static HRESULT WINAPI
IReferenceClock_fnQueryInterface(IReferenceClock* iface,REFIID riid,void** ppobj)
{
CSystemClock_THIS(iface,refclk);
TRACE("(%p)->()\n",This);
return IUnknown_QueryInterface((IUnknown*)(&This->unk),riid,ppobj);
}
static ULONG WINAPI
IReferenceClock_fnAddRef(IReferenceClock* iface)
{
CSystemClock_THIS(iface,refclk);
TRACE("(%p)->()\n",This);
return IUnknown_AddRef((IUnknown*)(&This->unk));
}
static ULONG WINAPI
IReferenceClock_fnRelease(IReferenceClock* iface)
{
CSystemClock_THIS(iface,refclk);
TRACE("(%p)->()\n",This);
return IUnknown_Release((IUnknown*)(&This->unk));
}
static HRESULT WINAPI
IReferenceClock_fnGetTime(IReferenceClock* iface,REFERENCE_TIME* prtTime)
{
CSystemClock_THIS(iface,refclk);
FIXME( "(%p)->() stub!\n", This );
return E_NOTIMPL;
}
static HRESULT WINAPI
IReferenceClock_fnAdviseTime(IReferenceClock* iface,REFERENCE_TIME rtBase,REFERENCE_TIME rtStream,HEVENT hEvent,DWORD_PTR* pdwAdvCookie)
{
CSystemClock_THIS(iface,refclk);
FIXME( "(%p)->() stub!\n", This );
return E_NOTIMPL;
}
static HRESULT WINAPI
IReferenceClock_fnAdvisePeriodic(IReferenceClock* iface,REFERENCE_TIME rtStart,REFERENCE_TIME rtPeriod,HSEMAPHORE hSemaphore,DWORD_PTR* pdwAdvCookie)
{
CSystemClock_THIS(iface,refclk);
FIXME( "(%p)->() stub!\n", This );
return E_NOTIMPL;
}
static HRESULT WINAPI
IReferenceClock_fnUnadvise(IReferenceClock* iface,DWORD_PTR dwAdvCookie)
{
CSystemClock_THIS(iface,refclk);
FIXME( "(%p)->() stub!\n", This );
return E_NOTIMPL;
}
static ICOM_VTABLE(IReferenceClock) irefclk =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
/* IUnknown fields */
IReferenceClock_fnQueryInterface,
IReferenceClock_fnAddRef,
IReferenceClock_fnRelease,
/* IReferenceClock fields */
IReferenceClock_fnGetTime,
IReferenceClock_fnAdviseTime,
IReferenceClock_fnAdvisePeriodic,
IReferenceClock_fnUnadvise,
};
void CSystemClock_InitIReferenceClock( CSystemClock* psc )
{
TRACE("(%p)\n",psc);
ICOM_VTBL(&psc->refclk) = &irefclk;
}

100
dlls/quartz/iunk.c Normal file
View File

@ -0,0 +1,100 @@
/*
* An implementation of IUnknown.
*
* hidenori@a2.ctktv.ne.jp
*/
#include "config.h"
#include "windef.h"
#include "winerror.h"
#include "wine/obj_base.h"
#include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(quartz);
#include "quartz_private.h"
#include "iunk.h"
static HRESULT WINAPI
IUnknown_fnQueryInterface(IUnknown* iface,REFIID riid,LPVOID *ppobj)
{
ICOM_THIS(QUARTZ_IUnkImpl,iface);
size_t ofs;
DWORD dwIndex;
TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(riid),ppobj);
if ( ppobj == NULL )
return E_POINTER;
*ppobj = NULL;
ofs = 0;
for ( dwIndex = 0; dwIndex < This->dwEntries; dwIndex++ )
{
if ( IsEqualGUID( This->pEntries[dwIndex].piid, riid ) )
{
ofs = This->pEntries[dwIndex].ofsVTPtr;
break;
}
}
if ( dwIndex == This->dwEntries )
{
if ( !IsEqualGUID( &IID_IUnknown, riid ) )
{
TRACE("unknown interface: %s\n",debugstr_guid(riid));
return E_NOINTERFACE;
}
}
*ppobj = (LPVOID)(((char*)This) + ofs);
IUnknown_AddRef(iface);
return S_OK;
}
static ULONG WINAPI
IUnknown_fnAddRef(IUnknown* iface)
{
ICOM_THIS(QUARTZ_IUnkImpl,iface);
TRACE("(%p)->()\n",This);
return ++(This->ref);
}
static ULONG WINAPI
IUnknown_fnRelease(IUnknown* iface)
{
ICOM_THIS(QUARTZ_IUnkImpl,iface);
TRACE("(%p)->()\n",This);
if ( (--(This->ref)) > 0 )
return This->ref;
QUARTZ_FreeObj(This);
return 0;
}
static ICOM_VTABLE(IUnknown) iunknown =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
/* IUnknown fields */
IUnknown_fnQueryInterface,
IUnknown_fnAddRef,
IUnknown_fnRelease,
};
void QUARTZ_IUnkInit( QUARTZ_IUnkImpl* pImpl )
{
TRACE("(%p)\n",pImpl);
ICOM_VTBL(pImpl) = &iunknown;
pImpl->pEntries = NULL;
pImpl->dwEntries = 0;
pImpl->ref = 1;
}

50
dlls/quartz/iunk.h Normal file
View File

@ -0,0 +1,50 @@
/*
* An implementation of IUnknown.
*
* hidenori@a2.ctktv.ne.jp
*/
#ifndef WINE_DSHOW_IUNK_H
#define WINE_DSHOW_IUNK_H
/*
To avoid implementing IUnknown for all interfaces,
1) To give a method to get rel-offset of IUnknown.
2) The IUnknown knows all IIDs and offsets of interfaces.
So each implementation must have following two members
with the following order:
typedef struct IDispatchImpl
{
ICOM_VFIELD(IDispatch); <-pointer of the interface.
size_t ofsIUnknown; <-ofs<IDispatchImpl> - ofs<QUARTZ_IUnkImpl>
};
*/
typedef struct QUARTZ_IFEntry
{
REFIID piid; /* interface ID. */
size_t ofsVTPtr; /* offset from IUnknown. */
} QUARTZ_IFEntry;
typedef struct QUARTZ_IUnkImpl
{
/* pointer of IUnknown interface. */
ICOM_VFIELD(IUnknown);
/* array of supported IIDs and offsets. */
const QUARTZ_IFEntry* pEntries;
DWORD dwEntries;
/* IUnknown fields. */
ULONG ref;
} QUARTZ_IUnkImpl;
void QUARTZ_IUnkInit( QUARTZ_IUnkImpl* pImpl );
#endif /* WINE_DSHOW_IUNK_H */

View File

@ -2,14 +2,28 @@
#include "windef.h"
#include "winerror.h"
#include "winbase.h"
#include "wingdi.h"
#include "ole2.h"
#include "guiddef.h"
/*#include "dshow.h"*/ /* not yet */
#include "strmif.h"
#include "uuids.h"
#include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(quartz);
#include "quartz_private.h"
#include "fgraph.h"
#include "sysclock.h"
#include "memalloc.h"
typedef struct QUARTZ_CLASSENTRY
{
const CLSID* pclsid;
QUARTZ_pCreateIUnknown pCreateIUnk;
} QUARTZ_CLASSENTRY;
static HRESULT WINAPI
IClassFactory_fnQueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj);
static ULONG WINAPI IClassFactory_fnAddRef(LPCLASSFACTORY iface);
@ -32,12 +46,56 @@ typedef struct
/* IUnknown fields */
ICOM_VFIELD(IClassFactory);
DWORD ref;
/* IClassFactory fields */
const QUARTZ_CLASSENTRY* pEntry;
} IClassFactoryImpl;
static IClassFactoryImpl QUARTZ_GlobalCF = {&iclassfact, 0 };
static const QUARTZ_CLASSENTRY QUARTZ_ClassList[] =
{
{ &CLSID_FilterGraph, &QUARTZ_CreateFilterGraph },
{ &CLSID_SystemClock, &QUARTZ_CreateSystemClock },
{ &CLSID_MemoryAllocator, &QUARTZ_CreateMemoryAllocator },
{ NULL, NULL },
};
/* per-process variables */
static CRITICAL_SECTION csHeap;
static DWORD dwClassObjRef;
static HANDLE hDLLHeap;
void* QUARTZ_AllocObj( DWORD dwSize )
{
void* pv;
EnterCriticalSection( &csHeap );
dwClassObjRef ++;
pv = HeapAlloc( hDLLHeap, 0, dwSize );
if ( pv == NULL )
dwClassObjRef --;
LeaveCriticalSection( &csHeap );
return pv;
}
void QUARTZ_FreeObj( void* pobj )
{
EnterCriticalSection( &csHeap );
HeapFree( hDLLHeap, 0, pobj );
dwClassObjRef --;
LeaveCriticalSection( &csHeap );
}
void* QUARTZ_AllocMem( DWORD dwSize )
{
return HeapAlloc( hDLLHeap, 0, dwSize );
}
void QUARTZ_FreeMem( void* pMem )
{
HeapFree( hDLLHeap, 0, pMem );
}
/************************************************************************/
static HRESULT WINAPI
IClassFactory_fnQueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj)
@ -61,8 +119,6 @@ static ULONG WINAPI IClassFactory_fnAddRef(LPCLASSFACTORY iface)
ICOM_THIS(IClassFactoryImpl,iface);
TRACE("(%p)->()\n",This);
if ( (This->ref) == 0 )
dwClassObjRef ++;
return ++(This->ref);
}
@ -75,21 +131,31 @@ static ULONG WINAPI IClassFactory_fnRelease(LPCLASSFACTORY iface)
if ( (--(This->ref)) > 0 )
return This->ref;
dwClassObjRef --;
QUARTZ_FreeObj(This);
return 0;
}
static HRESULT WINAPI IClassFactory_fnCreateInstance(LPCLASSFACTORY iface,LPUNKNOWN pOuter,REFIID riid,LPVOID *ppobj)
{
ICOM_THIS(IClassFactoryImpl,iface);
HRESULT hr;
IUnknown* punk;
FIXME("(%p)->(%p,%s,%p),stub!\n",This,pOuter,debugstr_guid(riid),ppobj);
TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
if ( ppobj == NULL )
return E_POINTER;
*ppobj = NULL;
if ( pOuter != NULL )
return E_FAIL;
return E_NOINTERFACE;
hr = (*This->pEntry->pCreateIUnk)(pOuter,(void**)&punk);
if ( hr != S_OK )
return hr;
hr = IUnknown_QueryInterface(punk,riid,ppobj);
IUnknown_Release(punk);
return hr;
}
static HRESULT WINAPI IClassFactory_fnLockServer(LPCLASSFACTORY iface,BOOL dolock)
@ -108,6 +174,34 @@ static HRESULT WINAPI IClassFactory_fnLockServer(LPCLASSFACTORY iface,BOOL doloc
static HRESULT IClassFactory_Alloc( const CLSID* pclsid, void** ppobj )
{
const QUARTZ_CLASSENTRY* pEntry;
IClassFactoryImpl* pImpl;
TRACE( "(%s,%p)\n", debugstr_guid(pclsid), ppobj );
pEntry = QUARTZ_ClassList;
while ( pEntry->pclsid != NULL )
{
if ( IsEqualGUID( pclsid, pEntry->pclsid ) )
goto found;
}
return CLASS_E_CLASSNOTAVAILABLE;
found:
pImpl = (IClassFactoryImpl*)QUARTZ_AllocObj( sizeof(IClassFactoryImpl) );
if ( pImpl == NULL )
return E_OUTOFMEMORY;
ICOM_VTBL(pImpl) = &iclassfact;
pImpl->ref = 1;
pImpl->pEntry = pEntry;
*ppobj = (void*)pImpl;
return S_OK;
}
/***********************************************************************
* QUARTZ_InitProcess (internal)
@ -117,6 +211,12 @@ static BOOL QUARTZ_InitProcess( void )
TRACE("()\n");
dwClassObjRef = 0;
hDLLHeap = (HANDLE)NULL;
InitializeCriticalSection( &csHeap );
hDLLHeap = HeapCreate( 0, 0x10000, 0 );
if ( hDLLHeap == (HANDLE)NULL )
return FALSE;
return TRUE;
}
@ -130,6 +230,12 @@ static void QUARTZ_UninitProcess( void )
if ( dwClassObjRef != 0 )
ERR( "you must release some objects allocated from quartz.\n" );
if ( hDLLHeap != (HANDLE)NULL )
{
HeapDestroy( hDLLHeap );
hDLLHeap = (HANDLE)NULL;
}
DeleteCriticalSection( &csHeap );
}
/***********************************************************************
@ -166,23 +272,28 @@ BOOL WINAPI QUARTZ_DllMain(
* Success: S_OK
* Failure: S_FALSE
*/
DWORD WINAPI QUARTZ_DllCanUnloadNow(void)
HRESULT WINAPI QUARTZ_DllCanUnloadNow(void)
{
return ( dwClassObjRef == 0 ) ? S_OK : S_FALSE;
HRESULT hr;
EnterCriticalSection( &csHeap );
hr = ( dwClassObjRef == 0 ) ? S_OK : S_FALSE;
LeaveCriticalSection( &csHeap );
return hr;
}
/***********************************************************************
* DllGetClassObject (QUARTZ.@)
*/
DWORD WINAPI QUARTZ_DllGetClassObject(
HRESULT WINAPI QUARTZ_DllGetClassObject(
const CLSID* pclsid,const IID* piid,void** ppv)
{
*ppv = NULL;
if ( IsEqualCLSID( &IID_IClassFactory, piid ) )
if ( IsEqualCLSID( &IID_IUnknown, piid ) ||
IsEqualCLSID( &IID_IClassFactory, piid ) )
{
*ppv = (LPVOID)&QUARTZ_GlobalCF;
IClassFactory_AddRef((IClassFactory*)*ppv);
return S_OK;
return IClassFactory_Alloc( pclsid, ppv );
}
return CLASS_E_CLASSNOTAVAILABLE;

51
dlls/quartz/memalloc.c Normal file
View File

@ -0,0 +1,51 @@
/*
* Implementation of CLSID_MemoryAllocator.
*
* FIXME - stub.
*
* hidenori@a2.ctktv.ne.jp
*/
#include "config.h"
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winerror.h"
#include "wine/obj_base.h"
#include "strmif.h"
#include "uuids.h"
#include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(quartz);
#include "quartz_private.h"
#include "memalloc.h"
/* can I use offsetof safely? - FIXME? */
static QUARTZ_IFEntry IFEntries[] =
{
{ &IID_IMemAllocator, offsetof(CMemoryAllocator,memalloc)-offsetof(CMemoryAllocator,unk) },
};
HRESULT QUARTZ_CreateMemoryAllocator(IUnknown* punkOuter,void** ppobj)
{
CMemoryAllocator* pma;
TRACE("(%p,%p)\n",punkOuter,ppobj);
pma = (CMemoryAllocator*)QUARTZ_AllocObj( sizeof(CMemoryAllocator) );
if ( pma == NULL )
return E_OUTOFMEMORY;
QUARTZ_IUnkInit( &pma->unk );
CMemoryAllocator_InitIMemAllocator( pma );
pma->unk.pEntries = IFEntries;
pma->unk.dwEntries = sizeof(IFEntries)/sizeof(IFEntries[0]);
*ppobj = (void*)pma;
return S_OK;
}

36
dlls/quartz/memalloc.h Normal file
View File

@ -0,0 +1,36 @@
#ifndef WINE_DSHOW_MEMALLOC_H
#define WINE_DSHOW_MEMALLOC_H
/*
implements CLSID_MemoryAllocator.
- At least, the following interfaces should be implemented:
IUnknown
+ IMemAllocator
*/
#include "iunk.h"
typedef struct MA_IMemAllocatorImpl
{
ICOM_VFIELD(IMemAllocator);
} MA_IMemAllocatorImpl;
typedef struct CMemoryAllocator
{
QUARTZ_IUnkImpl unk;
MA_IMemAllocatorImpl memalloc;
/* IMemAllocator fields. */
} CMemoryAllocator;
#define CMemoryAllocator_THIS(iface,member) CMemoryAllocator* This = ((CMemoryAllocator*)(((char*)iface)-offsetof(CMemoryAllocator,member)))
HRESULT QUARTZ_CreateMemoryAllocator(IUnknown* punkOuter,void** ppobj);
void CMemoryAllocator_InitIMemAllocator( CMemoryAllocator* pma );
#endif /* WINE_DSHOW_MEMALLOC_H */

View File

@ -1,7 +1,9 @@
name quartz
type win32
init QUARTZ_DllMain
#import ole2.dll
import kernel32.dll
import ntdll.dll
debug_channels (quartz)

View File

@ -0,0 +1,12 @@
#ifndef QUARTZ_PRIVATE_H
#define QUARTZ_PRIVATE_H
typedef HRESULT (*QUARTZ_pCreateIUnknown)(IUnknown* punkOuter,void** ppobj);
void* QUARTZ_AllocObj( DWORD dwSize );
void QUARTZ_FreeObj( void* pobj );
void* QUARTZ_AllocMem( DWORD dwSize );
void QUARTZ_FreeMem( void* pMem );
#endif /* QUARTZ_PRIVATE_H */

51
dlls/quartz/sysclock.c Normal file
View File

@ -0,0 +1,51 @@
/*
* Implementation of CLSID_SystemClock.
*
* FIXME - stub.
*
* hidenori@a2.ctktv.ne.jp
*/
#include "config.h"
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winerror.h"
#include "wine/obj_base.h"
#include "strmif.h"
#include "uuids.h"
#include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(quartz);
#include "quartz_private.h"
#include "sysclock.h"
/* can I use offsetof safely? - FIXME? */
static QUARTZ_IFEntry IFEntries[] =
{
{ &IID_IReferenceClock, offsetof(CSystemClock,refclk)-offsetof(CSystemClock,unk) },
};
HRESULT QUARTZ_CreateSystemClock(IUnknown* punkOuter,void** ppobj)
{
CSystemClock* psc;
TRACE("(%p,%p)\n",punkOuter,ppobj);
psc = (CSystemClock*)QUARTZ_AllocObj( sizeof(CSystemClock) );
if ( psc == NULL )
return E_OUTOFMEMORY;
QUARTZ_IUnkInit( &psc->unk );
CSystemClock_InitIReferenceClock( psc );
psc->unk.pEntries = IFEntries;
psc->unk.dwEntries = sizeof(IFEntries)/sizeof(IFEntries[0]);
*ppobj = (void*)psc;
return S_OK;
}

37
dlls/quartz/sysclock.h Normal file
View File

@ -0,0 +1,37 @@
#ifndef WINE_DSHOW_SYSCLOCK_H
#define WINE_DSHOW_SYSCLOCK_H
/*
implements CLSID_SystemClock.
- At least, the following interfaces should be implemented:
IUnknown
+ IReferenceClock
*/
#include "iunk.h"
typedef struct SC_IReferenceClockImpl
{
ICOM_VFIELD(IReferenceClock);
} SC_IReferenceClockImpl;
typedef struct CSystemClock
{
QUARTZ_IUnkImpl unk;
SC_IReferenceClockImpl refclk;
/* IReferenceClock fields. */
} CSystemClock;
#define CSystemClock_THIS(iface,member) CSystemClock* This = ((CSystemClock*)(((char*)iface)-offsetof(CSystemClock,member)))
HRESULT QUARTZ_CreateSystemClock(IUnknown* punkOuter,void** ppobj);
void CSystemClock_InitIReferenceClock( CSystemClock* psc );
#endif /* WINE_DSHOW_SYSCLOCK_H */

View File

@ -237,6 +237,26 @@
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{8856f961-340a-11d0-a96b-00c04fd705a2}\shellex\MayChangeDefaultMenu]
@=""
#
# Entries for quartz.dll
#
# CLSID_FilterGraph
[HKEY_CLASSES_ROOT\CLSID\{E436EBB3-524F-11CE-9F53-0020AF0BA770}\InprocServer32]
@="quartz.dll"
"ThreadingModel"="Both"
# CLSID_SystemClock
[HKEY_CLASSES_ROOT\CLSID\{E436EBB1-524F-11CE-9F53-0020AF0BA770}\InprocServer32]
@="quartz.dll"
"ThreadingModel"="Both"
# CLSID_MemoryAllocator
[HKEY_CLASSES_ROOT\CLSID\{1E651CC0-B199-11D0-8212-00C04FC32C45}\InprocServer32]
@="quartz.dll"
"ThreadingModel"="Both"
#
# Entries for Mozilla ActiveX control support
#