Commit f1c74923 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

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

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