2 * Implementation of IMediaControl for FilterGraph.
6 * Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
35 #include "wine/debug.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(quartz);
38 #include "quartz_private.h"
44 IMediaControl_fnQueryInterface(IMediaControl* iface,REFIID riid,void** ppobj)
46 CFilterGraph_THIS(iface,mediacontrol);
48 TRACE("(%p)->()\n",This);
50 return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj);
54 IMediaControl_fnAddRef(IMediaControl* iface)
56 CFilterGraph_THIS(iface,mediacontrol);
58 TRACE("(%p)->()\n",This);
60 return IUnknown_AddRef(This->unk.punkControl);
64 IMediaControl_fnRelease(IMediaControl* iface)
66 CFilterGraph_THIS(iface,mediacontrol);
68 TRACE("(%p)->()\n",This);
70 return IUnknown_Release(This->unk.punkControl);
74 IMediaControl_fnGetTypeInfoCount(IMediaControl* iface,UINT* pcTypeInfo)
76 CFilterGraph_THIS(iface,mediacontrol);
78 FIXME("(%p)->()\n",This);
84 IMediaControl_fnGetTypeInfo(IMediaControl* iface,UINT iTypeInfo, LCID lcid, ITypeInfo** ppobj)
86 CFilterGraph_THIS(iface,mediacontrol);
88 FIXME("(%p)->()\n",This);
94 IMediaControl_fnGetIDsOfNames(IMediaControl* iface,REFIID riid, LPOLESTR* ppwszName, UINT cNames, LCID lcid, DISPID* pDispId)
96 CFilterGraph_THIS(iface,mediacontrol);
98 FIXME("(%p)->()\n",This);
103 static HRESULT WINAPI
104 IMediaControl_fnInvoke(IMediaControl* iface,DISPID DispId, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarRes, EXCEPINFO* pExcepInfo, UINT* puArgErr)
106 CFilterGraph_THIS(iface,mediacontrol);
108 FIXME("(%p)->()\n",This);
114 static HRESULT WINAPI
115 IMediaControl_fnRun(IMediaControl* iface)
117 CFilterGraph_THIS(iface,mediacontrol);
119 TRACE("(%p)->()\n",This);
121 return IMediaFilter_Run( CFilterGraph_IMediaFilter(This),
125 static HRESULT WINAPI
126 IMediaControl_fnPause(IMediaControl* iface)
128 CFilterGraph_THIS(iface,mediacontrol);
130 TRACE("(%p)->()\n",This);
132 return IMediaFilter_Pause( CFilterGraph_IMediaFilter(This) );
135 static HRESULT WINAPI
136 IMediaControl_fnStop(IMediaControl* iface)
138 CFilterGraph_THIS(iface,mediacontrol);
142 TRACE("(%p)->()\n",This);
144 hr = IMediaControl_GetState(iface,INFINITE,(OAFilterState*)&fs);
145 if ( SUCCEEDED(hr) && fs == State_Running )
147 hr = IMediaControl_Pause(iface);
149 hr = IMediaControl_GetState(iface,INFINITE,(OAFilterState*)&fs);
152 if ( SUCCEEDED(hr) && fs == State_Paused )
154 hr = IMediaFilter_Stop(CFilterGraph_IMediaFilter(This));
156 hr = IMediaControl_GetState(iface,INFINITE,(OAFilterState*)&fs);
162 static HRESULT WINAPI
163 IMediaControl_fnGetState(IMediaControl* iface,LONG lTimeOut,OAFilterState* pFilterState)
165 CFilterGraph_THIS(iface,mediacontrol);
167 TRACE("(%p)->()\n",This);
169 return IMediaFilter_GetState( CFilterGraph_IMediaFilter(This), (DWORD)lTimeOut, (FILTER_STATE*)pFilterState );
172 static HRESULT WINAPI
173 IMediaControl_fnRenderFile(IMediaControl* iface,BSTR bstrFileName)
175 CFilterGraph_THIS(iface,mediacontrol);
180 TRACE("(%p)->()\n",This);
182 uLen = SysStringLen(bstrFileName);
183 pwszName = (WCHAR*)QUARTZ_AllocMem( sizeof(WCHAR) * (uLen+1) );
184 if ( pwszName == NULL )
185 return E_OUTOFMEMORY;
186 memcpy( pwszName, bstrFileName, sizeof(WCHAR)*uLen );
187 pwszName[uLen] = (WCHAR)0;
189 hr = IFilterGraph2_RenderFile(
190 CFilterGraph_IFilterGraph2(This), pwszName, NULL );
192 QUARTZ_FreeMem( pwszName );
197 static HRESULT WINAPI
198 IMediaControl_fnAddSourceFilter(IMediaControl* iface,BSTR bstrFileName,IDispatch** ppobj)
200 CFilterGraph_THIS(iface,mediacontrol);
202 FIXME("(%p)->()\n",This);
207 static HRESULT WINAPI
208 IMediaControl_fnget_FilterCollection(IMediaControl* iface,IDispatch** ppobj)
210 CFilterGraph_THIS(iface,mediacontrol);
212 FIXME("(%p)->()\n",This);
217 static HRESULT WINAPI
218 IMediaControl_fnget_RegFilterCollection(IMediaControl* iface,IDispatch** ppobj)
220 CFilterGraph_THIS(iface,mediacontrol);
222 FIXME("(%p)->()\n",This);
227 static HRESULT WINAPI
228 IMediaControl_fnStopWhenReady(IMediaControl* iface)
230 CFilterGraph_THIS(iface,mediacontrol);
232 TRACE("(%p)->()\n",This);
234 return IMediaFilter_Stop( CFilterGraph_IMediaFilter(This) );
238 static ICOM_VTABLE(IMediaControl) imediacontrol =
240 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
241 /* IUnknown fields */
242 IMediaControl_fnQueryInterface,
243 IMediaControl_fnAddRef,
244 IMediaControl_fnRelease,
245 /* IDispatch fields */
246 IMediaControl_fnGetTypeInfoCount,
247 IMediaControl_fnGetTypeInfo,
248 IMediaControl_fnGetIDsOfNames,
249 IMediaControl_fnInvoke,
250 /* IMediaControl fields */
252 IMediaControl_fnPause,
253 IMediaControl_fnStop,
254 IMediaControl_fnGetState,
255 IMediaControl_fnRenderFile,
256 IMediaControl_fnAddSourceFilter,
257 IMediaControl_fnget_FilterCollection,
258 IMediaControl_fnget_RegFilterCollection,
259 IMediaControl_fnStopWhenReady,
263 HRESULT CFilterGraph_InitIMediaControl( CFilterGraph* pfg )
266 ICOM_VTBL(&pfg->mediacontrol) = &imediacontrol;
271 void CFilterGraph_UninitIMediaControl( CFilterGraph* pfg )