Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/memallocator.c | 21 ++++++++++----------- dlls/quartz/tests/memallocator.c | 2 +- 2 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/dlls/quartz/memallocator.c b/dlls/quartz/memallocator.c index ac12abd6e58..1d74c3cb9fe 100644 --- a/dlls/quartz/memallocator.c +++ b/dlls/quartz/memallocator.c @@ -734,21 +734,20 @@ static HRESULT WINAPI StdMediaSample2_GetMediaTime(IMediaSample2 * iface, LONGLO return S_OK; }
-static HRESULT WINAPI StdMediaSample2_SetMediaTime(IMediaSample2 * iface, LONGLONG * pStart, LONGLONG * pEnd) +static HRESULT WINAPI StdMediaSample2_SetMediaTime(IMediaSample2 *iface, LONGLONG *start, LONGLONG *end) { - StdMediaSample2 *This = impl_from_IMediaSample2(iface); - - TRACE("(%p)->(%p, %p)\n", iface, pStart, pEnd); + StdMediaSample2 *sample = impl_from_IMediaSample2(iface);
- if (pStart) - This->tMediaStart = *pStart; - else - This->tMediaStart = INVALID_MEDIA_TIME; + TRACE("sample %p, start %p, end %p.\n", iface, start, end);
- if (pEnd) - This->tMediaEnd = *pEnd; + if (start) + { + if (!end) return E_POINTER; + sample->tMediaStart = *start; + sample->tMediaEnd = *end; + } else - This->tMediaEnd = 0; + sample->tMediaStart = INVALID_MEDIA_TIME;
return S_OK; } diff --git a/dlls/quartz/tests/memallocator.c b/dlls/quartz/tests/memallocator.c index b4f3b23710e..3868312aac9 100644 --- a/dlls/quartz/tests/memallocator.c +++ b/dlls/quartz/tests/memallocator.c @@ -379,7 +379,7 @@ static void test_media_time(void) { start = 0x123; hr = IMediaSample_SetMediaTime(sample, &start, NULL); - todo_wine ok(hr == E_POINTER, "Got hr %#x.\n", hr); + ok(hr == E_POINTER, "Got hr %#x.\n", hr); }
end = 0x321;
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/memallocator.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/dlls/quartz/memallocator.c b/dlls/quartz/memallocator.c index 1d74c3cb9fe..b7dff8cdabe 100644 --- a/dlls/quartz/memallocator.c +++ b/dlls/quartz/memallocator.c @@ -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; }
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/memallocator.c | 2 +- dlls/quartz/tests/memallocator.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/quartz/memallocator.c b/dlls/quartz/memallocator.c index b7dff8cdabe..91c23736fd0 100644 --- a/dlls/quartz/memallocator.c +++ b/dlls/quartz/memallocator.c @@ -686,7 +686,7 @@ static HRESULT WINAPI StdMediaSample2_SetMediaType(IMediaSample2 * iface, AM_MED This->props.pMediaType = NULL; } if (!pMediaType) - return S_FALSE; + return S_OK; if (!(This->props.pMediaType = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE)))) return E_OUTOFMEMORY;
diff --git a/dlls/quartz/tests/memallocator.c b/dlls/quartz/tests/memallocator.c index 3868312aac9..9bbfd425cfa 100644 --- a/dlls/quartz/tests/memallocator.c +++ b/dlls/quartz/tests/memallocator.c @@ -487,7 +487,7 @@ static void test_sample_properties(void) ok(!mt, "Got media type %p.\n", mt);
hr = IMediaSample_SetMediaType(sample, NULL); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr);
mt = (AM_MEDIA_TYPE *)0xdeadbeef; hr = IMediaSample_GetMediaType(sample, &mt); @@ -513,7 +513,7 @@ static void test_sample_properties(void) ok(!memcmp(props.pMediaType, &expect_mt, sizeof(AM_MEDIA_TYPE)), "Media types didn't match.\n");
hr = IMediaSample_SetMediaType(sample, NULL); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr);
mt = (AM_MEDIA_TYPE *)0xdeadbeef; hr = IMediaSample_GetMediaType(sample, &mt);
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/memallocator.c | 7 +++++++ dlls/quartz/tests/memallocator.c | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/dlls/quartz/memallocator.c b/dlls/quartz/memallocator.c index 91c23736fd0..5ac8a72a818 100644 --- a/dlls/quartz/memallocator.c +++ b/dlls/quartz/memallocator.c @@ -685,8 +685,15 @@ static HRESULT WINAPI StdMediaSample2_SetMediaType(IMediaSample2 * iface, AM_MED DeleteMediaType(This->props.pMediaType); This->props.pMediaType = NULL; } + if (!pMediaType) + { + This->props.dwSampleFlags &= ~AM_SAMPLE_TYPECHANGED; return S_OK; + } + + This->props.dwSampleFlags |= AM_SAMPLE_TYPECHANGED; + if (!(This->props.pMediaType = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE)))) return E_OUTOFMEMORY;
diff --git a/dlls/quartz/tests/memallocator.c b/dlls/quartz/tests/memallocator.c index 9bbfd425cfa..164f3af47f4 100644 --- a/dlls/quartz/tests/memallocator.c +++ b/dlls/quartz/tests/memallocator.c @@ -509,7 +509,7 @@ static void test_sample_properties(void)
hr = IMediaSample2_GetProperties(sample2, sizeof(props), (BYTE *)&props); ok(hr == S_OK, "Got hr %#x.\n", hr); - todo_wine ok(props.dwSampleFlags == AM_SAMPLE_TYPECHANGED, "Got flags %#x.\n", props.dwSampleFlags); + ok(props.dwSampleFlags == AM_SAMPLE_TYPECHANGED, "Got flags %#x.\n", props.dwSampleFlags); ok(!memcmp(props.pMediaType, &expect_mt, sizeof(AM_MEDIA_TYPE)), "Media types didn't match.\n");
hr = IMediaSample_SetMediaType(sample, NULL);