Changeset 6952 for trunk/src/quartz/ifgraph.c
- Timestamp:
- Oct 6, 2001, 10:56:18 AM (24 years ago)
- File:
-
- 1 edited
-
trunk/src/quartz/ifgraph.c (modified) (22 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/quartz/ifgraph.c
r6710 r6952 2 2 * Implementation of IFilterGraph. 3 3 * 4 * FIXME - stub. 5 * FIXME - implement IGraphBuilder / IFilterGraph2. 4 * FIXME - create a thread to process some methods correctly. 5 * 6 * FIXME - ReconnectEx 7 * FIXME - process Pause/Stop asynchronously and notify when completed. 8 * 6 9 * 7 10 * hidenori@a2.ctktv.ne.jp … … 13 16 #include "winbase.h" 14 17 #include "wingdi.h" 18 #include "winuser.h" 15 19 #include "winerror.h" 16 20 #include "wine/obj_base.h" … … 21 25 #include "vfwmsgs.h" 22 26 #include "wine/unicode.h" 27 #include "evcode.h" 23 28 24 29 #include "debugtools.h" … … 28 33 #include "fgraph.h" 29 34 #include "enumunk.h" 35 #include "sysclock.h" 30 36 31 37 … … 75 81 76 82 83 static HRESULT CFilterGraph_GraphChanged( CFilterGraph* This ) 84 { 85 /* IDistributorNotify_NotifyGraphChange() */ 86 87 IMediaEventSink_Notify(CFilterGraph_IMediaEventSink(This), 88 EC_GRAPH_CHANGED, 0, 0); 89 EnterCriticalSection( &This->m_csGraphVersion ); 90 This->m_lGraphVersion ++; 91 LeaveCriticalSection( &This->m_csGraphVersion ); 92 93 return NOERROR; 94 } 95 96 77 97 /****************************************************************************/ 78 98 … … 111 131 { 112 132 CFilterGraph_THIS(iface,fgraph); 133 FILTER_STATE fs; 113 134 FILTER_INFO info; 114 135 HRESULT hr; … … 120 141 121 142 QUARTZ_CompList_Lock( This->m_pFilterList ); 143 144 hr = IMediaFilter_GetState(CFilterGraph_IMediaFilter(This),0,&fs); 145 if ( hr == VFW_S_STATE_INTERMEDIATE ) 146 hr = VFW_E_STATE_CHANGED; 147 if ( fs != State_Stopped ) 148 hr = VFW_E_NOT_STOPPED; 149 if ( FAILED(hr) ) 150 goto end; 151 152 TRACE( "(%p) search the specified name.\n",This ); 122 153 123 154 if ( pName != NULL ) … … 180 211 181 212 name_ok: 213 TRACE( "(%p) add this filter.\n",This ); 214 182 215 /* register this filter. */ 183 216 hr = QUARTZ_CompList_AddComp( … … 188 221 189 222 hr = IBaseFilter_JoinFilterGraph(pFilter,(IFilterGraph*)iface,pName); 190 if ( FAILED(hr) ) 191 { 223 if ( SUCCEEDED(hr) ) 224 { 225 EnterCriticalSection( &This->m_csClock ); 226 hr = IBaseFilter_SetSyncSource( pFilter, This->m_pClock ); 227 LeaveCriticalSection( &This->m_csClock ); 228 } 229 if ( FAILED(hr) ) 230 { 231 IBaseFilter_JoinFilterGraph(pFilter,NULL,pName); 192 232 QUARTZ_CompList_RemoveComp( 193 233 This->m_pFilterList,(IUnknown*)pFilter); … … 195 235 } 196 236 197 EnterCriticalSection( &This->m_csGraphVersion);198 This->m_lGraphVersion ++;199 LeaveCriticalSection( &This->m_csGraphVersion );237 hr = CFilterGraph_GraphChanged(This); 238 if ( FAILED(hr) ) 239 goto end; 200 240 201 241 hr = hrSucceeded; … … 203 243 QUARTZ_CompList_Unlock( This->m_pFilterList ); 204 244 245 TRACE( "(%p) return %08lx\n", This, hr ); 246 205 247 return hr; 206 248 } … … 211 253 CFilterGraph_THIS(iface,fgraph); 212 254 QUARTZ_CompListItem* pItem; 255 FILTER_STATE fs; 213 256 HRESULT hr = NOERROR; 214 257 … … 217 260 QUARTZ_CompList_Lock( This->m_pFilterList ); 218 261 262 hr = IMediaFilter_GetState(CFilterGraph_IMediaFilter(This),0,&fs); 263 if ( hr == VFW_S_STATE_INTERMEDIATE ) 264 hr = VFW_E_STATE_CHANGED; 265 if ( fs != State_Stopped ) 266 hr = VFW_E_NOT_STOPPED; 267 if ( FAILED(hr) ) 268 goto end; 269 270 hr = S_FALSE; /* FIXME? */ 219 271 pItem = QUARTZ_CompList_SearchComp( 220 272 This->m_pFilterList, (IUnknown*)pFilter ); … … 222 274 { 223 275 CFilterGraph_DisconnectAllPins(pFilter); 276 IBaseFilter_SetSyncSource( pFilter, NULL ); 224 277 hr = IBaseFilter_JoinFilterGraph( 225 278 pFilter, NULL, QUARTZ_CompList_GetDataPtr(pItem) ); … … 228 281 } 229 282 230 EnterCriticalSection( &This->m_csGraphVersion ); 231 This->m_lGraphVersion ++; 232 LeaveCriticalSection( &This->m_csGraphVersion ); 233 283 hr = CFilterGraph_GraphChanged(This); 284 if ( FAILED(hr) ) 285 goto end; 286 287 end:; 234 288 QUARTZ_CompList_Unlock( This->m_pFilterList ); 235 289 … … 332 386 pConnTo = NULL; 333 387 hr = IPin_ConnectedTo(pIn,&pConnTo); 334 if ( FAILED(hr) ) 335 goto end; 336 if ( pConnTo != NULL ) 388 if ( hr == NOERROR && pConnTo != NULL ) 337 389 { 338 390 IPin_Release(pConnTo); 391 hr = VFW_E_ALREADY_CONNECTED; 339 392 goto end; 340 393 } … … 342 395 pConnTo = NULL; 343 396 hr = IPin_ConnectedTo(pOut,&pConnTo); 344 if ( FAILED(hr) ) 345 goto end; 346 if ( pConnTo != NULL ) 397 if ( hr == NOERROR && pConnTo != NULL ) 347 398 { 348 399 IPin_Release(pConnTo); 349 goto end; 350 } 351 352 hr = IPin_Connect(pIn,pOut,pmt); 353 if ( FAILED(hr) ) 354 goto end; 400 hr = VFW_E_ALREADY_CONNECTED; 401 goto end; 402 } 403 404 TRACE("(%p) try to connect %p<->%p\n",This,pIn,pOut); 355 405 hr = IPin_Connect(pOut,pIn,pmt); 356 406 if ( FAILED(hr) ) 357 407 { 408 TRACE("(%p)->Connect(%p,%p) hr = %08lx\n",pOut,pIn,pmt,hr); 409 IPin_Disconnect(pOut); 358 410 IPin_Disconnect(pIn); 359 411 goto end; 360 412 } 361 413 362 EnterCriticalSection( &This->m_csGraphVersion);363 This->m_lGraphVersion ++;364 LeaveCriticalSection( &This->m_csGraphVersion );414 hr = CFilterGraph_GraphChanged(This); 415 if ( FAILED(hr) ) 416 goto end; 365 417 366 418 end: … … 384 436 CFilterGraph_THIS(iface,fgraph); 385 437 386 FIXME( "(%p)->(%p) stub!\n",This,pPin ); 387 388 EnterCriticalSection( &This->m_csGraphVersion ); 389 This->m_lGraphVersion ++; 390 LeaveCriticalSection( &This->m_csGraphVersion ); 391 392 return E_NOTIMPL; 438 TRACE( "(%p)->(%p)\n",This,pPin ); 439 440 return IFilterGraph2_ReconnectEx(iface,pPin,NULL); 393 441 } 394 442 … … 397 445 { 398 446 CFilterGraph_THIS(iface,fgraph); 399 400 FIXME( "(%p)->(%p) stub!\n",This,pPin ); 401 402 EnterCriticalSection( &This->m_csGraphVersion ); 403 This->m_lGraphVersion ++; 404 LeaveCriticalSection( &This->m_csGraphVersion ); 405 406 return E_NOTIMPL; 447 IPin* pConnTo; 448 HRESULT hr; 449 450 TRACE( "(%p)->(%p)\n",This,pPin ); 451 452 QUARTZ_CompList_Lock( This->m_pFilterList ); 453 454 pConnTo = NULL; 455 hr = IPin_ConnectedTo(pPin,&pConnTo); 456 if ( hr == NOERROR && pConnTo != NULL ) 457 { 458 IPin_Disconnect(pConnTo); 459 IPin_Release(pConnTo); 460 } 461 hr = IPin_Disconnect(pPin); 462 if ( FAILED(hr) ) 463 goto end; 464 465 hr = CFilterGraph_GraphChanged(This); 466 if ( FAILED(hr) ) 467 goto end; 468 469 end: 470 QUARTZ_CompList_Unlock( This->m_pFilterList ); 471 472 return hr; 407 473 } 408 474 … … 411 477 { 412 478 CFilterGraph_THIS(iface,fgraph); 479 IUnknown* punk; 480 IReferenceClock* pClock; 481 HRESULT hr; 413 482 414 483 FIXME( "(%p)->() stub!\n", This ); 415 return E_NOTIMPL; 484 485 /* FIXME - search all filters. */ 486 487 hr = QUARTZ_CreateSystemClock( NULL, (void**)&punk ); 488 if ( FAILED(hr) ) 489 return hr; 490 hr = IUnknown_QueryInterface( punk, &IID_IReferenceClock, (void**)&pClock ); IUnknown_Release( punk ); 491 if ( FAILED(hr) ) 492 return hr; 493 494 hr = IMediaFilter_SetSyncSource( 495 CFilterGraph_IMediaFilter(This), pClock ); 496 IReferenceClock_Release( pClock ); 497 498 return hr; 416 499 } 417 500 … … 580 663 { 581 664 CFilterGraph_THIS(iface,fgraph); 665 HRESULT hr; 582 666 583 667 FIXME( "(%p)->(%p,%p) stub!\n",This,pPin,pmt ); 584 668 585 EnterCriticalSection( &This->m_csGraphVersion );586 This->m_lGraphVersion ++; 587 LeaveCriticalSection( &This->m_csGraphVersion);669 /* reconnect asynchronously. */ 670 671 hr = CFilterGraph_GraphChanged(This); 588 672 589 673 return E_NOTIMPL; … … 657 741 if ( pItem == NULL ) 658 742 break; 659 IFilterGraph2_ fnRemoveFilter(743 IFilterGraph2_RemoveFilter( 660 744 (IFilterGraph2*)(&pfg->fgraph), 661 745 (IBaseFilter*)QUARTZ_CompList_GetItemPtr(pItem) );
Note:
See TracChangeset
for help on using the changeset viewer.
