| 1 | /*
|
|---|
| 2 | * Implements IBaseFilter. (internal)
|
|---|
| 3 | *
|
|---|
| 4 | * hidenori@a2.ctktv.ne.jp
|
|---|
| 5 | */
|
|---|
| 6 |
|
|---|
| 7 | #include "config.h"
|
|---|
| 8 |
|
|---|
| 9 | #include "windef.h"
|
|---|
| 10 | #include "winbase.h"
|
|---|
| 11 | #include "wingdi.h"
|
|---|
| 12 | #include "winuser.h"
|
|---|
| 13 | #include "winerror.h"
|
|---|
| 14 | #include "wine/obj_base.h"
|
|---|
| 15 | #include "strmif.h"
|
|---|
| 16 | #include "vfwmsgs.h"
|
|---|
| 17 | #include "wine/unicode.h"
|
|---|
| 18 |
|
|---|
| 19 | #include "debugtools.h"
|
|---|
| 20 | DEFAULT_DEBUG_CHANNEL(quartz);
|
|---|
| 21 |
|
|---|
| 22 | #include "quartz_private.h"
|
|---|
| 23 | #include "basefilt.h"
|
|---|
| 24 | #include "enumunk.h"
|
|---|
| 25 |
|
|---|
| 26 | static HRESULT WINAPI
|
|---|
| 27 | CBaseFilterImpl_fnQueryInterface(IBaseFilter* iface,REFIID riid,void** ppobj)
|
|---|
| 28 | {
|
|---|
| 29 | ICOM_THIS(CBaseFilterImpl,iface);
|
|---|
| 30 |
|
|---|
| 31 | TRACE("(%p)->()\n",This);
|
|---|
| 32 |
|
|---|
| 33 | return IUnknown_QueryInterface(This->punkControl,riid,ppobj);
|
|---|
| 34 | }
|
|---|
| 35 |
|
|---|
| 36 | static ULONG WINAPI
|
|---|
| 37 | CBaseFilterImpl_fnAddRef(IBaseFilter* iface)
|
|---|
| 38 | {
|
|---|
| 39 | ICOM_THIS(CBaseFilterImpl,iface);
|
|---|
| 40 |
|
|---|
| 41 | TRACE("(%p)->()\n",This);
|
|---|
| 42 |
|
|---|
| 43 | return IUnknown_AddRef(This->punkControl);
|
|---|
| 44 | }
|
|---|
| 45 |
|
|---|
| 46 | static ULONG WINAPI
|
|---|
| 47 | CBaseFilterImpl_fnRelease(IBaseFilter* iface)
|
|---|
| 48 | {
|
|---|
| 49 | ICOM_THIS(CBaseFilterImpl,iface);
|
|---|
| 50 |
|
|---|
| 51 | TRACE("(%p)->()\n",This);
|
|---|
| 52 |
|
|---|
| 53 | return IUnknown_Release(This->punkControl);
|
|---|
| 54 | }
|
|---|
| 55 |
|
|---|
| 56 |
|
|---|
| 57 | static HRESULT WINAPI
|
|---|
| 58 | CBaseFilterImpl_fnGetClassID(IBaseFilter* iface,CLSID* pclsid)
|
|---|
| 59 | {
|
|---|
| 60 | ICOM_THIS(CBaseFilterImpl,iface);
|
|---|
| 61 |
|
|---|
| 62 | TRACE("(%p)->()\n",This);
|
|---|
| 63 |
|
|---|
| 64 | if ( pclsid == NULL )
|
|---|
| 65 | return E_POINTER;
|
|---|
| 66 |
|
|---|
| 67 | memcpy( pclsid, This->pclsidFilter, sizeof(CLSID) );
|
|---|
| 68 |
|
|---|
| 69 | return NOERROR;
|
|---|
| 70 | }
|
|---|
| 71 |
|
|---|
| 72 | static HRESULT WINAPI
|
|---|
| 73 | CBaseFilterImpl_fnStop(IBaseFilter* iface)
|
|---|
| 74 | {
|
|---|
| 75 | ICOM_THIS(CBaseFilterImpl,iface);
|
|---|
| 76 | HRESULT hr;
|
|---|
| 77 |
|
|---|
| 78 | TRACE("(%p)->()\n",This);
|
|---|
| 79 |
|
|---|
| 80 | hr = NOERROR;
|
|---|
| 81 |
|
|---|
| 82 | EnterCriticalSection( &This->csFilter );
|
|---|
| 83 |
|
|---|
| 84 | if ( This->fstate == State_Running )
|
|---|
| 85 | {
|
|---|
| 86 | if ( This->pHandlers->pOnInactive != NULL )
|
|---|
| 87 | hr = This->pHandlers->pOnInactive( This );
|
|---|
| 88 | }
|
|---|
| 89 |
|
|---|
| 90 | if ( SUCCEEDED(hr) )
|
|---|
| 91 | This->fstate = State_Stopped;
|
|---|
| 92 | LeaveCriticalSection( &This->csFilter );
|
|---|
| 93 |
|
|---|
| 94 | return hr;
|
|---|
| 95 | }
|
|---|
| 96 |
|
|---|
| 97 | static HRESULT WINAPI
|
|---|
| 98 | CBaseFilterImpl_fnPause(IBaseFilter* iface)
|
|---|
| 99 | {
|
|---|
| 100 | ICOM_THIS(CBaseFilterImpl,iface);
|
|---|
| 101 | HRESULT hr;
|
|---|
| 102 |
|
|---|
| 103 | TRACE("(%p)->()\n",This);
|
|---|
| 104 |
|
|---|
| 105 | hr = NOERROR;
|
|---|
| 106 |
|
|---|
| 107 | EnterCriticalSection( &This->csFilter );
|
|---|
| 108 |
|
|---|
| 109 | if ( This->fstate == State_Running )
|
|---|
| 110 | {
|
|---|
| 111 | if ( This->pHandlers->pOnInactive != NULL )
|
|---|
| 112 | hr = This->pHandlers->pOnInactive( This );
|
|---|
| 113 | }
|
|---|
| 114 |
|
|---|
| 115 | if ( SUCCEEDED(hr) )
|
|---|
| 116 | This->fstate = State_Paused;
|
|---|
| 117 |
|
|---|
| 118 | LeaveCriticalSection( &This->csFilter );
|
|---|
| 119 |
|
|---|
| 120 | TRACE("hr = %08lx\n",hr);
|
|---|
| 121 |
|
|---|
| 122 | return hr;
|
|---|
| 123 | }
|
|---|
| 124 |
|
|---|
| 125 | static HRESULT WINAPI
|
|---|
| 126 | CBaseFilterImpl_fnRun(IBaseFilter* iface,REFERENCE_TIME rtStart)
|
|---|
| 127 | {
|
|---|
| 128 | ICOM_THIS(CBaseFilterImpl,iface);
|
|---|
| 129 | HRESULT hr;
|
|---|
| 130 |
|
|---|
| 131 | TRACE("(%p)->()\n",This);
|
|---|
| 132 |
|
|---|
| 133 | hr = NOERROR;
|
|---|
| 134 |
|
|---|
| 135 | EnterCriticalSection( &This->csFilter );
|
|---|
| 136 |
|
|---|
| 137 | This->rtStart = rtStart;
|
|---|
| 138 |
|
|---|
| 139 | if ( This->fstate != State_Running )
|
|---|
| 140 | {
|
|---|
| 141 | if ( This->pHandlers->pOnActive != NULL )
|
|---|
| 142 | hr = This->pHandlers->pOnActive( This );
|
|---|
| 143 | }
|
|---|
| 144 |
|
|---|
| 145 | if ( SUCCEEDED(hr) )
|
|---|
| 146 | This->fstate = State_Running;
|
|---|
| 147 |
|
|---|
| 148 | LeaveCriticalSection( &This->csFilter );
|
|---|
| 149 |
|
|---|
| 150 | return hr;
|
|---|
| 151 | }
|
|---|
| 152 |
|
|---|
| 153 | static HRESULT WINAPI
|
|---|
| 154 | CBaseFilterImpl_fnGetState(IBaseFilter* iface,DWORD dw,FILTER_STATE* pState)
|
|---|
| 155 | {
|
|---|
| 156 | ICOM_THIS(CBaseFilterImpl,iface);
|
|---|
| 157 |
|
|---|
| 158 | TRACE("(%p)->(%p)\n",This,pState);
|
|---|
| 159 |
|
|---|
| 160 | if ( pState == NULL )
|
|---|
| 161 | return E_POINTER;
|
|---|
| 162 |
|
|---|
| 163 | /* FIXME - ignore 'intermediate state' now */
|
|---|
| 164 |
|
|---|
| 165 | EnterCriticalSection( &This->csFilter );
|
|---|
| 166 | TRACE("state %d\n",This->fstate);
|
|---|
| 167 | *pState = This->fstate;
|
|---|
| 168 | LeaveCriticalSection( &This->csFilter );
|
|---|
| 169 |
|
|---|
| 170 | return NOERROR;
|
|---|
| 171 | }
|
|---|
| 172 |
|
|---|
| 173 | static HRESULT WINAPI
|
|---|
| 174 | CBaseFilterImpl_fnSetSyncSource(IBaseFilter* iface,IReferenceClock* pobjClock)
|
|---|
| 175 | {
|
|---|
| 176 | ICOM_THIS(CBaseFilterImpl,iface);
|
|---|
| 177 |
|
|---|
| 178 | TRACE("(%p)->(%p)\n",This,pobjClock);
|
|---|
| 179 |
|
|---|
| 180 | EnterCriticalSection( &This->csFilter );
|
|---|
| 181 |
|
|---|
| 182 | if ( This->pClock != NULL )
|
|---|
| 183 | {
|
|---|
| 184 | IReferenceClock_Release( This->pClock );
|
|---|
| 185 | This->pClock = NULL;
|
|---|
| 186 | }
|
|---|
| 187 |
|
|---|
| 188 | This->pClock = pobjClock;
|
|---|
| 189 | if ( pobjClock != NULL )
|
|---|
| 190 | IReferenceClock_AddRef( pobjClock );
|
|---|
| 191 |
|
|---|
| 192 | LeaveCriticalSection( &This->csFilter );
|
|---|
| 193 |
|
|---|
| 194 | return NOERROR;
|
|---|
| 195 | }
|
|---|
| 196 |
|
|---|
| 197 | static HRESULT WINAPI
|
|---|
| 198 | CBaseFilterImpl_fnGetSyncSource(IBaseFilter* iface,IReferenceClock** ppobjClock)
|
|---|
| 199 | {
|
|---|
| 200 | ICOM_THIS(CBaseFilterImpl,iface);
|
|---|
| 201 | HRESULT hr = VFW_E_NO_CLOCK;
|
|---|
| 202 |
|
|---|
| 203 | TRACE("(%p)->(%p)\n",This,ppobjClock);
|
|---|
| 204 |
|
|---|
| 205 | if ( ppobjClock == NULL )
|
|---|
| 206 | return E_POINTER;
|
|---|
| 207 |
|
|---|
| 208 | EnterCriticalSection( &This->csFilter );
|
|---|
| 209 |
|
|---|
| 210 | *ppobjClock = This->pClock;
|
|---|
| 211 | if ( This->pClock != NULL )
|
|---|
| 212 | {
|
|---|
| 213 | hr = NOERROR;
|
|---|
| 214 | IReferenceClock_AddRef( This->pClock );
|
|---|
| 215 | }
|
|---|
| 216 |
|
|---|
| 217 | LeaveCriticalSection( &This->csFilter );
|
|---|
| 218 |
|
|---|
| 219 | return hr;
|
|---|
| 220 | }
|
|---|
| 221 |
|
|---|
| 222 |
|
|---|
| 223 | static HRESULT WINAPI
|
|---|
| 224 | CBaseFilterImpl_fnEnumPins(IBaseFilter* iface,IEnumPins** ppenum)
|
|---|
| 225 | {
|
|---|
| 226 | ICOM_THIS(CBaseFilterImpl,iface);
|
|---|
| 227 | HRESULT hr = E_FAIL;
|
|---|
| 228 | QUARTZ_CompList* pListPins;
|
|---|
| 229 | QUARTZ_CompListItem* pItem;
|
|---|
| 230 | IUnknown* punkPin;
|
|---|
| 231 |
|
|---|
| 232 | TRACE("(%p)->(%p)\n",This,ppenum);
|
|---|
| 233 |
|
|---|
| 234 | if ( ppenum == NULL )
|
|---|
| 235 | return E_POINTER;
|
|---|
| 236 | *ppenum = NULL;
|
|---|
| 237 |
|
|---|
| 238 | pListPins = QUARTZ_CompList_Alloc();
|
|---|
| 239 | if ( pListPins == NULL )
|
|---|
| 240 | return E_OUTOFMEMORY;
|
|---|
| 241 |
|
|---|
| 242 | QUARTZ_CompList_Lock( This->pInPins );
|
|---|
| 243 | QUARTZ_CompList_Lock( This->pOutPins );
|
|---|
| 244 |
|
|---|
| 245 | pItem = QUARTZ_CompList_GetFirst( This->pInPins );
|
|---|
| 246 | while ( pItem != NULL )
|
|---|
| 247 | {
|
|---|
| 248 | punkPin = QUARTZ_CompList_GetItemPtr( pItem );
|
|---|
| 249 | hr = QUARTZ_CompList_AddComp( pListPins, punkPin, NULL, 0 );
|
|---|
| 250 | if ( FAILED(hr) )
|
|---|
| 251 | goto err;
|
|---|
| 252 | pItem = QUARTZ_CompList_GetNext( This->pInPins, pItem );
|
|---|
| 253 | }
|
|---|
| 254 |
|
|---|
| 255 | pItem = QUARTZ_CompList_GetFirst( This->pOutPins );
|
|---|
| 256 | while ( pItem != NULL )
|
|---|
| 257 | {
|
|---|
| 258 | punkPin = QUARTZ_CompList_GetItemPtr( pItem );
|
|---|
| 259 | hr = QUARTZ_CompList_AddComp( pListPins, punkPin, NULL, 0 );
|
|---|
| 260 | if ( FAILED(hr) )
|
|---|
| 261 | goto err;
|
|---|
| 262 | pItem = QUARTZ_CompList_GetNext( This->pOutPins, pItem );
|
|---|
| 263 | }
|
|---|
| 264 |
|
|---|
| 265 | hr = QUARTZ_CreateEnumUnknown(
|
|---|
| 266 | &IID_IEnumPins, (void**)ppenum, pListPins );
|
|---|
| 267 | err:
|
|---|
| 268 | QUARTZ_CompList_Unlock( This->pInPins );
|
|---|
| 269 | QUARTZ_CompList_Unlock( This->pOutPins );
|
|---|
| 270 |
|
|---|
| 271 | QUARTZ_CompList_Free( pListPins );
|
|---|
| 272 |
|
|---|
| 273 | return hr;
|
|---|
| 274 | }
|
|---|
| 275 |
|
|---|
| 276 | static HRESULT WINAPI
|
|---|
| 277 | CBaseFilterImpl_fnFindPin(IBaseFilter* iface,LPCWSTR lpwszId,IPin** ppobj)
|
|---|
| 278 | {
|
|---|
| 279 | ICOM_THIS(CBaseFilterImpl,iface);
|
|---|
| 280 |
|
|---|
| 281 | FIXME("(%p)->(%s,%p) stub!\n",This,debugstr_w(lpwszId),ppobj);
|
|---|
| 282 |
|
|---|
| 283 | if ( ppobj == NULL )
|
|---|
| 284 | return E_POINTER;
|
|---|
| 285 |
|
|---|
| 286 |
|
|---|
| 287 |
|
|---|
| 288 | return E_NOTIMPL;
|
|---|
| 289 | }
|
|---|
| 290 |
|
|---|
| 291 | static HRESULT WINAPI
|
|---|
| 292 | CBaseFilterImpl_fnQueryFilterInfo(IBaseFilter* iface,FILTER_INFO* pfi)
|
|---|
| 293 | {
|
|---|
| 294 | ICOM_THIS(CBaseFilterImpl,iface);
|
|---|
| 295 |
|
|---|
| 296 | TRACE("(%p)->(%p)\n",This,pfi);
|
|---|
| 297 |
|
|---|
| 298 | if ( pfi == NULL )
|
|---|
| 299 | return E_POINTER;
|
|---|
| 300 |
|
|---|
| 301 | EnterCriticalSection( &This->csFilter );
|
|---|
| 302 |
|
|---|
| 303 | if ( This->cbNameGraph <= sizeof(WCHAR)*MAX_FILTER_NAME )
|
|---|
| 304 | {
|
|---|
| 305 | memcpy( pfi->achName, This->pwszNameGraph, This->cbNameGraph );
|
|---|
| 306 | }
|
|---|
| 307 | else
|
|---|
| 308 | {
|
|---|
| 309 | memcpy( pfi->achName, This->pwszNameGraph,
|
|---|
| 310 | sizeof(WCHAR)*MAX_FILTER_NAME );
|
|---|
| 311 | pfi->achName[MAX_FILTER_NAME-1] = (WCHAR)0;
|
|---|
| 312 | }
|
|---|
| 313 |
|
|---|
| 314 | pfi->pGraph = This->pfg;
|
|---|
| 315 | if ( pfi->pGraph != NULL )
|
|---|
| 316 | IFilterGraph_AddRef(pfi->pGraph);
|
|---|
| 317 |
|
|---|
| 318 | LeaveCriticalSection( &This->csFilter );
|
|---|
| 319 |
|
|---|
| 320 | return NOERROR;
|
|---|
| 321 | }
|
|---|
| 322 |
|
|---|
| 323 | static HRESULT WINAPI
|
|---|
| 324 | CBaseFilterImpl_fnJoinFilterGraph(IBaseFilter* iface,IFilterGraph* pfg,LPCWSTR lpwszName)
|
|---|
| 325 | {
|
|---|
| 326 | ICOM_THIS(CBaseFilterImpl,iface);
|
|---|
| 327 | HRESULT hr;
|
|---|
| 328 |
|
|---|
| 329 | TRACE("(%p)->(%p,%s)\n",This,pfg,debugstr_w(lpwszName));
|
|---|
| 330 |
|
|---|
| 331 | EnterCriticalSection( &This->csFilter );
|
|---|
| 332 |
|
|---|
| 333 | if ( This->pwszNameGraph != NULL )
|
|---|
| 334 | {
|
|---|
| 335 | QUARTZ_FreeMem( This->pwszNameGraph );
|
|---|
| 336 | This->pwszNameGraph = NULL;
|
|---|
| 337 | This->cbNameGraph = 0;
|
|---|
| 338 | }
|
|---|
| 339 |
|
|---|
| 340 | This->pfg = pfg;
|
|---|
| 341 | This->cbNameGraph = sizeof(WCHAR) * (strlenW(lpwszName)+1);
|
|---|
| 342 | This->pwszNameGraph = (WCHAR*)QUARTZ_AllocMem( This->cbNameGraph );
|
|---|
| 343 | if ( This->pwszNameGraph == NULL )
|
|---|
| 344 | {
|
|---|
| 345 | hr = E_OUTOFMEMORY;
|
|---|
| 346 | goto err;
|
|---|
| 347 | }
|
|---|
| 348 | memcpy( This->pwszNameGraph, lpwszName, This->cbNameGraph );
|
|---|
| 349 |
|
|---|
| 350 | hr = NOERROR;
|
|---|
| 351 | err:
|
|---|
| 352 | LeaveCriticalSection( &This->csFilter );
|
|---|
| 353 |
|
|---|
| 354 | return hr;
|
|---|
| 355 | }
|
|---|
| 356 |
|
|---|
| 357 | static HRESULT WINAPI
|
|---|
| 358 | CBaseFilterImpl_fnQueryVendorInfo(IBaseFilter* iface,LPWSTR* lpwszVendor)
|
|---|
| 359 | {
|
|---|
| 360 | ICOM_THIS(CBaseFilterImpl,iface);
|
|---|
| 361 |
|
|---|
| 362 | TRACE("(%p)->(%p)\n",This,lpwszVendor);
|
|---|
| 363 |
|
|---|
| 364 | /* E_NOTIMPL means 'no vender information'. */
|
|---|
| 365 | return E_NOTIMPL;
|
|---|
| 366 | }
|
|---|
| 367 |
|
|---|
| 368 |
|
|---|
| 369 |
|
|---|
| 370 | static ICOM_VTABLE(IBaseFilter) ibasefilter =
|
|---|
| 371 | {
|
|---|
| 372 | ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
|
|---|
| 373 | /* IUnknown fields */
|
|---|
| 374 | CBaseFilterImpl_fnQueryInterface,
|
|---|
| 375 | CBaseFilterImpl_fnAddRef,
|
|---|
| 376 | CBaseFilterImpl_fnRelease,
|
|---|
| 377 | /* IPersist fields */
|
|---|
| 378 | CBaseFilterImpl_fnGetClassID,
|
|---|
| 379 | /* IMediaFilter fields */
|
|---|
| 380 | CBaseFilterImpl_fnStop,
|
|---|
| 381 | CBaseFilterImpl_fnPause,
|
|---|
| 382 | CBaseFilterImpl_fnRun,
|
|---|
| 383 | CBaseFilterImpl_fnGetState,
|
|---|
| 384 | CBaseFilterImpl_fnSetSyncSource,
|
|---|
| 385 | CBaseFilterImpl_fnGetSyncSource,
|
|---|
| 386 | /* IBaseFilter fields */
|
|---|
| 387 | CBaseFilterImpl_fnEnumPins,
|
|---|
| 388 | CBaseFilterImpl_fnFindPin,
|
|---|
| 389 | CBaseFilterImpl_fnQueryFilterInfo,
|
|---|
| 390 | CBaseFilterImpl_fnJoinFilterGraph,
|
|---|
| 391 | CBaseFilterImpl_fnQueryVendorInfo,
|
|---|
| 392 | };
|
|---|
| 393 |
|
|---|
| 394 |
|
|---|
| 395 | HRESULT CBaseFilterImpl_InitIBaseFilter(
|
|---|
| 396 | CBaseFilterImpl* This, IUnknown* punkControl,
|
|---|
| 397 | const CLSID* pclsidFilter, LPCWSTR lpwszNameGraph,
|
|---|
| 398 | const CBaseFilterHandlers* pHandlers )
|
|---|
| 399 | {
|
|---|
| 400 | TRACE("(%p,%p)\n",This,punkControl);
|
|---|
| 401 |
|
|---|
| 402 | if ( punkControl == NULL )
|
|---|
| 403 | {
|
|---|
| 404 | ERR( "punkControl must not be NULL\n" );
|
|---|
| 405 | return E_INVALIDARG;
|
|---|
| 406 | }
|
|---|
| 407 |
|
|---|
| 408 | ICOM_VTBL(This) = &ibasefilter;
|
|---|
| 409 | This->punkControl = punkControl;
|
|---|
| 410 | This->pHandlers = pHandlers;
|
|---|
| 411 | This->pclsidFilter = pclsidFilter;
|
|---|
| 412 | This->pInPins = NULL;
|
|---|
| 413 | This->pOutPins = NULL;
|
|---|
| 414 | This->pfg = NULL;
|
|---|
| 415 | This->cbNameGraph = 0;
|
|---|
| 416 | This->pwszNameGraph = NULL;
|
|---|
| 417 | This->pClock = NULL;
|
|---|
| 418 | This->rtStart = 0;
|
|---|
| 419 | This->fstate = State_Stopped;
|
|---|
| 420 |
|
|---|
| 421 | This->cbNameGraph = sizeof(WCHAR) * (strlenW(lpwszNameGraph)+1);
|
|---|
| 422 | This->pwszNameGraph = (WCHAR*)QUARTZ_AllocMem( This->cbNameGraph );
|
|---|
| 423 | if ( This->pwszNameGraph == NULL )
|
|---|
| 424 | return E_OUTOFMEMORY;
|
|---|
| 425 | memcpy( This->pwszNameGraph, lpwszNameGraph, This->cbNameGraph );
|
|---|
| 426 |
|
|---|
| 427 | This->pInPins = QUARTZ_CompList_Alloc();
|
|---|
| 428 | This->pOutPins = QUARTZ_CompList_Alloc();
|
|---|
| 429 | if ( This->pInPins == NULL || This->pOutPins == NULL )
|
|---|
| 430 | {
|
|---|
| 431 | if ( This->pInPins != NULL )
|
|---|
| 432 | QUARTZ_CompList_Free(This->pInPins);
|
|---|
| 433 | if ( This->pOutPins != NULL )
|
|---|
| 434 | QUARTZ_CompList_Free(This->pOutPins);
|
|---|
| 435 | QUARTZ_FreeMem(This->pwszNameGraph);
|
|---|
| 436 | return E_OUTOFMEMORY;
|
|---|
| 437 | }
|
|---|
| 438 |
|
|---|
| 439 | InitializeCriticalSection( &This->csFilter );
|
|---|
| 440 |
|
|---|
| 441 | return NOERROR;
|
|---|
| 442 | }
|
|---|
| 443 |
|
|---|
| 444 | void CBaseFilterImpl_UninitIBaseFilter( CBaseFilterImpl* This )
|
|---|
| 445 | {
|
|---|
| 446 | QUARTZ_CompListItem* pListItem;
|
|---|
| 447 | IPin* pPin;
|
|---|
| 448 |
|
|---|
| 449 | TRACE("(%p)\n",This);
|
|---|
| 450 |
|
|---|
| 451 | if ( This->pInPins != NULL )
|
|---|
| 452 | {
|
|---|
| 453 | while ( 1 )
|
|---|
| 454 | {
|
|---|
| 455 | pListItem = QUARTZ_CompList_GetFirst( This->pInPins );
|
|---|
| 456 | if ( pListItem == NULL )
|
|---|
| 457 | break;
|
|---|
| 458 | pPin = (IPin*)QUARTZ_CompList_GetItemPtr( pListItem );
|
|---|
| 459 | QUARTZ_CompList_RemoveComp( This->pInPins, (IUnknown*)pPin );
|
|---|
| 460 | }
|
|---|
| 461 |
|
|---|
| 462 | QUARTZ_CompList_Free( This->pInPins );
|
|---|
| 463 | This->pInPins = NULL;
|
|---|
| 464 | }
|
|---|
| 465 | if ( This->pOutPins != NULL )
|
|---|
| 466 | {
|
|---|
| 467 | while ( 1 )
|
|---|
| 468 | {
|
|---|
| 469 | pListItem = QUARTZ_CompList_GetFirst( This->pOutPins );
|
|---|
| 470 | if ( pListItem == NULL )
|
|---|
| 471 | break;
|
|---|
| 472 | pPin = (IPin*)QUARTZ_CompList_GetItemPtr( pListItem );
|
|---|
| 473 | QUARTZ_CompList_RemoveComp( This->pOutPins, (IUnknown*)pPin );
|
|---|
| 474 | }
|
|---|
| 475 |
|
|---|
| 476 | QUARTZ_CompList_Free( This->pOutPins );
|
|---|
| 477 | This->pOutPins = NULL;
|
|---|
| 478 | }
|
|---|
| 479 |
|
|---|
| 480 | if ( This->pwszNameGraph != NULL )
|
|---|
| 481 | {
|
|---|
| 482 | QUARTZ_FreeMem( This->pwszNameGraph );
|
|---|
| 483 | This->pwszNameGraph = NULL;
|
|---|
| 484 | }
|
|---|
| 485 |
|
|---|
| 486 | if ( This->pClock != NULL )
|
|---|
| 487 | {
|
|---|
| 488 | IReferenceClock_Release( This->pClock );
|
|---|
| 489 | This->pClock = NULL;
|
|---|
| 490 | }
|
|---|
| 491 |
|
|---|
| 492 | DeleteCriticalSection( &This->csFilter );
|
|---|
| 493 | }
|
|---|