76#define AM_SAMPLE2_PROP_SIZE_WRITABLE FIELD_OFFSET(AM_SAMPLE2_PROPERTIES, pbBuffer)
87 assert(fnAlloc && fnFree && fnDestroyed);
96 pMemAlloc->
fnFree = fnFree;
118 *
ppv = &
This->IMemAllocator_iface;
120 *
ppv = &
This->IMemAllocator_iface;
153 if (
This->bCommitted)
156 This->fnDestroyed(iface);
169 TRACE(
"Requested %ld buffers, size %ld, alignment %ld, prefix %ld.\n",
176 else if (
This->bCommitted)
190 *pActual =
This->props;
206 memcpy(pProps, &
This->props,
sizeof(*pProps));
222 if (!
This->props.cbAlign)
224 else if (!
This->props.cbBuffer)
226 else if (!
This->props.cBuffers)
228 else if (
This->bDecommitQueued &&
This->bCommitted)
233 else if (
This->bCommitted)
244 hr =
This->fnAlloc(iface);
248 ERR(
"Failed to allocate, hr %#lx.\n",
hr);
266 if (!
This->bCommitted)
280 if (
This->lWaiting != 0)
281 ERR(
"Waiting: %ld\n",
This->lWaiting);
304 TRACE(
"allocator %p, sample %p, start_time %p, end_time %p, flags %#lx.\n",
310 if (!
This->bCommitted ||
This->bDecommitQueued)
312 WARN(
"Not committed\n");
333 if (!
This->bCommitted)
335 else if (
This->bDecommitQueued)
347 IMediaSample_AddRef(*pSample);
353 WARN(
"Returning hr %#lx.\n",
hr);
371 if (!
This->bCommitted)
372 ERR(
"Releasing a buffer when the allocator is not committed?!?\n");
381 if (
This->lWaiting != 0)
382 ERR(
"Waiting: %ld\n",
This->lWaiting);
426 (*ppSample)->ref = 0;
427 ZeroMemory(&(*ppSample)->props,
sizeof((*ppSample)->props));
432 (*ppSample)->pParent =
pParent;
434 (*ppSample)->props.cbBuffer = (*ppSample)->props.lActual = cbBuffer;
435 (*ppSample)->props.pbBuffer = pbBuffer;
436 (*ppSample)->media_time_valid =
FALSE;
443 if (
This->props.pMediaType)
465 IMediaSample2_AddRef(iface);
492 if (
This->props.pMediaType)
495 This->props.dwSampleFlags = 0;
510 TRACE(
"(%p)->(%p)\n", iface, ppBuffer);
512 *ppBuffer =
This->props.pbBuffer;
516 ERR(
"Requested an unlocked surface and trying to lock regardless\n");
527 TRACE(
"StdMediaSample2_GetSize()\n");
529 return This->props.cbBuffer;
537 TRACE(
"(%p)->(%p, %p)\n", iface, pStart, pEnd);
543 *pStart =
This->props.tStart;
544 *pEnd =
This->props.tStart + 1;
550 *pStart =
This->props.tStart;
551 *pEnd =
This->props.tStop;
577 sample->props.dwSampleFlags &= ~AM_SAMPLE_STOPVALID;
589 TRACE(
"(%p)->()\n", iface);
598 TRACE(
"(%p)->(%s)\n", iface, bIsSyncPoint ?
"TRUE" :
"FALSE");
603 This->props.dwSampleFlags &= ~AM_SAMPLE_SPLICEPOINT;
612 TRACE(
"(%p)->()\n", iface);
621 TRACE(
"(%p)->(%s)\n", iface, bIsPreroll ?
"TRUE" :
"FALSE");
626 This->props.dwSampleFlags &= ~AM_SAMPLE_PREROLL;
635 TRACE(
"(%p)->()\n", iface);
637 return This->props.lActual;
646 if ((
len >
This->props.cbBuffer) || (
len < 0))
648 ERR(
"Length %ld exceeds maximum %ld.\n",
len,
This->props.cbBuffer);
662 TRACE(
"(%p)->(%p)\n", iface, ppMediaType);
664 if (!
This->props.pMediaType) {
681 TRACE(
"(%p)->(%p)\n", iface, pMediaType);
683 if (
This->props.pMediaType)
691 This->props.dwSampleFlags &= ~AM_SAMPLE_TYPECHANGED;
707 TRACE(
"(%p)->()\n", iface);
716 TRACE(
"(%p)->(%s)\n", iface, bIsDiscontinuity ?
"TRUE" :
"FALSE");
718 if (bIsDiscontinuity)
721 This->props.dwSampleFlags &= ~AM_SAMPLE_DATADISCONTINUITY;
730 TRACE(
"(%p)->(%p, %p)\n", iface, pStart, pEnd);
732 if (!
This->media_time_valid)
735 *pStart =
This->tMediaStart;
736 *pEnd =
This->tMediaEnd;
765 TRACE(
"sample %p, size %lu, properties %p.\n",
This, cbProperties, pbProperties);
776 TRACE(
"sample %p, size %lu, properties %p.\n",
This, cbProperties, pbProperties);
856 for (
i =
This->base.props.cBuffers - 1;
i >= 0;
i--)
859 BYTE * pbBuffer = (
BYTE *)
This->pMemory +
i * (
This->base.props.cbBuffer +
This->base.props.cbPrefix) +
This->base.props.cbPrefix;
876 WARN(
"Freeing allocator with outstanding samples!\n");
906 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 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_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
HRESULT mem_allocator_create(IUnknown *lpUnkOuter, IUnknown **out)
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)
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_SetMediaTime(IMediaSample2 *iface, LONGLONG *start, LONGLONG *end)
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 HRESULT WINAPI StdMediaSample2_SetTime(IMediaSample2 *iface, REFERENCE_TIME *start, REFERENCE_TIME *end)
static void StdMediaSample2_Delete(StdMediaSample2 *This)
static HRESULT WINAPI BaseMemAllocator_Commit(IMemAllocator *iface)
void *WINAPI CoTaskMemAlloc(SIZE_T size)
void WINAPI CoTaskMemFree(void *ptr)
VOID WINAPI GetSystemInfo(IN LPSYSTEM_INFO lpSystemInfo)
BOOL WINAPI InitializeCriticalSectionEx(OUT LPCRITICAL_SECTION lpCriticalSection, IN DWORD dwSpinCount, IN DWORD flags)
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
#define memcpy(s1, s2, n)
_In_ LPWSTR _In_ DWORD _In_ DWORD _In_ DWORD dwFlags
#define IsEqualIID(riid1, riid2)
static const char * debugstr_time(REFERENCE_TIME time)
HRESULT WINAPI CopyMediaType(AM_MEDIA_TYPE *pDest, const AM_MEDIA_TYPE *pSrc)
void WINAPI DeleteMediaType(AM_MEDIA_TYPE *pMediaType)
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 *)
PRTL_CRITICAL_SECTION_DEBUG DebugInfo
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
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
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
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)
static HRESULT HRESULT_FROM_WIN32(unsigned int x)
#define CLASS_E_NOAGGREGATION
#define RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO