From: Brendan McGrath <bmcgrath@codeweavers.com> --- dlls/quartz/colorconv.c | 27 +++++++++++++++++++++++++++ dlls/quartz/tests/colorconv.c | 7 ------- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/dlls/quartz/colorconv.c b/dlls/quartz/colorconv.c index 22b4703c819..22cb3d9da2c 100644 --- a/dlls/quartz/colorconv.c +++ b/dlls/quartz/colorconv.c @@ -426,6 +426,7 @@ static HRESULT WINAPI color_sink_Receive(struct strmbase_sink *iface, IMediaSamp DWORD flags = 0, status; long output_image_size; LONGLONG start, stop; + AM_MEDIA_TYPE *mt; LONG dst_size; UINT32 *data; HRESULT hr; @@ -460,6 +461,32 @@ static HRESULT WINAPI color_sink_Receive(struct strmbase_sink *iface, IMediaSamp return hr; } + /* Handle dynamic format change. */ + if ((hr = IMediaSample_GetMediaType(dst_sample, &mt)) == S_OK) + { + if (memcmp(mt, &filter->source.pin.mt, offsetof(AM_MEDIA_TYPE, pbFormat)) || + memcmp(mt->pbFormat, filter->source.pin.mt.pbFormat, mt->cbFormat)) + { + DMO_MEDIA_TYPE dmo_mt; + + populate_output_dmo_mt(&filter->sink.pin.mt, mt, &dmo_mt); + if (FAILED(hr = IMediaObject_SetOutputType(filter->dmo, 0, &dmo_mt, 0))) + WARN("Failed to update media type, hr %#lx.\n", hr); + + filter->sample_output_stride = calculate_stride(&((VIDEOINFOHEADER *)mt->pbFormat)->bmiHeader); + filter->dmo_output_stride = calculate_stride(&((VIDEOINFOHEADER *)dmo_mt.pbFormat)->bmiHeader); + filter->dmo_output_sample_size = dmo_mt.lSampleSize; + + FreeMediaType(&filter->source.pin.mt); + filter->source.pin.mt = *mt; + CoTaskMemFree(mt); + } + } + else if (hr != S_FALSE) + { + ERR("Failed to get media type, hr %#lx.\n", hr); + } + hr = IMediaSample_GetPointer(dst_sample, &dst_buff); if (FAILED(hr)) { diff --git a/dlls/quartz/tests/colorconv.c b/dlls/quartz/tests/colorconv.c index 494b5f757c8..b85a4da1c5e 100644 --- a/dlls/quartz/tests/colorconv.c +++ b/dlls/quartz/tests/colorconv.c @@ -1918,7 +1918,6 @@ static void test_sample_processing( ok(hr == S_OK, "Got hr %#lx.\n", hr); ok(sink_allocator->sample_refcount == 1, "Got sample refcount %ld.\n", sink_allocator->sample_refcount); - todo_wine ok(sink_allocator->media_type_checked, "Expected media type to have been checked.\n"); ok(testsink->sample != NULL, "Expected out peer sample.\n"); sink_allocator->expect_get_buffer = FALSE; @@ -2015,7 +2014,6 @@ static void test_sample_processing( sink_allocator->media_type_checked = FALSE; hr = IMemInputPin_Receive(input, sample); ok(hr == S_OK, "Got hr %#lx.\n", hr); - todo_wine ok(sink_allocator->media_type_checked, "Expected media type to have been checked.\n"); sink_allocator->expect_get_buffer = FALSE; sink_allocator->expect_get_media_type = FALSE; @@ -2084,7 +2082,6 @@ static void test_sample_processing( sink_allocator->media_type_checked = FALSE; hr = IMemInputPin_Receive(input, sample); ok(hr == S_OK, "Got hr %#lx.\n", hr); - todo_wine ok(sink_allocator->media_type_checked, "Expected media type to have been checked.\n"); sink_allocator->expect_get_buffer = FALSE; sink_allocator->expect_get_media_type = FALSE; @@ -2109,7 +2106,6 @@ static void test_sample_processing( for (unsigned int i = 0; i < image_size; ++i) diff += abs((int)buff[i] - (int)rgb32_image->data[i]); diff = diff * 100 / 256 / image_size; - todo_wine ok(diff == 0, "Got %I64u%% difference.\n", diff); free(rgb32_image); @@ -2146,7 +2142,6 @@ static void test_streaming_events(IMediaControl *control, IPin *sink, IMemInputP ok(hr == S_OK, "Got hr %#lx.\n", hr); sink_allocator->expect_get_buffer = FALSE; sink_allocator->expect_get_media_type = FALSE; - todo_wine ok(sink_allocator->media_type_checked, "Expected media type to have been checked.\n"); hr = IMediaSample_GetPointer(sample, &data); ok(hr == S_OK, "Got hr %#lx.\n", hr); @@ -2176,7 +2171,6 @@ static void test_streaming_events(IMediaControl *control, IPin *sink, IMemInputP hr = IMemInputPin_Receive(input, sample); ok(hr == S_OK, "Got hr %#lx.\n", hr); ok(testsink->sample != NULL, "Expected to receive sample.\n"); - todo_wine ok(sink_allocator->media_type_checked, "Expected media type to have been checked.\n"); sink_allocator->expect_get_media_type = FALSE; if (testsink->sample) @@ -2205,7 +2199,6 @@ static void test_streaming_events(IMediaControl *control, IPin *sink, IMemInputP hr = IMemInputPin_Receive(input, sample); ok(hr == S_OK, "Got hr %#lx.\n", hr); ok(testsink->sample != NULL, "Expected to receive sample.\n"); - todo_wine ok(sink_allocator->media_type_checked, "Expected media type to have been checked.\n"); sink_allocator->expect_get_buffer = FALSE; sink_allocator->expect_get_media_type = FALSE; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11679