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;
570 This->props.tStop = *pEnd;
583 TRACE(
"(%p)->()\n", iface);
592 TRACE(
"(%p)->(%s)\n", iface, bIsSyncPoint ?
"TRUE" :
"FALSE");
606 TRACE(
"(%p)->()\n", iface);
615 TRACE(
"(%p)->(%s)\n", iface, bIsPreroll ?
"TRUE" :
"FALSE");
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)
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;
HRESULT(* fnBufferPrepare)(IMemAllocator *, StdMediaSample2 *, DWORD flags)
static HRESULT WINAPI BaseMemAllocator_SetProperties(IMemAllocator *iface, ALLOCATOR_PROPERTIES *pRequest, ALLOCATOR_PROPERTIES *pActual)
#define HRESULT_FROM_WIN32(x)
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
VOID WINAPI CoTaskMemFree(LPVOID ptr)
static HRESULT WINAPI StdMediaSample2_GetPointer(IMediaSample2 *iface, BYTE **ppBuffer)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateSemaphoreW(IN LPSECURITY_ATTRIBUTES lpSemaphoreAttributes OPTIONAL, IN LONG lInitialCount, IN LONG lMaximumCount, IN LPCWSTR lpName OPTIONAL)
#define AM_SAMPLE2_PROP_SIZE_WRITABLE
static HRESULT WINAPI BaseMemAllocator_QueryInterface(IMemAllocator *iface, REFIID riid, LPVOID *ppv)
const char * qzdebugstr_guid(const GUID *id)
__WINE_SERVER_LIST_INLINE void list_add_head(struct list *list, struct list *elem)
#define INVALID_MEDIA_TIME
HRESULT(* fnBufferReleased)(IMemAllocator *, StdMediaSample2 *)
DWORD WINAPI GetLastError(VOID)
static HRESULT WINAPI StdMediaSample2_SetSyncPoint(IMediaSample2 *iface, BOOL bIsSyncPoint)
static LONG WINAPI StdMediaSample2_GetSize(IMediaSample2 *iface)
static HRESULT WINAPI StdMediaSample2_IsDiscontinuity(IMediaSample2 *iface)
#define VFW_E_SAMPLE_TIME_NOT_SET
struct StdMemAllocator StdMemAllocator
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
HRESULT(* fnVerify)(IMemAllocator *, ALLOCATOR_PROPERTIES *)
static StdMediaSample2 * unsafe_impl_from_IMediaSample(IMediaSample *iface)
static HRESULT WINAPI StdMediaSample2_GetMediaTime(IMediaSample2 *iface, LONGLONG *pStart, LONGLONG *pEnd)
static HRESULT WINAPI StdMediaSample2_SetActualDataLength(IMediaSample2 *iface, LONG len)
__WINE_SERVER_LIST_INLINE struct list * list_head(const struct list *list)
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
struct BaseMemAllocator BaseMemAllocator
LPVOID NTAPI VirtualAlloc(IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD flAllocationType, IN DWORD flProtect)
static HRESULT WINAPI StdMediaSample2_SetProperties(IMediaSample2 *iface, DWORD cbProperties, const BYTE *pbProperties)
static HRESULT WINAPI BaseMemAllocator_GetBuffer(IMemAllocator *iface, IMediaSample **pSample, REFERENCE_TIME *pStartTime, REFERENCE_TIME *pEndTime, DWORD dwFlags)
IMemAllocator IMemAllocator_iface
static void StdMemAllocator_Destroy(IMemAllocator *iface)
static StdMemAllocator * StdMemAllocator_from_IMemAllocator(IMemAllocator *iface)
static void FreeMediaType(AM_MEDIA_TYPE *pMediaType)
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 ULONG WINAPI StdMediaSample2_AddRef(IMediaSample2 *iface)
#define VFW_E_ALREADY_COMMITTED
HRESULT StdMemAllocator_create(LPUNKNOWN lpUnkOuter, LPVOID *ppv)
static StdMediaSample2 * impl_from_IMediaSample2(IMediaSample2 *iface)
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
struct StdMediaSample2 StdMediaSample2
static const IMemAllocatorVtbl BaseMemAllocator_VTable
static HRESULT WINAPI StdMediaSample2_GetTime(IMediaSample2 *iface, REFERENCE_TIME *pStart, REFERENCE_TIME *pEnd)
static HRESULT WINAPI StdMediaSample2_QueryInterface(IMediaSample2 *iface, REFIID riid, void **ppv)
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
HRESULT(* fnFree)(IMemAllocator *)
static HRESULT WINAPI StdMediaSample2_GetMediaType(IMediaSample2 *iface, AM_MEDIA_TYPE **ppMediaType)
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
static void StdMediaSample2_Delete(StdMediaSample2 *This)
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
static HRESULT WINAPI StdMediaSample2_SetTime(IMediaSample2 *iface, REFERENCE_TIME *pStart, REFERENCE_TIME *pEnd)
static HRESULT WINAPI BaseMemAllocator_GetProperties(IMemAllocator *iface, ALLOCATOR_PROPERTIES *pProps)
ALLOCATOR_PROPERTIES props
WINE_DEFAULT_DEBUG_CHANNEL(quartz)
static HRESULT CopyMediaType(AM_MEDIA_TYPE *pDest, const AM_MEDIA_TYPE *pSrc)
PCRITICAL_SECTION_DEBUG DebugInfo
static HRESULT WINAPI BaseMemAllocator_Commit(IMemAllocator *iface)
#define VFW_E_BUFFER_OVERFLOW
#define InterlockedDecrement
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
static HRESULT WINAPI StdMediaSample2_SetDiscontinuity(IMediaSample2 *iface, BOOL bIsDiscontinuity)
#define memcpy(s1, s2, n)
#define CLASS_E_NOAGGREGATION
CRITICAL_SECTION * pCritSect
static HRESULT WINAPI StdMediaSample2_SetPreroll(IMediaSample2 *iface, BOOL bIsPreroll)
static HRESULT StdMediaSample2_Construct(BYTE *pbBuffer, LONG cbBuffer, IMemAllocator *pParent, StdMediaSample2 **ppSample)
#define VFW_E_MEDIA_TIME_NOT_SET
static LONG WINAPI StdMediaSample2_GetActualDataLength(IMediaSample2 *iface)
__WINE_SERVER_LIST_INLINE int list_empty(const struct list *list)
static HRESULT StdMemAllocator_Alloc(IMemAllocator *iface)
void(* fnDestroyed)(IMemAllocator *)
static const IMediaSample2Vtbl StdMediaSample2_VTable
struct tagAM_SAMPLE2_PROPERTIES AM_SAMPLE2_PROPERTIES
#define InterlockedIncrement
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 VFW_E_BUFFERS_OUTSTANDING
VOID WINAPI GetSystemInfo(IN LPSYSTEM_INFO lpSystemInfo)
static ULONG WINAPI StdMediaSample2_Release(IMediaSample2 *iface)
#define VFW_E_NOT_COMMITTED
BOOL WINAPI DECLSPEC_HOTPATCH ReleaseSemaphore(IN HANDLE hSemaphore, IN LONG lReleaseCount, IN LPLONG lpPreviousCount)
#define VFW_E_BUFFER_NOTSET
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
static BaseMemAllocator * impl_from_IMemAllocator(IMemAllocator *iface)
static HRESULT WINAPI StdMediaSample2_SetMediaTime(IMediaSample2 *iface, LONGLONG *pStart, LONGLONG *pEnd)
#define VFW_S_NO_STOP_TIME
static HRESULT StdMemAllocator_Free(IMemAllocator *iface)
static HRESULT WINAPI StdMediaSample2_SetMediaType(IMediaSample2 *iface, AM_MEDIA_TYPE *pMediaType)
static HRESULT WINAPI BaseMemAllocator_ReleaseBuffer(IMemAllocator *iface, IMediaSample *pSample)
BOOL NTAPI VirtualFree(IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD dwFreeType)
static HRESULT WINAPI StdMediaSample2_GetProperties(IMediaSample2 *iface, DWORD cbProperties, BYTE *pbProperties)
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
static HRESULT WINAPI StdMediaSample2_IsPreroll(IMediaSample2 *iface)
static ULONG WINAPI BaseMemAllocator_AddRef(IMemAllocator *iface)
static ULONG WINAPI BaseMemAllocator_Release(IMemAllocator *iface)
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
static HRESULT WINAPI BaseMemAllocator_Decommit(IMemAllocator *iface)
#define IsEqualIID(riid1, riid2)
static HRESULT WINAPI StdMediaSample2_IsSyncPoint(IMediaSample2 *iface)
DWORD_PTR Spare[8/sizeof(DWORD_PTR)]
HRESULT(* fnAlloc)(IMemAllocator *)