2 * Implementation of IMediaControl for FilterGraph.
6 * hidenori@a2.ctktv.ne.jp
21 #include "debugtools.h"
22 DEFAULT_DEBUG_CHANNEL(quartz
);
24 #include "quartz_private.h"
30 IMediaControl_fnQueryInterface(IMediaControl
* iface
,REFIID riid
,void** ppobj
)
32 CFilterGraph_THIS(iface
,mediacontrol
);
34 TRACE("(%p)->()\n",This
);
36 return IUnknown_QueryInterface(This
->unk
.punkControl
,riid
,ppobj
);
40 IMediaControl_fnAddRef(IMediaControl
* iface
)
42 CFilterGraph_THIS(iface
,mediacontrol
);
44 TRACE("(%p)->()\n",This
);
46 return IUnknown_AddRef(This
->unk
.punkControl
);
50 IMediaControl_fnRelease(IMediaControl
* iface
)
52 CFilterGraph_THIS(iface
,mediacontrol
);
54 TRACE("(%p)->()\n",This
);
56 return IUnknown_Release(This
->unk
.punkControl
);
60 IMediaControl_fnGetTypeInfoCount(IMediaControl
* iface
,UINT
* pcTypeInfo
)
62 CFilterGraph_THIS(iface
,mediacontrol
);
64 FIXME("(%p)->()\n",This
);
70 IMediaControl_fnGetTypeInfo(IMediaControl
* iface
,UINT iTypeInfo
, LCID lcid
, ITypeInfo
** ppobj
)
72 CFilterGraph_THIS(iface
,mediacontrol
);
74 FIXME("(%p)->()\n",This
);
80 IMediaControl_fnGetIDsOfNames(IMediaControl
* iface
,REFIID riid
, LPOLESTR
* ppwszName
, UINT cNames
, LCID lcid
, DISPID
* pDispId
)
82 CFilterGraph_THIS(iface
,mediacontrol
);
84 FIXME("(%p)->()\n",This
);
90 IMediaControl_fnInvoke(IMediaControl
* iface
,DISPID DispId
, REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
* pDispParams
, VARIANT
* pVarRes
, EXCEPINFO
* pExcepInfo
, UINT
* puArgErr
)
92 CFilterGraph_THIS(iface
,mediacontrol
);
94 FIXME("(%p)->()\n",This
);
100 static HRESULT WINAPI
101 IMediaControl_fnRun(IMediaControl
* iface
)
103 CFilterGraph_THIS(iface
,mediacontrol
);
105 TRACE("(%p)->()\n",This
);
107 return IMediaFilter_Run( CFilterGraph_IMediaFilter(This
),
111 static HRESULT WINAPI
112 IMediaControl_fnPause(IMediaControl
* iface
)
114 CFilterGraph_THIS(iface
,mediacontrol
);
116 TRACE("(%p)->()\n",This
);
118 return IMediaFilter_Pause( CFilterGraph_IMediaFilter(This
) );
121 static HRESULT WINAPI
122 IMediaControl_fnStop(IMediaControl
* iface
)
124 CFilterGraph_THIS(iface
,mediacontrol
);
128 TRACE("(%p)->()\n",This
);
130 hr
= IMediaControl_GetState(iface
,INFINITE
,(OAFilterState
*)&fs
);
131 if ( SUCCEEDED(hr
) && fs
== State_Running
)
133 hr
= IMediaControl_Pause(iface
);
135 hr
= IMediaControl_GetState(iface
,INFINITE
,(OAFilterState
*)&fs
);
138 if ( SUCCEEDED(hr
) && fs
== State_Paused
)
140 hr
= IMediaFilter_Stop(CFilterGraph_IMediaFilter(This
));
142 hr
= IMediaControl_GetState(iface
,INFINITE
,(OAFilterState
*)&fs
);
148 static HRESULT WINAPI
149 IMediaControl_fnGetState(IMediaControl
* iface
,LONG lTimeOut
,OAFilterState
* pFilterState
)
151 CFilterGraph_THIS(iface
,mediacontrol
);
153 TRACE("(%p)->()\n",This
);
155 return IMediaFilter_GetState( CFilterGraph_IMediaFilter(This
), (DWORD
)lTimeOut
, (FILTER_STATE
*)pFilterState
);
158 static HRESULT WINAPI
159 IMediaControl_fnRenderFile(IMediaControl
* iface
,BSTR bstrFileName
)
161 CFilterGraph_THIS(iface
,mediacontrol
);
166 TRACE("(%p)->()\n",This
);
168 uLen
= SysStringLen(bstrFileName
);
169 pwszName
= (WCHAR
*)QUARTZ_AllocMem( sizeof(WCHAR
) * (uLen
+1) );
170 if ( pwszName
== NULL
)
171 return E_OUTOFMEMORY
;
172 memcpy( pwszName
, bstrFileName
, sizeof(WCHAR
)*uLen
);
173 pwszName
[uLen
] = (WCHAR
)0;
175 hr
= IFilterGraph2_RenderFile(
176 CFilterGraph_IFilterGraph2(This
), pwszName
, NULL
);
178 QUARTZ_FreeMem( pwszName
);
183 static HRESULT WINAPI
184 IMediaControl_fnAddSourceFilter(IMediaControl
* iface
,BSTR bstrFileName
,IDispatch
** ppobj
)
186 CFilterGraph_THIS(iface
,mediacontrol
);
188 FIXME("(%p)->()\n",This
);
193 static HRESULT WINAPI
194 IMediaControl_fnget_FilterCollection(IMediaControl
* iface
,IDispatch
** ppobj
)
196 CFilterGraph_THIS(iface
,mediacontrol
);
198 FIXME("(%p)->()\n",This
);
203 static HRESULT WINAPI
204 IMediaControl_fnget_RegFilterCollection(IMediaControl
* iface
,IDispatch
** ppobj
)
206 CFilterGraph_THIS(iface
,mediacontrol
);
208 FIXME("(%p)->()\n",This
);
213 static HRESULT WINAPI
214 IMediaControl_fnStopWhenReady(IMediaControl
* iface
)
216 CFilterGraph_THIS(iface
,mediacontrol
);
218 TRACE("(%p)->()\n",This
);
220 return IMediaFilter_Stop( CFilterGraph_IMediaFilter(This
) );
224 static ICOM_VTABLE(IMediaControl
) imediacontrol
=
226 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
227 /* IUnknown fields */
228 IMediaControl_fnQueryInterface
,
229 IMediaControl_fnAddRef
,
230 IMediaControl_fnRelease
,
231 /* IDispatch fields */
232 IMediaControl_fnGetTypeInfoCount
,
233 IMediaControl_fnGetTypeInfo
,
234 IMediaControl_fnGetIDsOfNames
,
235 IMediaControl_fnInvoke
,
236 /* IMediaControl fields */
238 IMediaControl_fnPause
,
239 IMediaControl_fnStop
,
240 IMediaControl_fnGetState
,
241 IMediaControl_fnRenderFile
,
242 IMediaControl_fnAddSourceFilter
,
243 IMediaControl_fnget_FilterCollection
,
244 IMediaControl_fnget_RegFilterCollection
,
245 IMediaControl_fnStopWhenReady
,
249 HRESULT
CFilterGraph_InitIMediaControl( CFilterGraph
* pfg
)
252 ICOM_VTBL(&pfg
->mediacontrol
) = &imediacontrol
;
257 void CFilterGraph_UninitIMediaControl( CFilterGraph
* pfg
)