From e575ad292ecc16d48cca6e12330ff2cc4183a0c4 Mon Sep 17 00:00:00 2001 From: Hidenori Takeshima Date: Mon, 17 Sep 2001 20:04:28 +0000 Subject: [PATCH] Implemented IMemAllocator. --- dlls/quartz/Makefile.in | 1 + dlls/quartz/complist.c | 1 + dlls/quartz/devenum.c | 1 + dlls/quartz/enumunk.c | 1 + dlls/quartz/fgclsid.c | 1 + dlls/quartz/fgidisp.c | 1 + dlls/quartz/fgraph.c | 1 + dlls/quartz/fmap.c | 1 + dlls/quartz/fmap2.c | 1 + dlls/quartz/ibasaud.c | 1 + dlls/quartz/ibasvid.c | 1 + dlls/quartz/ifgraph.c | 1 + dlls/quartz/ifmap.c | 1 + dlls/quartz/ifmap3.c | 1 + dlls/quartz/igrver.c | 1 + dlls/quartz/imcntl.c | 1 + dlls/quartz/imem.c | 193 +++++++++++++++- dlls/quartz/imesink.c | 1 + dlls/quartz/imevent.c | 1 + dlls/quartz/imfilter.c | 1 + dlls/quartz/impos.c | 1 + dlls/quartz/imseek.c | 1 + dlls/quartz/irclock.c | 2 +- dlls/quartz/ividwin.c | 1 + dlls/quartz/main.c | 1 + dlls/quartz/memalloc.c | 1 + dlls/quartz/memalloc.h | 4 + dlls/quartz/sample.c | 414 ++++++++++++++++++++++++++++++++++ dlls/quartz/sample.h | 34 +++ dlls/quartz/seekpass.c | 1 + dlls/quartz/sysclock.c | 1 + include/Makefile.in | 1 + include/dsound.h | 27 +-- include/strmif.h | 376 ++++++++++++++++++++++++++++++ include/wine/obj_ksproperty.h | 37 +++ 35 files changed, 1077 insertions(+), 37 deletions(-) create mode 100644 dlls/quartz/sample.c create mode 100644 dlls/quartz/sample.h create mode 100644 include/wine/obj_ksproperty.h diff --git a/dlls/quartz/Makefile.in b/dlls/quartz/Makefile.in index 3b0240ac394..24d611c9a2d 100644 --- a/dlls/quartz/Makefile.in +++ b/dlls/quartz/Makefile.in @@ -41,6 +41,7 @@ C_SRCS = \ memalloc.c \ monprop.c \ regsvr.c \ + sample.c \ seekpass.c \ sysclock.c diff --git a/dlls/quartz/complist.c b/dlls/quartz/complist.c index 5bf07f876e7..48fca2b9789 100644 --- a/dlls/quartz/complist.c +++ b/dlls/quartz/complist.c @@ -9,6 +9,7 @@ #include "windef.h" #include "winbase.h" #include "wingdi.h" +#include "winuser.h" #include "winerror.h" #include "wine/obj_base.h" #include "strmif.h" diff --git a/dlls/quartz/devenum.c b/dlls/quartz/devenum.c index 6d94bca142f..ccdb8b62859 100644 --- a/dlls/quartz/devenum.c +++ b/dlls/quartz/devenum.c @@ -11,6 +11,7 @@ #include "windef.h" #include "winbase.h" #include "wingdi.h" +#include "winuser.h" #include "winerror.h" #include "wine/obj_base.h" #include "wine/obj_oleaut.h" diff --git a/dlls/quartz/enumunk.c b/dlls/quartz/enumunk.c index eeb887734ca..e834f40f1f4 100644 --- a/dlls/quartz/enumunk.c +++ b/dlls/quartz/enumunk.c @@ -9,6 +9,7 @@ #include "windef.h" #include "winbase.h" #include "wingdi.h" +#include "winuser.h" #include "winerror.h" #include "wine/obj_base.h" #include "wine/obj_oleaut.h" diff --git a/dlls/quartz/fgclsid.c b/dlls/quartz/fgclsid.c index b66609c8158..8702b92f0c8 100644 --- a/dlls/quartz/fgclsid.c +++ b/dlls/quartz/fgclsid.c @@ -11,6 +11,7 @@ #include "windef.h" #include "winbase.h" #include "wingdi.h" +#include "winuser.h" #include "winerror.h" #include "wine/obj_base.h" #include "wine/obj_oleaut.h" diff --git a/dlls/quartz/fgidisp.c b/dlls/quartz/fgidisp.c index cebaa82a17f..d350aefd4df 100644 --- a/dlls/quartz/fgidisp.c +++ b/dlls/quartz/fgidisp.c @@ -11,6 +11,7 @@ #include "windef.h" #include "winbase.h" #include "wingdi.h" +#include "winuser.h" #include "winerror.h" #include "wine/obj_base.h" #include "wine/obj_oleaut.h" diff --git a/dlls/quartz/fgraph.c b/dlls/quartz/fgraph.c index fc6116a7c11..0b66264dde7 100644 --- a/dlls/quartz/fgraph.c +++ b/dlls/quartz/fgraph.c @@ -9,6 +9,7 @@ #include "windef.h" #include "winbase.h" #include "wingdi.h" +#include "winuser.h" #include "winerror.h" #include "wine/obj_base.h" #include "wine/obj_oleaut.h" diff --git a/dlls/quartz/fmap.c b/dlls/quartz/fmap.c index 2853b25e50a..268c6e61165 100644 --- a/dlls/quartz/fmap.c +++ b/dlls/quartz/fmap.c @@ -11,6 +11,7 @@ #include "windef.h" #include "winbase.h" #include "wingdi.h" +#include "winuser.h" #include "winerror.h" #include "wine/obj_base.h" #include "wine/obj_oleaut.h" diff --git a/dlls/quartz/fmap2.c b/dlls/quartz/fmap2.c index 96c6a9b985c..30a7ffd42f4 100644 --- a/dlls/quartz/fmap2.c +++ b/dlls/quartz/fmap2.c @@ -12,6 +12,7 @@ #include "winbase.h" #include "wingdi.h" #include "winerror.h" +#include "winuser.h" #include "wine/obj_base.h" #include "wine/obj_oleaut.h" #include "strmif.h" diff --git a/dlls/quartz/ibasaud.c b/dlls/quartz/ibasaud.c index 643a75a5c59..89107c70b2d 100644 --- a/dlls/quartz/ibasaud.c +++ b/dlls/quartz/ibasaud.c @@ -11,6 +11,7 @@ #include "windef.h" #include "winbase.h" #include "wingdi.h" +#include "winuser.h" #include "winerror.h" #include "wine/obj_base.h" #include "wine/obj_oleaut.h" diff --git a/dlls/quartz/ibasvid.c b/dlls/quartz/ibasvid.c index 44843c34d38..dff5cd06c29 100644 --- a/dlls/quartz/ibasvid.c +++ b/dlls/quartz/ibasvid.c @@ -11,6 +11,7 @@ #include "windef.h" #include "winbase.h" #include "wingdi.h" +#include "winuser.h" #include "winerror.h" #include "wine/obj_base.h" #include "wine/obj_oleaut.h" diff --git a/dlls/quartz/ifgraph.c b/dlls/quartz/ifgraph.c index 43565d02064..8e0f04d5d8d 100644 --- a/dlls/quartz/ifgraph.c +++ b/dlls/quartz/ifgraph.c @@ -12,6 +12,7 @@ #include "windef.h" #include "winbase.h" #include "wingdi.h" +#include "winuser.h" #include "winerror.h" #include "wine/obj_base.h" #include "wine/obj_oleaut.h" diff --git a/dlls/quartz/ifmap.c b/dlls/quartz/ifmap.c index 8905cc12f3c..0e3424f14d2 100644 --- a/dlls/quartz/ifmap.c +++ b/dlls/quartz/ifmap.c @@ -11,6 +11,7 @@ #include "windef.h" #include "winbase.h" #include "wingdi.h" +#include "winuser.h" #include "winreg.h" #include "winerror.h" #include "wine/obj_base.h" diff --git a/dlls/quartz/ifmap3.c b/dlls/quartz/ifmap3.c index 44093da83a0..c5e896492c4 100644 --- a/dlls/quartz/ifmap3.c +++ b/dlls/quartz/ifmap3.c @@ -11,6 +11,7 @@ #include "windef.h" #include "winbase.h" #include "wingdi.h" +#include "winuser.h" #include "winreg.h" #include "winerror.h" #include "wine/obj_base.h" diff --git a/dlls/quartz/igrver.c b/dlls/quartz/igrver.c index a7e157961c8..3fee68c5794 100644 --- a/dlls/quartz/igrver.c +++ b/dlls/quartz/igrver.c @@ -11,6 +11,7 @@ #include "windef.h" #include "winbase.h" #include "wingdi.h" +#include "winuser.h" #include "winerror.h" #include "wine/obj_base.h" #include "wine/obj_oleaut.h" diff --git a/dlls/quartz/imcntl.c b/dlls/quartz/imcntl.c index 52b653ca31d..512600c0784 100644 --- a/dlls/quartz/imcntl.c +++ b/dlls/quartz/imcntl.c @@ -11,6 +11,7 @@ #include "windef.h" #include "winbase.h" #include "wingdi.h" +#include "winuser.h" #include "winerror.h" #include "wine/obj_base.h" #include "wine/obj_oleaut.h" diff --git a/dlls/quartz/imem.c b/dlls/quartz/imem.c index 4dc0d677d4d..dea44298530 100644 --- a/dlls/quartz/imem.c +++ b/dlls/quartz/imem.c @@ -1,7 +1,7 @@ /* * Implementation of CLSID_MemoryAllocator. * - * FIXME - stub. + * FIXME - not tested. * * hidenori@a2.ctktv.ne.jp */ @@ -11,6 +11,7 @@ #include "windef.h" #include "winbase.h" #include "wingdi.h" +#include "winuser.h" #include "winerror.h" #include "wine/obj_base.h" #include "strmif.h" @@ -58,6 +59,7 @@ IMemAllocator_fnSetProperties(IMemAllocator* iface,ALLOCATOR_PROPERTIES* pPropRe { CMemoryAllocator_THIS(iface,memalloc); long padding; + HRESULT hr; TRACE( "(%p)->(%p,%p)\n", This, pPropReq, pPropActual ); @@ -72,8 +74,17 @@ IMemAllocator_fnSetProperties(IMemAllocator* iface,ALLOCATOR_PROPERTIES* pPropRe if ( ( pPropReq->cbAlign & (pPropReq->cbAlign-1) ) != 0 ) return E_INVALIDARG; + hr = NOERROR; + EnterCriticalSection( &This->csMem ); + if ( This->pData != NULL || This->ppSamples != NULL ) + { + /* if commited, properties must not be changed. */ + hr = E_UNEXPECTED; + goto end; + } + This->prop.cBuffers = pPropReq->cBuffers; This->prop.cbBuffer = pPropReq->cbBuffer; This->prop.cbAlign = pPropReq->cbAlign; @@ -88,9 +99,10 @@ IMemAllocator_fnSetProperties(IMemAllocator* iface,ALLOCATOR_PROPERTIES* pPropRe memcpy( pPropActual, &This->prop, sizeof(ALLOCATOR_PROPERTIES) ); +end: LeaveCriticalSection( &This->csMem ); - return NOERROR; + return hr; } static HRESULT WINAPI @@ -116,27 +128,176 @@ static HRESULT WINAPI IMemAllocator_fnCommit(IMemAllocator* iface) { CMemoryAllocator_THIS(iface,memalloc); + HRESULT hr; + LONG lBufSize; + LONG i; + BYTE* pCur; - FIXME( "(%p)->() stub!\n", This ); - return E_NOTIMPL; + TRACE( "(%p)->()\n", This ); + + EnterCriticalSection( &This->csMem ); + + hr = NOERROR; + if ( This->pData != NULL || This->ppSamples != NULL || + This->prop.cBuffers <= 0 ) + goto end; + + lBufSize = This->prop.cBuffers * + (This->prop.cbBuffer + This->prop.cbPrefix) + + This->prop.cbAlign; + if ( lBufSize <= 0 ) + lBufSize = 1; + + This->pData = (BYTE*)QUARTZ_AllocMem( lBufSize ); + if ( This->pData == NULL ) + { + hr = E_OUTOFMEMORY; + goto end; + } + + This->ppSamples = (CMemMediaSample**)QUARTZ_AllocMem( + sizeof(CMemMediaSample*) * This->prop.cBuffers ); + if ( This->ppSamples == NULL ) + { + hr = E_OUTOFMEMORY; + goto end; + } + + for ( i = 0; i < This->prop.cBuffers; i++ ) + This->ppSamples[i] = NULL; + + pCur = This->pData + This->prop.cbAlign - ((This->pData-(BYTE*)NULL) & (This->prop.cbAlign-1)); + + for ( i = 0; i < This->prop.cBuffers; i++ ) + { + hr = QUARTZ_CreateMemMediaSample( + pCur, (This->prop.cbBuffer + This->prop.cbPrefix), + iface, &This->ppSamples[i] ); + if ( FAILED(hr) ) + goto end; + pCur += (This->prop.cbBuffer + This->prop.cbPrefix); + } + + hr = NOERROR; +end: + if ( FAILED(hr) ) + IMemAllocator_Decommit(iface); + + LeaveCriticalSection( &This->csMem ); + + return hr; } static HRESULT WINAPI IMemAllocator_fnDecommit(IMemAllocator* iface) { CMemoryAllocator_THIS(iface,memalloc); + HRESULT hr; + LONG i; + BOOL bBlock; - FIXME( "(%p)->() stub!\n", This ); - return E_NOTIMPL; + TRACE( "(%p)->()\n", This ); + + EnterCriticalSection( &This->csMem ); + + hr = NOERROR; + + if ( This->pData == NULL && This->ppSamples == NULL ) + goto end; + + while ( 1 ) + { + bBlock = FALSE; + i = 0; + + ResetEvent( This->hEventSample ); + + while ( 1 ) + { + if ( i >= This->prop.cBuffers ) + break; + + if ( This->ppSamples[i] != NULL ) + { + if ( This->ppSamples[i]->ref == 0 ) + { + QUARTZ_DestroyMemMediaSample( This->ppSamples[i] ); + This->ppSamples[i] = NULL; + } + else + { + bBlock = TRUE; + } + } + i++; + } + + if ( !bBlock ) + { + hr = NOERROR; + break; + } + + WaitForSingleObject( This->hEventSample, INFINITE ); + } + +end: + LeaveCriticalSection( &This->csMem ); + + return hr; } static HRESULT WINAPI IMemAllocator_fnGetBuffer(IMemAllocator* iface,IMediaSample** ppSample,REFERENCE_TIME* prtStart,REFERENCE_TIME* prtEnd,DWORD dwFlags) { CMemoryAllocator_THIS(iface,memalloc); + LONG i; + HRESULT hr; - FIXME( "(%p)->() stub!\n", This ); - return E_NOTIMPL; + TRACE( "(%p)->(%p,%p,%p,%lu)\n", This, ppSample, prtStart, prtEnd, dwFlags ); + + if ( ppSample == NULL ) + return E_POINTER; + + EnterCriticalSection( &This->csMem ); + + hr = NOERROR; + + if ( This->pData == NULL || This->ppSamples == NULL || + This->prop.cBuffers <= 0 ) + { + hr = E_FAIL; /* FIXME? */ + goto end; + } + + while ( 1 ) + { + ResetEvent( This->hEventSample ); + + for ( i = 0; i < This->prop.cBuffers; i++ ) + { + if ( This->ppSamples[i]->ref == 0 ) + { + *ppSample = (IMediaSample*)(This->ppSamples[i]); + IMediaSample_AddRef( *ppSample ); + hr = NOERROR; + goto end; + } + } + + if ( dwFlags & AM_GBF_NOWAIT ) + { + hr = E_FAIL; /* FIXME? */ + goto end; + } + + WaitForSingleObject( This->hEventSample, INFINITE ); + } + +end: + LeaveCriticalSection( &This->csMem ); + + return hr; } static HRESULT WINAPI @@ -144,8 +305,10 @@ IMemAllocator_fnReleaseBuffer(IMemAllocator* iface,IMediaSample* pSample) { CMemoryAllocator_THIS(iface,memalloc); - FIXME( "(%p)->() stub!\n", This ); - return E_NOTIMPL; + TRACE( "(%p)->(%p)\n", This, pSample ); + SetEvent( This->hEventSample ); + + return NOERROR; } @@ -174,6 +337,13 @@ HRESULT CMemoryAllocator_InitIMemAllocator( CMemoryAllocator* pma ) ICOM_VTBL(&pma->memalloc) = &imemalloc; ZeroMemory( &pma->prop, sizeof(pma->prop) ); + pma->hEventSample = (HANDLE)NULL; + pma->pData = NULL; + pma->ppSamples = NULL; + + pma->hEventSample = CreateEventA( NULL, TRUE, FALSE, NULL ); + if ( pma->hEventSample == (HANDLE)NULL ) + return E_OUTOFMEMORY; InitializeCriticalSection( &pma->csMem ); @@ -187,4 +357,7 @@ void CMemoryAllocator_UninitIMemAllocator( CMemoryAllocator* pma ) IMemAllocator_Decommit( (IMemAllocator*)(&pma->memalloc) ); DeleteCriticalSection( &pma->csMem ); + + if ( pma->hEventSample != (HANDLE)NULL ) + CloseHandle( pma->hEventSample ); } diff --git a/dlls/quartz/imesink.c b/dlls/quartz/imesink.c index 5e2e7bfce42..bf3f7b91ac6 100644 --- a/dlls/quartz/imesink.c +++ b/dlls/quartz/imesink.c @@ -11,6 +11,7 @@ #include "windef.h" #include "winbase.h" #include "wingdi.h" +#include "winuser.h" #include "winerror.h" #include "wine/obj_base.h" #include "wine/obj_oleaut.h" diff --git a/dlls/quartz/imevent.c b/dlls/quartz/imevent.c index eaf44382599..dd3709f3b95 100644 --- a/dlls/quartz/imevent.c +++ b/dlls/quartz/imevent.c @@ -11,6 +11,7 @@ #include "windef.h" #include "winbase.h" #include "wingdi.h" +#include "winuser.h" #include "winerror.h" #include "wine/obj_base.h" #include "wine/obj_oleaut.h" diff --git a/dlls/quartz/imfilter.c b/dlls/quartz/imfilter.c index 0e0a4e5c15f..a3c0aee7390 100644 --- a/dlls/quartz/imfilter.c +++ b/dlls/quartz/imfilter.c @@ -11,6 +11,7 @@ #include "windef.h" #include "winbase.h" #include "wingdi.h" +#include "winuser.h" #include "winerror.h" #include "wine/obj_base.h" #include "wine/obj_oleaut.h" diff --git a/dlls/quartz/impos.c b/dlls/quartz/impos.c index 2036d509ca0..38d69030c4e 100644 --- a/dlls/quartz/impos.c +++ b/dlls/quartz/impos.c @@ -11,6 +11,7 @@ #include "windef.h" #include "winbase.h" #include "wingdi.h" +#include "winuser.h" #include "winerror.h" #include "wine/obj_base.h" #include "wine/obj_oleaut.h" diff --git a/dlls/quartz/imseek.c b/dlls/quartz/imseek.c index cf67ff76f5a..4d4a98cde53 100644 --- a/dlls/quartz/imseek.c +++ b/dlls/quartz/imseek.c @@ -11,6 +11,7 @@ #include "windef.h" #include "winbase.h" #include "wingdi.h" +#include "winuser.h" #include "winerror.h" #include "wine/obj_base.h" #include "wine/obj_oleaut.h" diff --git a/dlls/quartz/irclock.c b/dlls/quartz/irclock.c index 9b8bbbf49d4..e03623dec46 100644 --- a/dlls/quartz/irclock.c +++ b/dlls/quartz/irclock.c @@ -213,7 +213,7 @@ IReferenceClock_fnGetTime(IReferenceClock* iface,REFERENCE_TIME* prtTime) EnterCriticalSection( &This->m_csClock ); dwTimeCur = GetTickCount(); - This->m_rtLast += (REFERENCE_TIME)(DWORD)(dwTimeCur - This->m_dwTimeLast); + This->m_rtLast += (REFERENCE_TIME)(DWORD)(dwTimeCur - This->m_dwTimeLast) * (REFERENCE_TIME)10000; This->m_dwTimeLast = dwTimeCur; diff --git a/dlls/quartz/ividwin.c b/dlls/quartz/ividwin.c index a81fa751926..3d2b3df5b67 100644 --- a/dlls/quartz/ividwin.c +++ b/dlls/quartz/ividwin.c @@ -11,6 +11,7 @@ #include "windef.h" #include "winbase.h" #include "wingdi.h" +#include "winuser.h" #include "winerror.h" #include "wine/obj_base.h" #include "wine/obj_oleaut.h" diff --git a/dlls/quartz/main.c b/dlls/quartz/main.c index e82a750ca77..005547a6041 100644 --- a/dlls/quartz/main.c +++ b/dlls/quartz/main.c @@ -4,6 +4,7 @@ #include "winerror.h" #include "winbase.h" #include "wingdi.h" +#include "winuser.h" #include "ole2.h" #include "wine/obj_oleaut.h" #include "strmif.h" diff --git a/dlls/quartz/memalloc.c b/dlls/quartz/memalloc.c index 7bde1491308..40f98c7ef3c 100644 --- a/dlls/quartz/memalloc.c +++ b/dlls/quartz/memalloc.c @@ -11,6 +11,7 @@ #include "windef.h" #include "winbase.h" #include "wingdi.h" +#include "winuser.h" #include "winerror.h" #include "wine/obj_base.h" #include "strmif.h" diff --git a/dlls/quartz/memalloc.h b/dlls/quartz/memalloc.h index 2477ec56a9c..eeeb4f43fe9 100644 --- a/dlls/quartz/memalloc.h +++ b/dlls/quartz/memalloc.h @@ -12,6 +12,7 @@ */ #include "iunk.h" +#include "sample.h" typedef struct MA_IMemAllocatorImpl { @@ -26,6 +27,9 @@ typedef struct CMemoryAllocator /* IMemAllocator fields. */ CRITICAL_SECTION csMem; ALLOCATOR_PROPERTIES prop; + HANDLE hEventSample; + BYTE* pData; + CMemMediaSample** ppSamples; } CMemoryAllocator; #define CMemoryAllocator_THIS(iface,member) CMemoryAllocator* This = ((CMemoryAllocator*)(((char*)iface)-offsetof(CMemoryAllocator,member))) diff --git a/dlls/quartz/sample.c b/dlls/quartz/sample.c new file mode 100644 index 00000000000..5e7aa1c6742 --- /dev/null +++ b/dlls/quartz/sample.c @@ -0,0 +1,414 @@ +/* + * Implements IMediaSample2 for CMemMediaSample. + * + * hidenori@a2.ctktv.ne.jp + */ + +#include "config.h" + +#include "windef.h" +#include "winbase.h" +#include "wingdi.h" +#include "winuser.h" +#include "winerror.h" +#include "wine/obj_base.h" +#include "strmif.h" +#include "vfwmsgs.h" + +#include "debugtools.h" +DEFAULT_DEBUG_CHANNEL(quartz); + +#include "quartz_private.h" +#include "sample.h" + + + +static HRESULT WINAPI +IMediaSample2_fnQueryInterface(IMediaSample2* iface,REFIID riid,void** ppobj) +{ + ICOM_THIS(CMemMediaSample,iface); + + TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(riid),ppobj); + + if ( ppobj == NULL ) + return E_POINTER; + + if ( IsEqualGUID( riid, &IID_IUnknown ) || + IsEqualGUID( riid, &IID_IMediaSample ) || + IsEqualGUID( riid, &IID_IMediaSample2 ) ) + { + *ppobj = iface; + IMediaSample2_AddRef(iface); + return NOERROR; + } + + return E_NOINTERFACE; +} + +static ULONG WINAPI +IMediaSample2_fnAddRef(IMediaSample2* iface) +{ + ICOM_THIS(CMemMediaSample,iface); + + TRACE("(%p)->()\n",This); + + return InterlockedExchangeAdd(&(This->ref),1) + 1; +} + +static ULONG WINAPI +IMediaSample2_fnRelease(IMediaSample2* iface) +{ + ICOM_THIS(CMemMediaSample,iface); + LONG ref; + + TRACE("(%p)->()\n",This); + + ref = InterlockedExchangeAdd(&(This->ref),-1) - 1; + if ( ref > 0 ) + return (ULONG)ref; + + IMemAllocator_ReleaseBuffer(This->pOwner,(IMediaSample*)iface); + + return 0; +} + + + +static HRESULT WINAPI +IMediaSample2_fnGetPointer(IMediaSample2* iface,BYTE** ppData) +{ + ICOM_THIS(CMemMediaSample,iface); + + TRACE("(%p)->()\n",This); + + if ( ppData == NULL ) + return E_POINTER; + + *ppData = This->prop.pbBuffer; + return NOERROR; +} + +static long WINAPI +IMediaSample2_fnGetSize(IMediaSample2* iface) +{ + ICOM_THIS(CMemMediaSample,iface); + + TRACE("(%p)->()\n",This); + + return This->prop.cbBuffer; +} + +static HRESULT WINAPI +IMediaSample2_fnGetTime(IMediaSample2* iface,REFERENCE_TIME* prtStart,REFERENCE_TIME* prtEnd) +{ + ICOM_THIS(CMemMediaSample,iface); + + TRACE("(%p)->(%p,%p)\n",This,prtStart,prtEnd); + + if ( prtStart == NULL || prtEnd == NULL ) + return E_POINTER; + + if ( ( This->prop.dwSampleFlags & AM_SAMPLE_TIMEVALID ) && + ( This->prop.dwSampleFlags & AM_SAMPLE_STOPVALID ) ) + { + *prtStart = This->prop.tStart; + *prtEnd = This->prop.tStop; + return NOERROR; + } + + return VFW_E_MEDIA_TIME_NOT_SET; +} + +static HRESULT WINAPI +IMediaSample2_fnSetTime(IMediaSample2* iface,REFERENCE_TIME* prtStart,REFERENCE_TIME* prtEnd) +{ + ICOM_THIS(CMemMediaSample,iface); + + TRACE("(%p)->(%p,%p) stub!\n",This,prtStart,prtEnd); + + This->prop.dwSampleFlags &= ~(AM_SAMPLE_TIMEVALID|AM_SAMPLE_STOPVALID); + if ( prtStart != NULL ) + { + This->prop.dwSampleFlags |= AM_SAMPLE_TIMEVALID; + This->prop.tStart = *prtStart; + } + if ( prtEnd != NULL ) + { + This->prop.dwSampleFlags |= AM_SAMPLE_STOPVALID; + This->prop.tStop = *prtEnd; + } + + return NOERROR; +} + +static HRESULT WINAPI +IMediaSample2_fnIsSyncPoint(IMediaSample2* iface) +{ + ICOM_THIS(CMemMediaSample,iface); + + TRACE("(%p)->()\n",This); + + return ( This->prop.dwSampleFlags & AM_SAMPLE_SPLICEPOINT ) ? + S_OK : S_FALSE; +} + +static HRESULT WINAPI +IMediaSample2_fnSetSyncPoint(IMediaSample2* iface,BOOL bSync) +{ + ICOM_THIS(CMemMediaSample,iface); + + TRACE("(%p)->(%d)\n",This,bSync); + + if ( bSync ) + This->prop.dwSampleFlags |= AM_SAMPLE_SPLICEPOINT; + else + This->prop.dwSampleFlags &= ~AM_SAMPLE_SPLICEPOINT; + + return NOERROR; +} + +static HRESULT WINAPI +IMediaSample2_fnIsPreroll(IMediaSample2* iface) +{ + ICOM_THIS(CMemMediaSample,iface); + + TRACE("(%p)->()\n",This); + + return ( This->prop.dwSampleFlags & AM_SAMPLE_PREROLL ) ? + S_OK : S_FALSE; +} + +static HRESULT WINAPI +IMediaSample2_fnSetPreroll(IMediaSample2* iface,BOOL bPreroll) +{ + ICOM_THIS(CMemMediaSample,iface); + + TRACE("(%p)->(%d)\n",This,bPreroll); + + if ( bPreroll ) + This->prop.dwSampleFlags |= AM_SAMPLE_PREROLL; + else + This->prop.dwSampleFlags &= ~AM_SAMPLE_PREROLL; + + return NOERROR; +} + +static long WINAPI +IMediaSample2_fnGetActualDataLength(IMediaSample2* iface) +{ + ICOM_THIS(CMemMediaSample,iface); + + TRACE("(%p)->()\n",This); + + return This->prop.lActual; +} + +static HRESULT WINAPI +IMediaSample2_fnSetActualDataLength(IMediaSample2* iface,long lLength) +{ + ICOM_THIS(CMemMediaSample,iface); + + TRACE("(%p)->(%ld)\n",This,lLength); + + if ( This->prop.cbBuffer > lLength ) + return E_INVALIDARG; + + This->prop.lActual = lLength; + return NOERROR; +} + +static HRESULT WINAPI +IMediaSample2_fnGetMediaType(IMediaSample2* iface,AM_MEDIA_TYPE** ppmt) +{ + ICOM_THIS(CMemMediaSample,iface); + + TRACE("(%p)->(%p)\n",This,ppmt); + + if ( ppmt == NULL ) + return E_POINTER; + if ( !(This->prop.dwSampleFlags & AM_SAMPLE_TYPECHANGED) ) + return S_FALSE; + + /* FIXME - not implemented! */ + + FIXME("(%p)->(%p) not implemented!\n",This,ppmt); + + /* return CoTaskMemAlloc-ed memory. */ + + return E_NOTIMPL; +} + +static HRESULT WINAPI +IMediaSample2_fnSetMediaType(IMediaSample2* iface,AM_MEDIA_TYPE* pmt) +{ + ICOM_THIS(CMemMediaSample,iface); + + FIXME("(%p)->() stub!\n",This); + + /* FIXME - not implemented! */ + + return E_NOTIMPL; +} + +static HRESULT WINAPI +IMediaSample2_fnIsDiscontinuity(IMediaSample2* iface) +{ + ICOM_THIS(CMemMediaSample,iface); + + TRACE("(%p)->()\n",This); + + return ( This->prop.dwSampleFlags & AM_SAMPLE_DATADISCONTINUITY ) ? + S_OK : S_FALSE; +} + +static HRESULT WINAPI +IMediaSample2_fnSetDiscontinuity(IMediaSample2* iface,BOOL bDiscontinuity) +{ + ICOM_THIS(CMemMediaSample,iface); + + TRACE("(%p)->(%d)\n",This,bDiscontinuity); + + if ( bDiscontinuity ) + This->prop.dwSampleFlags |= AM_SAMPLE_DATADISCONTINUITY; + else + This->prop.dwSampleFlags &= ~AM_SAMPLE_DATADISCONTINUITY; + + return NOERROR; +} + +static HRESULT WINAPI +IMediaSample2_fnGetMediaTime(IMediaSample2* iface,LONGLONG* pTimeStart,LONGLONG* pTimeEnd) +{ + ICOM_THIS(CMemMediaSample,iface); + + FIXME("(%p)->() stub!\n",This); + + if ( pTimeStart == NULL || pTimeEnd == NULL ) + return E_POINTER; + + if ( !This->fMediaTimeIsValid ) + return VFW_E_MEDIA_TIME_NOT_SET; + + *pTimeStart = This->llMediaTimeStart; + *pTimeEnd = This->llMediaTimeEnd; + + return NOERROR; + + return E_NOTIMPL; +} + +static HRESULT WINAPI +IMediaSample2_fnSetMediaTime(IMediaSample2* iface,LONGLONG* pTimeStart,LONGLONG* pTimeEnd) +{ + ICOM_THIS(CMemMediaSample,iface); + + TRACE("(%p)->()\n",This); + if ( pTimeStart == NULL || pTimeEnd == NULL ) + { + This->fMediaTimeIsValid = FALSE; + } + else + { + This->fMediaTimeIsValid = TRUE; + This->llMediaTimeStart = *pTimeStart; + This->llMediaTimeEnd = *pTimeEnd; + } + + return NOERROR; +} + + +static HRESULT WINAPI +IMediaSample2_fnGetProperties(IMediaSample2* iface,DWORD cbProp,BYTE* pbProp) +{ + ICOM_THIS(CMemMediaSample,iface); + + TRACE("(%p)->(%lu,%p)\n",This,cbProp,pbProp); + + if ( cbProp < 0 || cbProp > sizeof(AM_SAMPLE2_PROPERTIES) ) + return E_FAIL; + memcpy( pbProp, &This->prop, cbProp ); + + return NOERROR; +} + +static HRESULT WINAPI +IMediaSample2_fnSetProperties(IMediaSample2* iface,DWORD cbProp,const BYTE* pbProp) +{ + ICOM_THIS(CMemMediaSample,iface); + + FIXME("(%p)->() stub!\n",This); + + return E_NOTIMPL; +} + + + +static ICOM_VTABLE(IMediaSample2) imediasample2 = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + /* IUnknown fields */ + IMediaSample2_fnQueryInterface, + IMediaSample2_fnAddRef, + IMediaSample2_fnRelease, + /* IMediaSample fields */ + IMediaSample2_fnGetPointer, + IMediaSample2_fnGetSize, + IMediaSample2_fnGetTime, + IMediaSample2_fnSetTime, + IMediaSample2_fnIsSyncPoint, + IMediaSample2_fnSetSyncPoint, + IMediaSample2_fnIsPreroll, + IMediaSample2_fnSetPreroll, + IMediaSample2_fnGetActualDataLength, + IMediaSample2_fnSetActualDataLength, + IMediaSample2_fnGetMediaType, + IMediaSample2_fnSetMediaType, + IMediaSample2_fnIsDiscontinuity, + IMediaSample2_fnSetDiscontinuity, + IMediaSample2_fnGetMediaTime, + IMediaSample2_fnSetMediaTime, + /* IMediaSample2 fields */ + IMediaSample2_fnGetProperties, + IMediaSample2_fnSetProperties, +}; + + + +HRESULT QUARTZ_CreateMemMediaSample( + BYTE* pbData, DWORD dwDataLength, + IMemAllocator* pOwner, + CMemMediaSample** ppSample ) +{ + CMemMediaSample* pms; + + TRACE("(%p,%08lx,%p,%p)\n",pbData,dwDataLength,pOwner,ppSample); + pms = (CMemMediaSample*)QUARTZ_AllocObj( sizeof(CMemMediaSample) ); + if ( pms == NULL ) + return E_OUTOFMEMORY; + + ICOM_VTBL(pms) = &imediasample2; + pms->ref = 1; + pms->pOwner = pOwner; + pms->fMediaTimeIsValid = FALSE; + pms->llMediaTimeStart = 0; + pms->llMediaTimeEnd = 0; + ZeroMemory( &(pms->prop), sizeof(pms->prop) ); + pms->prop.cbData = sizeof(pms->prop); + pms->prop.dwTypeSpecificFlags = 0; + pms->prop.dwSampleFlags = 0; + pms->prop.pbBuffer = pbData; + pms->prop.cbBuffer = (LONG)dwDataLength; + pms->prop.lActual = (LONG)dwDataLength; + + *ppSample = pms; + + return S_OK; +} + +void QUARTZ_DestroyMemMediaSample( + CMemMediaSample* pSample ) +{ + QUARTZ_FreeObj( pSample ); +} + diff --git a/dlls/quartz/sample.h b/dlls/quartz/sample.h new file mode 100644 index 00000000000..834e866710f --- /dev/null +++ b/dlls/quartz/sample.h @@ -0,0 +1,34 @@ +#ifndef WINE_DSHOW_SAMPLE_H +#define WINE_DSHOW_SAMPLE_H + +/* + implements CMemMediaSample. + + - At least, the following interfaces should be implemented: + + IUnknown - IMediaSample - IMediaSample2 + */ + +typedef struct CMemMediaSample +{ + ICOM_VFIELD(IMediaSample2); + + /* IUnknown fields */ + ULONG ref; + /* IMediaSample2 fields */ + IMemAllocator* pOwner; /* not addref-ed. */ + BOOL fMediaTimeIsValid; + LONGLONG llMediaTimeStart; + LONGLONG llMediaTimeEnd; + AM_SAMPLE2_PROPERTIES prop; +} CMemMediaSample; + + +HRESULT QUARTZ_CreateMemMediaSample( + BYTE* pbData, DWORD dwDataLength, + IMemAllocator* pOwner, + CMemMediaSample** ppSample ); +void QUARTZ_DestroyMemMediaSample( + CMemMediaSample* pSample ); + +#endif /* WINE_DSHOW_SAMPLE_H */ diff --git a/dlls/quartz/seekpass.c b/dlls/quartz/seekpass.c index 0620f314a51..817d7316d77 100644 --- a/dlls/quartz/seekpass.c +++ b/dlls/quartz/seekpass.c @@ -9,6 +9,7 @@ #include "windef.h" #include "winbase.h" #include "wingdi.h" +#include "winuser.h" #include "winerror.h" #include "wine/obj_base.h" #include "strmif.h" diff --git a/dlls/quartz/sysclock.c b/dlls/quartz/sysclock.c index dd1e2c64393..def4edda34e 100644 --- a/dlls/quartz/sysclock.c +++ b/dlls/quartz/sysclock.c @@ -11,6 +11,7 @@ #include "windef.h" #include "winbase.h" #include "wingdi.h" +#include "winuser.h" #include "winerror.h" #include "wine/obj_base.h" #include "strmif.h" diff --git a/include/Makefile.in b/include/Makefile.in index dd990987ab8..ee235447b6e 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -144,6 +144,7 @@ INSTALLED_INCLUDES = \ wine/obj_errorinfo.h \ wine/obj_extracticon.h \ wine/obj_inplace.h \ + wine/obj_ksproperty.h \ wine/obj_marshal.h \ wine/obj_misc.h \ wine/obj_moniker.h \ diff --git a/include/dsound.h b/include/dsound.h index d3da415a5a9..6c3d42af7a0 100644 --- a/include/dsound.h +++ b/include/dsound.h @@ -4,6 +4,7 @@ #include "winbase.h" /* for CRITICAL_SECTION */ #include "mmsystem.h" #include "d3dtypes.h" +#include "wine/obj_ksproperty.h" #ifdef __cplusplus extern "C" { @@ -35,9 +36,6 @@ typedef struct IDirectSoundCapture IDirectSoundCapture,*LPDIRECTSOUNDCAPTURE; DEFINE_GUID(IID_IDirectSoundCaptureBuffer,0xB0210782,0x89CD,0x11D0,0xAF,0x08,0x00,0xA0,0xC9,0x25,0xCD,0x16); typedef struct IDirectSoundCaptureBuffer IDirectSoundCaptureBuffer,*LPDIRECTSOUNDCAPTUREBUFFER; -DEFINE_GUID(IID_IKsPropertySet, 0x31EFAC30,0x515C,0x11D0,0xA9,0xAA,0x00,0xAA,0x00,0x61,0xBE,0x93); -typedef struct IKsPropertySet IKsPropertySet,*LPKSPROPERTYSET; - #define _FACDS 0x878 #define MAKE_DSHRESULT(code) MAKE_HRESULT(1,_FACDS,code) @@ -554,29 +552,6 @@ ICOM_DEFINE(IDirectSound3DBuffer,IUnknown) #define IDirectSound3DBuffer_SetVelocity(p,a,b,c,d) ICOM_CALL4(SetVelocity,p,a,b,c,d) -/***************************************************************************** - * IKsPropertySet interface - */ -#define KSPROPERTY_SUPPORT_GET 1 -#define KSPROPERTY_SUPPORT_SET 2 - -#define ICOM_INTERFACE IKsPropertySet -#define IKsPropertySet_METHODS \ - ICOM_METHOD7(HRESULT,Get,REFGUID,rgid,ULONG,x1,LPVOID,p1,ULONG,x2,LPVOID,p2,ULONG,x3,ULONG*,px4);\ - ICOM_METHOD6(HRESULT,Set,REFGUID,rgid,ULONG,x1,LPVOID,p1,ULONG,x2,LPVOID,p2,ULONG,x3);\ - ICOM_METHOD3(HRESULT,QuerySupport,REFGUID,rgid,ULONG,x1,ULONG*,px2); -#define IKsPropertySet_IMETHODS \ - IUnknown_IMETHODS \ - IKsPropertySet_METHODS -ICOM_DEFINE(IKsPropertySet,IUnknown) -#undef ICOM_INTERFACE - -#define IKsPropertySet_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) -#define IKsPropertySet_AddRef(p) ICOM_CALL (AddRef,p) -#define IKsPropertySet_Release(p) ICOM_CALL (Release,p) -#define IKsPropertySet_Get(p,a,b,c,d,e,f,g) ICOM_CALL7(Get,p,a,b,c,d,e,f,g) -#define IKsPropertySet_Set(p,a,b,c,d,e,f) ICOM_CALL6(Set,p,a,b,c,d,e,f) -#define IKsPropertySet_QuerySupport(p,a,b,c) ICOM_CALL3(QuerySupport,p,a,b,c) #ifdef __cplusplus } /* extern "C" */ diff --git a/include/strmif.h b/include/strmif.h index 9ea3212a681..293b550b901 100644 --- a/include/strmif.h +++ b/include/strmif.h @@ -11,6 +11,9 @@ #define __WINE_STRMIF_H_ #include "ole2.h" +#include "wine/obj_oleaut.h" +#include "wine/obj_property.h" +#include "wine/obj_ksproperty.h" /* undef GetTimeFormat - FIXME? */ #undef GetTimeFormat @@ -282,6 +285,22 @@ typedef enum REG_PINFLAG_B_OUTPUT = 0x8, } REG_PINFLAG; +typedef enum +{ + AM_SAMPLE_SPLICEPOINT = 0x1, + AM_SAMPLE_PREROLL = 0x2, + AM_SAMPLE_DATADISCONTINUITY = 0x4, + AM_SAMPLE_TYPECHANGED = 0x8, + AM_SAMPLE_TIMEVALID = 0x10, + AM_SAMPLE_TIMEDISCONTINUITY = 0x40, + AM_SAMPLE_FLUSH_ON_PAUSE = 0x80, + AM_SAMPLE_STOPVALID = 0x100, + AM_SAMPLE_ENDOFSTREAM = 0x200, + + AM_STREAM_MEDIA = 0, + AM_STREAM_CONTROL = 1 +} AM_SAMPLE_PROPERTY_FLAGS; + /* structs. */ @@ -397,6 +416,21 @@ typedef struct } DUMMYUNIONNAME; } REGFILTER2; +typedef struct +{ + DWORD cbData; + DWORD dwTypeSpecificFlags; + DWORD dwSampleFlags; + LONG lActual; + REFERENCE_TIME tStart; + REFERENCE_TIME tStop; + DWORD dwStreamId; + AM_MEDIA_TYPE* pMediaType; + BYTE* pbBuffer; + LONG cbBuffer; +} AM_SAMPLE2_PROPERTIES; + + /* defines. */ @@ -404,9 +438,51 @@ typedef struct #define MAX_PIN_NAME 128 #define MAX_FILTER_NAME 128 +#define AM_GBF_PREVFRAMESKIPPED 1 +#define AM_GBF_NOTASYNCPOINT 2 +#define AM_GBF_NOWAIT 4 + /* interfaces. */ +/************************************************************************** + * + * IAsyncReader interface + * + */ + +#define ICOM_INTERFACE IAsyncReader +#define IAsyncReader_METHODS \ + ICOM_METHOD3(HRESULT,RequestAllocator,IMemAllocator*,a1,ALLOCATOR_PROPERTIES*,a2,IMemAllocator**,a3) \ + ICOM_METHOD2(HRESULT,Request,IMediaSample*,a1,DWORD_PTR,a2) \ + ICOM_METHOD3(HRESULT,WaitForNext,DWORD,a1,IMediaSample**,a2,DWORD_PTR*,a3) \ + ICOM_METHOD1(HRESULT,SyncReadAligned,IMediaSample*,a1) \ + ICOM_METHOD3(HRESULT,SyncRead,LONGLONG,a1,LONG,a2,BYTE*,a3) \ + ICOM_METHOD2(HRESULT,Length,LONGLONG*,a1,LONGLONG*,a2) \ + ICOM_METHOD (HRESULT,BeginFlush) \ + ICOM_METHOD (HRESULT,EndFlush) + +#define IAsyncReader_IMETHODS \ + IUnknown_IMETHODS \ + IAsyncReader_METHODS + +ICOM_DEFINE(IAsyncReader,IUnknown) +#undef ICOM_INTERFACE + + /*** IUnknown methods ***/ +#define IAsyncReader_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2) +#define IAsyncReader_AddRef(p) ICOM_CALL (AddRef,p) +#define IAsyncReader_Release(p) ICOM_CALL (Release,p) + /*** IAsyncReader methods ***/ +#define IAsyncReader_RequestAllocator(p,a1,a2,a3) ICOM_CALL3(RequestAllocator,p,a1,a2,a3) +#define IAsyncReader_Request(p,a1,a2) ICOM_CALL2(Request,p,a1,a2) +#define IAsyncReader_WaitForNext(p,a1,a2,a3) ICOM_CALL3(WaitForNext,p,a1,a2,a3) +#define IAsyncReader_SyncReadAligned(p,a1) ICOM_CALL1(SyncReadAligned,p,a1) +#define IAsyncReader_SyncRead(p,a1,a2,a3) ICOM_CALL3(SyncRead,p,a1,a2,a3) +#define IAsyncReader_Length(p,a1,a2) ICOM_CALL2(Length,p,a1,a2) +#define IAsyncReader_BeginFlush(p) ICOM_CALL (BeginFlush,p) +#define IAsyncReader_EndFlush(p) ICOM_CALL (EndFlush,p) + /************************************************************************** * * IMediaFilter interface @@ -484,6 +560,84 @@ ICOM_DEFINE(IBaseFilter,IMediaFilter) #define IBaseFilter_JoinFilterGraph(p,a1,a2) ICOM_CALL2(JoinFilterGraph,p,a1,a2) #define IBaseFilter_QueryVendorInfo(p,a1) ICOM_CALL1(QueryVendorInfo,p,a1) +/************************************************************************** + * + * ICaptureGraphBuilder interface + * + */ + +#define ICOM_INTERFACE ICaptureGraphBuilder +#define ICaptureGraphBuilder_METHODS \ + ICOM_METHOD1(HRESULT,SetFiltergraph,IGraphBuilder*,a1) \ + ICOM_METHOD1(HRESULT,GetFiltergraph,IGraphBuilder**,a1) \ + ICOM_METHOD4(HRESULT,SetOutputFileName,const GUID*,a1,LPCOLESTR,a2,IBaseFilter**,a3,IFileSinkFilter**,a4) \ + ICOM_METHOD4(HRESULT,FindInterface,const GUID*,a1,IBaseFilter*,a2,REFIID,a3,void**,a4) \ + ICOM_METHOD4(HRESULT,RenderStream,const GUID*,a1,IUnknown*,a2,IBaseFilter*,a3,IBaseFilter*,a4) \ + ICOM_METHOD6(HRESULT,ControlStream,const GUID*,a1,IBaseFilter*,a2,REFERENCE_TIME*,a3,REFERENCE_TIME*,a4,WORD,a5,WORD,a6) \ + ICOM_METHOD2(HRESULT,AllocCapFile,LPCOLESTR,a1,DWORDLONG,a2) \ + ICOM_METHOD4(HRESULT,CopyCaptureFile,LPOLESTR,a1,LPOLESTR,a2,int,a3,IAMCopyCaptureFileProgress*,a4) + +#define ICaptureGraphBuilder_IMETHODS \ + IUnknown_IMETHODS \ + ICaptureGraphBuilder_METHODS + +ICOM_DEFINE(ICaptureGraphBuilder,IUnknown) +#undef ICOM_INTERFACE + + /*** IUnknown methods ***/ +#define ICaptureGraphBuilder_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2) +#define ICaptureGraphBuilder_AddRef(p) ICOM_CALL (AddRef,p) +#define ICaptureGraphBuilder_Release(p) ICOM_CALL (Release,p) + /*** ICaptureGraphBuilder methods ***/ +#define ICaptureGraphBuilder_SetFiltergraph(p,a1) ICOM_CALL1(SetFiltergraph,p,a1) +#define ICaptureGraphBuilder_GetFiltergraph(p,a1) ICOM_CALL1(GetFiltergraph,p,a1) +#define ICaptureGraphBuilder_SetOutputFileName(p,a1,a2,a3,a4) ICOM_CALL4(SetOutputFileName,p,a1,a2,a3,a4) +#define ICaptureGraphBuilder_FindInterface(p,a1,a2,a3,a4) ICOM_CALL4(FindInterface,p,a1,a2,a3,a4) +#define ICaptureGraphBuilder_RenderStream(p,a1,a2,a3,a4) ICOM_CALL4(RenderStream,p,a1,a2,a3,a4) +#define ICaptureGraphBuilder_ControlStream(p,a1,a2,a3,a4,a5,a6) ICOM_CALL6(ControlStream,p,a1,a2,a3,a4,a5,a6) +#define ICaptureGraphBuilder_AllocCapFile(p,a1,a2) ICOM_CALL2(AllocCapFile,p,a1,a2) +#define ICaptureGraphBuilder_CopyCaptureFile(p,a1,a2,a3,a4) ICOM_CALL4(CopyCaptureFile,p,a1,a2,a3,a4) + +/************************************************************************** + * + * ICaptureGraphBuilder2 interface + * + */ + +#define ICOM_INTERFACE ICaptureGraphBuilder2 +#define ICaptureGraphBuilder2_METHODS \ + ICOM_METHOD1(HRESULT,SetFiltergraph,IGraphBuilder*,a1) \ + ICOM_METHOD1(HRESULT,GetFiltergraph,IGraphBuilder**,a1) \ + ICOM_METHOD4(HRESULT,SetOutputFileName,const GUID*,a1,LPCOLESTR,a2,IBaseFilter**,a3,IFileSinkFilter**,a4) \ + ICOM_METHOD5(HRESULT,FindInterface,const GUID*,a1,const GUID*,a2,IBaseFilter*,a3,REFIID,a4,void**,a5) \ + ICOM_METHOD5(HRESULT,RenderStream,const GUID*,a1,const GUID*,a2,IUnknown*,a3,IBaseFilter*,a4,IBaseFilter*,a5) \ + ICOM_METHOD7(HRESULT,ControlStream,const GUID*,a1,const GUID*,a2,IBaseFilter*,a3,REFERENCE_TIME*,a4,REFERENCE_TIME*,a5,WORD,a6,WORD,a7) \ + ICOM_METHOD2(HRESULT,AllocCapFile,LPCOLESTR,a1,DWORDLONG,a2) \ + ICOM_METHOD4(HRESULT,CopyCaptureFile,LPOLESTR,a1,LPOLESTR,a2,int,a3,IAMCopyCaptureFileProgress*,a4) \ + ICOM_METHOD7(HRESULT,FindPin,IUnknown*,a1,PIN_DIRECTION,a2,const GUID*,a3,const GUID*,a4,BOOL,a5,int,a6,IPin**,a7) + +#define ICaptureGraphBuilder2_IMETHODS \ + IUnknown_IMETHODS \ + ICaptureGraphBuilder2_METHODS + +ICOM_DEFINE(ICaptureGraphBuilder2,IUnknown) +#undef ICOM_INTERFACE + + /*** IUnknown methods ***/ +#define ICaptureGraphBuilder2_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2) +#define ICaptureGraphBuilder2_AddRef(p) ICOM_CALL (AddRef,p) +#define ICaptureGraphBuilder2_Release(p) ICOM_CALL (Release,p) + /*** ICaptureGraphBuilder2 methods ***/ +#define ICaptureGraphBuilder2_SetFiltergraph(p,a1) ICOM_CALL1(SetFiltergraph,p,a1) +#define ICaptureGraphBuilder2_GetFiltergraph(p,a1) ICOM_CALL1(GetFiltergraph,p,a1) +#define ICaptureGraphBuilder2_SetOutputFileName(p,a1,a2,a3,a4) ICOM_CALL4(SetOutputFileName,p,a1,a2,a3,a4) +#define ICaptureGraphBuilder2_FindInterface(p,a1,a2,a3,a4,a5) ICOM_CALL5(FindInterface,p,a1,a2,a3,a4,a5) +#define ICaptureGraphBuilder2_RenderStream(p,a1,a2,a3,a4,a5) ICOM_CALL5(RenderStream,p,a1,a2,a3,a4,a5) +#define ICaptureGraphBuilder2_ControlStream(p,a1,a2,a3,a4,a5,a6,a7) ICOM_CALL7(ControlStream,p,a1,a2,a3,a4,a5,a6,a7) +#define ICaptureGraphBuilder2_AllocCapFile(p,a1,a2) ICOM_CALL2(AllocCapFile,p,a1,a2) +#define ICaptureGraphBuilder2_CopyCaptureFile(p,a1,a2,a3,a4) ICOM_CALL4(CopyCaptureFile,p,a1,a2,a3,a4) +#define ICaptureGraphBuilder2_FindPin(p,a1,a2,a3,a4,a5,a6,a7) ICOM_CALL7(FindPin,p,a1,a2,a3,a4,a5,a6,a7) + /************************************************************************** * * ICreateDevEnum interface @@ -508,6 +662,62 @@ ICOM_DEFINE(ICreateDevEnum,IUnknown) /*** ICreateDevEnum methods ***/ #define ICreateDevEnum_CreateClassEnumerator(p,a1,a2,a3) ICOM_CALL3(CreateClassEnumerator,p,a1,a2,a3) +/************************************************************************** + * + * IDistributorNotify interface + * + */ + +#define ICOM_INTERFACE IDistributorNotify +#define IDistributorNotify_METHODS \ + ICOM_METHOD (HRESULT,Stop) \ + ICOM_METHOD (HRESULT,Pause) \ + ICOM_METHOD1(HRESULT,Run,REFERENCE_TIME,a1) \ + ICOM_METHOD1(HRESULT,SetSyncSource,IReferenceClock*,a1) \ + ICOM_METHOD (HRESULT,NotifyGraphChange) + +#define IDistributorNotify_IMETHODS \ + IUnknown_IMETHODS \ + IDistributorNotify_METHODS + +ICOM_DEFINE(IDistributorNotify,IUnknown) +#undef ICOM_INTERFACE + + /*** IUnknown methods ***/ +#define IDistributorNotify_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2) +#define IDistributorNotify_AddRef(p) ICOM_CALL (AddRef,p) +#define IDistributorNotify_Release(p) ICOM_CALL (Release,p) + /*** IDistributorNotify methods ***/ +#define IDistributorNotify_Stop(p) ICOM_CALL (Stop,p) +#define IDistributorNotify_Pause(p) ICOM_CALL (Pause,p) +#define IDistributorNotify_Run(p,a1) ICOM_CALL1(Run,p,a1) +#define IDistributorNotify_SetSyncSource(p,a1) ICOM_CALL1(SetSyncSource,p,a1) +#define IDistributorNotify_NotifyGraphChange(p) ICOM_CALL (NotifyGraphChange,p) + +/************************************************************************** + * + * IDVSplitter interface + * + */ + +#define ICOM_INTERFACE IDVSplitter +#define IDVSplitter_METHODS \ + ICOM_METHOD1(HRESULT,DiscardAlternateVideoFrames,int,a1) + +#define IDVSplitter_IMETHODS \ + IUnknown_IMETHODS \ + IDVSplitter_METHODS + +ICOM_DEFINE(IDVSplitter,IUnknown) +#undef ICOM_INTERFACE + + /*** IUnknown methods ***/ +#define IDVSplitter_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2) +#define IDVSplitter_AddRef(p) ICOM_CALL (AddRef,p) +#define IDVSplitter_Release(p) ICOM_CALL (Release,p) + /*** IDVSplitter methods ***/ +#define IDVSplitter_DiscardAlternateVideoFrames(p,a1) ICOM_CALL1(DiscardAlternateVideoFrames,p,a1) + /************************************************************************** * * IEnumFilters interface @@ -679,6 +889,36 @@ ICOM_DEFINE(IFileSourceFilter,IUnknown) #define IFileSourceFilter_Load(p,a1,a2) ICOM_CALL2(Load,p,a1,a2) #define IFileSourceFilter_GetCurFile(p,a1,a2) ICOM_CALL2(GetCurFile,p,a1,a2) +/************************************************************************** + * + * IFilterChain interface + * + */ + +#define ICOM_INTERFACE IFilterChain +#define IFilterChain_METHODS \ + ICOM_METHOD2(HRESULT,StartChain,IBaseFilter*,a1,IBaseFilter*,a2) \ + ICOM_METHOD2(HRESULT,PauseChain,IBaseFilter*,a1,IBaseFilter*,a2) \ + ICOM_METHOD2(HRESULT,StopChain,IBaseFilter*,a1,IBaseFilter*,a2) \ + ICOM_METHOD2(HRESULT,RemoveChain,IBaseFilter*,a1,IBaseFilter*,a2) + +#define IFilterChain_IMETHODS \ + IUnknown_IMETHODS \ + IFilterChain_METHODS + +ICOM_DEFINE(IFilterChain,IUnknown) +#undef ICOM_INTERFACE + + /*** IUnknown methods ***/ +#define IFilterChain_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2) +#define IFilterChain_AddRef(p) ICOM_CALL (AddRef,p) +#define IFilterChain_Release(p) ICOM_CALL (Release,p) + /*** IFilterChain methods ***/ +#define IFilterChain_StartChain(p,a1,a2) ICOM_CALL2(StartChain,p,a1,a2) +#define IFilterChain_PauseChain(p,a1,a2) ICOM_CALL2(PauseChain,p,a1,a2) +#define IFilterChain_StopChain(p,a1,a2) ICOM_CALL2(StopChain,p,a1,a2) +#define IFilterChain_RemoveChain(p,a1,a2) ICOM_CALL2(RemoveChain,p,a1,a2) + /************************************************************************** * * IFilterMapper interface @@ -904,6 +1144,72 @@ ICOM_DEFINE(IFilterGraph2,IGraphBuilder) #define IFilterGraph2_ReconnectEx(p,a1,a2) ICOM_CALL2(ReconnectEx,p,a1,a2) #define IFilterGraph2_RenderEx(p,a1,a2,a3) ICOM_CALL3(RenderEx,p,a1,a2,a3) +/************************************************************************** + * + * IGraphConfig interface + * + */ + +#define ICOM_INTERFACE IGraphConfig +#define IGraphConfig_METHODS \ + ICOM_METHOD6(HRESULT,Reconnect,IPin*,a1,IPin*,a2,const AM_MEDIA_TYPE*,a3,IBaseFilter*,a4,HANDLE,a5,DWORD,a6) \ + ICOM_METHOD4(HRESULT,Reconfigure,IGraphConfigCallback*,a1,PVOID,a2,DWORD,a3,HANDLE,a4) \ + ICOM_METHOD1(HRESULT,AddFilterToCache,IBaseFilter*,a1) \ + ICOM_METHOD1(HRESULT,EnumCacheFilter,IEnumFilters**,a1) \ + ICOM_METHOD1(HRESULT,RemoveFilterFromCache,IBaseFilter*,a1) \ + ICOM_METHOD1(HRESULT,GetStartTime,REFERENCE_TIME*,a1) \ + ICOM_METHOD3(HRESULT,PushThroughData,IPin*,a1,IPinConnection*,a2,HANDLE,a3) \ + ICOM_METHOD2(HRESULT,SetFilterFlags,IBaseFilter*,a1,DWORD,a2) \ + ICOM_METHOD2(HRESULT,GetFilterFlags,IBaseFilter*,a1,DWORD*,a2) \ + ICOM_METHOD2(HRESULT,RemoveFilterEx,IBaseFilter*,a1,DWORD,a2) + +#define IGraphConfig_IMETHODS \ + IUnknown_IMETHODS \ + IGraphConfig_METHODS + +ICOM_DEFINE(IGraphConfig,IUnknown) +#undef ICOM_INTERFACE + + /*** IUnknown methods ***/ +#define IGraphConfig_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2) +#define IGraphConfig_AddRef(p) ICOM_CALL (AddRef,p) +#define IGraphConfig_Release(p) ICOM_CALL (Release,p) + /*** IGraphConfig methods ***/ +#define IGraphConfig_Reconnect(p,a1,a2,a3,a4,a5,a6) ICOM_CALL6(Reconnect,p,a1,a2,a3,a4,a5,a6) +#define IGraphConfig_Reconfigure(p,a1,a2,a3,a4) ICOM_CALL4(Reconfigure,p,a1,a2,a3,a4) +#define IGraphConfig_AddFilterToCache(p,a1) ICOM_CALL1(AddFilterToCache,p,a1) +#define IGraphConfig_EnumCacheFilter(p,a1) ICOM_CALL1(EnumCacheFilter,p,a1) +#define IGraphConfig_RemoveFilterFromCache(p,a1) ICOM_CALL1(RemoveFilterFromCache,p,a1) +#define IGraphConfig_GetStartTime(p,a1) ICOM_CALL1(GetStartTime,p,a1) +#define IGraphConfig_PushThroughData(p,a1,a2,a3) ICOM_CALL3(PushThroughData,p,a1,a2,a3) +#define IGraphConfig_SetFilterFlags(p,a1,a2) ICOM_CALL2(SetFilterFlags,p,a1,a2) +#define IGraphConfig_GetFilterFlags(p,a1,a2) ICOM_CALL2(GetFilterFlags,p,a1,a2) +#define IGraphConfig_RemoveFilterEx(p,a1,a2) ICOM_CALL2(RemoveFilterEx,p,a1,a2) + +/************************************************************************** + * + * IGraphConfigCallback interface + * + */ + +#define ICOM_INTERFACE IGraphConfigCallback +#define IGraphConfigCallback_METHODS \ + ICOM_METHOD2(HRESULT,Reconfigure,PVOID,a1,DWORD,a2) + +#define IGraphConfigCallback_IMETHODS \ + IUnknown_IMETHODS \ + IGraphConfigCallback_METHODS + +ICOM_DEFINE(IGraphConfigCallback,IUnknown) +#undef ICOM_INTERFACE + + /*** IUnknown methods ***/ +#define IGraphConfigCallback_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2) +#define IGraphConfigCallback_AddRef(p) ICOM_CALL (AddRef,p) +#define IGraphConfigCallback_Release(p) ICOM_CALL (Release,p) + /*** IGraphConfigCallback methods ***/ +#define IGraphConfigCallback_Reconfigure(p,a1,a2) ICOM_CALL2(Reconfigure,p,a1,a2) + /************************************************************************** * * IGraphVersion interface @@ -928,6 +1234,7 @@ ICOM_DEFINE(IGraphVersion,IUnknown) /*** IGraphVersion methods ***/ #define IGraphVersion_QueryVersion(p,a1) ICOM_CALL1(QueryVersion,p,a1) + /************************************************************************** * * IMediaEventSink interface @@ -952,6 +1259,33 @@ ICOM_DEFINE(IMediaEventSink,IUnknown) /*** IMediaEventSink methods ***/ #define IMediaEventSink_Notify(p,a1,a2,a3) ICOM_CALL3(Notify,p,a1,a2,a3) +/************************************************************************** + * + * IMediaPropertyBag interface + * + */ + +#define ICOM_INTERFACE IMediaPropertyBag +#define IMediaPropertyBag_METHODS \ + ICOM_METHOD3(HRESULT,EnumProperty,ULONG,a1,VARIANT*,a2,VARIANT*,a3) + +#define IMediaPropertyBag_IMETHODS \ + IPropertyBag_IMETHODS \ + IMediaPropertyBag_METHODS + +ICOM_DEFINE(IMediaPropertyBag,IPropertyBag) +#undef ICOM_INTERFACE + + /*** IUnknown methods ***/ +#define IMediaPropertyBag_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2) +#define IMediaPropertyBag_AddRef(p) ICOM_CALL (AddRef,p) +#define IMediaPropertyBag_Release(p) ICOM_CALL (Release,p) + /*** IPropertyBag methods ***/ +#define IMediaPropertyBag_Read(p,a1,a2,a3) ICOM_CALL3(Read,p,a1,a2,a3) +#define IMediaPropertyBag_Write(p,a1,a2) ICOM_CALL2(Write,p,a1,a2) + /*** IMediaPropertyBag methods ***/ +#define IMediaPropertyBag_EnumProperty(p,a1,a2,a3) ICOM_CALL3(EnumProperty,p,a1,a2,a3) + /************************************************************************** * * IMediaSample interface @@ -1230,6 +1564,48 @@ ICOM_DEFINE(IMemInputPin,IUnknown) #define IMemInputPin_ReceiveMultiple(p,a1,a2,a3) ICOM_CALL3(ReceiveMultiple,p,a1,a2,a3) #define IMemInputPin_ReceiveCanBlock(p) ICOM_CALL (ReceiveCanBlock,p) +/************************************************************************** + * + * IOverlay interface + * + */ + +#define ICOM_INTERFACE IOverlay +#define IOverlay_METHODS \ + ICOM_METHOD2(HRESULT,GetPalette,DWORD*,a1,PALETTEENTRY**,a2) \ + ICOM_METHOD2(HRESULT,SetPalette,DWORD,a1,PALETTEENTRY*,a2) \ + ICOM_METHOD1(HRESULT,GetDefaultColorKey,COLORKEY*,a1) \ + ICOM_METHOD1(HRESULT,GetColorKey,COLORKEY*,a1) \ + ICOM_METHOD1(HRESULT,SetColorKey,COLORKEY*,a1) \ + ICOM_METHOD1(HRESULT,GetWindowHandle,HWND*,a1) \ + ICOM_METHOD3(HRESULT,GetClipList,RECT*,a1,RECT*,a2,RGNDATA**,a3) \ + ICOM_METHOD2(HRESULT,GetVideoPosition,RECT*,a1,RECT*,a2) \ + ICOM_METHOD2(HRESULT,Advise,IOverlayNotify*,a1,DWORD,a2) \ + ICOM_METHOD (HRESULT,Unadvise) + +#define IOverlay_IMETHODS \ + IUnknown_IMETHODS \ + IOverlay_METHODS + +ICOM_DEFINE(IOverlay,IUnknown) +#undef ICOM_INTERFACE + + /*** IUnknown methods ***/ +#define IOverlay_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2) +#define IOverlay_AddRef(p) ICOM_CALL (AddRef,p) +#define IOverlay_Release(p) ICOM_CALL (Release,p) + /*** IOverlay methods ***/ +#define IOverlay_GetPalette(p,a1,a2) ICOM_CALL2(GetPalette,p,a1,a2) +#define IOverlay_SetPalette(p,a1,a2) ICOM_CALL2(SetPalette,p,a1,a2) +#define IOverlay_GetDefaultColorKey(p,a1) ICOM_CALL1(GetDefaultColorKey,p,a1) +#define IOverlay_GetColorKey(p,a1) ICOM_CALL1(GetColorKey,p,a1) +#define IOverlay_SetColorKey(p,a1) ICOM_CALL1(SetColorKey,p,a1) +#define IOverlay_GetWindowHandle(p,a1) ICOM_CALL1(GetWindowHandle,p,a1) +#define IOverlay_GetClipList(p,a1,a2,a3) ICOM_CALL3(GetClipList,p,a1,a2,a3) +#define IOverlay_GetVideoPosition(p,a1,a2) ICOM_CALL2(GetVideoPosition,p,a1,a2) +#define IOverlay_Advise(p,a1,a2) ICOM_CALL2(Advise,p,a1,a2) +#define IOverlay_Unadvise(p) ICOM_CALL1(Unadvise,p) + /************************************************************************** * * IPin interface diff --git a/include/wine/obj_ksproperty.h b/include/wine/obj_ksproperty.h new file mode 100644 index 00000000000..ecfbff969bc --- /dev/null +++ b/include/wine/obj_ksproperty.h @@ -0,0 +1,37 @@ +#ifndef WINE_WINE_OBJ_KSPROPERTY_H +#define WINE_WINE_OBJ_KSPROPERTY_H + +/* NOTE: IKsPropertySet is declared in both dsound.h and strmif.h */ + +DEFINE_GUID(IID_IKsPropertySet, 0x31EFAC30,0x515C,0x11D0,0xA9,0xAA,0x00,0xAA,0x00,0x61,0xBE,0x93); +typedef struct IKsPropertySet IKsPropertySet,*LPKSPROPERTYSET; + +/***************************************************************************** + * IKsPropertySet interface + */ +#define KSPROPERTY_SUPPORT_GET 1 +#define KSPROPERTY_SUPPORT_SET 2 + +#define ICOM_INTERFACE IKsPropertySet +#define IKsPropertySet_METHODS \ + ICOM_METHOD7(HRESULT,Get,REFGUID,rgid,ULONG,x1,LPVOID,p1,ULONG,x2,LPVOID,p2,ULONG,x3,ULONG*,px4);\ + ICOM_METHOD6(HRESULT,Set,REFGUID,rgid,ULONG,x1,LPVOID,p1,ULONG,x2,LPVOID,p2,ULONG,x3);\ + ICOM_METHOD3(HRESULT,QuerySupport,REFGUID,rgid,ULONG,x1,ULONG*,px2); +#define IKsPropertySet_IMETHODS \ + IUnknown_IMETHODS \ + IKsPropertySet_METHODS +ICOM_DEFINE(IKsPropertySet,IUnknown) +#undef ICOM_INTERFACE + +#define IKsPropertySet_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) +#define IKsPropertySet_AddRef(p) ICOM_CALL (AddRef,p) +#define IKsPropertySet_Release(p) ICOM_CALL (Release,p) +#define IKsPropertySet_Get(p,a,b,c,d,e,f,g) ICOM_CALL7(Get,p,a,b,c,d,e,f,g) +#define IKsPropertySet_Set(p,a,b,c,d,e,f) ICOM_CALL6(Set,p,a,b,c,d,e,f) +#define IKsPropertySet_QuerySupport(p,a,b,c) ICOM_CALL3(QuerySupport,p,a,b,c) +/* The real windows header declares 'QuerySupport' in dsound.h */ +/* but 'QuerySupported' in strmif.h ! */ +#define IKsPropertySet_QuerySupported(p,a,b,c) ICOM_CALL3(QuerySupport,p,a,b,c) + + +#endif /* WINE_WINE_OBJ_KSPROPERTY_H */