quartz/memallocator: Avoid using a magic value for the start media time.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2019-06-24 20:05:17 -05:00 committed by Alexandre Julliard
parent 44318feeb6
commit f1c7492394
1 changed files with 6 additions and 8 deletions

View File

@ -40,6 +40,7 @@ typedef struct StdMediaSample2
struct list listentry;
LONGLONG tMediaStart;
LONGLONG tMediaEnd;
BOOL media_time_valid;
} StdMediaSample2;
typedef struct BaseMemAllocator
@ -74,8 +75,6 @@ static inline StdMediaSample2 *unsafe_impl_from_IMediaSample(IMediaSample * ifac
#define AM_SAMPLE2_PROP_SIZE_WRITABLE FIELD_OFFSET(AM_SAMPLE2_PROPERTIES, pbBuffer)
#define INVALID_MEDIA_TIME (((ULONGLONG)0x7fffffff << 32) | 0xffffffff)
static HRESULT BaseMemAllocator_Init(HRESULT (* fnAlloc)(IMemAllocator *),
HRESULT (* fnFree)(IMemAllocator *),
HRESULT (* fnVerify)(IMemAllocator *, ALLOCATOR_PROPERTIES *),
@ -435,8 +434,7 @@ static HRESULT StdMediaSample2_Construct(BYTE * pbBuffer, LONG cbBuffer, IMemAll
(*ppSample)->props.cbData = sizeof(AM_SAMPLE2_PROPERTIES);
(*ppSample)->props.cbBuffer = (*ppSample)->props.lActual = cbBuffer;
(*ppSample)->props.pbBuffer = pbBuffer;
(*ppSample)->tMediaStart = INVALID_MEDIA_TIME;
(*ppSample)->tMediaEnd = 0;
(*ppSample)->media_time_valid = FALSE;
return S_OK;
}
@ -496,8 +494,7 @@ static ULONG WINAPI StdMediaSample2_Release(IMediaSample2 * iface)
DeleteMediaType(This->props.pMediaType);
This->props.pMediaType = NULL;
This->props.dwSampleFlags = 0;
This->tMediaStart = INVALID_MEDIA_TIME;
This->tMediaEnd = 0;
This->media_time_valid = FALSE;
if (This->pParent)
IMemAllocator_ReleaseBuffer(This->pParent, (IMediaSample *)iface);
@ -725,7 +722,7 @@ static HRESULT WINAPI StdMediaSample2_GetMediaTime(IMediaSample2 * iface, LONGLO
TRACE("(%p)->(%p, %p)\n", iface, pStart, pEnd);
if (This->tMediaStart == INVALID_MEDIA_TIME)
if (!This->media_time_valid)
return VFW_E_MEDIA_TIME_NOT_SET;
*pStart = This->tMediaStart;
@ -745,9 +742,10 @@ static HRESULT WINAPI StdMediaSample2_SetMediaTime(IMediaSample2 *iface, LONGLON
if (!end) return E_POINTER;
sample->tMediaStart = *start;
sample->tMediaEnd = *end;
sample->media_time_valid = TRUE;
}
else
sample->tMediaStart = INVALID_MEDIA_TIME;
sample->media_time_valid = FALSE;
return S_OK;
}