Changeset 6952 for trunk/src/quartz
- Timestamp:
- Oct 6, 2001, 10:56:18 AM (24 years ago)
- Location:
- trunk/src/quartz
- Files:
-
- 12 added
- 10 deleted
- 26 edited
-
audren.c (added)
-
audren.h (added)
-
basefilt.c (added)
-
basefilt.h (added)
-
basepin.c (added)
-
complist.c (modified) (1 diff)
-
devenum.c (modified) (4 diffs)
-
devmon.c (modified) (7 diffs)
-
devmon.h (modified) (1 diff)
-
enumunk.c (modified) (2 diffs)
-
fgevent.c (added)
-
fgidisp.c (modified) (1 diff)
-
fgpass.c (added)
-
fgraph.c (modified) (6 diffs)
-
fgraph.h (modified) (7 diffs)
-
fmap.c (modified) (3 diffs)
-
fmap2.c (modified) (3 diffs)
-
ibasaud.c (deleted)
-
ibasvid.c (deleted)
-
idevenum.c (deleted)
-
ifgraph.c (modified) (22 diffs)
-
ifmap.c (deleted)
-
ifmap3.c (deleted)
-
igconfig.c (added)
-
igrver.c (modified) (1 diff)
-
imcntl.c (modified) (1 diff)
-
imem.c (deleted)
-
imesink.c (deleted)
-
imevent.c (deleted)
-
imfilter.c (modified) (12 diffs)
-
impos.c (modified) (1 diff)
-
imseek.c (modified) (3 diffs)
-
irclock.c (deleted)
-
iunk.c (modified) (1 diff)
-
ividwin.c (deleted)
-
main.c (modified) (8 diffs)
-
makefile (modified) (3 diffs)
-
memalloc.c (modified) (4 diffs)
-
memalloc.h (modified) (2 diffs)
-
mtype.c (added)
-
mtype.h (added)
-
quartz_private.h (modified) (1 diff)
-
regsvr.c (modified) (1 diff)
-
sample.c (added)
-
sample.h (added)
-
seekpass.c (modified) (8 diffs)
-
seekpass.h (modified) (2 diffs)
-
sysclock.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/quartz/complist.c
r6710 r6952 10 10 #include "winbase.h" 11 11 #include "wingdi.h" 12 #include "winuser.h" 12 13 #include "winerror.h" 13 14 #include "wine/obj_base.h" -
trunk/src/quartz/devenum.c
r6710 r6952 2 2 * Implementation of CLSID_SystemDeviceEnum. 3 3 * 4 * FIXME - stub.4 * FIXME - not tested enough. 5 5 * 6 6 * hidenori@a2.ctktv.ne.jp … … 12 12 #include "winbase.h" 13 13 #include "wingdi.h" 14 #include "winuser.h" 15 #include "winreg.h" 14 16 #include "winerror.h" 15 17 #include "wine/obj_base.h" 16 #include "wine/obj_oleaut.h" 18 #include "objidl.h" 19 #include "oleidl.h" 20 #include "ocidl.h" 17 21 #include "strmif.h" 18 22 #include "control.h" 19 23 #include "uuids.h" 24 #include "wine/unicode.h" 20 25 21 26 #include "debugtools.h" … … 24 29 #include "quartz_private.h" 25 30 #include "devenum.h" 31 #include "regsvr.h" 32 #include "enumunk.h" 33 #include "complist.h" 34 #include "devmon.h" 35 36 37 /*************************************************************************** 38 * 39 * new/delete for CLSID_SystemDeviceEnum 40 * 41 */ 26 42 27 43 /* can I use offsetof safely? - FIXME? */ … … 68 84 } 69 85 86 87 /*************************************************************************** 88 * 89 * CSysDevEnum::ICreateDevEnum 90 * 91 */ 92 93 94 static HRESULT WINAPI 95 ICreateDevEnum_fnQueryInterface(ICreateDevEnum* iface,REFIID riid,void** ppobj) 96 { 97 CSysDevEnum_THIS(iface,createdevenum); 98 99 TRACE("(%p)->()\n",This); 100 101 return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj); 102 } 103 104 static ULONG WINAPI 105 ICreateDevEnum_fnAddRef(ICreateDevEnum* iface) 106 { 107 CSysDevEnum_THIS(iface,createdevenum); 108 109 TRACE("(%p)->()\n",This); 110 111 return IUnknown_AddRef(This->unk.punkControl); 112 } 113 114 static ULONG WINAPI 115 ICreateDevEnum_fnRelease(ICreateDevEnum* iface) 116 { 117 CSysDevEnum_THIS(iface,createdevenum); 118 119 TRACE("(%p)->()\n",This); 120 121 return IUnknown_Release(This->unk.punkControl); 122 } 123 124 static HRESULT WINAPI 125 ICreateDevEnum_fnCreateClassEnumerator(ICreateDevEnum* iface,REFCLSID rclsidDeviceClass,IEnumMoniker** ppobj, DWORD dwFlags) 126 { 127 CSysDevEnum_THIS(iface,createdevenum); 128 HRESULT hr; 129 HKEY hKey; 130 QUARTZ_CompList* pMonList; 131 IMoniker* pMon; 132 DWORD dwIndex; 133 LONG lr; 134 WCHAR wszPath[ 1024 ]; 135 DWORD dwLen; 136 DWORD dwNameMax; 137 DWORD cbName; 138 FILETIME ftLastWrite; 139 140 TRACE("(%p)->(%s,%p,%08lx)\n",This, 141 debugstr_guid(rclsidDeviceClass),ppobj,dwFlags); 142 if ( dwFlags != 0 ) 143 { 144 FIXME("unknown flags %08lx\n",dwFlags); 145 return E_NOTIMPL; 146 } 147 148 if ( ppobj == NULL ) 149 return E_POINTER; 150 *ppobj = NULL; 151 152 hr = QUARTZ_CreateCLSIDPath( 153 wszPath, sizeof(wszPath)/sizeof(wszPath[0]), 154 rclsidDeviceClass, QUARTZ_wszInstance ); 155 if ( FAILED(hr) ) 156 return hr; 157 158 if ( RegOpenKeyExW( HKEY_CLASSES_ROOT, wszPath, 159 0, KEY_READ, &hKey ) != ERROR_SUCCESS ) 160 return E_FAIL; 161 162 dwLen = strlenW(wszPath); 163 wszPath[dwLen++] = '\\'; wszPath[dwLen] = 0; 164 dwNameMax = sizeof(wszPath)/sizeof(wszPath[0]) - dwLen - 8; 165 166 pMonList = QUARTZ_CompList_Alloc(); 167 if ( pMonList == NULL ) 168 { 169 hr = E_OUTOFMEMORY; 170 goto err; 171 } 172 173 /* enumerate all subkeys. */ 174 dwIndex = 0; 175 while ( 1 ) 176 { 177 cbName = dwNameMax; 178 lr = RegEnumKeyExW( 179 hKey, dwIndex, &wszPath[dwLen], &cbName, 180 NULL, NULL, NULL, &ftLastWrite ); 181 if ( lr == ERROR_NO_MORE_ITEMS ) 182 break; 183 if ( lr != ERROR_SUCCESS ) 184 { 185 hr = E_FAIL; 186 goto err; 187 } 188 189 hr = QUARTZ_CreateDeviceMoniker( 190 HKEY_CLASSES_ROOT, wszPath, &pMon ); 191 if ( FAILED(hr) ) 192 goto err; 193 194 hr = QUARTZ_CompList_AddComp( 195 pMonList, (IUnknown*)pMon, NULL, 0 ); 196 IMoniker_Release( pMon ); 197 198 if ( FAILED(hr) ) 199 goto err; 200 201 dwIndex ++; 202 } 203 204 /* create an enumerator. */ 205 hr = QUARTZ_CreateEnumUnknown( 206 &IID_IEnumMoniker, (void**)ppobj, pMonList ); 207 if ( FAILED(hr) ) 208 goto err; 209 210 hr = S_OK; 211 err: 212 if ( pMonList != NULL ) 213 QUARTZ_CompList_Free( pMonList ); 214 RegCloseKey( hKey ); 215 216 return hr; 217 } 218 219 static ICOM_VTABLE(ICreateDevEnum) icreatedevenum = 220 { 221 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 222 /* IUnknown fields */ 223 ICreateDevEnum_fnQueryInterface, 224 ICreateDevEnum_fnAddRef, 225 ICreateDevEnum_fnRelease, 226 /* ICreateDevEnum fields */ 227 ICreateDevEnum_fnCreateClassEnumerator, 228 }; 229 230 HRESULT CSysDevEnum_InitICreateDevEnum( CSysDevEnum* psde ) 231 { 232 TRACE("(%p)\n",psde); 233 ICOM_VTBL(&psde->createdevenum) = &icreatedevenum; 234 235 return NOERROR; 236 } 237 238 void CSysDevEnum_UninitICreateDevEnum( CSysDevEnum* psde ) 239 { 240 TRACE("(%p)\n",psde); 241 } -
trunk/src/quartz/devmon.c
r6710 r6952 1 1 /* 2 2 * Implements IMoniker for CLSID_CDeviceMoniker. 3 * Implements IPropertyBag. (internal) 3 4 * 4 5 * hidenori@a2.ctktv.ne.jp … … 27 28 #include "quartz_private.h" 28 29 #include "devmon.h" 29 #include "monprop.h"30 30 #include "regsvr.h" 31 31 32 33 /*************************************************************************** 34 * 35 * CDeviceMoniker::IMoniker 36 * 37 */ 32 38 33 39 static HRESULT WINAPI … … 150 156 return hr; 151 157 152 returnCoCreateInstance(158 hr = CoCreateInstance( 153 159 &clsid, NULL, CLSCTX_INPROC_SERVER, riid, ppvResult ); 160 TRACE( "hr = %08lx\n", hr ); 161 162 return hr; 154 163 } 155 164 … … 374 383 } 375 384 385 /*************************************************************************** 386 * 387 * new/delete for CDeviceMoniker 388 * 389 */ 376 390 377 391 static void QUARTZ_DestroyDeviceMoniker(IUnknown* punk) … … 383 397 384 398 /* can I use offsetof safely? - FIXME? */ 385 static QUARTZ_IFEntry IFEntries[] =399 static QUARTZ_IFEntry CDeviceMoniker_IFEntries[] = 386 400 { 387 401 { &IID_IPersist, offsetof(CDeviceMoniker,moniker)-offsetof(CDeviceMoniker,unk) }, … … 411 425 } 412 426 413 pdm->unk.pEntries = IFEntries;414 pdm->unk.dwEntries = sizeof( IFEntries)/sizeof(IFEntries[0]);427 pdm->unk.pEntries = CDeviceMoniker_IFEntries; 428 pdm->unk.dwEntries = sizeof(CDeviceMoniker_IFEntries)/sizeof(CDeviceMoniker_IFEntries[0]); 415 429 pdm->unk.pOnFinalRelease = &QUARTZ_DestroyDeviceMoniker; 416 430 … … 421 435 422 436 437 /*************************************************************************** 438 * 439 * CRegPropertyBag::IPropertyBag 440 * 441 */ 442 443 static HRESULT WINAPI 444 IPropertyBag_fnQueryInterface(IPropertyBag* iface,REFIID riid,void** ppobj) 445 { 446 CRegPropertyBag_THIS(iface,propbag); 447 448 TRACE("(%p)->()\n",This); 449 450 return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj); 451 } 452 453 static ULONG WINAPI 454 IPropertyBag_fnAddRef(IPropertyBag* iface) 455 { 456 CRegPropertyBag_THIS(iface,propbag); 457 458 TRACE("(%p)->()\n",This); 459 460 return IUnknown_AddRef(This->unk.punkControl); 461 } 462 463 static ULONG WINAPI 464 IPropertyBag_fnRelease(IPropertyBag* iface) 465 { 466 CRegPropertyBag_THIS(iface,propbag); 467 468 TRACE("(%p)->()\n",This); 469 470 return IUnknown_Release(This->unk.punkControl); 471 } 472 473 static HRESULT WINAPI 474 IPropertyBag_fnRead(IPropertyBag* iface,LPCOLESTR lpszPropName,VARIANT* pVar,IErrorLog* pLog) 475 { 476 CRegPropertyBag_THIS(iface,propbag); 477 LONG lr; 478 DWORD dwSize; 479 DWORD dwValueType; 480 481 TRACE("(%p)->(%s,%p,%p)\n",This, 482 debugstr_w(lpszPropName),pVar,pLog); 483 484 if ( lpszPropName == NULL || pVar == NULL ) 485 return E_POINTER; 486 487 dwSize = 0; 488 lr = RegQueryValueExW( 489 This->m_hKey, lpszPropName, NULL, 490 &dwValueType, NULL, &dwSize ); 491 if ( lr != ERROR_SUCCESS ) 492 { 493 TRACE( "RegQueryValueExW failed.\n" ); 494 return E_INVALIDARG; 495 } 496 497 switch ( dwValueType ) 498 { 499 case REG_SZ: 500 TRACE( "REG_SZ / length = %lu\n", dwSize ); 501 if ( pVar->n1.n2.vt == VT_EMPTY ) 502 pVar->n1.n2.vt = VT_BSTR; 503 if ( pVar->n1.n2.vt != VT_BSTR ) 504 { 505 TRACE( "type of VARIANT is not BSTR\n" ); 506 return E_FAIL; 507 } 508 509 pVar->n1.n2.n3.bstrVal = SysAllocStringByteLen( 510 NULL, dwSize ); 511 if ( pVar->n1.n2.n3.bstrVal == NULL ) 512 { 513 TRACE( "out of memory.\n" ); 514 return E_OUTOFMEMORY; 515 } 516 lr = RegQueryValueExW( 517 This->m_hKey, lpszPropName, NULL, 518 &dwValueType, 519 (BYTE*)pVar->n1.n2.n3.bstrVal, &dwSize ); 520 if ( lr != ERROR_SUCCESS ) 521 { 522 TRACE( "failed to query value\n" ); 523 SysFreeString(pVar->n1.n2.n3.bstrVal); 524 return E_FAIL; 525 } 526 TRACE( "value is BSTR; %s\n", debugstr_w(pVar->n1.n2.n3.bstrVal) ); 527 break; 528 default: 529 FIXME("(%p)->(%s,%p,%p) - unsupported value type.\n",This, 530 debugstr_w(lpszPropName),pVar,pLog); 531 return E_FAIL; 532 } 533 534 TRACE( "returned successfully.\n" ); 535 return NOERROR; 536 } 537 538 static HRESULT WINAPI 539 IPropertyBag_fnWrite(IPropertyBag* iface,LPCOLESTR lpszPropName,VARIANT* pVar) 540 { 541 CRegPropertyBag_THIS(iface,propbag); 542 543 FIXME("(%p)->(%s,%p) stub!\n",This, 544 debugstr_w(lpszPropName),pVar); 545 546 if ( lpszPropName == NULL || pVar == NULL ) 547 return E_POINTER; 548 549 return E_NOTIMPL; 550 } 551 552 553 554 555 static ICOM_VTABLE(IPropertyBag) ipropbag = 556 { 557 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 558 /* IUnknown fields */ 559 IPropertyBag_fnQueryInterface, 560 IPropertyBag_fnAddRef, 561 IPropertyBag_fnRelease, 562 /* IPropertyBag fields */ 563 IPropertyBag_fnRead, 564 IPropertyBag_fnWrite, 565 }; 566 567 static HRESULT CRegPropertyBag_InitIPropertyBag( 568 CRegPropertyBag* prpb, HKEY hkRoot, LPCWSTR lpKeyPath ) 569 { 570 ICOM_VTBL(&prpb->propbag) = &ipropbag; 571 572 if ( RegOpenKeyExW( 573 hkRoot, lpKeyPath, 0, 574 KEY_ALL_ACCESS, &prpb->m_hKey ) != ERROR_SUCCESS ) 575 return E_FAIL; 576 577 return NOERROR; 578 } 579 580 static void CRegPropertyBag_UninitIPropertyBag( 581 CRegPropertyBag* prpb ) 582 { 583 RegCloseKey( prpb->m_hKey ); 584 } 585 586 587 /*************************************************************************** 588 * 589 * new/delete for CRegPropertyBag 590 * 591 */ 592 593 static void QUARTZ_DestroyRegPropertyBag(IUnknown* punk) 594 { 595 CRegPropertyBag_THIS(punk,unk); 596 597 CRegPropertyBag_UninitIPropertyBag(This); 598 } 599 600 601 /* can I use offsetof safely? - FIXME? */ 602 static QUARTZ_IFEntry CRegPropertyBag_IFEntries[] = 603 { 604 { &IID_IPropertyBag, offsetof(CRegPropertyBag,propbag)-offsetof(CRegPropertyBag,unk) }, 605 }; 606 607 HRESULT QUARTZ_CreateRegPropertyBag( 608 HKEY hkRoot, LPCWSTR lpKeyPath, 609 IPropertyBag** ppPropBag ) 610 { 611 CRegPropertyBag* prpb; 612 HRESULT hr; 613 614 TRACE("(%08x,%s,%p)\n",hkRoot,debugstr_w(lpKeyPath),ppPropBag ); 615 616 prpb = (CRegPropertyBag*)QUARTZ_AllocObj( sizeof(CRegPropertyBag) ); 617 if ( prpb == NULL ) 618 return E_OUTOFMEMORY; 619 620 QUARTZ_IUnkInit( &prpb->unk, NULL ); 621 hr = CRegPropertyBag_InitIPropertyBag( prpb, hkRoot, lpKeyPath ); 622 if ( FAILED(hr) ) 623 { 624 QUARTZ_FreeObj( prpb ); 625 return hr; 626 } 627 628 prpb->unk.pEntries = CRegPropertyBag_IFEntries; 629 prpb->unk.dwEntries = sizeof(CRegPropertyBag_IFEntries)/sizeof(CRegPropertyBag_IFEntries[0]); 630 prpb->unk.pOnFinalRelease = &QUARTZ_DestroyRegPropertyBag; 631 632 *ppPropBag = (IPropertyBag*)(&prpb->propbag); 633 634 return S_OK; 635 } 636 637 638 -
trunk/src/quartz/devmon.h
r6710 r6952 34 34 35 35 36 /* 37 implements IPropertyBag for accessing registry. 38 39 - At least, the following interfaces should be implemented: 40 41 IUnknown 42 + IPropertyBag 43 */ 44 45 #include "iunk.h" 46 47 typedef struct DMON_IPropertyBagImpl 48 { 49 ICOM_VFIELD(IPropertyBag); 50 } DMON_IPropertyBagImpl; 51 52 typedef struct CRegPropertyBag 53 { 54 QUARTZ_IUnkImpl unk; 55 DMON_IPropertyBagImpl propbag; 56 /* IPropertyBag fields */ 57 HKEY m_hKey; 58 } CRegPropertyBag; 59 60 #define CRegPropertyBag_THIS(iface,member) CRegPropertyBag* This = (CRegPropertyBag*)(((char*)iface)-offsetof(CRegPropertyBag,member)) 61 62 HRESULT QUARTZ_CreateRegPropertyBag( 63 HKEY hkRoot, LPCWSTR lpKeyPath, 64 IPropertyBag** ppPropBag ); 65 36 66 #endif /* WINE_DSHOW_DEVMON_H */ -
trunk/src/quartz/enumunk.c
r6710 r6952 10 10 #include "winbase.h" 11 11 #include "wingdi.h" 12 #include "winuser.h" 12 13 #include "winerror.h" 13 14 #include "wine/obj_base.h" … … 177 178 (void**)ppunk, 178 179 This->pCompList ); 180 FIXME( "current pointer must be seeked correctly\n" ); 179 181 180 182 QUARTZ_CompList_Unlock( This->pCompList ); -
trunk/src/quartz/fgidisp.c
r6710 r6952 12 12 #include "winbase.h" 13 13 #include "wingdi.h" 14 #include "winuser.h" 14 15 #include "winerror.h" 15 16 #include "wine/obj_base.h" -
trunk/src/quartz/fgraph.c
r6710 r6952 10 10 #include "winbase.h" 11 11 #include "wingdi.h" 12 #include "winuser.h" 12 13 #include "winerror.h" 13 14 #include "wine/obj_base.h" … … 23 24 #include "fgraph.h" 24 25 26 /*************************************************************************** 27 * 28 * new/delete for CFilterGraph 29 * 30 */ 31 25 32 /* can I use offsetof safely? - FIXME? */ 26 33 static QUARTZ_IFEntry IFEntries[] = … … 32 39 { &IID_IFilterGraph2, offsetof(CFilterGraph,fgraph)-offsetof(CFilterGraph,unk) }, 33 40 { &IID_IGraphVersion, offsetof(CFilterGraph,graphversion)-offsetof(CFilterGraph,unk) }, 41 { &IID_IGraphConfig, offsetof(CFilterGraph,grphconf)-offsetof(CFilterGraph,unk) }, 34 42 { &IID_IMediaControl, offsetof(CFilterGraph,mediacontrol)-offsetof(CFilterGraph,unk) }, 35 43 { &IID_IMediaFilter, offsetof(CFilterGraph,mediafilter)-offsetof(CFilterGraph,unk) }, … … 60 68 FGENT(IFilterGraph2) 61 69 FGENT(IGraphVersion) 70 FGENT(IGraphConfig) 62 71 FGENT(IMediaControl) 63 72 FGENT(IMediaFilter) … … 80 89 int i; 81 90 91 TRACE( "(%p)\n", punk ); 92 82 93 /* At first, call Stop. */ 83 94 IMediaControl_Stop( CFilterGraph_IMediaControl(This) ); … … 136 147 137 148 149 /*************************************************************************** 150 * 151 * CFilterGraph::IPersist 152 * 153 */ 154 155 static HRESULT WINAPI 156 IPersist_fnQueryInterface(IPersist* iface,REFIID riid,void** ppobj) 157 { 158 CFilterGraph_THIS(iface,persist); 159 160 TRACE("(%p)->()\n",This); 161 162 return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj); 163 } 164 165 static ULONG WINAPI 166 IPersist_fnAddRef(IPersist* iface) 167 { 168 CFilterGraph_THIS(iface,persist); 169 170 TRACE("(%p)->()\n",This); 171 172 return IUnknown_AddRef(This->unk.punkControl); 173 } 174 175 static ULONG WINAPI 176 IPersist_fnRelease(IPersist* iface) 177 { 178 CFilterGraph_THIS(iface,persist); 179 180 TRACE("(%p)->()\n",This); 181 182 return IUnknown_Release(This->unk.punkControl); 183 } 184 185 186 static HRESULT WINAPI 187 IPersist_fnGetClassID(IPersist* iface,CLSID* pclsid) 188 { 189 CFilterGraph_THIS(iface,persist); 190 191 TRACE("(%p)->()\n",This); 192 193 if ( pclsid == NULL ) 194 return E_POINTER; 195 memcpy( pclsid, &CLSID_FilterGraph, sizeof(CLSID) ); 196 197 return E_NOTIMPL; 198 } 199 200 201 static ICOM_VTABLE(IPersist) ipersist = 202 { 203 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 204 /* IUnknown fields */ 205 IPersist_fnQueryInterface, 206 IPersist_fnAddRef, 207 IPersist_fnRelease, 208 /* IPersist fields */ 209 IPersist_fnGetClassID, 210 }; 211 212 HRESULT CFilterGraph_InitIPersist( CFilterGraph* pfg ) 213 { 214 TRACE("(%p)\n",pfg); 215 ICOM_VTBL(&pfg->persist) = &ipersist; 216 217 return NOERROR; 218 } 219 220 void CFilterGraph_UninitIPersist( CFilterGraph* pfg ) 221 { 222 TRACE("(%p)\n",pfg); 223 } -
trunk/src/quartz/fgraph.h
r6710 r6952 12 12 + IFilterGraph - IGraphBuilder - IFilterGraph2 13 13 + IGraphVersion 14 + IGraphConfig 14 15 + IDispatch - IMediaControl 15 16 + IPersist - IMediaFilter … … 50 51 ICOM_VFIELD(IGraphVersion); 51 52 } FG_IGraphVersionImpl; 53 54 typedef struct FG_IGraphConfigImpl 55 { 56 ICOM_VFIELD(IGraphConfig); 57 } FG_IGraphConfigImpl; 52 58 53 59 typedef struct FG_IMediaControlImpl … … 96 102 } FG_IVideoWindowImpl; 97 103 104 typedef struct FilterGraph_MEDIAEVENT FilterGraph_MEDIAEVENT; 98 105 99 106 typedef struct CFilterGraph … … 104 111 FG_IFilterGraph2Impl fgraph; 105 112 FG_IGraphVersionImpl graphversion; 113 FG_IGraphConfigImpl grphconf; 106 114 FG_IMediaControlImpl mediacontrol; 107 115 FG_IMediaFilterImpl mediafilter; … … 124 132 CRITICAL_SECTION m_csGraphState; 125 133 FILTER_STATE m_stateGraph; /* must NOT accessed directly! */ 134 CRITICAL_SECTION m_csClock; 135 IReferenceClock* m_pClock; 126 136 /* IMediaEvent fields. */ 127 137 HANDLE m_hMediaEvent; 138 CRITICAL_SECTION m_csMediaEvents; 139 FilterGraph_MEDIAEVENT* m_pMediaEvents; 140 ULONG m_cbMediaEventsPut; 141 ULONG m_cbMediaEventsGet; 142 ULONG m_cbMediaEventsMax; 143 HWND m_hwndEventNotify; 144 long m_lEventNotifyMsg; 145 LONG_PTR m_lEventNotifyParam; 146 long m_lEventNotifyFlags; 128 147 /* IMediaEventSink fields. */ 129 148 /* IMediaPosition fields. */ … … 138 157 #define CFilterGraph_IDispatch(th) ((IDispatch*)&((th)->disp)) 139 158 #define CFilterGraph_IFilterGraph2(th) ((IFilterGraph2*)&((th)->fgraph)) 159 #define CFilterGraph_IMediaControl(th) ((IMediaControl*)&((th)->mediacontrol)) 140 160 #define CFilterGraph_IMediaFilter(th) ((IMediaFilter*)&((th)->mediafilter)) 141 #define CFilterGraph_IMediaControl(th) ((IMediaControl*)&((th)->mediacontrol)) 161 #define CFilterGraph_IMediaEventEx(th) ((IMediaEventEx*)&((th)->mediaevent)) 162 #define CFilterGraph_IMediaEventSink(th) ((IMediaEventSink*)&((th)->mediaeventsink)) 142 163 143 164 HRESULT QUARTZ_CreateFilterGraph(IUnknown* punkOuter,void** ppobj); … … 151 172 HRESULT CFilterGraph_InitIGraphVersion( CFilterGraph* pfg ); 152 173 void CFilterGraph_UninitIGraphVersion( CFilterGraph* pfg ); 174 HRESULT CFilterGraph_InitIGraphConfig( CFilterGraph* pfg ); 175 void CFilterGraph_UninitIGraphConfig( CFilterGraph* pfg ); 153 176 HRESULT CFilterGraph_InitIMediaControl( CFilterGraph* pfg ); 154 177 void CFilterGraph_UninitIMediaControl( CFilterGraph* pfg ); -
trunk/src/quartz/fmap.c
r6710 r6952 12 12 #include "winbase.h" 13 13 #include "wingdi.h" 14 #include "winuser.h" 15 #include "winreg.h" 14 16 #include "winerror.h" 15 17 #include "wine/obj_base.h" … … 24 26 #include "quartz_private.h" 25 27 #include "fmap.h" 28 #include "regsvr.h" 29 30 31 /*************************************************************************** 32 * 33 * new/delete for CLSID_FilterMapper 34 * 35 */ 26 36 27 37 /* can I use offsetof safely? - FIXME? */ … … 66 76 return S_OK; 67 77 } 78 79 /*************************************************************************** 80 * 81 * CLSID_FilterMapper::IFilterMapper 82 * 83 */ 84 85 static HRESULT WINAPI 86 IFilterMapper_fnQueryInterface(IFilterMapper* iface,REFIID riid,void** ppobj) 87 { 88 CFilterMapper_THIS(iface,fmap); 89 90 TRACE("(%p)->()\n",This); 91 92 return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj); 93 } 94 95 static ULONG WINAPI 96 IFilterMapper_fnAddRef(IFilterMapper* iface) 97 { 98 CFilterMapper_THIS(iface,fmap); 99 100 TRACE("(%p)->()\n",This); 101 102 return IUnknown_AddRef(This->unk.punkControl); 103 } 104 105 static ULONG WINAPI 106 IFilterMapper_fnRelease(IFilterMapper* iface) 107 { 108 CFilterMapper_THIS(iface,fmap); 109 110 TRACE("(%p)->()\n",This); 111 112 return IUnknown_Release(This->unk.punkControl); 113 } 114 115 116 static HRESULT WINAPI 117 IFilterMapper_fnRegisterFilter(IFilterMapper* iface,CLSID clsid,LPCWSTR lpwszName,DWORD dwMerit) 118 { 119 CFilterMapper_THIS(iface,fmap); 120 121 FIXME("(%p)->(%s,%s,%08lx)\n",This, 122 debugstr_guid(&clsid),debugstr_w(lpwszName),dwMerit); 123 124 /* FIXME */ 125 /* FIXME - handle dwMerit! */ 126 return QUARTZ_RegisterAMovieFilter( 127 &CLSID_LegacyAmFilterCategory, 128 &clsid, 129 NULL, 0, 130 lpwszName, NULL, TRUE ); 131 } 132 133 static HRESULT WINAPI 134 IFilterMapper_fnRegisterFilterInstance(IFilterMapper* iface,CLSID clsid,LPCWSTR lpwszName,CLSID* pclsidMedia) 135 { 136 CFilterMapper_THIS(iface,fmap); 137 HRESULT hr; 138 139 FIXME("(%p)->()\n",This); 140 141 if ( pclsidMedia == NULL ) 142 return E_POINTER; 143 hr = CoCreateGuid(pclsidMedia); 144 if ( FAILED(hr) ) 145 return hr; 146 147 /* FIXME */ 148 /* this doesn't work. */ 149 /* return IFilterMapper_RegisterFilter(iface, 150 *pclsidMedia,lpwszName,0x60000000); */ 151 152 return E_NOTIMPL; 153 } 154 155 static HRESULT WINAPI 156 IFilterMapper_fnRegisterPin(IFilterMapper* iface,CLSID clsidFilter,LPCWSTR lpwszName,BOOL bRendered,BOOL bOutput,BOOL bZero,BOOL bMany,CLSID clsidReserved,LPCWSTR lpwszReserved) 157 { 158 CFilterMapper_THIS(iface,fmap); 159 160 FIXME("(%p)->() stub!\n",This); 161 162 return E_NOTIMPL; 163 } 164 165 static HRESULT WINAPI 166 IFilterMapper_fnRegisterPinType(IFilterMapper* iface,CLSID clsidFilter,LPCWSTR lpwszName,CLSID clsidMajorType,CLSID clsidSubType) 167 { 168 CFilterMapper_THIS(iface,fmap); 169 170 FIXME("(%p)->() stub!\n",This); 171 172 return E_NOTIMPL; 173 } 174 175 static HRESULT WINAPI 176 IFilterMapper_fnUnregisterFilter(IFilterMapper* iface,CLSID clsidFilter) 177 { 178 CFilterMapper_THIS(iface,fmap); 179 180 FIXME("(%p)->(%s)\n",This,debugstr_guid(&clsidFilter)); 181 182 /* FIXME */ 183 return QUARTZ_RegisterAMovieFilter( 184 &CLSID_LegacyAmFilterCategory, 185 &clsidFilter, 186 NULL, 0, NULL, NULL, FALSE ); 187 } 188 189 static HRESULT WINAPI 190 IFilterMapper_fnUnregisterFilterInstance(IFilterMapper* iface,CLSID clsidMedia) 191 { 192 CFilterMapper_THIS(iface,fmap); 193 194 FIXME("(%p)->(%s)\n",This,debugstr_guid(&clsidMedia)); 195 196 /* FIXME */ 197 /* this doesn't work. */ 198 /* return IFilterMapper_UnregisterFilter(iface,clsidMedia); */ 199 200 return E_NOTIMPL; 201 } 202 203 static HRESULT WINAPI 204 IFilterMapper_fnUnregisterPin(IFilterMapper* iface,CLSID clsidPin,LPCWSTR lpwszName) 205 { 206 CFilterMapper_THIS(iface,fmap); 207 208 FIXME("(%p)->(%s,%s) stub!\n",This, 209 debugstr_guid(&clsidPin),debugstr_w(lpwszName)); 210 211 return E_NOTIMPL; 212 } 213 214 static HRESULT WINAPI 215 IFilterMapper_fnEnumMatchingFilters(IFilterMapper* iface,IEnumRegFilters** ppobj,DWORD dwMerit,BOOL bInputNeeded,CLSID clsInMajorType,CLSID clsidSubType,BOOL bRender,BOOL bOutputNeeded,CLSID clsOutMajorType,CLSID clsOutSubType) 216 { 217 CFilterMapper_THIS(iface,fmap); 218 219 FIXME("(%p)->() stub!\n",This); 220 221 return E_NOTIMPL; 222 } 223 224 225 226 static ICOM_VTABLE(IFilterMapper) ifmap = 227 { 228 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 229 /* IUnknown fields */ 230 IFilterMapper_fnQueryInterface, 231 IFilterMapper_fnAddRef, 232 IFilterMapper_fnRelease, 233 /* IFilterMapper fields */ 234 IFilterMapper_fnRegisterFilter, 235 IFilterMapper_fnRegisterFilterInstance, 236 IFilterMapper_fnRegisterPin, 237 IFilterMapper_fnRegisterPinType, 238 IFilterMapper_fnUnregisterFilter, 239 IFilterMapper_fnUnregisterFilterInstance, 240 IFilterMapper_fnUnregisterPin, 241 IFilterMapper_fnEnumMatchingFilters, 242 }; 243 244 245 HRESULT CFilterMapper_InitIFilterMapper( CFilterMapper* pfm ) 246 { 247 TRACE("(%p)\n",pfm); 248 ICOM_VTBL(&pfm->fmap) = &ifmap; 249 250 return NOERROR; 251 } 252 253 void CFilterMapper_UninitIFilterMapper( CFilterMapper* pfm ) 254 { 255 TRACE("(%p)\n",pfm); 256 } -
trunk/src/quartz/fmap2.c
r6710 r6952 12 12 #include "winbase.h" 13 13 #include "wingdi.h" 14 #include "winuser.h" 15 #include "winreg.h" 14 16 #include "winerror.h" 15 17 #include "wine/obj_base.h" … … 24 26 #include "quartz_private.h" 25 27 #include "fmap2.h" 28 #include "regsvr.h" 29 30 31 /*************************************************************************** 32 * 33 * new/delete for CLSID_FilterMapper2 34 * 35 */ 26 36 27 37 /* can I use offsetof safely? - FIXME? */ … … 67 77 return S_OK; 68 78 } 79 80 /*************************************************************************** 81 * 82 * CLSID_FilterMapper2::IFilterMapper3 83 * 84 */ 85 86 87 static HRESULT WINAPI 88 IFilterMapper3_fnQueryInterface(IFilterMapper3* iface,REFIID riid,void** ppobj) 89 { 90 CFilterMapper2_THIS(iface,fmap3); 91 92 TRACE("(%p)->()\n",This); 93 94 return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj); 95 } 96 97 static ULONG WINAPI 98 IFilterMapper3_fnAddRef(IFilterMapper3* iface) 99 { 100 CFilterMapper2_THIS(iface,fmap3); 101 102 TRACE("(%p)->()\n",This); 103 104 return IUnknown_AddRef(This->unk.punkControl); 105 } 106 107 static ULONG WINAPI 108 IFilterMapper3_fnRelease(IFilterMapper3* iface) 109 { 110 CFilterMapper2_THIS(iface,fmap3); 111 112 TRACE("(%p)->()\n",This); 113 114 return IUnknown_Release(This->unk.punkControl); 115 } 116 117 static HRESULT WINAPI 118 IFilterMapper3_fnCreateCategory(IFilterMapper3* iface,REFCLSID rclsidCategory,DWORD dwMerit,LPCWSTR lpwszDesc) 119 { 120 CFilterMapper2_THIS(iface,fmap3); 121 122 FIXME("(%p)->(%s,%lu,%s) stub!\n",This, 123 debugstr_guid(rclsidCategory), 124 (unsigned long)dwMerit,debugstr_w(lpwszDesc)); 125 126 return E_NOTIMPL; 127 } 128 129 130 static HRESULT WINAPI 131 IFilterMapper3_fnUnregisterFilter(IFilterMapper3* iface,const CLSID* pclsidCategory,const OLECHAR* lpwszInst,REFCLSID rclsidFilter) 132 { 133 CFilterMapper2_THIS(iface,fmap3); 134 135 FIXME("(%p)->(%s,%s,%s) stub!\n",This, 136 debugstr_guid(pclsidCategory), 137 debugstr_w(lpwszInst), 138 debugstr_guid(rclsidFilter)); 139 140 if ( pclsidCategory == NULL ) 141 pclsidCategory = &CLSID_LegacyAmFilterCategory; 142 143 /* FIXME */ 144 return QUARTZ_RegisterAMovieFilter( 145 pclsidCategory, 146 rclsidFilter, 147 NULL, 0, 148 NULL, lpwszInst, FALSE ); 149 } 150 151 152 static HRESULT WINAPI 153 IFilterMapper3_fnRegisterFilter(IFilterMapper3* iface,REFCLSID rclsidFilter,LPCWSTR lpName,IMoniker** ppMoniker,const CLSID* pclsidCategory,const OLECHAR* lpwszInst,const REGFILTER2* pRF2) 154 { 155 CFilterMapper2_THIS(iface,fmap3); 156 157 FIXME( "(%p)->(%s,%s,%p,%s,%s,%p) stub!\n",This, 158 debugstr_guid(rclsidFilter),debugstr_w(lpName), 159 ppMoniker,debugstr_guid(pclsidCategory), 160 debugstr_w(lpwszInst),pRF2 ); 161 162 if ( lpName == NULL || pRF2 == NULL ) 163 return E_POINTER; 164 165 if ( ppMoniker != NULL ) 166 { 167 FIXME( "ppMoniker != NULL - not implemented!\n" ); 168 return E_NOTIMPL; 169 } 170 171 if ( pclsidCategory == NULL ) 172 pclsidCategory = &CLSID_LegacyAmFilterCategory; 173 174 /* FIXME!! - all members in REGFILTER2 are ignored ! */ 175 176 return QUARTZ_RegisterAMovieFilter( 177 pclsidCategory, 178 rclsidFilter, 179 NULL, 0, 180 lpName, lpwszInst, TRUE ); 181 } 182 183 184 static HRESULT WINAPI 185 IFilterMapper3_fnEnumMatchingFilters(IFilterMapper3* iface,IEnumMoniker** ppMoniker,DWORD dwFlags,BOOL bExactMatch,DWORD dwMerit,BOOL bInputNeeded,DWORD cInputTypes,const GUID* pguidInputTypes,const REGPINMEDIUM* pPinMediumIn,const CLSID* pPinCategoryIn,BOOL bRender,BOOL bOutputNeeded,DWORD cOutputTypes,const GUID* pguidOutputTypes,const REGPINMEDIUM* pPinMediumOut,const CLSID* pPinCategoryOut) 186 { 187 CFilterMapper2_THIS(iface,fmap3); 188 189 FIXME("(%p)->() stub!\n",This); 190 191 return E_NOTIMPL; 192 } 193 194 static HRESULT WINAPI 195 IFilterMapper3_fnGetICreateDevEnum(IFilterMapper3* iface,ICreateDevEnum** ppDevEnum) 196 { 197 CFilterMapper2_THIS(iface,fmap3); 198 199 /* undocumented */ 200 FIXME("(%p)->() stub!\n",This); 201 202 return E_NOTIMPL; 203 } 204 205 206 207 208 static ICOM_VTABLE(IFilterMapper3) ifmap3 = 209 { 210 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 211 /* IUnknown fields */ 212 IFilterMapper3_fnQueryInterface, 213 IFilterMapper3_fnAddRef, 214 IFilterMapper3_fnRelease, 215 /* IFilterMapper2 fields */ 216 IFilterMapper3_fnCreateCategory, 217 IFilterMapper3_fnUnregisterFilter, 218 IFilterMapper3_fnRegisterFilter, 219 IFilterMapper3_fnEnumMatchingFilters, 220 /* IFilterMapper3 fields */ 221 IFilterMapper3_fnGetICreateDevEnum, 222 }; 223 224 225 HRESULT CFilterMapper2_InitIFilterMapper3( CFilterMapper2* pfm ) 226 { 227 TRACE("(%p)\n",pfm); 228 ICOM_VTBL(&pfm->fmap3) = &ifmap3; 229 230 return NOERROR; 231 } 232 233 void CFilterMapper2_UninitIFilterMapper3( CFilterMapper2* pfm ) 234 { 235 TRACE("(%p)\n",pfm); 236 } 237 -
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) ); -
trunk/src/quartz/igrver.c
r6710 r6952 12 12 #include "winbase.h" 13 13 #include "wingdi.h" 14 #include "winuser.h" 14 15 #include "winerror.h" 15 16 #include "wine/obj_base.h" -
trunk/src/quartz/imcntl.c
r6710 r6952 12 12 #include "winbase.h" 13 13 #include "wingdi.h" 14 #include "winuser.h" 14 15 #include "winerror.h" 15 16 #include "wine/obj_base.h" -
trunk/src/quartz/imfilter.c
r6710 r6952 12 12 #include "winbase.h" 13 13 #include "wingdi.h" 14 #include "winuser.h" 14 15 #include "winerror.h" 15 16 #include "wine/obj_base.h" … … 19 20 #include "uuids.h" 20 21 #include "vfwmsgs.h" 22 #include "evcode.h" 21 23 22 24 #include "debugtools.h" … … 127 129 if ( This->m_stateGraph != State_Stopped ) 128 130 { 131 /* IDistributorNotify_Stop() */ 132 129 133 QUARTZ_CompList_Lock( This->m_pFilterList ); 130 134 … … 171 175 if ( This->m_stateGraph != State_Paused ) 172 176 { 177 /* IDistributorNotify_Pause() */ 178 173 179 QUARTZ_CompList_Lock( This->m_pFilterList ); 174 180 … … 210 216 TRACE("(%p)->()\n",This); 211 217 212 /* handle the special time. */213 if ( rtStart == (REFERENCE_TIME)0 )214 {215 hr = IMediaFilter_GetSyncSource(iface,&pClock);216 if ( hr == S_OK && pClock != NULL )217 {218 IReferenceClock_GetTime(pClock,&rtStart);219 IReferenceClock_Release(pClock);220 }221 }222 223 hr = S_OK;224 225 218 EnterCriticalSection( &This->m_csGraphState ); 226 219 220 if ( This->m_stateGraph == State_Stopped ) 221 { 222 hr = IMediaFilter_Pause(iface); 223 if ( FAILED(hr) ) 224 goto end; 225 } 226 227 /* handle the special time. */ 228 if ( rtStart == (REFERENCE_TIME)0 ) 229 { 230 hr = IMediaFilter_GetSyncSource(iface,&pClock); 231 if ( hr == S_OK && pClock != NULL ) 232 { 233 IReferenceClock_GetTime(pClock,&rtStart); 234 IReferenceClock_Release(pClock); 235 } 236 } 237 238 hr = NOERROR; 239 227 240 if ( This->m_stateGraph != State_Running ) 228 241 { 242 /* IDistributorNotify_Run() */ 243 229 244 QUARTZ_CompList_Lock( This->m_pFilterList ); 230 245 … … 249 264 } 250 265 266 end: 251 267 LeaveCriticalSection( &This->m_csGraphState ); 252 268 … … 265 281 if ( pState == NULL ) 266 282 return E_POINTER; 267 268 EnterCriticalSection( &This->m_csGraphState );269 *pState = This->m_stateGraph;270 LeaveCriticalSection( &This->m_csGraphState );271 283 272 284 dwTickStart = GetTickCount(); … … 292 304 } 293 305 306 EnterCriticalSection( &This->m_csGraphState ); 307 *pState = This->m_stateGraph; 308 LeaveCriticalSection( &This->m_csGraphState ); 309 294 310 return hr; 295 311 } … … 299 315 { 300 316 CFilterGraph_THIS(iface,mediafilter); 301 302 FIXME("(%p)->() stub!\n",This); 303 304 return E_NOTIMPL; 317 QUARTZ_CompListItem* pItem; 318 IBaseFilter* pFilter; 319 HRESULT hr = NOERROR; 320 HRESULT hrCur; 321 322 TRACE("(%p)->(%p)\n",This,pobjClock); 323 324 /* IDistributorNotify_SetSyncSource() */ 325 326 EnterCriticalSection( &This->m_csClock ); 327 QUARTZ_CompList_Lock( This->m_pFilterList ); 328 329 if ( This->m_pClock != NULL ) 330 { 331 IReferenceClock_Release(This->m_pClock); 332 This->m_pClock = NULL; 333 } 334 335 This->m_pClock = pobjClock; 336 if ( pobjClock != NULL ) 337 IReferenceClock_AddRef( pobjClock ); 338 339 pItem = QUARTZ_CompList_GetFirst( This->m_pFilterList ); 340 while ( pItem != NULL ) 341 { 342 pFilter = (IBaseFilter*)QUARTZ_CompList_GetItemPtr( pItem ); 343 hrCur = IBaseFilter_SetSyncSource(pFilter,pobjClock); 344 if ( FAILED(hrCur) ) 345 hr = hrCur; 346 pItem = QUARTZ_CompList_GetNext( This->m_pFilterList, pItem ); 347 } 348 349 QUARTZ_CompList_Unlock( This->m_pFilterList ); 350 351 IMediaEventSink_Notify(CFilterGraph_IMediaEventSink(This), 352 EC_CLOCK_CHANGED, 0, 0); 353 354 LeaveCriticalSection( &This->m_csClock ); 355 356 TRACE( "hr = %08lx\n", hr ); 357 358 return hr; 305 359 } 306 360 … … 309 363 { 310 364 CFilterGraph_THIS(iface,mediafilter); 311 312 FIXME("(%p)->() stub!\n",This); 313 314 return E_NOTIMPL; 365 HRESULT hr = VFW_E_NO_CLOCK; 366 367 TRACE("(%p)->(%p)\n",This,ppobjClock); 368 369 if ( ppobjClock == NULL ) 370 return E_POINTER; 371 372 EnterCriticalSection( &This->m_csClock ); 373 *ppobjClock = This->m_pClock; 374 if ( This->m_pClock != NULL ) 375 { 376 hr = NOERROR; 377 IReferenceClock_AddRef( This->m_pClock ); 378 } 379 LeaveCriticalSection( &This->m_csClock ); 380 381 TRACE( "hr = %08lx\n", hr ); 382 383 return hr; 315 384 } 316 385 … … 342 411 343 412 InitializeCriticalSection( &pfg->m_csGraphState ); 413 InitializeCriticalSection( &pfg->m_csClock ); 344 414 pfg->m_stateGraph = State_Stopped; 415 pfg->m_pClock = NULL; 345 416 346 417 return NOERROR; … … 351 422 TRACE("(%p)\n",pfg); 352 423 424 if ( pfg->m_pClock != NULL ) 425 { 426 IReferenceClock_Release( pfg->m_pClock ); 427 pfg->m_pClock = NULL; 428 } 429 353 430 DeleteCriticalSection( &pfg->m_csGraphState ); 354 } 431 DeleteCriticalSection( &pfg->m_csClock ); 432 } -
trunk/src/quartz/impos.c
r6710 r6952 12 12 #include "winbase.h" 13 13 #include "wingdi.h" 14 #include "winuser.h" 14 15 #include "winerror.h" 15 16 #include "wine/obj_base.h" -
trunk/src/quartz/imseek.c
r6710 r6952 3 3 * 4 4 * FIXME - stub. 5 * FIXME - this interface should be allocated as a plug-in(?) 5 6 * 6 7 * hidenori@a2.ctktv.ne.jp … … 12 13 #include "winbase.h" 13 14 #include "wingdi.h" 15 #include "winuser.h" 14 16 #include "winerror.h" 15 17 #include "wine/obj_base.h" … … 133 135 CFilterGraph_THIS(iface,mediaseeking); 134 136 137 /* the following line may produce too many FIXMEs... */ 135 138 FIXME("(%p)->() stub!\n",This); 136 139 -
trunk/src/quartz/iunk.c
r6710 r6952 66 66 if ( hr == E_NOINTERFACE ) 67 67 { 68 FIXME(" unknown interface: %s\n",debugstr_guid(riid));68 FIXME("(%p) unknown interface: %s\n",This,debugstr_guid(riid)); 69 69 } 70 70 -
trunk/src/quartz/main.c
r6710 r6952 1 /* 2 * Exported APIs. 3 * 4 * hidenori@a2.ctktv.ne.jp 5 */ 6 1 7 #include "config.h" 2 8 … … 5 11 #include "winbase.h" 6 12 #include "wingdi.h" 13 #include "winuser.h" 14 #include "winnls.h" 15 #include "mmsystem.h" 7 16 #include "ole2.h" 8 17 #include "wine/obj_oleaut.h" … … 10 19 #include "control.h" 11 20 #include "uuids.h" 21 #include "errors.h" 12 22 13 23 #include "debugtools.h" … … 22 32 #include "fmap2.h" 23 33 #include "seekpass.h" 34 #include "audren.h" 24 35 25 36 … … 66 77 { &CLSID_FilterMapper2, &QUARTZ_CreateFilterMapper2 }, 67 78 { &CLSID_SeekingPassThru, &QUARTZ_CreateSeekingPassThru }, 79 { &CLSID_AudioRender, &QUARTZ_CreateAudioRenderer }, 68 80 { NULL, NULL }, 69 81 }; … … 105 117 HeapFree( hDLLHeap, 0, pMem ); 106 118 } 119 120 void* QUARTZ_ReallocMem( void* pMem, DWORD dwSize ) 121 { 122 if ( pMem == NULL ) 123 return QUARTZ_AllocMem( dwSize ); 124 125 return HeapReAlloc( hDLLHeap, 0, pMem, dwSize ); 126 } 127 128 static 129 LPWSTR QUARTZ_strncpyAtoW( LPWSTR lpwstr, LPCSTR lpstr, INT wbuflen ) 130 { 131 INT len; 132 133 len = MultiByteToWideChar( CP_ACP, 0, lpstr, -1, lpwstr, wbuflen ); 134 if ( len == 0 ) 135 *lpwstr = 0; 136 return lpwstr; 137 } 138 107 139 108 140 /************************************************************************/ … … 264 296 LPVOID lpvReserved ) 265 297 { 298 TRACE("(%08x,%08lx,%p)\n",hInstDLL,fdwReason,lpvReserved); 299 266 300 switch ( fdwReason ) 267 301 { … … 337 371 } 338 372 339 340 373 /**************************************************************************/ 374 /**************************************************************************/ 375 376 /* FIXME - all string should be defined in the resource of quartz. */ 377 378 static LPCSTR hresult_to_string( HRESULT hr ) 379 { 380 switch ( hr ) 381 { 382 #define ENTRY(x) case x: return (const char*)#x 383 /* some known codes */ 384 ENTRY(S_OK); 385 ENTRY(S_FALSE); 386 ENTRY(E_FAIL); 387 ENTRY(E_POINTER); 388 ENTRY(E_NOTIMPL); 389 ENTRY(E_NOINTERFACE); 390 ENTRY(E_OUTOFMEMORY); 391 ENTRY(CLASS_E_CLASSNOTAVAILABLE); 392 ENTRY(CLASS_E_NOAGGREGATION); 393 394 /* vfwmsgs.h */ 395 ENTRY(VFW_S_NO_MORE_ITEMS); 396 ENTRY(VFW_E_BAD_KEY); 397 ENTRY(VFW_E_INVALIDMEDIATYPE); 398 ENTRY(VFW_E_INVALIDSUBTYPE); 399 ENTRY(VFW_E_NEED_OWNER); 400 ENTRY(VFW_E_ENUM_OUT_OF_SYNC); 401 ENTRY(VFW_E_ALREADY_CONNECTED); 402 ENTRY(VFW_E_FILTER_ACTIVE); 403 ENTRY(VFW_E_NO_TYPES); 404 ENTRY(VFW_E_NO_ACCEPTABLE_TYPES); 405 ENTRY(VFW_E_INVALID_DIRECTION); 406 ENTRY(VFW_E_NOT_CONNECTED); 407 ENTRY(VFW_E_NO_ALLOCATOR); 408 ENTRY(VFW_E_RUNTIME_ERROR); 409 ENTRY(VFW_E_BUFFER_NOTSET); 410 ENTRY(VFW_E_BUFFER_OVERFLOW); 411 ENTRY(VFW_E_BADALIGN); 412 ENTRY(VFW_E_ALREADY_COMMITTED); 413 ENTRY(VFW_E_BUFFERS_OUTSTANDING); 414 ENTRY(VFW_E_NOT_COMMITTED); 415 ENTRY(VFW_E_SIZENOTSET); 416 ENTRY(VFW_E_NO_CLOCK); 417 ENTRY(VFW_E_NO_SINK); 418 ENTRY(VFW_E_NO_INTERFACE); 419 ENTRY(VFW_E_NOT_FOUND); 420 ENTRY(VFW_E_CANNOT_CONNECT); 421 ENTRY(VFW_E_CANNOT_RENDER); 422 ENTRY(VFW_E_CHANGING_FORMAT); 423 ENTRY(VFW_E_NO_COLOR_KEY_SET); 424 ENTRY(VFW_E_NOT_OVERLAY_CONNECTION); 425 ENTRY(VFW_E_NOT_SAMPLE_CONNECTION); 426 ENTRY(VFW_E_PALETTE_SET); 427 ENTRY(VFW_E_COLOR_KEY_SET); 428 ENTRY(VFW_E_NO_COLOR_KEY_FOUND); 429 ENTRY(VFW_E_NO_PALETTE_AVAILABLE); 430 ENTRY(VFW_E_NO_DISPLAY_PALETTE); 431 ENTRY(VFW_E_TOO_MANY_COLORS); 432 ENTRY(VFW_E_STATE_CHANGED); 433 ENTRY(VFW_E_NOT_STOPPED); 434 ENTRY(VFW_E_NOT_PAUSED); 435 ENTRY(VFW_E_NOT_RUNNING); 436 ENTRY(VFW_E_WRONG_STATE); 437 ENTRY(VFW_E_START_TIME_AFTER_END); 438 ENTRY(VFW_E_INVALID_RECT); 439 ENTRY(VFW_E_TYPE_NOT_ACCEPTED); 440 ENTRY(VFW_E_SAMPLE_REJECTED); 441 ENTRY(VFW_E_SAMPLE_REJECTED_EOS); 442 ENTRY(VFW_S_DUPLICATE_NAME); 443 ENTRY(VFW_E_DUPLICATE_NAME); 444 ENTRY(VFW_E_TIMEOUT); 445 ENTRY(VFW_E_INVALID_FILE_FORMAT); 446 ENTRY(VFW_E_ENUM_OUT_OF_RANGE); 447 ENTRY(VFW_E_CIRCULAR_GRAPH); 448 ENTRY(VFW_E_NOT_ALLOWED_TO_SAVE); 449 ENTRY(VFW_E_TIME_ALREADY_PASSED); 450 ENTRY(VFW_E_ALREADY_CANCELLED); 451 ENTRY(VFW_E_CORRUPT_GRAPH_FILE); 452 ENTRY(VFW_E_ADVISE_ALREADY_SET); 453 ENTRY(VFW_S_STATE_INTERMEDIATE); 454 ENTRY(VFW_E_NO_MODEX_AVAILABLE); 455 ENTRY(VFW_E_NO_ADVISE_SET); 456 ENTRY(VFW_E_NO_FULLSCREEN); 457 ENTRY(VFW_E_IN_FULLSCREEN_MODE); 458 ENTRY(VFW_E_UNKNOWN_FILE_TYPE); 459 ENTRY(VFW_E_CANNOT_LOAD_SOURCE_FILTER); 460 ENTRY(VFW_S_PARTIAL_RENDER); 461 ENTRY(VFW_E_FILE_TOO_SHORT); 462 ENTRY(VFW_E_INVALID_FILE_VERSION); 463 ENTRY(VFW_S_SOME_DATA_IGNORED); 464 ENTRY(VFW_S_CONNECTIONS_DEFERRED); 465 ENTRY(VFW_E_INVALID_CLSID); 466 ENTRY(VFW_E_INVALID_MEDIA_TYPE); 467 ENTRY(VFW_E_SAMPLE_TIME_NOT_SET); 468 ENTRY(VFW_S_RESOURCE_NOT_NEEDED); 469 ENTRY(VFW_E_MEDIA_TIME_NOT_SET); 470 ENTRY(VFW_E_NO_TIME_FORMAT_SET); 471 ENTRY(VFW_E_MONO_AUDIO_HW); 472 ENTRY(VFW_S_MEDIA_TYPE_IGNORED); 473 ENTRY(VFW_E_NO_DECOMPRESSOR); 474 ENTRY(VFW_E_NO_AUDIO_HARDWARE); 475 ENTRY(VFW_S_VIDEO_NOT_RENDERED); 476 ENTRY(VFW_S_AUDIO_NOT_RENDERED); 477 ENTRY(VFW_E_RPZA); 478 ENTRY(VFW_S_RPZA); 479 ENTRY(VFW_E_PROCESSOR_NOT_SUITABLE); 480 ENTRY(VFW_E_UNSUPPORTED_AUDIO); 481 ENTRY(VFW_E_UNSUPPORTED_VIDEO); 482 ENTRY(VFW_E_MPEG_NOT_CONSTRAINED); 483 ENTRY(VFW_E_NOT_IN_GRAPH); 484 ENTRY(VFW_S_ESTIMATED); 485 ENTRY(VFW_E_NO_TIME_FORMAT); 486 ENTRY(VFW_E_READ_ONLY); 487 ENTRY(VFW_S_RESERVED); 488 ENTRY(VFW_E_BUFFER_UNDERFLOW); 489 ENTRY(VFW_E_UNSUPPORTED_STREAM); 490 ENTRY(VFW_E_NO_TRANSPORT); 491 ENTRY(VFW_S_STREAM_OFF); 492 ENTRY(VFW_S_CANT_CUE); 493 ENTRY(VFW_E_BAD_VIDEOCD); 494 ENTRY(VFW_S_NO_STOP_TIME); 495 ENTRY(VFW_E_OUT_OF_VIDEO_MEMORY); 496 ENTRY(VFW_E_VP_NEGOTIATION_FAILED); 497 ENTRY(VFW_E_DDRAW_CAPS_NOT_SUITABLE); 498 ENTRY(VFW_E_NO_VP_HARDWARE); 499 ENTRY(VFW_E_NO_CAPTURE_HARDWARE); 500 ENTRY(VFW_E_DVD_OPERATION_INHIBITED); 501 ENTRY(VFW_E_DVD_INVALIDDOMAIN); 502 ENTRY(VFW_E_DVD_NO_BUTTON); 503 ENTRY(VFW_E_DVD_GRAPHNOTREADY); 504 ENTRY(VFW_E_DVD_RENDERFAIL); 505 ENTRY(VFW_E_DVD_DECNOTENOUGH); 506 ENTRY(VFW_E_DDRAW_VERSION_NOT_SUITABLE); 507 ENTRY(VFW_E_COPYPROT_FAILED); 508 ENTRY(VFW_S_NOPREVIEWPIN); 509 ENTRY(VFW_E_TIME_EXPIRED); 510 ENTRY(VFW_S_DVD_NON_ONE_SEQUENTIAL); 511 ENTRY(VFW_E_DVD_WRONG_SPEED); 512 ENTRY(VFW_E_DVD_MENU_DOES_NOT_EXIST); 513 ENTRY(VFW_E_DVD_CMD_CANCELLED); 514 ENTRY(VFW_E_DVD_STATE_WRONG_VERSION); 515 ENTRY(VFW_E_DVD_STATE_CORRUPT); 516 ENTRY(VFW_E_DVD_STATE_WRONG_DISC); 517 ENTRY(VFW_E_DVD_INCOMPATIBLE_REGION); 518 ENTRY(VFW_E_DVD_NO_ATTRIBUTES); 519 ENTRY(VFW_E_DVD_NO_GOUP_PGC); 520 ENTRY(VFW_E_DVD_LOW_PARENTAL_LEVEL); 521 ENTRY(VFW_E_DVD_NOT_IN_KARAOKE_MODE); 522 ENTRY(VFW_S_DVD_CHANNEL_CONTENTS_NOT_AVAILABLE); 523 ENTRY(VFW_S_DVD_NOT_ACCURATE); 524 ENTRY(VFW_E_FRAME_STEP_UNSUPPORTED); 525 ENTRY(VFW_E_DVD_STREAM_DISABLED); 526 ENTRY(VFW_E_DVD_TITLE_UNKNOWN); 527 ENTRY(VFW_E_DVD_INVALID_DISC); 528 ENTRY(VFW_E_DVD_NO_RESUME_INFORMATION); 529 ENTRY(VFW_E_PIN_ALREADY_BLOCKED_ON_THIS_THREAD); 530 ENTRY(VFW_E_PIN_ALREADY_BLOCKED); 531 ENTRY(VFW_E_CERTIFICATION_FAILURE); 532 #undef ENTRY 533 } 534 535 return NULL; 536 } 537 538 /*********************************************************************** 539 * AMGetErrorTextA (quartz.@) 540 */ 541 DWORD WINAPI AMGetErrorTextA(HRESULT hr, LPSTR pszbuf, DWORD dwBufLen) 542 { 543 LPCSTR lpszRes; 544 DWORD len; 545 546 lpszRes = hresult_to_string( hr ); 547 if ( lpszRes == NULL ) 548 return 0; 549 len = (DWORD)(strlen(lpszRes)+1); 550 if ( len > dwBufLen ) 551 return 0; 552 553 memcpy( pszbuf, lpszRes, len ); 554 return len; 555 } 556 557 /*********************************************************************** 558 * AMGetErrorTextW (quartz.@) 559 */ 560 DWORD WINAPI AMGetErrorTextW(HRESULT hr, LPWSTR pwszbuf, DWORD dwBufLen) 561 { 562 CHAR szBuf[MAX_ERROR_TEXT_LEN+1]; 563 DWORD dwLen; 564 565 dwLen = AMGetErrorTextA(hr,szBuf,MAX_ERROR_TEXT_LEN); 566 if ( dwLen == 0 ) 567 return 0; 568 szBuf[dwLen] = 0; 569 570 QUARTZ_strncpyAtoW( pwszbuf, szBuf, dwBufLen ); 571 572 return lstrlenW( pwszbuf ); 573 } -
trunk/src/quartz/makefile
r6918 r6952 1 # $Id: makefile,v 1. 4 2001-10-01 01:41:21 birdExp $1 # $Id: makefile,v 1.5 2001-10-06 08:54:26 sandervl Exp $ 2 2 3 3 # … … 28 28 # 29 29 OBJS = \ 30 $(OBJDIR)\amerror.obj \31 30 $(OBJDIR)\amundoc.obj \ 31 $(OBJDIR)\audren.obj \ 32 $(OBJDIR)\basefilt.obj \ 33 $(OBJDIR)\basepin.obj \ 32 34 $(OBJDIR)\complist.obj \ 33 $(OBJDIR)\fgclsid.obj \ 35 $(OBJDIR)\devenum.obj \ 36 $(OBJDIR)\devmon.obj \ 37 $(OBJDIR)\enumunk.obj \ 38 $(OBJDIR)\fgevent.obj \ 34 39 $(OBJDIR)\fgidisp.obj \ 40 $(OBJDIR)\fgpass.obj \ 35 41 $(OBJDIR)\fgraph.obj \ 36 42 $(OBJDIR)\fmap.obj \ 37 43 $(OBJDIR)\fmap2.obj \ 38 $(OBJDIR)\ibasaud.obj \39 $(OBJDIR)\ibasvid.obj \40 44 $(OBJDIR)\ifgraph.obj \ 41 $(OBJDIR)\ifmap.obj \ 42 $(OBJDIR)\ifmap3.obj \ 45 $(OBJDIR)\igconfig.obj \ 43 46 $(OBJDIR)\igrver.obj \ 44 47 $(OBJDIR)\imcntl.obj \ 45 $(OBJDIR)\imem.obj \46 $(OBJDIR)\imesink.obj \47 $(OBJDIR)\imevent.obj \48 48 $(OBJDIR)\imfilter.obj \ 49 49 $(OBJDIR)\impos.obj \ 50 50 $(OBJDIR)\imseek.obj \ 51 $(OBJDIR)\irclock.obj \52 51 $(OBJDIR)\iunk.obj \ 53 $(OBJDIR)\ividwin.obj \54 52 $(OBJDIR)\main.obj \ 55 53 $(OBJDIR)\memalloc.obj \ 56 $(OBJDIR)\m onprop.obj \54 $(OBJDIR)\mtype.obj \ 57 55 $(OBJDIR)\regsvr.obj \ 56 $(OBJDIR)\sample.obj \ 58 57 $(OBJDIR)\seekpass.obj \ 59 58 $(OBJDIR)\sysclock.obj \ 60 $(OBJDIR)\devenum.obj \61 $(OBJDIR)\devmon.obj \62 $(OBJDIR)\enumunk.obj \63 $(OBJDIR)\idevenum.obj \64 59 $(OBJDIR)\initterm.obj \ 65 60 $(OBJDIR)\initquartz.obj \ … … 74 69 $(ODIN32_LIB)/kernel32.lib \ 75 70 $(ODIN32_LIB)/user32.lib \ 71 $(ODIN32_LIB)/winmm.lib \ 72 $(ODIN32_LIB)/ntdll.lib \ 76 73 $(ODIN32_LIB)/ole32.lib \ 77 74 $(ODIN32_LIB)/oleaut32.lib \ -
trunk/src/quartz/memalloc.c
r6710 r6952 2 2 * Implementation of CLSID_MemoryAllocator. 3 3 * 4 * FIXME - stub.5 *6 4 * hidenori@a2.ctktv.ne.jp 7 5 */ … … 12 10 #include "winbase.h" 13 11 #include "wingdi.h" 12 #include "winuser.h" 14 13 #include "winerror.h" 15 14 #include "wine/obj_base.h" … … 24 23 25 24 25 /*************************************************************************** 26 * 27 * new/delete for CLSID_MemoryAllocator. 28 * 29 */ 30 26 31 /* can I use offsetof safely? - FIXME? */ 27 32 static QUARTZ_IFEntry IFEntries[] = … … 64 69 return S_OK; 65 70 } 71 72 73 /*************************************************************************** 74 * 75 * CMemoryAllocator::IMemAllocator 76 * 77 */ 78 79 80 static HRESULT WINAPI 81 IMemAllocator_fnQueryInterface(IMemAllocator* iface,REFIID riid,void** ppobj) 82 { 83 CMemoryAllocator_THIS(iface,memalloc); 84 85 TRACE("(%p)->()\n",This); 86 87 return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj); 88 } 89 90 static ULONG WINAPI 91 IMemAllocator_fnAddRef(IMemAllocator* iface) 92 { 93 CMemoryAllocator_THIS(iface,memalloc); 94 95 TRACE("(%p)->()\n",This); 96 97 return IUnknown_AddRef(This->unk.punkControl); 98 } 99 100 static ULONG WINAPI 101 IMemAllocator_fnRelease(IMemAllocator* iface) 102 { 103 CMemoryAllocator_THIS(iface,memalloc); 104 105 TRACE("(%p)->()\n",This); 106 107 return IUnknown_Release(This->unk.punkControl); 108 } 109 110 static HRESULT WINAPI 111 IMemAllocator_fnSetProperties(IMemAllocator* iface,ALLOCATOR_PROPERTIES* pPropReq,ALLOCATOR_PROPERTIES* pPropActual) 112 { 113 CMemoryAllocator_THIS(iface,memalloc); 114 long padding; 115 HRESULT hr; 116 117 TRACE( "(%p)->(%p,%p)\n", This, pPropReq, pPropActual ); 118 119 if ( pPropReq == NULL || pPropActual == NULL ) 120 return E_POINTER; 121 if ( pPropReq->cBuffers < 0 || 122 pPropReq->cbBuffer < 0 || 123 pPropReq->cbAlign < 0 || 124 pPropReq->cbPrefix < 0 ) 125 return E_INVALIDARG; 126 127 if ( ( pPropReq->cbAlign & (pPropReq->cbAlign-1) ) != 0 ) 128 return E_INVALIDARG; 129 130 hr = NOERROR; 131 132 EnterCriticalSection( &This->csMem ); 133 134 if ( This->pData != NULL || This->ppSamples != NULL ) 135 { 136 /* if commited, properties must not be changed. */ 137 hr = E_UNEXPECTED; 138 goto end; 139 } 140 141 This->prop.cBuffers = pPropReq->cBuffers; 142 This->prop.cbBuffer = pPropReq->cbBuffer; 143 This->prop.cbAlign = pPropReq->cbAlign; 144 This->prop.cbPrefix = pPropReq->cbPrefix; 145 146 if ( This->prop.cbAlign == 0 ) 147 This->prop.cbAlign = 1; 148 padding = This->prop.cbAlign - 149 ( (This->prop.cbBuffer+This->prop.cbPrefix) % This->prop.cbAlign ); 150 151 This->prop.cbBuffer += padding; 152 153 memcpy( pPropActual, &This->prop, sizeof(ALLOCATOR_PROPERTIES) ); 154 155 end: 156 LeaveCriticalSection( &This->csMem ); 157 158 return hr; 159 } 160 161 static HRESULT WINAPI 162 IMemAllocator_fnGetProperties(IMemAllocator* iface,ALLOCATOR_PROPERTIES* pProp) 163 { 164 CMemoryAllocator_THIS(iface,memalloc); 165 166 TRACE( "(%p)->(%p)\n", This, pProp ); 167 168 if ( pProp == NULL ) 169 return E_POINTER; 170 171 EnterCriticalSection( &This->csMem ); 172 173 memcpy( pProp, &This->prop, sizeof(ALLOCATOR_PROPERTIES) ); 174 175 LeaveCriticalSection( &This->csMem ); 176 177 return NOERROR; 178 } 179 180 static HRESULT WINAPI 181 IMemAllocator_fnCommit(IMemAllocator* iface) 182 { 183 CMemoryAllocator_THIS(iface,memalloc); 184 HRESULT hr; 185 LONG lBufSize; 186 LONG i; 187 BYTE* pCur; 188 189 TRACE( "(%p)->()\n", This ); 190 191 EnterCriticalSection( &This->csMem ); 192 193 hr = NOERROR; 194 if ( This->pData != NULL || This->ppSamples != NULL || 195 This->prop.cBuffers <= 0 ) 196 goto end; 197 198 lBufSize = This->prop.cBuffers * 199 (This->prop.cbBuffer + This->prop.cbPrefix) + 200 This->prop.cbAlign; 201 if ( lBufSize <= 0 ) 202 lBufSize = 1; 203 204 This->pData = (BYTE*)QUARTZ_AllocMem( lBufSize ); 205 if ( This->pData == NULL ) 206 { 207 hr = E_OUTOFMEMORY; 208 goto end; 209 } 210 211 This->ppSamples = (CMemMediaSample**)QUARTZ_AllocMem( 212 sizeof(CMemMediaSample*) * This->prop.cBuffers ); 213 if ( This->ppSamples == NULL ) 214 { 215 hr = E_OUTOFMEMORY; 216 goto end; 217 } 218 219 for ( i = 0; i < This->prop.cBuffers; i++ ) 220 This->ppSamples[i] = NULL; 221 222 pCur = This->pData + This->prop.cbAlign - ((This->pData-(BYTE*)NULL) & (This->prop.cbAlign-1)); 223 224 for ( i = 0; i < This->prop.cBuffers; i++ ) 225 { 226 hr = QUARTZ_CreateMemMediaSample( 227 pCur, (This->prop.cbBuffer + This->prop.cbPrefix), 228 iface, &This->ppSamples[i] ); 229 if ( FAILED(hr) ) 230 goto end; 231 pCur += (This->prop.cbBuffer + This->prop.cbPrefix); 232 } 233 234 hr = NOERROR; 235 end: 236 if ( FAILED(hr) ) 237 IMemAllocator_Decommit(iface); 238 239 LeaveCriticalSection( &This->csMem ); 240 241 return hr; 242 } 243 244 static HRESULT WINAPI 245 IMemAllocator_fnDecommit(IMemAllocator* iface) 246 { 247 CMemoryAllocator_THIS(iface,memalloc); 248 HRESULT hr; 249 LONG i; 250 BOOL bBlock; 251 252 TRACE( "(%p)->()\n", This ); 253 254 EnterCriticalSection( &This->csMem ); 255 256 hr = NOERROR; 257 258 if ( This->pData == NULL && This->ppSamples == NULL ) 259 goto end; 260 261 while ( 1 ) 262 { 263 bBlock = FALSE; 264 i = 0; 265 266 ResetEvent( This->hEventSample ); 267 268 while ( 1 ) 269 { 270 if ( i >= This->prop.cBuffers ) 271 break; 272 273 if ( This->ppSamples[i] != NULL ) 274 { 275 if ( This->ppSamples[i]->ref == 0 ) 276 { 277 QUARTZ_DestroyMemMediaSample( This->ppSamples[i] ); 278 This->ppSamples[i] = NULL; 279 } 280 else 281 { 282 bBlock = TRUE; 283 } 284 } 285 i++; 286 } 287 288 if ( !bBlock ) 289 { 290 QUARTZ_FreeMem(This->ppSamples); 291 This->ppSamples = NULL; 292 QUARTZ_FreeMem(This->pData); 293 This->pData = NULL; 294 hr = NOERROR; 295 break; 296 } 297 298 WaitForSingleObject( This->hEventSample, INFINITE ); 299 } 300 301 end: 302 LeaveCriticalSection( &This->csMem ); 303 304 return hr; 305 } 306 307 static HRESULT WINAPI 308 IMemAllocator_fnGetBuffer(IMemAllocator* iface,IMediaSample** ppSample,REFERENCE_TIME* prtStart,REFERENCE_TIME* prtEnd,DWORD dwFlags) 309 { 310 CMemoryAllocator_THIS(iface,memalloc); 311 LONG i; 312 HRESULT hr; 313 314 TRACE( "(%p)->(%p,%p,%p,%lu)\n", This, ppSample, prtStart, prtEnd, dwFlags ); 315 316 if ( ppSample == NULL ) 317 return E_POINTER; 318 319 EnterCriticalSection( &This->csMem ); 320 321 hr = NOERROR; 322 323 if ( This->pData == NULL || This->ppSamples == NULL || 324 This->prop.cBuffers <= 0 ) 325 { 326 hr = E_FAIL; /* FIXME? */ 327 goto end; 328 } 329 330 while ( 1 ) 331 { 332 ResetEvent( This->hEventSample ); 333 334 for ( i = 0; i < This->prop.cBuffers; i++ ) 335 { 336 if ( This->ppSamples[i]->ref == 0 ) 337 { 338 *ppSample = (IMediaSample*)(This->ppSamples[i]); 339 IMediaSample_AddRef( *ppSample ); 340 hr = NOERROR; 341 goto end; 342 } 343 } 344 345 if ( dwFlags & AM_GBF_NOWAIT ) 346 { 347 hr = E_FAIL; /* FIXME? */ 348 goto end; 349 } 350 351 WaitForSingleObject( This->hEventSample, INFINITE ); 352 } 353 354 end: 355 LeaveCriticalSection( &This->csMem ); 356 357 return hr; 358 } 359 360 static HRESULT WINAPI 361 IMemAllocator_fnReleaseBuffer(IMemAllocator* iface,IMediaSample* pSample) 362 { 363 CMemoryAllocator_THIS(iface,memalloc); 364 365 TRACE( "(%p)->(%p)\n", This, pSample ); 366 SetEvent( This->hEventSample ); 367 368 return NOERROR; 369 } 370 371 372 373 static ICOM_VTABLE(IMemAllocator) imemalloc = 374 { 375 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 376 /* IUnknown fields */ 377 IMemAllocator_fnQueryInterface, 378 IMemAllocator_fnAddRef, 379 IMemAllocator_fnRelease, 380 /* IMemAllocator fields */ 381 IMemAllocator_fnSetProperties, 382 IMemAllocator_fnGetProperties, 383 IMemAllocator_fnCommit, 384 IMemAllocator_fnDecommit, 385 IMemAllocator_fnGetBuffer, 386 IMemAllocator_fnReleaseBuffer, 387 }; 388 389 390 HRESULT CMemoryAllocator_InitIMemAllocator( CMemoryAllocator* pma ) 391 { 392 TRACE("(%p)\n",pma); 393 394 ICOM_VTBL(&pma->memalloc) = &imemalloc; 395 396 ZeroMemory( &pma->prop, sizeof(pma->prop) ); 397 pma->hEventSample = (HANDLE)NULL; 398 pma->pData = NULL; 399 pma->ppSamples = NULL; 400 401 pma->hEventSample = CreateEventA( NULL, TRUE, FALSE, NULL ); 402 if ( pma->hEventSample == (HANDLE)NULL ) 403 return E_OUTOFMEMORY; 404 405 InitializeCriticalSection( &pma->csMem ); 406 407 return NOERROR; 408 } 409 410 void CMemoryAllocator_UninitIMemAllocator( CMemoryAllocator* pma ) 411 { 412 TRACE("(%p)\n",pma); 413 414 IMemAllocator_Decommit( (IMemAllocator*)(&pma->memalloc) ); 415 416 DeleteCriticalSection( &pma->csMem ); 417 418 if ( pma->hEventSample != (HANDLE)NULL ) 419 CloseHandle( pma->hEventSample ); 420 } -
trunk/src/quartz/memalloc.h
r6710 r6952 13 13 14 14 #include "iunk.h" 15 #include "sample.h" 15 16 16 17 typedef struct MA_IMemAllocatorImpl … … 27 28 CRITICAL_SECTION csMem; 28 29 ALLOCATOR_PROPERTIES prop; 30 HANDLE hEventSample; 31 BYTE* pData; 32 CMemMediaSample** ppSamples; 29 33 } CMemoryAllocator; 30 34 -
trunk/src/quartz/quartz_private.h
r6563 r6952 8 8 void* QUARTZ_AllocMem( DWORD dwSize ); 9 9 void QUARTZ_FreeMem( void* pMem ); 10 void* QUARTZ_ReallocMem( void* pMem, DWORD dwSize ); 10 11 11 12 #endif /* QUARTZ_PRIVATE_H */ -
trunk/src/quartz/regsvr.c
r6710 r6952 13 13 #include "winerror.h" 14 14 #include "winreg.h" 15 #ifdef __WIN32OS2__16 #include "wine/obj_base.h"17 #endif18 15 #include "uuids.h" 19 16 #include "wine/unicode.h" -
trunk/src/quartz/seekpass.c
r6710 r6952 1 1 /* 2 * Implementation of CLSID_SeekingPassThru. 2 * Implementation of CLSID_SeekingPassThru 3 * 4 * FIXME - not tested yet. 3 5 * 4 6 * hidenori@a2.ctktv.ne.jp … … 10 12 #include "winbase.h" 11 13 #include "wingdi.h" 14 #include "winuser.h" 12 15 #include "winerror.h" 13 16 #include "wine/obj_base.h" 14 17 #include "strmif.h" 18 #include "control.h" 15 19 #include "uuids.h" 16 20 … … 22 26 23 27 28 /*************************************************************************** 29 * 30 * CSeekingPassThru::ISeekingPassThru 31 * 32 */ 24 33 25 34 static HRESULT WINAPI … … 58 67 CSeekingPassThru_THIS(iface,seekpass); 59 68 60 FIXME("(%p)->(%d,%p) stub!\n",This,bRendering,pPin); 61 62 return E_NOTIMPL; 69 FIXME("(%p)->(%d,%p) not tested!\n",This,bRendering,pPin); 70 71 if ( pPin == NULL ) 72 return E_POINTER; 73 74 /* Why is 'bRendering' given as an argument?? */ 75 EnterCriticalSection( &This->cs ); 76 77 if ( This->passthru.pPin != NULL ) 78 IPin_Release( This->passthru.pPin ); 79 This->passthru.pPin = pPin; IPin_AddRef( pPin ); 80 81 LeaveCriticalSection( &This->cs ); 82 83 return NOERROR; 63 84 } 64 85 … … 80 101 TRACE("(%p)\n",This); 81 102 ICOM_VTBL(&This->seekpass) = &iseekingpassthru; 103 This->passthru.punk = This->unk.punkControl; 104 This->passthru.pPin = NULL; 105 InitializeCriticalSection( &This->cs ); 82 106 83 107 return NOERROR; … … 88 112 { 89 113 TRACE("(%p)\n",This); 90 } 91 114 if ( This->passthru.pPin != NULL ) 115 { 116 IPin_Release( This->passthru.pPin ); 117 This->passthru.pPin = NULL; 118 } 119 DeleteCriticalSection( &This->cs ); 120 } 121 122 /*************************************************************************** 123 * 124 * new/delete for CLSID_SeekingPassThru. 125 * 126 */ 92 127 93 128 /* can I use offsetof safely? - FIXME? */ … … 95 130 { 96 131 { &IID_ISeekingPassThru, offsetof(CSeekingPassThru,seekpass)-offsetof(CSeekingPassThru,unk) }, 132 { &IID_IMediaPosition, offsetof(CSeekingPassThru,passthru.mpos)-offsetof(CSeekingPassThru,unk) }, 133 { &IID_IMediaSeeking, offsetof(CSeekingPassThru,passthru.mseek)-offsetof(CSeekingPassThru,unk) }, 97 134 }; 98 135 … … 133 170 } 134 171 172 173 174 175 /*************************************************************************** 176 * 177 * CPassThruImpl Helper methods. 178 * 179 */ 180 181 static 182 HRESULT CPassThruImpl_GetConnected( CPassThruImpl* pImpl, IPin** ppPin ) 183 { 184 return IPin_ConnectedTo( pImpl->pPin, ppPin ); 185 } 186 187 HRESULT CPassThruImpl_QueryPosPass( 188 CPassThruImpl* pImpl, IMediaPosition** ppPosition ) 189 { 190 IPin* pPin; 191 HRESULT hr; 192 193 hr = CPassThruImpl_GetConnected( pImpl, &pPin ); 194 if ( FAILED(hr) ) 195 return hr; 196 hr = IPin_QueryInterface(pPin,&IID_IMediaPosition,(void**)ppPosition); 197 IPin_Release(pPin); 198 199 return hr; 200 } 201 202 HRESULT CPassThruImpl_QuerySeekPass( 203 CPassThruImpl* pImpl, IMediaSeeking** ppSeeking ) 204 { 205 IPin* pPin; 206 HRESULT hr; 207 208 hr = CPassThruImpl_GetConnected( pImpl, &pPin ); 209 if ( FAILED(hr) ) 210 return hr; 211 hr = IPin_QueryInterface(pPin,&IID_IMediaSeeking,(void**)ppSeeking); 212 IPin_Release(pPin); 213 214 return hr; 215 } 216 217 /*************************************************************************** 218 * 219 * An implementation for CPassThruImpl::IMediaPosition. 220 * 221 */ 222 223 224 #define QUERYPOSPASS \ 225 IMediaPosition* pPos = NULL; \ 226 HRESULT hr; \ 227 hr = CPassThruImpl_QueryPosPass( This, &pPos ); \ 228 if ( FAILED(hr) ) return hr; 229 230 static HRESULT WINAPI 231 IMediaPosition_fnQueryInterface(IMediaPosition* iface,REFIID riid,void** ppobj) 232 { 233 CPassThruImpl_THIS(iface,mpos); 234 235 TRACE("(%p)->()\n",This); 236 237 return IUnknown_QueryInterface(This->punk,riid,ppobj); 238 } 239 240 static ULONG WINAPI 241 IMediaPosition_fnAddRef(IMediaPosition* iface) 242 { 243 CPassThruImpl_THIS(iface,mpos); 244 245 TRACE("(%p)->()\n",This); 246 247 return IUnknown_AddRef(This->punk); 248 } 249 250 static ULONG WINAPI 251 IMediaPosition_fnRelease(IMediaPosition* iface) 252 { 253 CPassThruImpl_THIS(iface,mpos); 254 255 TRACE("(%p)->()\n",This); 256 257 return IUnknown_Release(This->punk); 258 } 259 260 static HRESULT WINAPI 261 IMediaPosition_fnGetTypeInfoCount(IMediaPosition* iface,UINT* pcTypeInfo) 262 { 263 CPassThruImpl_THIS(iface,mpos); 264 265 FIXME("(%p)->() stub!\n",This); 266 267 return E_NOTIMPL; 268 } 269 270 static HRESULT WINAPI 271 IMediaPosition_fnGetTypeInfo(IMediaPosition* iface,UINT iTypeInfo, LCID lcid, ITypeInfo** ppobj) 272 { 273 CPassThruImpl_THIS(iface,mpos); 274 275 FIXME("(%p)->() stub!\n",This); 276 277 return E_NOTIMPL; 278 } 279 280 static HRESULT WINAPI 281 IMediaPosition_fnGetIDsOfNames(IMediaPosition* iface,REFIID riid, LPOLESTR* ppwszName, UINT cNames, LCID lcid, DISPID* pDispId) 282 { 283 CPassThruImpl_THIS(iface,mpos); 284 285 FIXME("(%p)->() stub!\n",This); 286 287 return E_NOTIMPL; 288 } 289 290 static HRESULT WINAPI 291 IMediaPosition_fnInvoke(IMediaPosition* iface,DISPID DispId, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarRes, EXCEPINFO* pExcepInfo, UINT* puArgErr) 292 { 293 CPassThruImpl_THIS(iface,mpos); 294 295 FIXME("(%p)->() stub!\n",This); 296 297 return E_NOTIMPL; 298 } 299 300 301 static HRESULT WINAPI 302 IMediaPosition_fnget_Duration(IMediaPosition* iface,REFTIME* prefTime) 303 { 304 CPassThruImpl_THIS(iface,mpos); 305 QUERYPOSPASS 306 307 TRACE("(%p)->()\n",This); 308 309 return IMediaPosition_get_Duration(pPos,prefTime); 310 } 311 312 static HRESULT WINAPI 313 IMediaPosition_fnput_CurrentPosition(IMediaPosition* iface,REFTIME refTime) 314 { 315 CPassThruImpl_THIS(iface,mpos); 316 QUERYPOSPASS 317 318 TRACE("(%p)->()\n",This); 319 320 return IMediaPosition_put_CurrentPosition(pPos,refTime); 321 } 322 323 static HRESULT WINAPI 324 IMediaPosition_fnget_CurrentPosition(IMediaPosition* iface,REFTIME* prefTime) 325 { 326 CPassThruImpl_THIS(iface,mpos); 327 QUERYPOSPASS 328 329 TRACE("(%p)->()\n",This); 330 331 return IMediaPosition_get_CurrentPosition(pPos,prefTime); 332 } 333 334 static HRESULT WINAPI 335 IMediaPosition_fnget_StopTime(IMediaPosition* iface,REFTIME* prefTime) 336 { 337 CPassThruImpl_THIS(iface,mpos); 338 QUERYPOSPASS 339 340 TRACE("(%p)->()\n",This); 341 342 return IMediaPosition_get_StopTime(pPos,prefTime); 343 } 344 345 static HRESULT WINAPI 346 IMediaPosition_fnput_StopTime(IMediaPosition* iface,REFTIME refTime) 347 { 348 CPassThruImpl_THIS(iface,mpos); 349 QUERYPOSPASS 350 351 TRACE("(%p)->()\n",This); 352 353 return IMediaPosition_put_StopTime(pPos,refTime); 354 } 355 356 static HRESULT WINAPI 357 IMediaPosition_fnget_PrerollTime(IMediaPosition* iface,REFTIME* prefTime) 358 { 359 CPassThruImpl_THIS(iface,mpos); 360 QUERYPOSPASS 361 362 TRACE("(%p)->()\n",This); 363 364 return IMediaPosition_get_PrerollTime(pPos,prefTime); 365 } 366 367 static HRESULT WINAPI 368 IMediaPosition_fnput_PrerollTime(IMediaPosition* iface,REFTIME refTime) 369 { 370 CPassThruImpl_THIS(iface,mpos); 371 QUERYPOSPASS 372 373 TRACE("(%p)->()\n",This); 374 375 return IMediaPosition_put_PrerollTime(pPos,refTime); 376 } 377 378 static HRESULT WINAPI 379 IMediaPosition_fnput_Rate(IMediaPosition* iface,double dblRate) 380 { 381 CPassThruImpl_THIS(iface,mpos); 382 QUERYPOSPASS 383 384 TRACE("(%p)->()\n",This); 385 386 return IMediaPosition_put_Rate(pPos,dblRate); 387 } 388 389 static HRESULT WINAPI 390 IMediaPosition_fnget_Rate(IMediaPosition* iface,double* pdblRate) 391 { 392 CPassThruImpl_THIS(iface,mpos); 393 QUERYPOSPASS 394 395 TRACE("(%p)->()\n",This); 396 397 return IMediaPosition_get_Rate(pPos,pdblRate); 398 } 399 400 static HRESULT WINAPI 401 IMediaPosition_fnCanSeekForward(IMediaPosition* iface,LONG* pCanSeek) 402 { 403 CPassThruImpl_THIS(iface,mpos); 404 QUERYPOSPASS 405 406 TRACE("(%p)->()\n",This); 407 408 return IMediaPosition_CanSeekForward(pPos,pCanSeek); 409 } 410 411 static HRESULT WINAPI 412 IMediaPosition_fnCanSeekBackward(IMediaPosition* iface,LONG* pCanSeek) 413 { 414 CPassThruImpl_THIS(iface,mpos); 415 QUERYPOSPASS 416 417 TRACE("(%p)->()\n",This); 418 419 return IMediaPosition_CanSeekBackward(pPos,pCanSeek); 420 } 421 422 423 static ICOM_VTABLE(IMediaPosition) impos = 424 { 425 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 426 /* IUnknown fields */ 427 IMediaPosition_fnQueryInterface, 428 IMediaPosition_fnAddRef, 429 IMediaPosition_fnRelease, 430 /* IDispatch fields */ 431 IMediaPosition_fnGetTypeInfoCount, 432 IMediaPosition_fnGetTypeInfo, 433 IMediaPosition_fnGetIDsOfNames, 434 IMediaPosition_fnInvoke, 435 /* IMediaPosition fields */ 436 IMediaPosition_fnget_Duration, 437 IMediaPosition_fnput_CurrentPosition, 438 IMediaPosition_fnget_CurrentPosition, 439 IMediaPosition_fnget_StopTime, 440 IMediaPosition_fnput_StopTime, 441 IMediaPosition_fnget_PrerollTime, 442 IMediaPosition_fnput_PrerollTime, 443 IMediaPosition_fnput_Rate, 444 IMediaPosition_fnget_Rate, 445 IMediaPosition_fnCanSeekForward, 446 IMediaPosition_fnCanSeekBackward, 447 }; 448 449 450 HRESULT CPassThruImpl_InitIMediaPosition( CPassThruImpl* pImpl ) 451 { 452 TRACE("(%p)\n",pImpl); 453 ICOM_VTBL(&pImpl->mpos) = &impos; 454 455 return NOERROR; 456 } 457 458 void CPassThruImpl_UninitIMediaPosition( CPassThruImpl* pImpl ) 459 { 460 TRACE("(%p)\n",pImpl); 461 } 462 463 #undef QUERYPOSPASS 464 465 466 /*************************************************************************** 467 * 468 * An implementation for CPassThruImpl::IMediaSeeking. 469 * 470 */ 471 472 #define QUERYSEEKPASS \ 473 IMediaSeeking* pSeek = NULL; \ 474 HRESULT hr; \ 475 hr = CPassThruImpl_QuerySeekPass( This, &pSeek ); \ 476 if ( FAILED(hr) ) return hr; 477 478 479 static HRESULT WINAPI 480 IMediaSeeking_fnQueryInterface(IMediaSeeking* iface,REFIID riid,void** ppobj) 481 { 482 CPassThruImpl_THIS(iface,mseek); 483 484 TRACE("(%p)->()\n",This); 485 486 return IUnknown_QueryInterface(This->punk,riid,ppobj); 487 } 488 489 static ULONG WINAPI 490 IMediaSeeking_fnAddRef(IMediaSeeking* iface) 491 { 492 CPassThruImpl_THIS(iface,mseek); 493 494 TRACE("(%p)->()\n",This); 495 496 return IUnknown_AddRef(This->punk); 497 } 498 499 static ULONG WINAPI 500 IMediaSeeking_fnRelease(IMediaSeeking* iface) 501 { 502 CPassThruImpl_THIS(iface,mseek); 503 504 TRACE("(%p)->()\n",This); 505 506 return IUnknown_Release(This->punk); 507 } 508 509 510 static HRESULT WINAPI 511 IMediaSeeking_fnGetCapabilities(IMediaSeeking* iface,DWORD* pdwCaps) 512 { 513 CPassThruImpl_THIS(iface,mseek); 514 QUERYSEEKPASS 515 516 TRACE("(%p)->()\n",This); 517 518 return IMediaSeeking_GetCapabilities(pSeek,pdwCaps); 519 } 520 521 static HRESULT WINAPI 522 IMediaSeeking_fnCheckCapabilities(IMediaSeeking* iface,DWORD* pdwCaps) 523 { 524 CPassThruImpl_THIS(iface,mseek); 525 QUERYSEEKPASS 526 527 TRACE("(%p)->()\n",This); 528 529 return IMediaSeeking_CheckCapabilities(pSeek,pdwCaps); 530 } 531 532 static HRESULT WINAPI 533 IMediaSeeking_fnIsFormatSupported(IMediaSeeking* iface,const GUID* pidFormat) 534 { 535 CPassThruImpl_THIS(iface,mseek); 536 QUERYSEEKPASS 537 538 TRACE("(%p)->()\n",This); 539 540 return IMediaSeeking_IsFormatSupported(pSeek,pidFormat); 541 } 542 543 static HRESULT WINAPI 544 IMediaSeeking_fnQueryPreferredFormat(IMediaSeeking* iface,GUID* pidFormat) 545 { 546 CPassThruImpl_THIS(iface,mseek); 547 QUERYSEEKPASS 548 549 TRACE("(%p)->()\n",This); 550 551 return IMediaSeeking_QueryPreferredFormat(pSeek,pidFormat); 552 } 553 554 static HRESULT WINAPI 555 IMediaSeeking_fnGetTimeFormat(IMediaSeeking* iface,GUID* pidFormat) 556 { 557 CPassThruImpl_THIS(iface,mseek); 558 QUERYSEEKPASS 559 560 TRACE("(%p)->()\n",This); 561 562 return IMediaSeeking_GetTimeFormat(pSeek,pidFormat); 563 } 564 565 static HRESULT WINAPI 566 IMediaSeeking_fnIsUsingTimeFormat(IMediaSeeking* iface,const GUID* pidFormat) 567 { 568 CPassThruImpl_THIS(iface,mseek); 569 QUERYSEEKPASS 570 571 TRACE("(%p)->()\n",This); 572 573 return IMediaSeeking_IsUsingTimeFormat(pSeek,pidFormat); 574 } 575 576 static HRESULT WINAPI 577 IMediaSeeking_fnSetTimeFormat(IMediaSeeking* iface,const GUID* pidFormat) 578 { 579 CPassThruImpl_THIS(iface,mseek); 580 QUERYSEEKPASS 581 582 TRACE("(%p)->()\n",This); 583 584 return IMediaSeeking_SetTimeFormat(pSeek,pidFormat); 585 } 586 587 static HRESULT WINAPI 588 IMediaSeeking_fnGetDuration(IMediaSeeking* iface,LONGLONG* pllDuration) 589 { 590 CPassThruImpl_THIS(iface,mseek); 591 QUERYSEEKPASS 592 593 TRACE("(%p)->()\n",This); 594 595 return IMediaSeeking_GetDuration(pSeek,pllDuration); 596 } 597 598 static HRESULT WINAPI 599 IMediaSeeking_fnGetStopPosition(IMediaSeeking* iface,LONGLONG* pllPos) 600 { 601 CPassThruImpl_THIS(iface,mseek); 602 QUERYSEEKPASS 603 604 TRACE("(%p)->()\n",This); 605 606 return IMediaSeeking_GetStopPosition(pSeek,pllPos); 607 } 608 609 static HRESULT WINAPI 610 IMediaSeeking_fnGetCurrentPosition(IMediaSeeking* iface,LONGLONG* pllPos) 611 { 612 CPassThruImpl_THIS(iface,mseek); 613 QUERYSEEKPASS 614 615 TRACE("(%p)->()\n",This); 616 617 return IMediaSeeking_GetCurrentPosition(pSeek,pllPos); 618 } 619 620 static HRESULT WINAPI 621 IMediaSeeking_fnConvertTimeFormat(IMediaSeeking* iface,LONGLONG* pllOut,const GUID* pidFmtOut,LONGLONG llIn,const GUID* pidFmtIn) 622 { 623 CPassThruImpl_THIS(iface,mseek); 624 QUERYSEEKPASS 625 626 TRACE("(%p)->()\n",This); 627 628 return IMediaSeeking_ConvertTimeFormat(pSeek,pllOut,pidFmtOut,llIn,pidFmtIn); 629 } 630 631 static HRESULT WINAPI 632 IMediaSeeking_fnSetPositions(IMediaSeeking* iface,LONGLONG* pllCur,DWORD dwCurFlags,LONGLONG* pllStop,DWORD dwStopFlags) 633 { 634 CPassThruImpl_THIS(iface,mseek); 635 QUERYSEEKPASS 636 637 TRACE("(%p)->()\n",This); 638 639 return IMediaSeeking_SetPositions(pSeek,pllCur,dwCurFlags,pllStop,dwStopFlags); 640 } 641 642 static HRESULT WINAPI 643 IMediaSeeking_fnGetPositions(IMediaSeeking* iface,LONGLONG* pllCur,LONGLONG* pllStop) 644 { 645 CPassThruImpl_THIS(iface,mseek); 646 QUERYSEEKPASS 647 648 TRACE("(%p)->()\n",This); 649 650 return IMediaSeeking_GetPositions(pSeek,pllCur,pllStop); 651 } 652 653 static HRESULT WINAPI 654 IMediaSeeking_fnGetAvailable(IMediaSeeking* iface,LONGLONG* pllFirst,LONGLONG* pllLast) 655 { 656 CPassThruImpl_THIS(iface,mseek); 657 QUERYSEEKPASS 658 659 TRACE("(%p)->()\n",This); 660 661 return IMediaSeeking_GetAvailable(pSeek,pllFirst,pllLast); 662 } 663 664 static HRESULT WINAPI 665 IMediaSeeking_fnSetRate(IMediaSeeking* iface,double dblRate) 666 { 667 CPassThruImpl_THIS(iface,mseek); 668 QUERYSEEKPASS 669 670 TRACE("(%p)->()\n",This); 671 672 return IMediaSeeking_SetRate(pSeek,dblRate); 673 } 674 675 static HRESULT WINAPI 676 IMediaSeeking_fnGetRate(IMediaSeeking* iface,double* pdblRate) 677 { 678 CPassThruImpl_THIS(iface,mseek); 679 QUERYSEEKPASS 680 681 TRACE("(%p)->()\n",This); 682 683 return IMediaSeeking_GetRate(pSeek,pdblRate); 684 } 685 686 static HRESULT WINAPI 687 IMediaSeeking_fnGetPreroll(IMediaSeeking* iface,LONGLONG* pllPreroll) 688 { 689 CPassThruImpl_THIS(iface,mseek); 690 QUERYSEEKPASS 691 692 TRACE("(%p)->()\n",This); 693 694 return IMediaSeeking_GetPreroll(pSeek,pllPreroll); 695 } 696 697 698 699 700 static ICOM_VTABLE(IMediaSeeking) imseek = 701 { 702 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 703 /* IUnknown fields */ 704 IMediaSeeking_fnQueryInterface, 705 IMediaSeeking_fnAddRef, 706 IMediaSeeking_fnRelease, 707 /* IMediaSeeking fields */ 708 IMediaSeeking_fnGetCapabilities, 709 IMediaSeeking_fnCheckCapabilities, 710 IMediaSeeking_fnIsFormatSupported, 711 IMediaSeeking_fnQueryPreferredFormat, 712 IMediaSeeking_fnGetTimeFormat, 713 IMediaSeeking_fnIsUsingTimeFormat, 714 IMediaSeeking_fnSetTimeFormat, 715 IMediaSeeking_fnGetDuration, 716 IMediaSeeking_fnGetStopPosition, 717 IMediaSeeking_fnGetCurrentPosition, 718 IMediaSeeking_fnConvertTimeFormat, 719 IMediaSeeking_fnSetPositions, 720 IMediaSeeking_fnGetPositions, 721 IMediaSeeking_fnGetAvailable, 722 IMediaSeeking_fnSetRate, 723 IMediaSeeking_fnGetRate, 724 IMediaSeeking_fnGetPreroll, 725 }; 726 727 728 729 HRESULT CPassThruImpl_InitIMediaSeeking( CPassThruImpl* pImpl ) 730 { 731 TRACE("(%p)\n",pImpl); 732 ICOM_VTBL(&pImpl->mseek) = &imseek; 733 734 return NOERROR; 735 } 736 737 void CPassThruImpl_UninitIMediaSeeking( CPassThruImpl* pImpl ) 738 { 739 TRACE("(%p)\n",pImpl); 740 } 741 742 #undef QUERYSEEKPASS -
trunk/src/quartz/seekpass.h
r6710 r6952 14 14 #include "iunk.h" 15 15 16 17 /****************************************************************************/ 18 19 typedef struct CPassThruImpl 20 { 21 struct { ICOM_VFIELD(IMediaPosition); } mpos; 22 struct { ICOM_VFIELD(IMediaSeeking); } mseek; 23 24 IUnknown* punk; 25 IPin* pPin; 26 } CPassThruImpl; 27 28 #define CPassThruImpl_THIS(iface,member) CPassThruImpl* This = ((CPassThruImpl*)(((char*)iface)-offsetof(CPassThruImpl,member))) 29 30 HRESULT CPassThruImpl_InitIMediaPosition( CPassThruImpl* pImpl ); 31 void CPassThruImpl_UninitIMediaPosition( CPassThruImpl* pImpl ); 32 HRESULT CPassThruImpl_InitIMediaSeeking( CPassThruImpl* pImpl ); 33 void CPassThruImpl_UninitIMediaSeeking( CPassThruImpl* pImpl ); 34 35 HRESULT CPassThruImpl_QueryPosPass( 36 CPassThruImpl* pImpl, IMediaPosition** ppPosition ); 37 HRESULT CPassThruImpl_QuerySeekPass( 38 CPassThruImpl* pImpl, IMediaSeeking** ppSeeking ); 39 40 /****************************************************************************/ 41 16 42 typedef struct QUARTZ_ISeekingPassThruImpl 17 43 { 18 44 ICOM_VFIELD(ISeekingPassThru); 19 45 } QUARTZ_ISeekingPassThruImpl; 20 21 46 22 47 typedef struct CSeekingPassThru … … 26 51 27 52 /* ISeekingPassThru fields. */ 53 CRITICAL_SECTION cs; 54 CPassThruImpl passthru; 28 55 } CSeekingPassThru; 29 56 -
trunk/src/quartz/sysclock.c
r6710 r6952 2 2 * Implementation of CLSID_SystemClock. 3 3 * 4 * FIXME - stub.5 *6 4 * hidenori@a2.ctktv.ne.jp 7 5 */ … … 12 10 #include "winbase.h" 13 11 #include "wingdi.h" 12 #include "winuser.h" 14 13 #include "winerror.h" 15 14 #include "wine/obj_base.h" … … 24 23 25 24 25 /*************************************************************************** 26 * 27 * new/delete for CLSID_SystemClock 28 * 29 */ 30 26 31 /* can I use offsetof safely? - FIXME? */ 27 32 static QUARTZ_IFEntry IFEntries[] = … … 65 70 return S_OK; 66 71 } 72 73 74 /*************************************************************************** 75 * 76 * CLSID_SystemClock::IReferenceClock 77 * 78 */ 79 80 #define QUARTZ_MSG_ADDTIMER (WM_APP+0) 81 #define QUARTZ_MSG_REMOVETIMER (WM_APP+1) 82 #define QUARTZ_MSG_EXITTHREAD (WM_APP+2) 83 84 85 /****************************************************************************/ 86 87 static QUARTZ_TimerEntry* IReferenceClock_AllocTimerEntry(CSystemClock* This) 88 { 89 QUARTZ_TimerEntry* pEntry; 90 DWORD dw; 91 92 pEntry = &This->m_timerEntries[0]; 93 for ( dw = 0; dw < WINE_QUARTZ_SYSCLOCK_TIMER_MAX; dw++ ) 94 { 95 if ( pEntry->hEvent == (HANDLE)NULL ) 96 return pEntry; 97 pEntry ++; 98 } 99 100 return NULL; 101 } 102 103 static QUARTZ_TimerEntry* IReferenceClock_SearchTimer(CSystemClock* This, DWORD dwAdvCookie) 104 { 105 QUARTZ_TimerEntry* pEntry; 106 DWORD dw; 107 108 pEntry = &This->m_timerEntries[0]; 109 for ( dw = 0; dw < WINE_QUARTZ_SYSCLOCK_TIMER_MAX; dw++ ) 110 { 111 if ( pEntry->hEvent != (HANDLE)NULL && 112 pEntry->dwAdvCookie == dwAdvCookie ) 113 return pEntry; 114 pEntry ++; 115 } 116 117 return NULL; 118 } 119 120 static DWORD IReferenceClock_OnTimerUpdated(CSystemClock* This) 121 { 122 QUARTZ_TimerEntry* pEntry; 123 REFERENCE_TIME rtCur; 124 REFERENCE_TIME rtSignal; 125 REFERENCE_TIME rtCount; 126 HRESULT hr; 127 LONG lCount; 128 DWORD dw; 129 DWORD dwTimeout = INFINITE; 130 DWORD dwTimeoutCur; 131 132 hr = IReferenceClock_GetTime((IReferenceClock*)(&This->refclk),&rtCur); 133 if ( hr != NOERROR ) 134 return INFINITE; 135 136 pEntry = &This->m_timerEntries[0]; 137 for ( dw = 0; dw < WINE_QUARTZ_SYSCLOCK_TIMER_MAX; dw++ ) 138 { 139 if ( pEntry->hEvent != (HANDLE)NULL ) 140 { 141 rtSignal = pEntry->rtStart + pEntry->rtInterval; 142 if ( rtCur >= rtSignal ) 143 { 144 if ( pEntry->fPeriodic ) 145 { 146 rtCount = ((rtCur - pEntry->rtStart) / pEntry->rtInterval); 147 lCount = ( rtCount > (REFERENCE_TIME)0x7fffffff ) ? 148 (LONG)0x7fffffff : (LONG)rtCount; 149 if ( !ReleaseSemaphore( pEntry->hEvent, lCount, NULL ) ) 150 { 151 while ( lCount > 0 ) 152 { 153 if ( !ReleaseSemaphore( pEntry->hEvent, 1, NULL ) ) 154 break; 155 } 156 } 157 dwTimeout = 0; 158 } 159 else 160 { 161 TRACE( "signal an event\n" ); 162 SetEvent( pEntry->hEvent ); 163 pEntry->hEvent = (HANDLE)NULL; 164 } 165 } 166 else 167 { 168 rtCount = rtSignal - rtCur; 169 /* [100ns] -> [ms] */ 170 rtCount = (rtCount+(REFERENCE_TIME)9999)/(REFERENCE_TIME)10000; 171 dwTimeoutCur = (rtCount >= 0xfffffffe) ? (DWORD)0xfffffffe : (DWORD)rtCount; 172 if ( dwTimeout > dwTimeoutCur ) 173 dwTimeout = dwTimeoutCur; 174 } 175 } 176 pEntry ++; 177 } 178 179 return dwTimeout; 180 } 181 182 static 183 DWORD WINAPI IReferenceClock_TimerEntry( LPVOID lpvParam ) 184 { 185 CSystemClock* This = (CSystemClock*)lpvParam; 186 MSG msg; 187 DWORD dwRes; 188 DWORD dwTimeout; 189 190 /* initialize the message queue. */ 191 PeekMessageA( &msg, (HWND)NULL, 0, 0, PM_NOREMOVE ); 192 /* resume the owner thread. */ 193 SetEvent( This->m_hEventInit ); 194 195 TRACE( "Enter message loop.\n" ); 196 197 /* message loop. */ 198 dwTimeout = INFINITE; 199 while ( 1 ) 200 { 201 if ( dwTimeout > 0 ) 202 { 203 dwRes = MsgWaitForMultipleObjects( 204 0, NULL, FALSE, 205 dwTimeout, 206 QS_ALLEVENTS ); 207 } 208 209 EnterCriticalSection( &This->m_csClock ); 210 dwTimeout = IReferenceClock_OnTimerUpdated(This); 211 LeaveCriticalSection( &This->m_csClock ); 212 TRACE( "catch an event / timeout %lu\n", dwTimeout ); 213 214 while ( PeekMessageA( &msg, (HWND)NULL, 0, 0, PM_REMOVE ) ) 215 { 216 if ( msg.message == WM_QUIT ) 217 goto quitthread; 218 219 if ( msg.hwnd != (HWND)NULL ) 220 { 221 TranslateMessage( &msg ); 222 DispatchMessageA( &msg ); 223 } 224 else 225 { 226 switch ( msg.message ) 227 { 228 case QUARTZ_MSG_ADDTIMER: 229 case QUARTZ_MSG_REMOVETIMER: 230 dwTimeout = 0; 231 break; 232 case QUARTZ_MSG_EXITTHREAD: 233 PostQuitMessage(0); 234 break; 235 default: 236 FIXME( "invalid message %04u\n", (unsigned)msg.message ); 237 break; 238 } 239 } 240 } 241 } 242 243 quitthread: 244 TRACE( "quit thread\n" ); 245 return 0; 246 } 247 248 /****************************************************************************/ 249 250 static HRESULT WINAPI 251 IReferenceClock_fnQueryInterface(IReferenceClock* iface,REFIID riid,void** ppobj) 252 { 253 CSystemClock_THIS(iface,refclk); 254 255 TRACE("(%p)->()\n",This); 256 257 return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj); 258 } 259 260 static ULONG WINAPI 261 IReferenceClock_fnAddRef(IReferenceClock* iface) 262 { 263 CSystemClock_THIS(iface,refclk); 264 265 TRACE("(%p)->()\n",This); 266 267 return IUnknown_AddRef(This->unk.punkControl); 268 } 269 270 static ULONG WINAPI 271 IReferenceClock_fnRelease(IReferenceClock* iface) 272 { 273 CSystemClock_THIS(iface,refclk); 274 275 TRACE("(%p)->()\n",This); 276 277 return IUnknown_Release(This->unk.punkControl); 278 } 279 280 static HRESULT WINAPI 281 IReferenceClock_fnGetTime(IReferenceClock* iface,REFERENCE_TIME* prtTime) 282 { 283 CSystemClock_THIS(iface,refclk); 284 DWORD dwTimeCur; 285 286 TRACE( "(%p)->(%p)\n", This, prtTime ); 287 288 if ( prtTime == NULL ) 289 return E_POINTER; 290 291 EnterCriticalSection( &This->m_csClock ); 292 293 dwTimeCur = GetTickCount(); 294 This->m_rtLast += (REFERENCE_TIME)(DWORD)(dwTimeCur - This->m_dwTimeLast) * (REFERENCE_TIME)10000; 295 296 This->m_dwTimeLast = dwTimeCur; 297 298 *prtTime = This->m_rtLast; 299 300 LeaveCriticalSection( &This->m_csClock ); 301 302 return NOERROR; 303 } 304 305 static HRESULT WINAPI 306 IReferenceClock_fnAdviseTime(IReferenceClock* iface,REFERENCE_TIME rtBase,REFERENCE_TIME rtStream,HEVENT hEvent,DWORD_PTR* pdwAdvCookie) 307 { 308 CSystemClock_THIS(iface,refclk); 309 QUARTZ_TimerEntry* pEntry; 310 HRESULT hr; 311 REFERENCE_TIME rtCur; 312 313 TRACE( "(%p)->()\n", This ); 314 315 if ( pdwAdvCookie == NULL ) 316 return E_POINTER; 317 if ( hEvent == (HANDLE)NULL ) 318 return E_INVALIDARG; 319 320 EnterCriticalSection( &This->m_csClock ); 321 322 *pdwAdvCookie = (DWORD_PTR)(This->m_dwAdvCookieNext ++); 323 324 hr = IReferenceClock_GetTime(iface,&rtCur); 325 if ( hr != NOERROR ) 326 goto err; 327 if ( rtCur >= (rtBase+rtStream) ) 328 { 329 SetEvent(hEvent); 330 hr = NOERROR; 331 goto err; 332 } 333 334 pEntry = IReferenceClock_AllocTimerEntry(This); 335 if ( pEntry == NULL ) 336 { 337 hr = E_FAIL; 338 goto err; 339 } 340 341 pEntry->dwAdvCookie = *pdwAdvCookie; 342 pEntry->fPeriodic = FALSE; 343 pEntry->hEvent = hEvent; 344 pEntry->rtStart = rtBase; 345 pEntry->rtInterval = rtStream; 346 347 if ( !PostThreadMessageA( 348 This->m_idThreadTimer, 349 QUARTZ_MSG_ADDTIMER, 350 0, 0 ) ) 351 { 352 pEntry->hEvent = (HANDLE)NULL; 353 hr = E_FAIL; 354 goto err; 355 } 356 357 hr = NOERROR; 358 err: 359 LeaveCriticalSection( &This->m_csClock ); 360 361 return hr; 362 } 363 364 static HRESULT WINAPI 365 IReferenceClock_fnAdvisePeriodic(IReferenceClock* iface,REFERENCE_TIME rtStart,REFERENCE_TIME rtPeriod,HSEMAPHORE hSemaphore,DWORD_PTR* pdwAdvCookie) 366 { 367 CSystemClock_THIS(iface,refclk); 368 QUARTZ_TimerEntry* pEntry; 369 HRESULT hr; 370 371 TRACE( "(%p)->()\n", This ); 372 373 if ( pdwAdvCookie == NULL ) 374 return E_POINTER; 375 if ( hSemaphore == (HSEMAPHORE)NULL ) 376 return E_INVALIDARG; 377 378 EnterCriticalSection( &This->m_csClock ); 379 380 *pdwAdvCookie = (DWORD_PTR)(This->m_dwAdvCookieNext ++); 381 382 pEntry = IReferenceClock_AllocTimerEntry(This); 383 if ( pEntry == NULL ) 384 { 385 hr = E_FAIL; 386 goto err; 387 } 388 389 pEntry->dwAdvCookie = *pdwAdvCookie; 390 pEntry->fPeriodic = TRUE; 391 pEntry->hEvent = (HANDLE)hSemaphore; 392 pEntry->rtStart = rtStart; 393 pEntry->rtInterval = rtPeriod; 394 395 if ( !PostThreadMessageA( 396 This->m_idThreadTimer, 397 QUARTZ_MSG_ADDTIMER, 398 0, 0 ) ) 399 { 400 pEntry->hEvent = (HANDLE)NULL; 401 hr = E_FAIL; 402 goto err; 403 } 404 405 hr = NOERROR; 406 err: 407 LeaveCriticalSection( &This->m_csClock ); 408 409 return hr; 410 } 411 412 static HRESULT WINAPI 413 IReferenceClock_fnUnadvise(IReferenceClock* iface,DWORD_PTR dwAdvCookie) 414 { 415 CSystemClock_THIS(iface,refclk); 416 QUARTZ_TimerEntry* pEntry; 417 418 TRACE( "(%p)->(%lu)\n", This, (DWORD)dwAdvCookie ); 419 420 EnterCriticalSection( &This->m_csClock ); 421 422 pEntry = IReferenceClock_SearchTimer(This,(DWORD)dwAdvCookie); 423 if ( pEntry != NULL ) 424 { 425 pEntry->hEvent = (HANDLE)NULL; 426 } 427 428 LeaveCriticalSection( &This->m_csClock ); 429 430 return NOERROR; 431 } 432 433 static ICOM_VTABLE(IReferenceClock) irefclk = 434 { 435 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 436 /* IUnknown fields */ 437 IReferenceClock_fnQueryInterface, 438 IReferenceClock_fnAddRef, 439 IReferenceClock_fnRelease, 440 /* IReferenceClock fields */ 441 IReferenceClock_fnGetTime, 442 IReferenceClock_fnAdviseTime, 443 IReferenceClock_fnAdvisePeriodic, 444 IReferenceClock_fnUnadvise, 445 }; 446 447 448 HRESULT CSystemClock_InitIReferenceClock( CSystemClock* psc ) 449 { 450 HANDLE hEvents[2]; 451 452 TRACE("(%p)\n",psc); 453 ICOM_VTBL(&psc->refclk) = &irefclk; 454 455 InitializeCriticalSection( &psc->m_csClock ); 456 psc->m_dwTimeLast = GetTickCount(); 457 psc->m_rtLast = (REFERENCE_TIME)0; 458 psc->m_hThreadTimer = (HANDLE)NULL; 459 psc->m_hEventInit = (HANDLE)NULL; 460 psc->m_idThreadTimer = 0; 461 psc->m_dwAdvCookieNext = 1; 462 ZeroMemory( psc->m_timerEntries, sizeof(psc->m_timerEntries) ); 463 464 psc->m_hEventInit = CreateEventA( NULL, TRUE, FALSE, NULL ); 465 if ( psc->m_hEventInit == (HANDLE)NULL ) 466 goto err; 467 468 psc->m_hThreadTimer = CreateThread( 469 NULL, 0, 470 IReferenceClock_TimerEntry, 471 psc, 0, &psc->m_idThreadTimer ); 472 473 if ( psc->m_hThreadTimer == (HANDLE)NULL ) 474 { 475 CloseHandle( psc->m_hEventInit ); 476 psc->m_hEventInit = (HANDLE)NULL; 477 goto err; 478 } 479 480 hEvents[0] = psc->m_hEventInit; 481 hEvents[1] = psc->m_hThreadTimer; 482 if ( WaitForMultipleObjects( 2, hEvents, FALSE, INFINITE ) 483 != WAIT_OBJECT_0 ) 484 { 485 CloseHandle( psc->m_hEventInit ); 486 psc->m_hEventInit = (HANDLE)NULL; 487 CloseHandle( psc->m_hThreadTimer ); 488 psc->m_hThreadTimer = (HANDLE)NULL; 489 goto err; 490 } 491 492 return NOERROR; 493 494 err: 495 DeleteCriticalSection( &psc->m_csClock ); 496 return E_FAIL; 497 } 498 499 void CSystemClock_UninitIReferenceClock( CSystemClock* psc ) 500 { 501 TRACE("(%p)\n",psc); 502 503 if ( psc->m_hThreadTimer != (HANDLE)NULL ) 504 { 505 if ( PostThreadMessageA( 506 psc->m_idThreadTimer, 507 QUARTZ_MSG_EXITTHREAD, 508 0, 0 ) ) 509 { 510 WaitForSingleObject( psc->m_hThreadTimer, INFINITE ); 511 } 512 CloseHandle( psc->m_hThreadTimer ); 513 psc->m_hThreadTimer = (HANDLE)NULL; 514 } 515 516 DeleteCriticalSection( &psc->m_csClock ); 517 }
Note:
See TracChangeset
for help on using the changeset viewer.
