Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/strmbase/filter.c | 39 +++++++++++++++++++++++++++++++++++++++ include/wine/strmbase.h | 3 +++ 2 files changed, 42 insertions(+)
diff --git a/dlls/strmbase/filter.c b/dlls/strmbase/filter.c index 5f57731b7a1..9ed588cf803 100644 --- a/dlls/strmbase/filter.c +++ b/dlls/strmbase/filter.c @@ -123,6 +123,45 @@ HRESULT WINAPI BaseFilterImpl_GetClassID(IBaseFilter * iface, CLSID * pClsid) return S_OK; }
+HRESULT WINAPI BaseFilterImpl_Stop(IBaseFilter *iface) +{ + BaseFilter *filter = impl_from_IBaseFilter(iface); + + TRACE("iface %p.\n", iface); + + EnterCriticalSection(&filter->csFilter); + filter->state = State_Stopped; + LeaveCriticalSection(&filter->csFilter); + + return S_OK; +} + +HRESULT WINAPI BaseFilterImpl_Pause(IBaseFilter *iface) +{ + BaseFilter *filter = impl_from_IBaseFilter(iface); + + TRACE("iface %p.\n", iface); + + EnterCriticalSection(&filter->csFilter); + filter->state = State_Paused; + LeaveCriticalSection(&filter->csFilter); + + return S_OK; +} + +HRESULT WINAPI BaseFilterImpl_Run(IBaseFilter *iface, REFERENCE_TIME start) +{ + BaseFilter *filter = impl_from_IBaseFilter(iface); + + TRACE("iface %p, start %s.\n", iface, wine_dbgstr_longlong(start)); + + EnterCriticalSection(&filter->csFilter); + filter->state = State_Running; + LeaveCriticalSection(&filter->csFilter); + + return S_OK; +} + HRESULT WINAPI BaseFilterImpl_GetState(IBaseFilter * iface, DWORD dwMilliSecsTimeout, FILTER_STATE *pState ) { BaseFilter *This = impl_from_IBaseFilter(iface); diff --git a/include/wine/strmbase.h b/include/wine/strmbase.h index 8de92b2826b..6abd8c76011 100644 --- a/include/wine/strmbase.h +++ b/include/wine/strmbase.h @@ -184,6 +184,9 @@ typedef struct BaseFilterFuncTable HRESULT WINAPI BaseFilterImpl_QueryInterface(IBaseFilter * iface, REFIID riid, LPVOID * ppv); ULONG WINAPI BaseFilterImpl_AddRef(IBaseFilter * iface); ULONG WINAPI BaseFilterImpl_Release(IBaseFilter * iface); +HRESULT WINAPI BaseFilterImpl_Stop(IBaseFilter *iface); +HRESULT WINAPI BaseFilterImpl_Pause(IBaseFilter *iface); +HRESULT WINAPI BaseFilterImpl_Run(IBaseFilter *iface, REFERENCE_TIME start); HRESULT WINAPI BaseFilterImpl_GetClassID(IBaseFilter * iface, CLSID * pClsid); HRESULT WINAPI BaseFilterImpl_GetState(IBaseFilter * iface, DWORD dwMilliSecsTimeout, FILTER_STATE *pState ); HRESULT WINAPI BaseFilterImpl_SetSyncSource(IBaseFilter * iface, IReferenceClock *pClock);
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/filesource.c | 54 ++++++---------------------------------- 1 file changed, 7 insertions(+), 47 deletions(-)
diff --git a/dlls/quartz/filesource.c b/dlls/quartz/filesource.c index 2d4265d5f03..a7063fea784 100644 --- a/dlls/quartz/filesource.c +++ b/dlls/quartz/filesource.c @@ -87,11 +87,6 @@ static inline AsyncReader *impl_from_BaseFilter(BaseFilter *iface) return CONTAINING_RECORD(iface, AsyncReader, filter); }
-static inline AsyncReader *impl_from_IBaseFilter(IBaseFilter *iface) -{ - return CONTAINING_RECORD(iface, AsyncReader, filter.IBaseFilter_iface); -} - static inline AsyncReader *impl_from_IFileSourceFilter(IFileSourceFilter *iface) { return CONTAINING_RECORD(iface, AsyncReader, IFileSourceFilter_iface); @@ -500,50 +495,15 @@ HRESULT AsyncReader_create(IUnknown *outer, void **out) return S_OK; }
-/** IMediaFilter methods **/ - -static HRESULT WINAPI AsyncReader_Stop(IBaseFilter * iface) -{ - AsyncReader *This = impl_from_IBaseFilter(iface); - - TRACE("%p->()\n", This); - - This->filter.state = State_Stopped; - - return S_OK; -} - -static HRESULT WINAPI AsyncReader_Pause(IBaseFilter * iface) -{ - AsyncReader *This = impl_from_IBaseFilter(iface); - - TRACE("%p->()\n", This); - - This->filter.state = State_Paused; - - return S_OK; -} - -static HRESULT WINAPI AsyncReader_Run(IBaseFilter * iface, REFERENCE_TIME tStart) -{ - AsyncReader *This = impl_from_IBaseFilter(iface); - - TRACE("%p->(%s)\n", This, wine_dbgstr_longlong(tStart)); - - This->filter.state = State_Running; - - return S_OK; -} - static const IBaseFilterVtbl AsyncReader_Vtbl = { BaseFilterImpl_QueryInterface, BaseFilterImpl_AddRef, BaseFilterImpl_Release, BaseFilterImpl_GetClassID, - AsyncReader_Stop, - AsyncReader_Pause, - AsyncReader_Run, + BaseFilterImpl_Stop, + BaseFilterImpl_Pause, + BaseFilterImpl_Run, BaseFilterImpl_GetState, BaseFilterImpl_SetSyncSource, BaseFilterImpl_GetSyncSource, @@ -697,12 +657,12 @@ static inline AsyncReader *impl_from_IAsyncReader(IAsyncReader *iface) return CONTAINING_RECORD(iface, AsyncReader, IAsyncReader_iface); }
-static HRESULT WINAPI FileAsyncReaderPin_CheckMediaType(BasePin *pin, const AM_MEDIA_TYPE *pmt) +static HRESULT WINAPI FileAsyncReaderPin_CheckMediaType(BasePin *iface, const AM_MEDIA_TYPE *pmt) { - AM_MEDIA_TYPE *pmt_filter = impl_from_IBaseFilter(pin->pinInfo.pFilter)->pmt; + AsyncReader *filter = impl_from_BasePin(iface);
- if (IsEqualGUID(&pmt->majortype, &pmt_filter->majortype) && - IsEqualGUID(&pmt->subtype, &pmt_filter->subtype)) + if (IsEqualGUID(&pmt->majortype, &filter->pmt->majortype) && + IsEqualGUID(&pmt->subtype, &filter->pmt->subtype)) return S_OK;
return S_FALSE;
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/memallocator.c | 486 +++++++++++++++++++++++++++++++ 1 file changed, 486 insertions(+)
diff --git a/dlls/quartz/tests/memallocator.c b/dlls/quartz/tests/memallocator.c index 53e56985a9b..498a2d971d2 100644 --- a/dlls/quartz/tests/memallocator.c +++ b/dlls/quartz/tests/memallocator.c @@ -171,12 +171,498 @@ static void test_commit(void) IMemAllocator_Release(allocator); }
+static void test_sample_time(void) +{ + ALLOCATOR_PROPERTIES req_props = {1, 65536, 1, 0}, ret_props; + IMemAllocator *allocator = create_allocator(); + AM_SAMPLE2_PROPERTIES props = {sizeof(props)}; + REFERENCE_TIME start, end; + IMediaSample2 *sample2; + IMediaSample *sample; + HRESULT hr; + + hr = IMemAllocator_SetProperties(allocator, &req_props, &ret_props); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IMemAllocator_Commit(allocator); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IMemAllocator_GetBuffer(allocator, &sample, NULL, NULL, 0); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IMediaSample_QueryInterface(sample, &IID_IMediaSample2, (void **)&sample2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + start = 0xdeadbeef; + end = 0xdeadf00d; + hr = IMediaSample_GetTime(sample, &start, &end); + ok(hr == VFW_E_SAMPLE_TIME_NOT_SET, "Got hr %#x.\n", hr); + ok(start == 0xdeadbeef, "Got start %s.\n", wine_dbgstr_longlong(start)); + ok(end == 0xdeadf00d, "Got end %s.\n", wine_dbgstr_longlong(end)); + + hr = IMediaSample2_GetProperties(sample2, sizeof(props), (BYTE *)&props); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!props.dwSampleFlags, "Got flags %#x.\n", props.dwSampleFlags); + + hr = IMediaSample_SetTime(sample, NULL, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMediaSample_GetTime(sample, &start, &end); + ok(hr == VFW_E_SAMPLE_TIME_NOT_SET, "Got hr %#x.\n", hr); + + hr = IMediaSample2_GetProperties(sample2, sizeof(props), (BYTE *)&props); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!props.dwSampleFlags, "Got flags %#x.\n", props.dwSampleFlags); + + start = 0x123; + hr = IMediaSample_SetTime(sample, &start, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + start = end = 0; + hr = IMediaSample_GetTime(sample, &start, &end); + ok(hr == VFW_S_NO_STOP_TIME, "Got hr %#x.\n", hr); + ok(start == 0x123, "Got start %s.\n", wine_dbgstr_longlong(start)); + ok(end == 0x124, "Got end %s.\n", wine_dbgstr_longlong(end)); + + hr = IMediaSample2_GetProperties(sample2, sizeof(props), (BYTE *)&props); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(props.dwSampleFlags == AM_SAMPLE_TIMEVALID, "Got flags %#x.\n", props.dwSampleFlags); + ok(props.tStart == 0x123, "Got start %s.\n", wine_dbgstr_longlong(props.tStart)); + + hr = IMediaSample_SetTime(sample, NULL, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMediaSample_GetTime(sample, &start, &end); + ok(hr == VFW_E_SAMPLE_TIME_NOT_SET, "Got hr %#x.\n", hr); + + hr = IMediaSample2_GetProperties(sample2, sizeof(props), (BYTE *)&props); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!props.dwSampleFlags, "Got flags %#x.\n", props.dwSampleFlags); + + end = 0x321; + hr = IMediaSample_SetTime(sample, NULL, &end); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMediaSample_GetTime(sample, &start, &end); + ok(hr == VFW_E_SAMPLE_TIME_NOT_SET, "Got hr %#x.\n", hr); + + hr = IMediaSample2_GetProperties(sample2, sizeof(props), (BYTE *)&props); + ok(hr == S_OK, "Got hr %#x.\n", hr); + todo_wine ok(!props.dwSampleFlags, "Got flags %#x.\n", props.dwSampleFlags); + + start = 0x123; + end = 0x321; + hr = IMediaSample_SetTime(sample, &start, &end); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + start = end = 0; + hr = IMediaSample_GetTime(sample, &start, &end); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(start == 0x123, "Got start %s.\n", wine_dbgstr_longlong(start)); + ok(end == 0x321, "Got end %s.\n", wine_dbgstr_longlong(end)); + + hr = IMediaSample2_GetProperties(sample2, sizeof(props), (BYTE *)&props); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(props.dwSampleFlags == (AM_SAMPLE_TIMEVALID | AM_SAMPLE_STOPVALID), + "Got flags %#x.\n", props.dwSampleFlags); + ok(props.tStart == 0x123, "Got start %s.\n", wine_dbgstr_longlong(props.tStart)); + ok(props.tStop == 0x321, "Got end %s.\n", wine_dbgstr_longlong(props.tStop)); + + props.dwSampleFlags = 0; + hr = IMediaSample2_SetProperties(sample2, sizeof(props), (BYTE *)&props); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMediaSample_GetTime(sample, &start, &end); + ok(hr == VFW_E_SAMPLE_TIME_NOT_SET, "Got hr %#x.\n", hr); + + hr = IMediaSample2_GetProperties(sample2, sizeof(props), (BYTE *)&props); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!props.dwSampleFlags, "Got flags %#x.\n", props.dwSampleFlags); + + props.dwSampleFlags = AM_SAMPLE_TIMEVALID; + props.tStart = 0x123; + hr = IMediaSample2_SetProperties(sample2, sizeof(props), (BYTE *)&props); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + start = end = 0; + hr = IMediaSample_GetTime(sample, &start, &end); + ok(hr == VFW_S_NO_STOP_TIME, "Got hr %#x.\n", hr); + ok(start == 0x123, "Got start %s.\n", wine_dbgstr_longlong(start)); + ok(end == 0x124, "Got end %s.\n", wine_dbgstr_longlong(end)); + + hr = IMediaSample2_GetProperties(sample2, sizeof(props), (BYTE *)&props); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(props.dwSampleFlags == AM_SAMPLE_TIMEVALID, "Got flags %#x.\n", props.dwSampleFlags); + ok(props.tStart == 0x123, "Got start %s.\n", wine_dbgstr_longlong(props.tStart)); + + props.dwSampleFlags = AM_SAMPLE_TIMEVALID | AM_SAMPLE_STOPVALID; + props.tStart = 0x1234; + props.tStop = 0x4321; + hr = IMediaSample2_SetProperties(sample2, sizeof(props), (BYTE *)&props); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + start = end = 0; + hr = IMediaSample_GetTime(sample, &start, &end); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(start == 0x1234, "Got start %s.\n", wine_dbgstr_longlong(start)); + ok(end == 0x4321, "Got end %s.\n", wine_dbgstr_longlong(end)); + + hr = IMediaSample2_GetProperties(sample2, sizeof(props), (BYTE *)&props); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(props.dwSampleFlags == (AM_SAMPLE_TIMEVALID | AM_SAMPLE_STOPVALID), + "Got flags %#x.\n", props.dwSampleFlags); + ok(props.tStart == 0x1234, "Got start %s.\n", wine_dbgstr_longlong(props.tStart)); + ok(props.tStop == 0x4321, "Got end %s.\n", wine_dbgstr_longlong(props.tStop)); + + IMediaSample2_Release(sample2); + IMediaSample_Release(sample); + + start = 0x123; + end = 0x321; + hr = IMemAllocator_GetBuffer(allocator, &sample, &start, &end, 0); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IMediaSample_QueryInterface(sample, &IID_IMediaSample2, (void **)&sample2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + start = 0xdeadbeef; + end = 0xdeadf00d; + hr = IMediaSample_GetTime(sample, &start, &end); + todo_wine ok(hr == VFW_E_SAMPLE_TIME_NOT_SET, "Got hr %#x.\n", hr); + todo_wine ok(start == 0xdeadbeef, "Got start %s.\n", wine_dbgstr_longlong(start)); + todo_wine ok(end == 0xdeadf00d, "Got end %s.\n", wine_dbgstr_longlong(end)); + + hr = IMediaSample2_GetProperties(sample2, sizeof(props), (BYTE *)&props); + ok(hr == S_OK, "Got hr %#x.\n", hr); + todo_wine ok(!props.dwSampleFlags, "Got flags %#x.\n", props.dwSampleFlags); + + start = 0x123; + end = 0x321; + hr = IMediaSample_SetMediaTime(sample, &start, &end); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMediaSample_GetTime(sample, &start, &end); + todo_wine ok(hr == VFW_E_SAMPLE_TIME_NOT_SET, "Got hr %#x.\n", hr); + + IMediaSample2_Release(sample2); + IMediaSample_Release(sample); + IMemAllocator_Release(allocator); +} + +static void test_media_time(void) +{ + ALLOCATOR_PROPERTIES req_props = {1, 65536, 1, 0}, ret_props; + IMemAllocator *allocator = create_allocator(); + AM_SAMPLE2_PROPERTIES props = {sizeof(props)}; + IMediaSample *sample; + LONGLONG start, end; + HRESULT hr; + + hr = IMemAllocator_SetProperties(allocator, &req_props, &ret_props); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IMemAllocator_Commit(allocator); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IMemAllocator_GetBuffer(allocator, &sample, NULL, NULL, 0); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + start = 0xdeadbeef; + end = 0xdeadf00d; + hr = IMediaSample_GetMediaTime(sample, &start, &end); + ok(hr == VFW_E_MEDIA_TIME_NOT_SET, "Got hr %#x.\n", hr); + ok(start == 0xdeadbeef, "Got start %s.\n", wine_dbgstr_longlong(start)); + ok(end == 0xdeadf00d, "Got end %s.\n", wine_dbgstr_longlong(end)); + + hr = IMediaSample_SetMediaTime(sample, NULL, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMediaSample_GetMediaTime(sample, &start, &end); + ok(hr == VFW_E_MEDIA_TIME_NOT_SET, "Got hr %#x.\n", hr); + + start = 0x123; + hr = IMediaSample_SetMediaTime(sample, &start, NULL); + todo_wine ok(hr == E_POINTER, "Got hr %#x.\n", hr); + + hr = IMediaSample_SetMediaTime(sample, NULL, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMediaSample_GetMediaTime(sample, &start, &end); + ok(hr == VFW_E_MEDIA_TIME_NOT_SET, "Got hr %#x.\n", hr); + + end = 0x321; + hr = IMediaSample_SetMediaTime(sample, NULL, &end); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMediaSample_GetMediaTime(sample, &start, &end); + ok(hr == VFW_E_MEDIA_TIME_NOT_SET, "Got hr %#x.\n", hr); + + start = 0x123; + end = 0x321; + hr = IMediaSample_SetMediaTime(sample, &start, &end); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + start = end = 0; + hr = IMediaSample_GetMediaTime(sample, &start, &end); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(start == 0x123, "Got start %s.\n", wine_dbgstr_longlong(start)); + ok(end == 0x321, "Got end %s.\n", wine_dbgstr_longlong(end)); + + IMediaSample_Release(sample); + + start = 0x123; + end = 0x321; + hr = IMemAllocator_GetBuffer(allocator, &sample, &start, &end, 0); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + start = 0xdeadbeef; + end = 0xdeadf00d; + hr = IMediaSample_GetMediaTime(sample, &start, &end); + todo_wine ok(hr == VFW_E_MEDIA_TIME_NOT_SET, "Got hr %#x.\n", hr); + todo_wine ok(start == 0xdeadbeef, "Got start %s.\n", wine_dbgstr_longlong(start)); + todo_wine ok(end == 0xdeadf00d, "Got end %s.\n", wine_dbgstr_longlong(end)); + + start = 0x123; + end = 0x321; + hr = IMediaSample_SetTime(sample, &start, &end); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMediaSample_GetMediaTime(sample, &start, &end); + todo_wine ok(hr == VFW_E_MEDIA_TIME_NOT_SET, "Got hr %#x.\n", hr); + + start = 0x123; + end = 0x321; + hr = IMediaSample_SetMediaTime(sample, &start, &end); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + IMediaSample_Release(sample); + + hr = IMemAllocator_GetBuffer(allocator, &sample, NULL, NULL, 0); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMediaSample_GetMediaTime(sample, &start, &end); + todo_wine ok(hr == VFW_E_MEDIA_TIME_NOT_SET, "Got hr %#x.\n", hr); + + IMediaSample_Release(sample); + IMemAllocator_Release(allocator); +} + +static void test_sample_properties(void) +{ + ALLOCATOR_PROPERTIES req_props = {1, 65536, 1, 0}, ret_props; + IMemAllocator *allocator = create_allocator(); + AM_SAMPLE2_PROPERTIES props = {sizeof(props)}; + AM_MEDIA_TYPE *mt, expect_mt; + IMediaSample2 *sample2; + IMediaSample *sample; + HRESULT hr; + BYTE *data; + LONG len; + + memset(&expect_mt, 0xcc, sizeof(expect_mt)); + expect_mt.pUnk = NULL; + expect_mt.cbFormat = 0; + expect_mt.pbFormat = NULL; + + hr = IMemAllocator_SetProperties(allocator, &req_props, &ret_props); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IMemAllocator_Commit(allocator); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IMemAllocator_GetBuffer(allocator, &sample, NULL, NULL, 0); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IMediaSample_QueryInterface(sample, &IID_IMediaSample2, (void **)&sample2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMediaSample_GetPointer(sample, &data); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMediaSample2_GetProperties(sample2, sizeof(props), (BYTE *)&props); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!props.dwTypeSpecificFlags, "Got type-specific flags %#x.\n", props.dwTypeSpecificFlags); + ok(!props.dwSampleFlags, "Got flags %#x.\n", props.dwSampleFlags); + ok(props.lActual == 65536, "Got actual length %d.\n", props.lActual); + ok(!props.tStart, "Got sample start %s.\n", wine_dbgstr_longlong(props.tStart)); + ok(!props.tStop, "Got sample end %s.\n", wine_dbgstr_longlong(props.tStop)); + ok(!props.dwStreamId, "Got stream ID %#x.\n", props.dwStreamId); + ok(!props.pMediaType, "Got media type %p.\n", props.pMediaType); + ok(props.pbBuffer == data, "Expected pointer %p, got %p.\n", data, props.pbBuffer); + ok(props.cbBuffer == 65536, "Got buffer length %d.\n", props.cbBuffer); + + /* media type */ + + mt = (AM_MEDIA_TYPE *)0xdeadbeef; + hr = IMediaSample_GetMediaType(sample, &mt); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + ok(!mt, "Got media type %p.\n", mt); + + hr = IMediaSample_SetMediaType(sample, NULL); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + + mt = (AM_MEDIA_TYPE *)0xdeadbeef; + hr = IMediaSample_GetMediaType(sample, &mt); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + ok(!mt, "Got media type %p.\n", mt); + + hr = IMediaSample2_GetProperties(sample2, sizeof(props), (BYTE *)&props); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!props.dwSampleFlags, "Got flags %#x.\n", props.dwSampleFlags); + ok(!props.pMediaType, "Got media type %p.\n", props.pMediaType); + + hr = IMediaSample_SetMediaType(sample, &expect_mt); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMediaSample_GetMediaType(sample, &mt); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!memcmp(mt, &expect_mt, sizeof(AM_MEDIA_TYPE)), "Media types didn't match.\n"); + CoTaskMemFree(mt); + + 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(!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); + + mt = (AM_MEDIA_TYPE *)0xdeadbeef; + hr = IMediaSample_GetMediaType(sample, &mt); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + ok(!mt, "Got media type %p.\n", mt); + + hr = IMediaSample2_GetProperties(sample2, sizeof(props), (BYTE *)&props); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!props.dwSampleFlags, "Got flags %#x.\n", props.dwSampleFlags); + ok(!props.pMediaType, "Got media type %p.\n", props.pMediaType); + + /* actual length */ + + len = IMediaSample_GetActualDataLength(sample); + ok(len == 65536, "Got length %d.\n", len); + + hr = IMediaSample_SetActualDataLength(sample, 65537); + ok(hr == VFW_E_BUFFER_OVERFLOW, "Got hr %#x.\n", hr); + hr = IMediaSample_SetActualDataLength(sample, -1); + ok(hr == VFW_E_BUFFER_OVERFLOW, "Got hr %#x.\n", hr); + hr = IMediaSample_SetActualDataLength(sample, 65536); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IMediaSample_SetActualDataLength(sample, 0); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + len = IMediaSample_GetActualDataLength(sample); + ok(len == 0, "Got length %d.\n", len); + + hr = IMediaSample2_GetProperties(sample2, sizeof(props), (BYTE *)&props); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(props.lActual == 0, "Got actual length %d.\n", props.lActual); + + props.lActual = 123; + hr = IMediaSample2_SetProperties(sample2, sizeof(props), (BYTE *)&props); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMediaSample2_GetProperties(sample2, sizeof(props), (BYTE *)&props); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(props.lActual == 123, "Got actual length %d.\n", props.lActual); + + len = IMediaSample_GetActualDataLength(sample); + ok(len == 123, "Got length %d.\n", len); + + /* boolean flags */ + + hr = IMediaSample_IsPreroll(sample); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + hr = IMediaSample_SetPreroll(sample, TRUE); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IMediaSample_IsPreroll(sample); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IMediaSample2_GetProperties(sample2, sizeof(props), (BYTE *)&props); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(props.dwSampleFlags == AM_SAMPLE_PREROLL, "Got flags %#x.\n", props.dwSampleFlags); + hr = IMediaSample_SetPreroll(sample, FALSE); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IMediaSample_IsPreroll(sample); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + hr = IMediaSample2_GetProperties(sample2, sizeof(props), (BYTE *)&props); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!props.dwSampleFlags, "Got flags %#x.\n", props.dwSampleFlags); + + hr = IMediaSample_IsDiscontinuity(sample); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + hr = IMediaSample_SetDiscontinuity(sample, TRUE); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IMediaSample_IsDiscontinuity(sample); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IMediaSample2_GetProperties(sample2, sizeof(props), (BYTE *)&props); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(props.dwSampleFlags == AM_SAMPLE_DATADISCONTINUITY, "Got flags %#x.\n", props.dwSampleFlags); + hr = IMediaSample_SetDiscontinuity(sample, FALSE); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IMediaSample_IsDiscontinuity(sample); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + hr = IMediaSample2_GetProperties(sample2, sizeof(props), (BYTE *)&props); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!props.dwSampleFlags, "Got flags %#x.\n", props.dwSampleFlags); + + hr = IMediaSample_IsSyncPoint(sample); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + hr = IMediaSample_SetSyncPoint(sample, TRUE); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IMediaSample_IsSyncPoint(sample); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IMediaSample2_GetProperties(sample2, sizeof(props), (BYTE *)&props); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(props.dwSampleFlags == AM_SAMPLE_SPLICEPOINT, "Got flags %#x.\n", props.dwSampleFlags); + hr = IMediaSample_SetSyncPoint(sample, FALSE); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IMediaSample_IsSyncPoint(sample); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + hr = IMediaSample2_GetProperties(sample2, sizeof(props), (BYTE *)&props); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!props.dwSampleFlags, "Got flags %#x.\n", props.dwSampleFlags); + + props.dwSampleFlags = (AM_SAMPLE_PREROLL | AM_SAMPLE_DATADISCONTINUITY | AM_SAMPLE_SPLICEPOINT); + hr = IMediaSample2_SetProperties(sample2, sizeof(props), (BYTE *)&props); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IMediaSample_IsPreroll(sample); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IMediaSample_IsDiscontinuity(sample); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IMediaSample_IsSyncPoint(sample); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IMediaSample2_GetProperties(sample2, sizeof(props), (BYTE *)&props); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(props.dwSampleFlags == (AM_SAMPLE_PREROLL | AM_SAMPLE_DATADISCONTINUITY | AM_SAMPLE_SPLICEPOINT), + "Got flags %#x.\n", props.dwSampleFlags); + + hr = IMediaSample_SetMediaType(sample, &expect_mt); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + IMediaSample2_Release(sample2); + IMediaSample_Release(sample); + + hr = IMemAllocator_GetBuffer(allocator, &sample, NULL, NULL, 0); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IMediaSample_QueryInterface(sample, &IID_IMediaSample2, (void **)&sample2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMediaSample2_GetProperties(sample2, sizeof(props), (BYTE *)&props); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!props.dwTypeSpecificFlags, "Got type-specific flags %#x.\n", props.dwTypeSpecificFlags); + todo_wine ok(!props.dwSampleFlags, "Got flags %#x.\n", props.dwSampleFlags); + ok(props.lActual == 123, "Got actual length %d.\n", props.lActual); + ok(!props.tStart, "Got sample start %s.\n", wine_dbgstr_longlong(props.tStart)); + ok(!props.tStop, "Got sample end %s.\n", wine_dbgstr_longlong(props.tStop)); + ok(!props.dwStreamId, "Got stream ID %#x.\n", props.dwStreamId); + todo_wine ok(!props.pMediaType, "Got media type %p.\n", props.pMediaType); + ok(props.cbBuffer == 65536, "Got buffer length %d.\n", props.cbBuffer); + + IMediaSample2_Release(sample2); + IMediaSample_Release(sample); + IMemAllocator_Release(allocator); +} + START_TEST(memallocator) { CoInitialize(NULL);
test_properties(); test_commit(); + test_sample_time(); + test_media_time(); + test_sample_properties();
CoUninitialize(); }
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=54014
Your paranoid android.
=== wxppro (32 bit report) ===
quartz: 0b40:memallocator: unhandled exception c0000005 at 7482E789
=== w2003std (32 bit report) ===
quartz: 06ac:memallocator: unhandled exception c0000005 at 75602F43
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=38421 Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/memallocator.c | 7 +++++++ dlls/quartz/tests/memallocator.c | 24 ++++++++++++------------ 2 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/dlls/quartz/memallocator.c b/dlls/quartz/memallocator.c index 4e366f3146f..be973b30c58 100644 --- a/dlls/quartz/memallocator.c +++ b/dlls/quartz/memallocator.c @@ -492,6 +492,13 @@ static ULONG WINAPI StdMediaSample2_Release(IMediaSample2 * iface)
if (!ref) { + if (This->props.pMediaType) + DeleteMediaType(This->props.pMediaType); + This->props.pMediaType = NULL; + This->props.dwSampleFlags = 0; + This->tMediaStart = INVALID_MEDIA_TIME; + This->tMediaEnd = 0; + if (This->pParent) IMemAllocator_ReleaseBuffer(This->pParent, (IMediaSample *)iface); else diff --git a/dlls/quartz/tests/memallocator.c b/dlls/quartz/tests/memallocator.c index 498a2d971d2..eb1c2428e33 100644 --- a/dlls/quartz/tests/memallocator.c +++ b/dlls/quartz/tests/memallocator.c @@ -324,13 +324,13 @@ static void test_sample_time(void) start = 0xdeadbeef; end = 0xdeadf00d; hr = IMediaSample_GetTime(sample, &start, &end); - todo_wine ok(hr == VFW_E_SAMPLE_TIME_NOT_SET, "Got hr %#x.\n", hr); - todo_wine ok(start == 0xdeadbeef, "Got start %s.\n", wine_dbgstr_longlong(start)); - todo_wine ok(end == 0xdeadf00d, "Got end %s.\n", wine_dbgstr_longlong(end)); + ok(hr == VFW_E_SAMPLE_TIME_NOT_SET, "Got hr %#x.\n", hr); + ok(start == 0xdeadbeef, "Got start %s.\n", wine_dbgstr_longlong(start)); + ok(end == 0xdeadf00d, "Got end %s.\n", wine_dbgstr_longlong(end));
hr = IMediaSample2_GetProperties(sample2, sizeof(props), (BYTE *)&props); ok(hr == S_OK, "Got hr %#x.\n", hr); - todo_wine ok(!props.dwSampleFlags, "Got flags %#x.\n", props.dwSampleFlags); + ok(!props.dwSampleFlags, "Got flags %#x.\n", props.dwSampleFlags);
start = 0x123; end = 0x321; @@ -338,7 +338,7 @@ static void test_sample_time(void) ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IMediaSample_GetTime(sample, &start, &end); - todo_wine ok(hr == VFW_E_SAMPLE_TIME_NOT_SET, "Got hr %#x.\n", hr); + ok(hr == VFW_E_SAMPLE_TIME_NOT_SET, "Got hr %#x.\n", hr);
IMediaSample2_Release(sample2); IMediaSample_Release(sample); @@ -412,9 +412,9 @@ static void test_media_time(void) start = 0xdeadbeef; end = 0xdeadf00d; hr = IMediaSample_GetMediaTime(sample, &start, &end); - todo_wine ok(hr == VFW_E_MEDIA_TIME_NOT_SET, "Got hr %#x.\n", hr); - todo_wine ok(start == 0xdeadbeef, "Got start %s.\n", wine_dbgstr_longlong(start)); - todo_wine ok(end == 0xdeadf00d, "Got end %s.\n", wine_dbgstr_longlong(end)); + ok(hr == VFW_E_MEDIA_TIME_NOT_SET, "Got hr %#x.\n", hr); + ok(start == 0xdeadbeef, "Got start %s.\n", wine_dbgstr_longlong(start)); + ok(end == 0xdeadf00d, "Got end %s.\n", wine_dbgstr_longlong(end));
start = 0x123; end = 0x321; @@ -422,7 +422,7 @@ static void test_media_time(void) ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IMediaSample_GetMediaTime(sample, &start, &end); - todo_wine ok(hr == VFW_E_MEDIA_TIME_NOT_SET, "Got hr %#x.\n", hr); + ok(hr == VFW_E_MEDIA_TIME_NOT_SET, "Got hr %#x.\n", hr);
start = 0x123; end = 0x321; @@ -435,7 +435,7 @@ static void test_media_time(void) ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IMediaSample_GetMediaTime(sample, &start, &end); - todo_wine ok(hr == VFW_E_MEDIA_TIME_NOT_SET, "Got hr %#x.\n", hr); + ok(hr == VFW_E_MEDIA_TIME_NOT_SET, "Got hr %#x.\n", hr);
IMediaSample_Release(sample); IMemAllocator_Release(allocator); @@ -641,12 +641,12 @@ static void test_sample_properties(void) hr = IMediaSample2_GetProperties(sample2, sizeof(props), (BYTE *)&props); ok(hr == S_OK, "Got hr %#x.\n", hr); ok(!props.dwTypeSpecificFlags, "Got type-specific flags %#x.\n", props.dwTypeSpecificFlags); - todo_wine ok(!props.dwSampleFlags, "Got flags %#x.\n", props.dwSampleFlags); + ok(!props.dwSampleFlags, "Got flags %#x.\n", props.dwSampleFlags); ok(props.lActual == 123, "Got actual length %d.\n", props.lActual); ok(!props.tStart, "Got sample start %s.\n", wine_dbgstr_longlong(props.tStart)); ok(!props.tStop, "Got sample end %s.\n", wine_dbgstr_longlong(props.tStop)); ok(!props.dwStreamId, "Got stream ID %#x.\n", props.dwStreamId); - todo_wine ok(!props.pMediaType, "Got media type %p.\n", props.pMediaType); + ok(!props.pMediaType, "Got media type %p.\n", props.pMediaType); ok(props.cbBuffer == 65536, "Got buffer length %d.\n", props.cbBuffer);
IMediaSample2_Release(sample2);
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=54015
Your paranoid android.
=== wxppro (32 bit report) ===
quartz: 0b40:memallocator: unhandled exception c0000005 at 7482E789
=== w2003std (32 bit report) ===
quartz: 06ac:memallocator: unhandled exception c0000005 at 75602F43
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/memallocator.c | 28 ++++++++++++++-------------- dlls/quartz/tests/memallocator.c | 2 +- 2 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/dlls/quartz/memallocator.c b/dlls/quartz/memallocator.c index be973b30c58..ac12abd6e58 100644 --- a/dlls/quartz/memallocator.c +++ b/dlls/quartz/memallocator.c @@ -560,27 +560,27 @@ static HRESULT WINAPI StdMediaSample2_GetTime(IMediaSample2 * iface, REFERENCE_T return hr; }
-static HRESULT WINAPI StdMediaSample2_SetTime(IMediaSample2 * iface, REFERENCE_TIME * pStart, REFERENCE_TIME * pEnd) +static HRESULT WINAPI StdMediaSample2_SetTime(IMediaSample2 *iface, REFERENCE_TIME *start, REFERENCE_TIME *end) { - StdMediaSample2 *This = impl_from_IMediaSample2(iface); + StdMediaSample2 *sample = impl_from_IMediaSample2(iface);
- TRACE("(%p)->(%p, %p)\n", iface, pStart, pEnd); + TRACE("iface %p, start %p, end %p.\n", iface, start, end);
- if (pStart) + if (start) { - This->props.tStart = *pStart; - This->props.dwSampleFlags |= AM_SAMPLE_TIMEVALID; - } - else - This->props.dwSampleFlags &= ~AM_SAMPLE_TIMEVALID; + sample->props.tStart = *start; + sample->props.dwSampleFlags |= AM_SAMPLE_TIMEVALID;
- if (pEnd) - { - This->props.tStop = *pEnd; - This->props.dwSampleFlags |= AM_SAMPLE_STOPVALID; + if (end) + { + sample->props.tStop = *end; + sample->props.dwSampleFlags |= AM_SAMPLE_STOPVALID; + } + else + sample->props.dwSampleFlags &= ~AM_SAMPLE_STOPVALID; } else - This->props.dwSampleFlags &= ~AM_SAMPLE_STOPVALID; + sample->props.dwSampleFlags &= ~(AM_SAMPLE_TIMEVALID | AM_SAMPLE_STOPVALID);
return S_OK; } diff --git a/dlls/quartz/tests/memallocator.c b/dlls/quartz/tests/memallocator.c index eb1c2428e33..92e2d45a0d0 100644 --- a/dlls/quartz/tests/memallocator.c +++ b/dlls/quartz/tests/memallocator.c @@ -245,7 +245,7 @@ static void test_sample_time(void)
hr = IMediaSample2_GetProperties(sample2, sizeof(props), (BYTE *)&props); ok(hr == S_OK, "Got hr %#x.\n", hr); - todo_wine ok(!props.dwSampleFlags, "Got flags %#x.\n", props.dwSampleFlags); + ok(!props.dwSampleFlags, "Got flags %#x.\n", props.dwSampleFlags);
start = 0x123; end = 0x321;
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=54016
Your paranoid android.
=== wxppro (32 bit report) ===
quartz: 0b40:memallocator: unhandled exception c0000005 at 7482E789
=== w2003std (32 bit report) ===
quartz: 06ac:memallocator: unhandled exception c0000005 at 75602F43