75#define AM_SAMPLE2_PROP_SIZE_WRITABLE FIELD_OFFSET(AM_SAMPLE2_PROPERTIES, pbBuffer)
77#define INVALID_MEDIA_TIME (((ULONGLONG)0x7fffffff << 32) | 0xffffffff)
88 assert(fnAlloc && fnFree && fnDestroyed);
97 pMemAlloc->
fnFree = fnFree;
119 *
ppv = &
This->IMemAllocator_iface;
121 *
ppv = &
This->IMemAllocator_iface;
139 TRACE(
"(%p)->() AddRef from %d\n", iface,
ref - 1);
149 TRACE(
"(%p)->() Release from %d\n", iface,
ref + 1);
154 if (
This->bCommitted)
157 This->fnDestroyed(iface);
174 else if (
This->bCommitted)
188 *pActual =
This->props;
205 memcpy(pProps, &
This->props,
sizeof(*pProps));
221 if (!
This->props.cbAlign)
223 else if (!
This->props.cbBuffer)
225 else if (!
This->props.cBuffers)
227 else if (
This->bDecommitQueued &&
This->bCommitted)
232 else if (
This->bCommitted)
243 hr =
This->fnAlloc(iface);
247 ERR(
"fnAlloc failed with error 0x%x\n",
hr);
265 if (!
This->bCommitted)
279 if (
This->lWaiting != 0)
280 ERR(
"Waiting: %d\n",
This->lWaiting);
288 ERR(
"fnFree failed with error 0x%x\n",
hr);
305 TRACE(
"(%p)->(%p, %p, %p, %x)\n",
This, pSample, pStartTime, pEndTime,
dwFlags);
310 if (!
This->bCommitted ||
This->bDecommitQueued)
312 WARN(
"Not committed\n");
333 if (!
This->bCommitted)
335 else if (
This->bDecommitQueued)
347 IMediaSample_AddRef(*pSample);
371 if (!
This->bCommitted)
372 ERR(
"Releasing a buffer when the allocator is not committed?!?\n");
383 if (
This->lWaiting != 0)
384 ERR(
"Waiting: %d\n",
This->lWaiting);
393 ERR(
"fnFree failed with error 0x%x\n", hrfree);
429 (*ppSample)->ref = 0;
430 ZeroMemory(&(*ppSample)->props,
sizeof((*ppSample)->props));
435 (*ppSample)->pParent =
pParent;
437 (*ppSample)->props.cbBuffer = (*ppSample)->props.lActual = cbBuffer;
438 (*ppSample)->props.pbBuffer = pbBuffer;
440 (*ppSample)->tMediaEnd = 0;
466 IMediaSample2_AddRef(iface);
505 TRACE(
"(%p)->(%p)\n", iface, ppBuffer);
507 *ppBuffer =
This->props.pbBuffer;
511 ERR(
"Requested an unlocked surface and trying to lock regardless\n");
522 TRACE(
"StdMediaSample2_GetSize()\n");
524 return This->props.cbBuffer;
532 TRACE(
"(%p)->(%p, %p)\n", iface, pStart, pEnd);
538 *pStart =
This->props.tStart;
539 *pEnd =
This->props.tStart + 1;
545 *pStart =
This->props.tStart;
546 *pEnd =
This->props.tStop;
558 TRACE(
"(%p)->(%p, %p)\n", iface, pStart, pEnd);
562 This->props.tStart = *pStart;
566 This->props.dwSampleFlags &= ~AM_SAMPLE_TIMEVALID;
570 This->props.tStop = *pEnd;
574 This->props.dwSampleFlags &= ~AM_SAMPLE_STOPVALID;
583 TRACE(
"(%p)->()\n", iface);
592 TRACE(
"(%p)->(%s)\n", iface, bIsSyncPoint ?
"TRUE" :
"FALSE");
597 This->props.dwSampleFlags &= ~AM_SAMPLE_SPLICEPOINT;
606 TRACE(
"(%p)->()\n", iface);
615 TRACE(
"(%p)->(%s)\n", iface, bIsPreroll ?
"TRUE" :
"FALSE");
620 This->props.dwSampleFlags &= ~AM_SAMPLE_PREROLL;
629 TRACE(
"(%p)->()\n", iface);
631 return This->props.lActual;
640 if ((
len >
This->props.cbBuffer) || (
len < 0))
642 WARN(
"Tried to set length to %d, while max is %d\n",
len,
This->props.cbBuffer);
656 TRACE(
"(%p)->(%p)\n", iface, ppMediaType);
658 if (!
This->props.pMediaType) {
675 TRACE(
"(%p)->(%p)\n", iface, pMediaType);
677 if (
This->props.pMediaType)
694 TRACE(
"(%p)->()\n", iface);
703 TRACE(
"(%p)->(%s)\n", iface, bIsDiscontinuity ?
"TRUE" :
"FALSE");
705 if (bIsDiscontinuity)
708 This->props.dwSampleFlags &= ~AM_SAMPLE_DATADISCONTINUITY;
717 TRACE(
"(%p)->(%p, %p)\n", iface, pStart, pEnd);
722 *pStart =
This->tMediaStart;
723 *pEnd =
This->tMediaEnd;
732 TRACE(
"(%p)->(%p, %p)\n", iface, pStart, pEnd);
735 This->tMediaStart = *pStart;
740 This->tMediaEnd = *pEnd;
751 TRACE(
"(%p)->(%d, %p)\n", iface, cbProperties, pbProperties);
762 TRACE(
"(%p)->(%d, %p)\n", iface, cbProperties, pbProperties);
842 for (
i =
This->base.props.cBuffers - 1;
i >= 0;
i--)
845 BYTE * pbBuffer = (
BYTE *)
This->pMemory +
i * (
This->base.props.cbBuffer +
This->base.props.cbPrefix) +
This->base.props.cbPrefix;
862 WARN(
"Freeing allocator with outstanding samples!\n");
892 This->csState.DebugInfo->Spare[0] = 0;
#define InterlockedIncrement
#define InterlockedDecrement
struct tagAM_SAMPLE2_PROPERTIES AM_SAMPLE2_PROPERTIES
@ AM_SAMPLE_DATADISCONTINUITY
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
static void list_remove(struct list_entry *entry)
static int list_empty(struct list_entry *head)
static void list_add_head(struct list_entry *head, struct list_entry *entry)
static void list_init(struct list_entry *head)
const char * qzdebugstr_guid(const GUID *id)
static HRESULT WINAPI StdMediaSample2_SetTime(IMediaSample2 *iface, REFERENCE_TIME *pStart, REFERENCE_TIME *pEnd)
static LONG WINAPI StdMediaSample2_GetActualDataLength(IMediaSample2 *iface)
static HRESULT WINAPI StdMediaSample2_SetPreroll(IMediaSample2 *iface, BOOL bIsPreroll)
static HRESULT WINAPI StdMediaSample2_SetDiscontinuity(IMediaSample2 *iface, BOOL bIsDiscontinuity)
static HRESULT WINAPI StdMediaSample2_SetMediaTime(IMediaSample2 *iface, LONGLONG *pStart, LONGLONG *pEnd)
static HRESULT WINAPI StdMediaSample2_SetMediaType(IMediaSample2 *iface, AM_MEDIA_TYPE *pMediaType)
static StdMemAllocator * StdMemAllocator_from_IMemAllocator(IMemAllocator *iface)
static StdMediaSample2 * unsafe_impl_from_IMediaSample(IMediaSample *iface)
static HRESULT StdMemAllocator_Alloc(IMemAllocator *iface)
static LONG WINAPI StdMediaSample2_GetSize(IMediaSample2 *iface)
static const IMemAllocatorVtbl BaseMemAllocator_VTable
static HRESULT WINAPI StdMediaSample2_GetMediaTime(IMediaSample2 *iface, LONGLONG *pStart, LONGLONG *pEnd)
#define AM_SAMPLE2_PROP_SIZE_WRITABLE
static HRESULT WINAPI StdMediaSample2_GetMediaType(IMediaSample2 *iface, AM_MEDIA_TYPE **ppMediaType)
static HRESULT WINAPI StdMediaSample2_GetTime(IMediaSample2 *iface, REFERENCE_TIME *pStart, REFERENCE_TIME *pEnd)
static HRESULT WINAPI StdMediaSample2_GetPointer(IMediaSample2 *iface, BYTE **ppBuffer)
static HRESULT WINAPI StdMediaSample2_GetProperties(IMediaSample2 *iface, DWORD cbProperties, BYTE *pbProperties)
static StdMediaSample2 * impl_from_IMediaSample2(IMediaSample2 *iface)
static HRESULT WINAPI StdMediaSample2_SetSyncPoint(IMediaSample2 *iface, BOOL bIsSyncPoint)
static ULONG WINAPI StdMediaSample2_Release(IMediaSample2 *iface)
static HRESULT WINAPI BaseMemAllocator_QueryInterface(IMemAllocator *iface, REFIID riid, LPVOID *ppv)
static HRESULT StdMediaSample2_Construct(BYTE *pbBuffer, LONG cbBuffer, IMemAllocator *pParent, StdMediaSample2 **ppSample)
static HRESULT BaseMemAllocator_Init(HRESULT(*fnAlloc)(IMemAllocator *), HRESULT(*fnFree)(IMemAllocator *), HRESULT(*fnVerify)(IMemAllocator *, ALLOCATOR_PROPERTIES *), HRESULT(*fnBufferPrepare)(IMemAllocator *, StdMediaSample2 *, DWORD), HRESULT(*fnBufferReleased)(IMemAllocator *, StdMediaSample2 *), void(*fnDestroyed)(IMemAllocator *), CRITICAL_SECTION *pCritSect, BaseMemAllocator *pMemAlloc)
static HRESULT WINAPI StdMediaSample2_QueryInterface(IMediaSample2 *iface, REFIID riid, void **ppv)
static BaseMemAllocator * impl_from_IMemAllocator(IMemAllocator *iface)
static HRESULT StdMemAllocator_Free(IMemAllocator *iface)
static ULONG WINAPI StdMediaSample2_AddRef(IMediaSample2 *iface)
static HRESULT WINAPI BaseMemAllocator_Decommit(IMemAllocator *iface)
static HRESULT WINAPI StdMediaSample2_IsDiscontinuity(IMediaSample2 *iface)
static HRESULT WINAPI BaseMemAllocator_GetBuffer(IMemAllocator *iface, IMediaSample **pSample, REFERENCE_TIME *pStartTime, REFERENCE_TIME *pEndTime, DWORD dwFlags)
HRESULT StdMemAllocator_create(LPUNKNOWN lpUnkOuter, LPVOID *ppv)
static HRESULT WINAPI StdMediaSample2_SetProperties(IMediaSample2 *iface, DWORD cbProperties, const BYTE *pbProperties)
static HRESULT WINAPI StdMediaSample2_IsPreroll(IMediaSample2 *iface)
static void StdMemAllocator_Destroy(IMemAllocator *iface)
static HRESULT WINAPI StdMediaSample2_IsSyncPoint(IMediaSample2 *iface)
static HRESULT WINAPI BaseMemAllocator_SetProperties(IMemAllocator *iface, ALLOCATOR_PROPERTIES *pRequest, ALLOCATOR_PROPERTIES *pActual)
static HRESULT WINAPI StdMediaSample2_SetActualDataLength(IMediaSample2 *iface, LONG len)
static ULONG WINAPI BaseMemAllocator_AddRef(IMemAllocator *iface)
static HRESULT WINAPI BaseMemAllocator_ReleaseBuffer(IMemAllocator *iface, IMediaSample *pSample)
static HRESULT WINAPI BaseMemAllocator_GetProperties(IMemAllocator *iface, ALLOCATOR_PROPERTIES *pProps)
static ULONG WINAPI BaseMemAllocator_Release(IMemAllocator *iface)
static const IMediaSample2Vtbl StdMediaSample2_VTable
static void StdMediaSample2_Delete(StdMediaSample2 *This)
#define INVALID_MEDIA_TIME
static HRESULT WINAPI BaseMemAllocator_Commit(IMemAllocator *iface)
VOID WINAPI GetSystemInfo(IN LPSYSTEM_INFO lpSystemInfo)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
VOID WINAPI CoTaskMemFree(LPVOID ptr)
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
#define memcpy(s1, s2, n)
static void FreeMediaType(AM_MEDIA_TYPE *pMediaType)
static HRESULT CopyMediaType(AM_MEDIA_TYPE *pDest, const AM_MEDIA_TYPE *pSrc)
#define IsEqualIID(riid1, riid2)
HRESULT(* fnVerify)(IMemAllocator *, ALLOCATOR_PROPERTIES *)
HRESULT(* fnFree)(IMemAllocator *)
void(* fnDestroyed)(IMemAllocator *)
IMemAllocator IMemAllocator_iface
CRITICAL_SECTION * pCritSect
HRESULT(* fnAlloc)(IMemAllocator *)
ALLOCATOR_PROPERTIES props
HRESULT(* fnBufferPrepare)(IMemAllocator *, StdMediaSample2 *, DWORD flags)
HRESULT(* fnBufferReleased)(IMemAllocator *, StdMediaSample2 *)
DWORD_PTR Spare[8/sizeof(DWORD_PTR)]
PCRITICAL_SECTION_DEBUG DebugInfo
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateSemaphoreW(IN LPSECURITY_ATTRIBUTES lpSemaphoreAttributes OPTIONAL, IN LONG lInitialCount, IN LONG lMaximumCount, IN LPCWSTR lpName OPTIONAL)
BOOL WINAPI DECLSPEC_HOTPATCH ReleaseSemaphore(IN HANDLE hSemaphore, IN LONG lReleaseCount, IN LPLONG lpPreviousCount)
#define CONTAINING_RECORD(address, type, field)
#define VFW_E_SAMPLE_TIME_NOT_SET
#define VFW_E_MEDIA_TIME_NOT_SET
#define VFW_E_NOT_COMMITTED
#define VFW_E_BUFFERS_OUTSTANDING
#define VFW_S_NO_STOP_TIME
#define VFW_E_BUFFER_OVERFLOW
#define VFW_E_ALREADY_COMMITTED
#define VFW_E_BUFFER_NOTSET
LPVOID NTAPI VirtualAlloc(IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD flAllocationType, IN DWORD flProtect)
BOOL NTAPI VirtualFree(IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD dwFreeType)
DWORD WINAPI GetLastError(void)
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
#define CLASS_E_NOAGGREGATION
#define HRESULT_FROM_WIN32(x)