From: R��mi Bernon rbernon@codeweavers.com
--- dlls/winegstreamer/color_convert.c | 4 ++++ dlls/winegstreamer/h264_decoder.c | 4 ++++ dlls/winegstreamer/resampler.c | 4 ++++ dlls/winegstreamer/video_processor.c | 4 ++++ dlls/winegstreamer/wma_decoder.c | 10 +++++++--- 5 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/dlls/winegstreamer/color_convert.c b/dlls/winegstreamer/color_convert.c index b47832b2c30..81067d052f7 100644 --- a/dlls/winegstreamer/color_convert.c +++ b/dlls/winegstreamer/color_convert.c @@ -401,6 +401,8 @@ static HRESULT WINAPI transform_SetInputType(IMFTransform *iface, DWORD id, IMFM break; if (i == ARRAY_SIZE(input_types)) return MF_E_INVALIDMEDIATYPE; + if (flags & MFT_SET_TYPE_TEST_ONLY) + return S_OK;
if (!impl->input_type && FAILED(hr = MFCreateMediaType(&impl->input_type))) return hr; @@ -444,6 +446,8 @@ static HRESULT WINAPI transform_SetOutputType(IMFTransform *iface, DWORD id, IMF break; if (i == ARRAY_SIZE(output_types)) return MF_E_INVALIDMEDIATYPE; + if (flags & MFT_SET_TYPE_TEST_ONLY) + return S_OK;
if (!impl->output_type && FAILED(hr = MFCreateMediaType(&impl->output_type))) return hr; diff --git a/dlls/winegstreamer/h264_decoder.c b/dlls/winegstreamer/h264_decoder.c index 43b8f83a20c..c6098aee302 100644 --- a/dlls/winegstreamer/h264_decoder.c +++ b/dlls/winegstreamer/h264_decoder.c @@ -419,6 +419,8 @@ static HRESULT WINAPI transform_SetInputType(IMFTransform *iface, DWORD id, IMFM break; if (i == ARRAY_SIZE(h264_decoder_input_types)) return MF_E_INVALIDMEDIATYPE; + if (flags & MFT_SET_TYPE_TEST_ONLY) + return S_OK;
if (decoder->output_type) { @@ -469,6 +471,8 @@ static HRESULT WINAPI transform_SetOutputType(IMFTransform *iface, DWORD id, IMF || (frame_size >> 32) != decoder->wg_format.u.video.width || (UINT32)frame_size != decoder->wg_format.u.video.height) return MF_E_INVALIDMEDIATYPE; + if (flags & MFT_SET_TYPE_TEST_ONLY) + return S_OK;
if (decoder->output_type) IMFMediaType_Release(decoder->output_type); diff --git a/dlls/winegstreamer/resampler.c b/dlls/winegstreamer/resampler.c index 65a29d96794..1d35775af68 100644 --- a/dlls/winegstreamer/resampler.c +++ b/dlls/winegstreamer/resampler.c @@ -383,6 +383,8 @@ static HRESULT WINAPI transform_SetInputType(IMFTransform *iface, DWORD id, IMFM
if (FAILED(hr = check_media_type(type))) return hr; + if (flags & MFT_SET_TYPE_TEST_ONLY) + return S_OK;
if (!impl->input_type && FAILED(hr = MFCreateMediaType(&impl->input_type))) return hr; @@ -414,6 +416,8 @@ static HRESULT WINAPI transform_SetOutputType(IMFTransform *iface, DWORD id, IMF
if (FAILED(hr = check_media_type(type))) return hr; + if (flags & MFT_SET_TYPE_TEST_ONLY) + return S_OK;
if (!impl->output_type && FAILED(hr = MFCreateMediaType(&impl->output_type))) return hr; diff --git a/dlls/winegstreamer/video_processor.c b/dlls/winegstreamer/video_processor.c index a271ca9231f..4094ecd2bdd 100644 --- a/dlls/winegstreamer/video_processor.c +++ b/dlls/winegstreamer/video_processor.c @@ -376,6 +376,8 @@ static HRESULT WINAPI video_processor_SetInputType(IMFTransform *iface, DWORD id break; if (i == ARRAY_SIZE(input_types)) return MF_E_INVALIDMEDIATYPE; + if (flags & MFT_SET_TYPE_TEST_ONLY) + return S_OK;
if (impl->input_type) IMFMediaType_Release(impl->input_type); @@ -413,6 +415,8 @@ static HRESULT WINAPI video_processor_SetOutputType(IMFTransform *iface, DWORD i break; if (i == ARRAY_SIZE(output_types)) return MF_E_INVALIDMEDIATYPE; + if (flags & MFT_SET_TYPE_TEST_ONLY) + return S_OK;
if (impl->output_type) IMFMediaType_Release(impl->output_type); diff --git a/dlls/winegstreamer/wma_decoder.c b/dlls/winegstreamer/wma_decoder.c index e2a7a770826..31fb49df1f7 100644 --- a/dlls/winegstreamer/wma_decoder.c +++ b/dlls/winegstreamer/wma_decoder.c @@ -387,6 +387,8 @@ static HRESULT WINAPI transform_SetInputType(IMFTransform *iface, DWORD id, IMFM if (FAILED(IMFMediaType_GetItemType(type, &MF_MT_AUDIO_NUM_CHANNELS, &item_type)) || item_type != MF_ATTRIBUTE_UINT32) return MF_E_INVALIDMEDIATYPE; + if (flags & MFT_SET_TYPE_TEST_ONLY) + return S_OK;
if (!decoder->input_type && FAILED(hr = MFCreateMediaType(&decoder->input_type))) return hr; @@ -443,9 +445,6 @@ static HRESULT WINAPI transform_SetOutputType(IMFTransform *iface, DWORD id, IMF return hr; }
- if (FAILED(IMFMediaType_SetUINT32(decoder->input_type, &MF_MT_AUDIO_BITS_PER_SAMPLE, sample_size))) - return MF_E_INVALIDMEDIATYPE; - if (FAILED(IMFMediaType_GetItemType(type, &MF_MT_AUDIO_AVG_BYTES_PER_SECOND, &item_type)) || item_type != MF_ATTRIBUTE_UINT32) return MF_E_INVALIDMEDIATYPE; @@ -461,6 +460,11 @@ static HRESULT WINAPI transform_SetOutputType(IMFTransform *iface, DWORD id, IMF if (FAILED(IMFMediaType_GetItemType(type, &MF_MT_AUDIO_BLOCK_ALIGNMENT, &item_type)) || item_type != MF_ATTRIBUTE_UINT32) return MF_E_INVALIDMEDIATYPE; + if (flags & MFT_SET_TYPE_TEST_ONLY) + return S_OK; + + if (FAILED(IMFMediaType_SetUINT32(decoder->input_type, &MF_MT_AUDIO_BITS_PER_SAMPLE, sample_size))) + return MF_E_INVALIDMEDIATYPE;
if (!decoder->output_type && FAILED(hr = MFCreateMediaType(&decoder->output_type))) return hr;
From: R��mi Bernon rbernon@codeweavers.com
--- dlls/mf/tests/mf.c | 6 +++--- dlls/mf/topology_loader.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index 35ccde2f9cb..78ad828f2bd 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -3027,13 +3027,13 @@ static void test_topology_loader(void) /* Float -> PCM, refuse input type, add converter */ .input_type = &audio_float_44100, .output_type = &audio_pcm_48000, .sink_method = MF_CONNECT_DIRECT, .source_method = -1, .expected_result = MF_E_NO_MORE_TYPES, - .flags = LOADER_SET_INVALID_INPUT | LOADER_ADD_RESAMPLER_MFT | LOADER_EXPECTED_CONVERTER | LOADER_TODO, + .flags = LOADER_SET_INVALID_INPUT | LOADER_ADD_RESAMPLER_MFT | LOADER_EXPECTED_CONVERTER, }, { /* Float -> PCM, refuse input type, add converter, allow resampler output type */ .input_type = &audio_float_44100, .output_type = &audio_pcm_48000_resampler, .sink_method = MF_CONNECT_DIRECT, .source_method = -1, .expected_result = S_OK, - .flags = LOADER_SET_INVALID_INPUT | LOADER_ADD_RESAMPLER_MFT | LOADER_EXPECTED_CONVERTER | LOADER_TODO, + .flags = LOADER_SET_INVALID_INPUT | LOADER_ADD_RESAMPLER_MFT | LOADER_EXPECTED_CONVERTER, },
{ @@ -3490,7 +3490,7 @@ todo_wine { else ok(!handler.enum_count, "got %lu GetMediaTypeByIndex\n", handler.enum_count);
- todo_wine_if((test->flags & LOADER_NO_CURRENT_OUTPUT) && !(test->flags & LOADER_SET_MEDIA_TYPES)) + todo_wine_if(test->flags & LOADER_NO_CURRENT_OUTPUT) ok(!handler.set_current_count, "got %lu SetCurrentMediaType\n", handler.set_current_count);
if (handler.current_type) diff --git a/dlls/mf/topology_loader.c b/dlls/mf/topology_loader.c index ab694379237..0c42a93511b 100644 --- a/dlls/mf/topology_loader.c +++ b/dlls/mf/topology_loader.c @@ -498,7 +498,7 @@ static HRESULT topology_loader_resolve_branches(struct topoloader_context *conte WARN("Failed to clone nodes for branch %s\n", debugstr_topology_branch(branch)); else hr = topology_branch_connect(context->output_topology, MF_CONNECT_ALLOW_DECODER, - branch, enumerate_source_types); + branch, enumerate_source_types || node_type == MF_TOPOLOGY_TRANSFORM_NODE);
topology_branch_destroy(branch); if (FAILED(hr))
From: R��mi Bernon rbernon@codeweavers.com
--- dlls/mf/session.c | 126 ++++++++++++++++++++++++++++++++++++++++++--- dlls/mf/tests/mf.c | 17 ------ 2 files changed, 120 insertions(+), 23 deletions(-)
diff --git a/dlls/mf/session.c b/dlls/mf/session.c index 8be3ffcd7f3..a7e93e327f2 100644 --- a/dlls/mf/session.c +++ b/dlls/mf/session.c @@ -1934,20 +1934,134 @@ static HRESULT WINAPI mfsession_QueueEvent(IMFMediaSession *iface, MediaEventTyp return IMFMediaEventQueue_QueueEventParamVar(session->event_queue, event_type, ext_type, hr, value); }
+static HRESULT session_check_stream_descriptor(IMFPresentationDescriptor *pd, IMFStreamDescriptor *sd) +{ + IMFStreamDescriptor *selected_sd; + DWORD i, count; + BOOL selected; + HRESULT hr; + + if (FAILED(hr = IMFPresentationDescriptor_GetStreamDescriptorCount(pd, &count))) + { + WARN("Failed to get stream descriptor count, hr %#lx.\n", hr); + return MF_E_TOPO_STREAM_DESCRIPTOR_NOT_SELECTED; + } + + for (i = 0; i < count; ++i) + { + if (FAILED(hr = IMFPresentationDescriptor_GetStreamDescriptorByIndex(pd, i, + &selected, &selected_sd))) + { + WARN("Failed to get stream descriptor %lu, hr %#lx.\n", i, hr); + return MF_E_TOPO_STREAM_DESCRIPTOR_NOT_SELECTED; + } + IMFStreamDescriptor_Release(selected_sd); + + if (selected_sd == sd) + { + if (selected) + return S_OK; + + WARN("Presentation descriptor %p stream %p is not selected.\n", pd, sd); + return MF_E_TOPO_STREAM_DESCRIPTOR_NOT_SELECTED; + } + } + + WARN("Failed to find stream descriptor %lu, hr %#lx.\n", i, hr); + return MF_E_TOPO_STREAM_DESCRIPTOR_NOT_SELECTED; +} + +static HRESULT session_check_topology(IMFTopology *topology) +{ + MF_TOPOLOGY_TYPE node_type; + IMFTopologyNode *node; + WORD node_count, i; + HRESULT hr; + + if (!topology) + return S_OK; + + if (FAILED(IMFTopology_GetNodeCount(topology, &node_count)) + || node_count == 0) + return E_INVALIDARG; + + for (i = 0; i < node_count; ++i) + { + if (FAILED(hr = IMFTopology_GetNode(topology, i, &node))) + break; + + if (FAILED(hr = IMFTopologyNode_GetNodeType(node, &node_type))) + { + IMFTopologyNode_Release(node); + break; + } + + switch (node_type) + { + case MF_TOPOLOGY_SOURCESTREAM_NODE: + { + IMFPresentationDescriptor *pd; + IMFStreamDescriptor *sd; + IMFMediaSource *source; + + if (FAILED(hr = IMFTopologyNode_GetUnknown(node, &MF_TOPONODE_SOURCE, &IID_IMFMediaSource, + (void **)&source))) + { + WARN("Missing MF_TOPONODE_SOURCE, hr %#lx.\n", hr); + IMFTopologyNode_Release(node); + return MF_E_TOPO_MISSING_SOURCE; + } + IMFMediaSource_Release(source); + + if (FAILED(hr = IMFTopologyNode_GetUnknown(node, &MF_TOPONODE_PRESENTATION_DESCRIPTOR, + &IID_IMFPresentationDescriptor, (void **)&pd))) + { + WARN("Missing MF_TOPONODE_PRESENTATION_DESCRIPTOR, hr %#lx.\n", hr); + IMFTopologyNode_Release(node); + return MF_E_TOPO_MISSING_PRESENTATION_DESCRIPTOR; + } + + if (FAILED(hr = IMFTopologyNode_GetUnknown(node, &MF_TOPONODE_STREAM_DESCRIPTOR, + &IID_IMFStreamDescriptor, (void **)&sd))) + { + WARN("Missing MF_TOPONODE_STREAM_DESCRIPTOR, hr %#lx.\n", hr); + IMFPresentationDescriptor_Release(pd); + IMFTopologyNode_Release(node); + return MF_E_TOPO_MISSING_STREAM_DESCRIPTOR; + } + + hr = session_check_stream_descriptor(pd, sd); + IMFPresentationDescriptor_Release(pd); + IMFStreamDescriptor_Release(sd); + if (FAILED(hr)) + { + IMFTopologyNode_Release(node); + return hr; + } + + break; + } + + default: + break; + } + + IMFTopologyNode_Release(node); + } + + return hr; +} + static HRESULT WINAPI mfsession_SetTopology(IMFMediaSession *iface, DWORD flags, IMFTopology *topology) { struct media_session *session = impl_from_IMFMediaSession(iface); struct session_op *op; - WORD node_count = 0; HRESULT hr;
TRACE("%p, %#lx, %p.\n", iface, flags, topology);
- if (topology) - { - if (FAILED(IMFTopology_GetNodeCount(topology, &node_count)) || node_count == 0) - return E_INVALIDARG; - } + if (FAILED(hr = session_check_topology(topology))) + return hr;
if (FAILED(hr = create_session_op(SESSION_CMD_SET_TOPOLOGY, &op))) return hr; diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index 78ad828f2bd..2469b60d8f2 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -2252,29 +2252,13 @@ static void test_media_session_events(void) ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IMFMediaSession_SetTopology(session, 0, topology); - todo_wine ok(hr == MF_E_TOPO_MISSING_SOURCE, "Unexpected hr %#lx.\n", hr); - if (hr == S_OK) - { - hr = wait_media_event(session, callback, MESessionTopologySet, 1000, &propvar); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - PropVariantClear(&propvar); - handler.enum_count = handler.set_current_count = 0; - }
source = create_test_source(pd); init_source_node(source, -1, src_node, pd, sd);
hr = IMFMediaSession_SetTopology(session, 0, topology); - todo_wine ok(hr == MF_E_TOPO_STREAM_DESCRIPTOR_NOT_SELECTED, "Unexpected hr %#lx.\n", hr); - if (hr == S_OK) - { - hr = wait_media_event(session, callback, MESessionTopologySet, 1000, &propvar); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - PropVariantClear(&propvar); - handler.enum_count = handler.set_current_count = 0; - }
hr = IMFMediaSession_ClearTopologies(session); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); @@ -2284,7 +2268,6 @@ static void test_media_session_events(void)
hr = IMFMediaSession_Shutdown(session); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine ok(!media_sink.shutdown, "media sink is shutdown.\n"); media_sink.shutdown = FALSE;
From: R��mi Bernon rbernon@codeweavers.com
Instead of the topology loader. --- dlls/mf/mf_private.h | 1 + dlls/mf/session.c | 72 +++++++++++++++++++++++++++++++++++++++ dlls/mf/tests/mf.c | 4 --- dlls/mf/topology_loader.c | 30 +++++++++++++--- 4 files changed, 99 insertions(+), 8 deletions(-)
diff --git a/dlls/mf/mf_private.h b/dlls/mf/mf_private.h index bd1d6c7537b..69923154b79 100644 --- a/dlls/mf/mf_private.h +++ b/dlls/mf/mf_private.h @@ -117,3 +117,4 @@ extern BOOL mf_is_sample_copier_transform(IMFTransform *transform) DECLSPEC_HIDD extern BOOL mf_is_sar_sink(IMFMediaSink *sink) DECLSPEC_HIDDEN; extern HRESULT topology_node_get_object(IMFTopologyNode *node, REFIID riid, void **obj) DECLSPEC_HIDDEN; extern HRESULT topology_node_get_type_handler(IMFTopologyNode *node, DWORD stream, BOOL output, IMFMediaTypeHandler **handler) DECLSPEC_HIDDEN; +extern HRESULT topology_node_init_media_type(IMFTopologyNode *node, DWORD stream, BOOL output, IMFMediaType **type) DECLSPEC_HIDDEN; diff --git a/dlls/mf/session.c b/dlls/mf/session.c index a7e93e327f2..40e98b14767 100644 --- a/dlls/mf/session.c +++ b/dlls/mf/session.c @@ -591,6 +591,76 @@ static HRESULT session_bind_output_nodes(IMFTopology *topology) return hr; }
+static HRESULT session_init_media_types(IMFTopology *topology) +{ + DWORD input_count, output_count; + MF_TOPOLOGY_TYPE node_type; + WORD node_count, i, j; + IMFTopologyNode *node; + IMFMediaType *type; + HRESULT hr; + + if (FAILED(hr = IMFTopology_GetNodeCount(topology, &node_count))) + return hr; + + for (i = 0; i < node_count; ++i) + { + if (FAILED(hr = IMFTopology_GetNode(topology, i, &node))) + break; + + if (FAILED(hr = IMFTopologyNode_GetNodeType(node, &node_type)) + || node_type != MF_TOPOLOGY_OUTPUT_NODE) + { + IMFTopologyNode_Release(node); + continue; + } + if (FAILED(hr = IMFTopologyNode_GetInputCount(node, &input_count))) + { + IMFTopologyNode_Release(node); + continue; + } + if (FAILED(hr = IMFTopologyNode_GetOutputCount(node, &output_count))) + { + IMFTopologyNode_Release(node); + continue; + } + + for (j = 0; j < input_count; ++j) + { + IMFMediaTypeHandler *handler; + IMFTopologyNode *up_node; + DWORD input; + + if (SUCCEEDED(hr = IMFTopologyNode_GetInput(node, j, &up_node, &input))) + { + hr = topology_node_init_media_type(up_node, input, TRUE, &type); + IMFTopologyNode_Release(up_node); + } + if (FAILED(hr)) + break; + + if (SUCCEEDED(hr = topology_node_get_type_handler(node, j, FALSE, &handler))) + { + hr = IMFMediaTypeHandler_SetCurrentMediaType(handler, type); + IMFMediaTypeHandler_Release(handler); + } + + IMFMediaType_Release(type); + } + + for (j = 0; j < output_count; ++j) + { + if (FAILED(hr = topology_node_init_media_type(node, j, TRUE, &type))) + break; + IMFMediaType_Release(type); + } + + IMFTopologyNode_Release(node); + } + + return hr; +} + static void session_set_caps(struct media_session *session, DWORD caps) { DWORD delta = session->caps ^ caps; @@ -1763,6 +1833,8 @@ static void session_set_topology(struct media_session *session, DWORD flags, IMF
if (SUCCEEDED(hr)) hr = IMFTopoLoader_Load(session->topo_loader, topology, &resolved_topology, NULL /* FIXME? */); + if (SUCCEEDED(hr)) + hr = session_init_media_types(resolved_topology);
if (SUCCEEDED(hr)) { diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index 2469b60d8f2..de2964f3dc9 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -2370,7 +2370,6 @@ static void test_media_session_events(void) PropVariantClear(&propvar);
ok(handler.enum_count, "got %lu GetMediaTypeByIndex\n", handler.enum_count); - todo_wine ok(handler.set_current_count, "got %lu SetCurrentMediaType\n", handler.set_current_count); handler.enum_count = handler.set_current_count = 0;
@@ -2449,7 +2448,6 @@ static void test_media_session_events(void) PropVariantClear(&propvar);
ok(!handler.enum_count, "got %lu GetMediaTypeByIndex\n", handler.enum_count); - todo_wine ok(handler.set_current_count, "got %lu SetCurrentMediaType\n", handler.set_current_count); handler.enum_count = handler.set_current_count = 0;
@@ -3472,8 +3470,6 @@ todo_wine { ok(handler.enum_count, "got %lu GetMediaTypeByIndex\n", handler.enum_count); else ok(!handler.enum_count, "got %lu GetMediaTypeByIndex\n", handler.enum_count); - - todo_wine_if(test->flags & LOADER_NO_CURRENT_OUTPUT) ok(!handler.set_current_count, "got %lu SetCurrentMediaType\n", handler.set_current_count);
if (handler.current_type) diff --git a/dlls/mf/topology_loader.c b/dlls/mf/topology_loader.c index 0c42a93511b..243ac704604 100644 --- a/dlls/mf/topology_loader.c +++ b/dlls/mf/topology_loader.c @@ -306,6 +306,8 @@ static HRESULT topology_branch_connect_indirect(IMFTopology *topology, MF_CONNEC IMFTopologyNode_SetGUID(node, &MF_TOPONODE_TRANSFORM_OBJECTID, &guid);
hr = topology_branch_connect_down(topology, MF_CONNECT_DIRECT, &up_branch, up_type); + if (SUCCEEDED(hr)) + hr = IMFTransform_SetInputType(transform, 0, up_type, 0); if (down_type) { if (SUCCEEDED(hr)) @@ -335,7 +337,7 @@ static HRESULT topology_branch_connect_indirect(IMFTopology *topology, MF_CONNEC return hr; }
-static HRESULT topology_branch_get_current_type(IMFMediaTypeHandler *handler, IMFMediaType **type) +static HRESULT get_first_supported_media_type(IMFMediaTypeHandler *handler, IMFMediaType **type) { IMFMediaType *media_type; HRESULT hr; @@ -359,12 +361,28 @@ static HRESULT topology_branch_get_current_type(IMFMediaTypeHandler *handler, IM return hr; }
+HRESULT topology_node_init_media_type(IMFTopologyNode *node, DWORD stream, BOOL output, IMFMediaType **type) +{ + IMFMediaTypeHandler *handler; + HRESULT hr; + + if (SUCCEEDED(hr = topology_node_get_type_handler(node, stream, output, &handler))) + { + if (SUCCEEDED(hr = get_first_supported_media_type(handler, type))) + hr = IMFMediaTypeHandler_SetCurrentMediaType(handler, *type); + IMFMediaTypeHandler_Release(handler); + } + + return hr; +} + static HRESULT topology_branch_connect_down(IMFTopology *topology, MF_CONNECT_METHOD method_mask, struct topology_branch *branch, IMFMediaType *up_type) { IMFMediaTypeHandler *down_handler; IMFMediaType *down_type = NULL; MF_CONNECT_METHOD method; + MF_TOPOLOGY_TYPE type; DWORD flags; HRESULT hr;
@@ -377,7 +395,7 @@ static HRESULT topology_branch_connect_down(IMFTopology *topology, MF_CONNECT_ME if (FAILED(hr = topology_node_get_type_handler(branch->down.node, branch->down.stream, FALSE, &down_handler))) return hr;
- if (SUCCEEDED(hr = topology_branch_get_current_type(down_handler, &down_type)) + if (SUCCEEDED(hr = get_first_supported_media_type(down_handler, &down_type)) && IMFMediaType_IsEqual(up_type, down_type, &flags) == S_OK) { TRACE("Connecting branch %s with current type %p.\n", debugstr_topology_branch(branch), up_type); @@ -385,10 +403,14 @@ static HRESULT topology_branch_connect_down(IMFTopology *topology, MF_CONNECT_ME goto done; }
- if (SUCCEEDED(hr = IMFMediaTypeHandler_IsMediaTypeSupported(down_handler, up_type, NULL)) - && SUCCEEDED(hr = IMFMediaTypeHandler_SetCurrentMediaType(down_handler, up_type))) + if (SUCCEEDED(hr = IMFMediaTypeHandler_IsMediaTypeSupported(down_handler, up_type, NULL))) { TRACE("Connected branch %s with upstream type %p.\n", debugstr_topology_branch(branch), up_type); + + if (SUCCEEDED(IMFTopologyNode_GetNodeType(branch->down.node, &type)) && type == MF_TOPOLOGY_TRANSFORM_NODE + && FAILED(hr = IMFMediaTypeHandler_SetCurrentMediaType(down_handler, up_type))) + WARN("Failed to set transform node media type, hr %#lx\n", hr); + hr = IMFTopologyNode_ConnectOutput(branch->up.node, branch->up.stream, branch->down.node, branch->down.stream); goto done; }
This again does not work for a test player attached at https://gitlab.winehq.org/wine/wine/-/merge_requests/607#note_6300 . It does not fail or crash, but instead shows black frames. Patch 4 is responsible for this.
On Wed Sep 7 17:37:53 2022 +0000, Nikolay Sivov wrote:
This again does not work for a test player attached at https://gitlab.winehq.org/wine/wine/-/merge_requests/607#note_6300 . It does not fail or crash, but instead shows black frames. Patch 4 is responsible for this.
Hmm okay, though I believe I tested it with it, I'll have a better look.
Bernhard Kölbl (@besentv) commented about dlls/mf/session.c:
- {
if (FAILED(hr = IMFTopology_GetNode(topology, i, &node)))
break;
if (FAILED(hr = IMFTopologyNode_GetNodeType(node, &node_type))
|| node_type != MF_TOPOLOGY_OUTPUT_NODE)
{
IMFTopologyNode_Release(node);
continue;
}
if (FAILED(hr = IMFTopologyNode_GetInputCount(node, &input_count)))
{
IMFTopologyNode_Release(node);
continue;
}
if (FAILED(hr = IMFTopologyNode_GetOutputCount(node, &output_count)))
Just a few comments about things that I came across while debugging this commit:
Output nodes don't have outputs, so iterating over them doesn't seem necessary here.
Bernhard Kölbl (@besentv) commented about dlls/mf/session.c:
IMFTopologyNode_Release(node);
continue;
}
if (FAILED(hr = IMFTopologyNode_GetOutputCount(node, &output_count)))
{
IMFTopologyNode_Release(node);
continue;
}
for (j = 0; j < input_count; ++j)
{
IMFMediaTypeHandler *handler;
IMFTopologyNode *up_node;
DWORD input;
if (SUCCEEDED(hr = IMFTopologyNode_GetInput(node, j, &up_node, &input)))
Input should be named output, because it's the up_node outputs data on this index.
Bernhard Kölbl (@besentv) commented about dlls/mf/session.c:
{
IMFTopologyNode_Release(node);
continue;
}
if (FAILED(hr = IMFTopologyNode_GetInputCount(node, &input_count)))
{
IMFTopologyNode_Release(node);
continue;
}
if (FAILED(hr = IMFTopologyNode_GetOutputCount(node, &output_count)))
{
IMFTopologyNode_Release(node);
continue;
}
for (j = 0; j < input_count; ++j)
Afaiu it's always given that output nodes only have one input, so this could probably be omitted as well.
Bernhard Kölbl (@besentv) commented about dlls/mf/topology_loader.c:
return hr;
}
+HRESULT topology_node_init_media_type(IMFTopologyNode *node, DWORD stream, BOOL output, IMFMediaType **type) +{
- IMFMediaTypeHandler *handler;
- HRESULT hr;
- if (SUCCEEDED(hr = topology_node_get_type_handler(node, stream, output, &handler)))
- {
if (SUCCEEDED(hr = get_first_supported_media_type(handler, type)))
Contrary to topology_branch_foreach_up_types, this only tries to set the first supported type instead of going through all.
This merge request was closed by Rémi Bernon.