Commit e575ad29 authored by Hidenori Takeshima's avatar Hidenori Takeshima Committed by Alexandre Julliard

Implemented IMemAllocator.

parent 4ee65164
......@@ -41,6 +41,7 @@ C_SRCS = \
memalloc.c \
monprop.c \
regsvr.c \
sample.c \
seekpass.c \
sysclock.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"
......
......@@ -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"
......
......@@ -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"
......
......@@ -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"
......
......@@ -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"
......
......@@ -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"
......
......@@ -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"
......
......@@ -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"
......
......@@ -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"
......
......@@ -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"
......
......@@ -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"
......
......@@ -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"
......
......@@ -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"
......
......@@ -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"
......
......@@ -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"
......
/*
* 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;
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);
FIXME( "(%p)->() stub!\n", This );
return E_NOTIMPL;
LeaveCriticalSection( &This->csMem );
return hr;
}
static HRESULT WINAPI
IMemAllocator_fnDecommit(IMemAllocator* iface)
{
CMemoryAllocator_THIS(iface,memalloc);
HRESULT hr;
LONG i;
BOOL bBlock;
TRACE( "(%p)->()\n", This );
FIXME( "(%p)->() stub!\n", This );
return E_NOTIMPL;
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;
TRACE( "(%p)->(%p,%p,%p,%lu)\n", This, ppSample, prtStart, prtEnd, dwFlags );
if ( ppSample == NULL )
return E_POINTER;
EnterCriticalSection( &This->csMem );
FIXME( "(%p)->() stub!\n", This );
return E_NOTIMPL;
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 );
}
......@@ -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"
......
......@@ -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"
......
......@@ -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"
......
......@@ -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"
......
......@@ -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"
......
......@@ -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;
......
......@@ -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"
......
......@@ -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"
......
......@@ -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"
......
......@@ -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)))
......
/*
* 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 );
}
#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 */
......@@ -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"
......
......@@ -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"
......
......@@ -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 \
......
......@@ -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" */
......
#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 */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment