2001-08-15 21:26:52 +02:00
|
|
|
/*
|
|
|
|
* Implementation of CLSID_FilterGraph.
|
|
|
|
*
|
2002-03-10 00:29:33 +01:00
|
|
|
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
|
|
|
|
*
|
|
|
|
* 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
|
2001-08-15 21:26:52 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "wingdi.h"
|
2001-09-17 22:04:28 +02:00
|
|
|
#include "winuser.h"
|
2001-08-15 21:26:52 +02:00
|
|
|
#include "winerror.h"
|
|
|
|
#include "strmif.h"
|
2001-08-22 20:06:00 +02:00
|
|
|
#include "control.h"
|
2001-08-15 21:26:52 +02:00
|
|
|
#include "uuids.h"
|
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
#include "wine/debug.h"
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
|
2001-08-15 21:26:52 +02:00
|
|
|
|
|
|
|
#include "quartz_private.h"
|
|
|
|
#include "fgraph.h"
|
|
|
|
|
2001-09-26 00:37:04 +02:00
|
|
|
/***************************************************************************
|
|
|
|
*
|
|
|
|
* new/delete for CFilterGraph
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2001-08-15 21:26:52 +02:00
|
|
|
/* can I use offsetof safely? - FIXME? */
|
|
|
|
static QUARTZ_IFEntry IFEntries[] =
|
|
|
|
{
|
2001-09-07 21:46:49 +02:00
|
|
|
{ &IID_IPersist, offsetof(CFilterGraph,persist)-offsetof(CFilterGraph,unk) },
|
|
|
|
{ &IID_IDispatch, offsetof(CFilterGraph,disp)-offsetof(CFilterGraph,unk) },
|
2001-08-15 21:26:52 +02:00
|
|
|
{ &IID_IFilterGraph, offsetof(CFilterGraph,fgraph)-offsetof(CFilterGraph,unk) },
|
|
|
|
{ &IID_IGraphBuilder, offsetof(CFilterGraph,fgraph)-offsetof(CFilterGraph,unk) },
|
|
|
|
{ &IID_IFilterGraph2, offsetof(CFilterGraph,fgraph)-offsetof(CFilterGraph,unk) },
|
2001-09-07 21:46:49 +02:00
|
|
|
{ &IID_IGraphVersion, offsetof(CFilterGraph,graphversion)-offsetof(CFilterGraph,unk) },
|
2001-08-22 20:06:00 +02:00
|
|
|
{ &IID_IMediaControl, offsetof(CFilterGraph,mediacontrol)-offsetof(CFilterGraph,unk) },
|
2001-09-07 21:46:49 +02:00
|
|
|
{ &IID_IMediaFilter, offsetof(CFilterGraph,mediafilter)-offsetof(CFilterGraph,unk) },
|
2001-08-22 20:06:00 +02:00
|
|
|
{ &IID_IMediaEvent, offsetof(CFilterGraph,mediaevent)-offsetof(CFilterGraph,unk) },
|
|
|
|
{ &IID_IMediaEventEx, offsetof(CFilterGraph,mediaevent)-offsetof(CFilterGraph,unk) },
|
2001-09-07 21:46:49 +02:00
|
|
|
{ &IID_IMediaEventSink, offsetof(CFilterGraph,mediaeventsink)-offsetof(CFilterGraph,unk) },
|
2001-08-22 20:06:00 +02:00
|
|
|
{ &IID_IMediaPosition, offsetof(CFilterGraph,mediaposition)-offsetof(CFilterGraph,unk) },
|
|
|
|
{ &IID_IMediaSeeking, offsetof(CFilterGraph,mediaseeking)-offsetof(CFilterGraph,unk) },
|
|
|
|
{ &IID_IBasicVideo, offsetof(CFilterGraph,basvid)-offsetof(CFilterGraph,unk) },
|
|
|
|
{ &IID_IBasicAudio, offsetof(CFilterGraph,basaud)-offsetof(CFilterGraph,unk) },
|
|
|
|
{ &IID_IVideoWindow, offsetof(CFilterGraph,vidwin)-offsetof(CFilterGraph,unk) },
|
2001-08-15 21:26:52 +02:00
|
|
|
};
|
|
|
|
|
2001-08-28 19:25:39 +02:00
|
|
|
|
2001-09-07 21:46:49 +02:00
|
|
|
struct FGInitEntry
|
|
|
|
{
|
|
|
|
HRESULT (*pInit)(CFilterGraph*);
|
|
|
|
void (*pUninit)(CFilterGraph*);
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct FGInitEntry FGRAPH_Init[] =
|
|
|
|
{
|
|
|
|
#define FGENT(a) {&CFilterGraph_Init##a,&CFilterGraph_Uninit##a},
|
|
|
|
|
|
|
|
FGENT(IPersist)
|
|
|
|
FGENT(IDispatch)
|
|
|
|
FGENT(IFilterGraph2)
|
|
|
|
FGENT(IGraphVersion)
|
|
|
|
FGENT(IMediaControl)
|
|
|
|
FGENT(IMediaFilter)
|
|
|
|
FGENT(IMediaEventEx)
|
|
|
|
FGENT(IMediaEventSink)
|
|
|
|
FGENT(IMediaPosition)
|
|
|
|
FGENT(IMediaSeeking)
|
2002-03-22 20:19:23 +01:00
|
|
|
FGENT(IBasicVideo)
|
2001-09-07 21:46:49 +02:00
|
|
|
FGENT(IBasicAudio)
|
|
|
|
FGENT(IVideoWindow)
|
|
|
|
|
|
|
|
#undef FGENT
|
|
|
|
{ NULL, NULL },
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2001-08-28 19:25:39 +02:00
|
|
|
static void QUARTZ_DestroyFilterGraph(IUnknown* punk)
|
|
|
|
{
|
|
|
|
CFilterGraph_THIS(punk,unk);
|
2001-09-07 21:46:49 +02:00
|
|
|
int i;
|
2001-08-28 19:25:39 +02:00
|
|
|
|
2001-09-26 00:37:04 +02:00
|
|
|
TRACE( "(%p)\n", punk );
|
|
|
|
|
2001-09-11 02:29:03 +02:00
|
|
|
/* At first, call Stop. */
|
|
|
|
IMediaControl_Stop( CFilterGraph_IMediaControl(This) );
|
|
|
|
IMediaFilter_Stop( CFilterGraph_IMediaFilter(This) );
|
|
|
|
|
2001-09-07 21:46:49 +02:00
|
|
|
i = 0;
|
|
|
|
while ( FGRAPH_Init[i].pInit != NULL )
|
|
|
|
{
|
|
|
|
FGRAPH_Init[i].pUninit( This );
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
TRACE( "succeeded.\n" );
|
2001-08-28 19:25:39 +02:00
|
|
|
}
|
|
|
|
|
2001-08-15 21:26:52 +02:00
|
|
|
HRESULT QUARTZ_CreateFilterGraph(IUnknown* punkOuter,void** ppobj)
|
|
|
|
{
|
|
|
|
CFilterGraph* pfg;
|
2001-09-07 21:46:49 +02:00
|
|
|
HRESULT hr;
|
|
|
|
int i;
|
2001-08-15 21:26:52 +02:00
|
|
|
|
|
|
|
TRACE("(%p,%p)\n",punkOuter,ppobj);
|
|
|
|
|
|
|
|
pfg = (CFilterGraph*)QUARTZ_AllocObj( sizeof(CFilterGraph) );
|
|
|
|
if ( pfg == NULL )
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
2001-08-22 20:06:00 +02:00
|
|
|
QUARTZ_IUnkInit( &pfg->unk, punkOuter );
|
2001-09-07 21:46:49 +02:00
|
|
|
|
|
|
|
i = 0;
|
|
|
|
hr = NOERROR;
|
|
|
|
while ( FGRAPH_Init[i].pInit != NULL )
|
|
|
|
{
|
|
|
|
hr = FGRAPH_Init[i].pInit( pfg );
|
|
|
|
if ( FAILED(hr) )
|
|
|
|
break;
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( FAILED(hr) )
|
|
|
|
{
|
|
|
|
while ( --i >= 0 )
|
|
|
|
FGRAPH_Init[i].pUninit( pfg );
|
|
|
|
QUARTZ_FreeObj( pfg );
|
|
|
|
return hr;
|
|
|
|
}
|
2001-08-15 21:26:52 +02:00
|
|
|
|
|
|
|
pfg->unk.pEntries = IFEntries;
|
|
|
|
pfg->unk.dwEntries = sizeof(IFEntries)/sizeof(IFEntries[0]);
|
2001-08-28 19:25:39 +02:00
|
|
|
pfg->unk.pOnFinalRelease = QUARTZ_DestroyFilterGraph;
|
2001-08-15 21:26:52 +02:00
|
|
|
|
2001-08-22 20:06:00 +02:00
|
|
|
*ppobj = (void*)(&pfg->unk);
|
2001-08-15 21:26:52 +02:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
2001-08-28 19:25:39 +02:00
|
|
|
|
|
|
|
|
2001-09-26 00:37:04 +02:00
|
|
|
/***************************************************************************
|
|
|
|
*
|
|
|
|
* CFilterGraph::IPersist
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
static HRESULT WINAPI
|
|
|
|
IPersist_fnQueryInterface(IPersist* iface,REFIID riid,void** ppobj)
|
|
|
|
{
|
|
|
|
CFilterGraph_THIS(iface,persist);
|
|
|
|
|
|
|
|
TRACE("(%p)->()\n",This);
|
|
|
|
|
|
|
|
return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI
|
|
|
|
IPersist_fnAddRef(IPersist* iface)
|
|
|
|
{
|
|
|
|
CFilterGraph_THIS(iface,persist);
|
|
|
|
|
|
|
|
TRACE("(%p)->()\n",This);
|
|
|
|
|
|
|
|
return IUnknown_AddRef(This->unk.punkControl);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI
|
|
|
|
IPersist_fnRelease(IPersist* iface)
|
|
|
|
{
|
|
|
|
CFilterGraph_THIS(iface,persist);
|
|
|
|
|
|
|
|
TRACE("(%p)->()\n",This);
|
|
|
|
|
|
|
|
return IUnknown_Release(This->unk.punkControl);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI
|
|
|
|
IPersist_fnGetClassID(IPersist* iface,CLSID* pclsid)
|
|
|
|
{
|
|
|
|
CFilterGraph_THIS(iface,persist);
|
|
|
|
|
|
|
|
TRACE("(%p)->()\n",This);
|
|
|
|
|
|
|
|
if ( pclsid == NULL )
|
|
|
|
return E_POINTER;
|
|
|
|
memcpy( pclsid, &CLSID_FilterGraph, sizeof(CLSID) );
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static ICOM_VTABLE(IPersist) ipersist =
|
|
|
|
{
|
|
|
|
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
|
|
|
|
/* IUnknown fields */
|
|
|
|
IPersist_fnQueryInterface,
|
|
|
|
IPersist_fnAddRef,
|
|
|
|
IPersist_fnRelease,
|
|
|
|
/* IPersist fields */
|
|
|
|
IPersist_fnGetClassID,
|
|
|
|
};
|
|
|
|
|
|
|
|
HRESULT CFilterGraph_InitIPersist( CFilterGraph* pfg )
|
|
|
|
{
|
|
|
|
TRACE("(%p)\n",pfg);
|
|
|
|
ICOM_VTBL(&pfg->persist) = &ipersist;
|
|
|
|
|
|
|
|
return NOERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CFilterGraph_UninitIPersist( CFilterGraph* pfg )
|
|
|
|
{
|
|
|
|
TRACE("(%p)\n",pfg);
|
|
|
|
}
|
2001-10-14 18:13:14 +02:00
|
|
|
|
|
|
|
/***************************************************************************
|
|
|
|
*
|
|
|
|
* CFilterGraph::IDispatch
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
static HRESULT WINAPI
|
|
|
|
IDispatch_fnQueryInterface(IDispatch* iface,REFIID riid,void** ppobj)
|
|
|
|
{
|
|
|
|
CFilterGraph_THIS(iface,disp);
|
|
|
|
|
|
|
|
TRACE("(%p)->()\n",This);
|
|
|
|
|
|
|
|
return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI
|
|
|
|
IDispatch_fnAddRef(IDispatch* iface)
|
|
|
|
{
|
|
|
|
CFilterGraph_THIS(iface,disp);
|
|
|
|
|
|
|
|
TRACE("(%p)->()\n",This);
|
|
|
|
|
|
|
|
return IUnknown_AddRef(This->unk.punkControl);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI
|
|
|
|
IDispatch_fnRelease(IDispatch* iface)
|
|
|
|
{
|
|
|
|
CFilterGraph_THIS(iface,disp);
|
|
|
|
|
|
|
|
TRACE("(%p)->()\n",This);
|
|
|
|
|
|
|
|
return IUnknown_Release(This->unk.punkControl);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI
|
|
|
|
IDispatch_fnGetTypeInfoCount(IDispatch* iface,UINT* pcTypeInfo)
|
|
|
|
{
|
|
|
|
CFilterGraph_THIS(iface,disp);
|
|
|
|
|
|
|
|
FIXME("(%p)->()\n",This);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI
|
|
|
|
IDispatch_fnGetTypeInfo(IDispatch* iface,UINT iTypeInfo, LCID lcid, ITypeInfo** ppobj)
|
|
|
|
{
|
|
|
|
CFilterGraph_THIS(iface,disp);
|
|
|
|
|
|
|
|
FIXME("(%p)->()\n",This);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI
|
|
|
|
IDispatch_fnGetIDsOfNames(IDispatch* iface,REFIID riid, LPOLESTR* ppwszName, UINT cNames, LCID lcid, DISPID* pDispId)
|
|
|
|
{
|
|
|
|
CFilterGraph_THIS(iface,disp);
|
|
|
|
|
|
|
|
FIXME("(%p)->()\n",This);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI
|
|
|
|
IDispatch_fnInvoke(IDispatch* iface,DISPID DispId, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarRes, EXCEPINFO* pExcepInfo, UINT* puArgErr)
|
|
|
|
{
|
|
|
|
CFilterGraph_THIS(iface,disp);
|
|
|
|
|
|
|
|
FIXME("(%p)->()\n",This);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static ICOM_VTABLE(IDispatch) idispatch =
|
|
|
|
{
|
|
|
|
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
|
|
|
|
/* IUnknown fields */
|
|
|
|
IDispatch_fnQueryInterface,
|
|
|
|
IDispatch_fnAddRef,
|
|
|
|
IDispatch_fnRelease,
|
|
|
|
/* IDispatch fields */
|
|
|
|
IDispatch_fnGetTypeInfoCount,
|
|
|
|
IDispatch_fnGetTypeInfo,
|
|
|
|
IDispatch_fnGetIDsOfNames,
|
|
|
|
IDispatch_fnInvoke,
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
HRESULT CFilterGraph_InitIDispatch( CFilterGraph* pfg )
|
|
|
|
{
|
|
|
|
TRACE("(%p)\n",pfg);
|
|
|
|
ICOM_VTBL(&pfg->disp) = &idispatch;
|
|
|
|
|
|
|
|
return NOERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CFilterGraph_UninitIDispatch( CFilterGraph* pfg )
|
|
|
|
{
|
|
|
|
TRACE("(%p)\n",pfg);
|
|
|
|
}
|
2002-03-19 03:15:26 +01:00
|
|
|
|
|
|
|
|
|
|
|
|