[PATCH 0/5] MR10474: mf/topology_loader: Misc cleanup / refactoring.
From: Rémi Bernon <rbernon@codeweavers.com> --- dlls/mf/mf_private.h | 1 + dlls/mf/session.c | 23 ++++-------------- dlls/mf/topology.c | 25 +++++++++++++------- dlls/mf/topology_loader.c | 50 ++++++++++++++++----------------------- 4 files changed, 42 insertions(+), 57 deletions(-) diff --git a/dlls/mf/mf_private.h b/dlls/mf/mf_private.h index 1f2ef17a8c9..c1e83b2d71a 100644 --- a/dlls/mf/mf_private.h +++ b/dlls/mf/mf_private.h @@ -119,6 +119,7 @@ extern HRESULT urlmon_scheme_handler_construct(REFIID riid, void **obj); extern BOOL mf_is_sample_copier_transform(IMFTransform *transform); extern BOOL mf_is_sar_sink(IMFMediaSink *sink); extern HRESULT create_topology(TOPOID id, IMFTopology **topology); +extern MF_TOPOLOGY_TYPE topology_node_get_type(IMFTopologyNode *node); extern HRESULT topology_node_get_object(IMFTopologyNode *node, REFIID riid, void **obj); extern HRESULT topology_node_get_type_handler(IMFTopologyNode *node, DWORD stream, BOOL output, IMFMediaTypeHandler **handler); extern HRESULT topology_node_init_media_type(IMFTopologyNode *node, DWORD stream, BOOL output, IMFMediaType **type); diff --git a/dlls/mf/session.c b/dlls/mf/session.c index e6407934fdd..db837c369d7 100644 --- a/dlls/mf/session.c +++ b/dlls/mf/session.c @@ -567,7 +567,6 @@ static void session_set_topo_status(struct media_session *session, HRESULT statu static HRESULT session_bind_output_nodes(IMFTopology *topology) { - MF_TOPOLOGY_TYPE node_type; IMFStreamSink *stream_sink; IMFMediaSink *media_sink; WORD node_count = 0, i; @@ -584,7 +583,7 @@ static HRESULT session_bind_output_nodes(IMFTopology *topology) if (FAILED(hr = IMFTopology_GetNode(topology, i, &node))) break; - if (FAILED(hr = IMFTopologyNode_GetNodeType(node, &node_type)) || node_type != MF_TOPOLOGY_OUTPUT_NODE) + if (topology_node_get_type(node) != MF_TOPOLOGY_OUTPUT_NODE) { IMFTopologyNode_Release(node); continue; @@ -632,7 +631,6 @@ static HRESULT session_bind_output_nodes(IMFTopology *topology) static HRESULT session_init_media_types(IMFTopology *topology) { - MF_TOPOLOGY_TYPE node_type; WORD node_count, i, j; IMFTopologyNode *node; IMFMediaType *type; @@ -648,8 +646,7 @@ static HRESULT session_init_media_types(IMFTopology *topology) break; if (FAILED(hr = IMFTopologyNode_GetInputCount(node, &input_count)) - || FAILED(hr = IMFTopologyNode_GetNodeType(node, &node_type)) - || node_type != MF_TOPOLOGY_OUTPUT_NODE) + || topology_node_get_type(node) != MF_TOPOLOGY_OUTPUT_NODE) { IMFTopologyNode_Release(node); continue; @@ -827,7 +824,6 @@ static void release_topo_node(struct topo_node *node) static void session_shutdown_current_topology(struct media_session *session) { unsigned int shutdown, force_shutdown; - MF_TOPOLOGY_TYPE node_type; IMFStreamSink *stream_sink; IMFTopology *topology; IMFTopologyNode *node; @@ -843,8 +839,7 @@ static void session_shutdown_current_topology(struct media_session *session) while (SUCCEEDED(IMFTopology_GetNode(topology, idx++, &node))) { - if (SUCCEEDED(IMFTopologyNode_GetNodeType(node, &node_type)) && - node_type == MF_TOPOLOGY_OUTPUT_NODE) + if (topology_node_get_type(node) == MF_TOPOLOGY_OUTPUT_NODE) { shutdown = 1; IMFTopologyNode_GetUINT32(node, &MF_TOPONODE_NOSHUTDOWN_ON_REMOVE, &shutdown); @@ -1888,7 +1883,6 @@ static HRESULT session_append_node(struct media_session *session, IMFTopologyNod if (!(topo_node = calloc(1, sizeof(*topo_node)))) return E_OUTOFMEMORY; - IMFTopologyNode_GetNodeType(node, &topo_node->type); IMFTopologyNode_GetTopoNodeID(node, &topo_node->node_id); topo_node->node = node; IMFTopologyNode_AddRef(topo_node->node); @@ -1896,7 +1890,7 @@ static HRESULT session_append_node(struct media_session *session, IMFTopologyNod if (SUCCEEDED(IMFTopologyNode_GetUINT32(node, &MF_TOPONODE_MARKIN_HERE, &value)) && value) topo_node->flags |= TOPO_NODE_MARKIN_HERE; - switch (topo_node->type) + switch ((topo_node->type = topology_node_get_type(node))) { case MF_TOPOLOGY_OUTPUT_NODE: topo_node->u.sink.notify_cb.lpVtbl = &node_sample_allocator_cb_vtbl; @@ -2338,7 +2332,6 @@ static HRESULT session_check_stream_descriptor(IMFPresentationDescriptor *pd, IM static HRESULT session_check_topology(IMFTopology *topology) { - MF_TOPOLOGY_TYPE node_type; IMFTopologyNode *node; WORD node_count, i; HRESULT hr; @@ -2355,13 +2348,7 @@ static HRESULT session_check_topology(IMFTopology *topology) if (FAILED(hr = IMFTopology_GetNode(topology, i, &node))) break; - if (FAILED(hr = IMFTopologyNode_GetNodeType(node, &node_type))) - { - IMFTopologyNode_Release(node); - break; - } - - switch (node_type) + switch (topology_node_get_type(node)) { case MF_TOPOLOGY_SOURCESTREAM_NODE: { diff --git a/dlls/mf/topology.c b/dlls/mf/topology.c index 572d4d426d3..48df8a6ec8b 100644 --- a/dlls/mf/topology.c +++ b/dlls/mf/topology.c @@ -1645,7 +1645,6 @@ static HRESULT WINAPI topology_node_GetInputPrefType(IMFTopologyNode *iface, DWO static HRESULT WINAPI topology_node_CloneFrom(IMFTopologyNode *iface, IMFTopologyNode *src_node) { struct topology_node *node = impl_from_IMFTopologyNode(iface); - MF_TOPOLOGY_TYPE node_type; IMFMediaType *mediatype; IUnknown *object; DWORD count, i; @@ -1654,10 +1653,7 @@ static HRESULT WINAPI topology_node_CloneFrom(IMFTopologyNode *iface, IMFTopolog TRACE("%p, %p.\n", iface, src_node); - if (FAILED(hr = IMFTopologyNode_GetNodeType(src_node, &node_type))) - return hr; - - if (node->node_type != node_type) + if (node->node_type != topology_node_get_type(src_node)) return MF_E_INVALIDREQUEST; if (FAILED(hr = IMFTopologyNode_GetTopoNodeID(src_node, &topoid))) @@ -1783,6 +1779,20 @@ static HRESULT create_topology_node(MF_TOPOLOGY_TYPE node_type, struct topology_ return S_OK; } +MF_TOPOLOGY_TYPE topology_node_get_type(IMFTopologyNode *node) +{ + MF_TOPOLOGY_TYPE type; + HRESULT hr; + + if (FAILED(hr = IMFTopologyNode_GetNodeType(node, &type))) + { + ERR("Failed to get node type, hr %#lx.\n", hr); + return -1; + } + + return type; +} + HRESULT topology_node_get_object(IMFTopologyNode *node, REFIID riid, void **obj) { IUnknown *unk; @@ -2013,10 +2023,7 @@ HRESULT topology_node_get_type_handler(IMFTopologyNode *node, DWORD stream, IMFTransform *transform; HRESULT hr; - if (FAILED(hr = IMFTopologyNode_GetNodeType(node, &node_type))) - return hr; - - switch (node_type) + switch ((node_type = topology_node_get_type(node))) { case MF_TOPOLOGY_OUTPUT_NODE: if (output || stream) diff --git a/dlls/mf/topology_loader.c b/dlls/mf/topology_loader.c index 012e519af8a..65d9a5e1df8 100644 --- a/dlls/mf/topology_loader.c +++ b/dlls/mf/topology_loader.c @@ -92,7 +92,6 @@ struct topoloader_context static HRESULT topology_loader_clone_node(struct topoloader_context *context, IMFTopologyNode *node, IMFTopologyNode **clone) { - MF_TOPOLOGY_TYPE node_type; HRESULT hr; TOPOID id; @@ -100,9 +99,7 @@ static HRESULT topology_loader_clone_node(struct topoloader_context *context, IM return hr; if (SUCCEEDED(hr = IMFTopology_GetNodeByID(context->output_topology, id, clone))) return hr; - - IMFTopologyNode_GetNodeType(node, &node_type); - if (FAILED(hr = MFCreateTopologyNode(node_type, clone))) + if (FAILED(hr = MFCreateTopologyNode(topology_node_get_type(node), clone))) return hr; hr = IMFTopologyNode_CloneFrom(*clone, node); @@ -417,7 +414,6 @@ static HRESULT topology_branch_connect_down(IMFTopology *topology, MF_CONNECT_ME { IMFMediaTypeHandler *down_handler; IMFMediaType *down_type = NULL; - MF_TOPOLOGY_TYPE type; UINT32 method; DWORD flags; HRESULT hr; @@ -443,7 +439,7 @@ static HRESULT topology_branch_connect_down(IMFTopology *topology, MF_CONNECT_ME { 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 + if (topology_node_get_type(branch->down.node) == MF_TOPOLOGY_TRANSFORM_NODE && FAILED(hr = IMFMediaTypeHandler_SetCurrentMediaType(down_handler, up_type))) WARN("Failed to set transform node media type, hr %#lx\n", hr); @@ -542,7 +538,6 @@ static HRESULT topology_loader_resolve_branches(struct topoloader_context *conte { struct list new_branches = LIST_INIT(new_branches); struct topology_branch *branch, *next; - MF_TOPOLOGY_TYPE node_type; HRESULT hr = S_OK; LIST_FOR_EACH_ENTRY_SAFE(branch, next, branches, struct topology_branch, entry) @@ -551,14 +546,12 @@ static HRESULT topology_loader_resolve_branches(struct topoloader_context *conte if (FAILED(hr = topology_node_list_branches(branch->down.node, &new_branches))) WARN("Failed to list branches from branch %s\n", debugstr_topology_branch(branch)); - else if (FAILED(hr = IMFTopologyNode_GetNodeType(branch->up.node, &node_type))) - WARN("Failed to get source node type for branch %s\n", debugstr_topology_branch(branch)); else if (FAILED(hr = topology_branch_clone_nodes(context, branch))) 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); - if (hr == MF_E_INVALIDMEDIATYPE && !enumerate_source_types && node_type == MF_TOPOLOGY_TRANSFORM_NODE) + if (hr == MF_E_INVALIDMEDIATYPE && !enumerate_source_types && topology_node_get_type(branch->up.node) == MF_TOPOLOGY_TRANSFORM_NODE) hr = topology_branch_connect(context->output_topology, MF_CONNECT_ALLOW_DECODER, branch, TRUE); } @@ -757,7 +750,6 @@ static HRESULT topology_loader_connect_d3d_aware_sink(struct topoloader_context static void topology_loader_resolve_complete(struct topoloader_context *context) { MFTOPOLOGY_DXVA_MODE dxva_mode; - MF_TOPOLOGY_TYPE node_type; IMFTopologyNode *node; WORD i, node_count; HRESULT hr; @@ -771,22 +763,23 @@ static void topology_loader_resolve_complete(struct topoloader_context *context) { if (SUCCEEDED(IMFTopology_GetNode(context->output_topology, i, &node))) { - IMFTopologyNode_GetNodeType(node, &node_type); - - if (node_type == MF_TOPOLOGY_OUTPUT_NODE) - { - /* Set MF_TOPONODE_STREAMID for all outputs. */ - if (FAILED(IMFTopologyNode_GetItem(node, &MF_TOPONODE_STREAMID, NULL))) - IMFTopologyNode_SetUINT32(node, &MF_TOPONODE_STREAMID, 0); - - if (FAILED(hr = topology_loader_connect_d3d_aware_sink(context, node, dxva_mode))) - WARN("Failed to connect D3D-aware input, hr %#lx.\n", hr); - } - else if (node_type == MF_TOPOLOGY_SOURCESTREAM_NODE) + switch (topology_node_get_type(node)) { - /* Set MF_TOPONODE_MEDIASTART for all sources. */ - if (FAILED(IMFTopologyNode_GetItem(node, &MF_TOPONODE_MEDIASTART, NULL))) - IMFTopologyNode_SetUINT64(node, &MF_TOPONODE_MEDIASTART, 0); + case MF_TOPOLOGY_OUTPUT_NODE: + /* Set MF_TOPONODE_STREAMID for all outputs. */ + if (FAILED(IMFTopologyNode_GetItem(node, &MF_TOPONODE_STREAMID, NULL))) + IMFTopologyNode_SetUINT32(node, &MF_TOPONODE_STREAMID, 0); + + if (FAILED(hr = topology_loader_connect_d3d_aware_sink(context, node, dxva_mode))) + WARN("Failed to connect D3D-aware input, hr %#lx.\n", hr); + break; + case MF_TOPOLOGY_SOURCESTREAM_NODE: + /* Set MF_TOPONODE_MEDIASTART for all sources. */ + if (FAILED(IMFTopologyNode_GetItem(node, &MF_TOPONODE_MEDIASTART, NULL))) + IMFTopologyNode_SetUINT64(node, &MF_TOPONODE_MEDIASTART, 0); + break; + default: + ; } IMFTopologyNode_Release(node); @@ -802,7 +795,6 @@ static HRESULT WINAPI topology_loader_Load(IMFTopoLoader *iface, IMFTopology *in struct topology_branch *branch, *next; UINT32 enumerate_source_types; IMFTopology *output_topology; - MF_TOPOLOGY_TYPE node_type; IMFTopologyNode *node; unsigned short i = 0; IMFStreamSink *sink; @@ -823,9 +815,7 @@ static HRESULT WINAPI topology_loader_Load(IMFTopoLoader *iface, IMFTopology *in */ while (SUCCEEDED(IMFTopology_GetNode(input_topology, i++, &node))) { - IMFTopologyNode_GetNodeType(node, &node_type); - - switch (node_type) + switch (topology_node_get_type(node)) { case MF_TOPOLOGY_OUTPUT_NODE: if (SUCCEEDED(hr = IMFTopologyNode_GetObject(node, &object))) -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10474
From: Conor McCarthy <cmccarthy@codeweavers.com> --- dlls/mf/main.c | 183 ++++++++++++++++++++++++++++++++++++++ dlls/mf/mf_private.h | 2 + dlls/mf/topology_loader.c | 28 ++++-- 3 files changed, 206 insertions(+), 7 deletions(-) diff --git a/dlls/mf/main.c b/dlls/mf/main.c index 3dfa551bfa5..3aa81f4b454 100644 --- a/dlls/mf/main.c +++ b/dlls/mf/main.c @@ -36,6 +36,189 @@ WINE_DEFAULT_DEBUG_CHANNEL(mfplat); extern const GUID CLSID_FileSchemePlugin; +struct guid_def +{ + const GUID *guid; + const char *name; +}; + +static int __cdecl debug_compare_guid(const void *a, const void *b) +{ + const GUID *guid = a; + const struct guid_def *guid_def = b; + return memcmp(guid, guid_def->guid, sizeof(*guid)); +} + +/* copied from mfplat module */ +const char *debugstr_mf_guid(const GUID *guid) +{ + static const struct guid_def guid_defs[] = + { +#define X(g) { &(g), #g } + X(MFAudioFormat_ADTS), + X(MFAudioFormat_PCM), + X(MFAudioFormat_PCM_HDCP), + X(MFAudioFormat_Float), + X(MFAudioFormat_DTS), + X(MFAudioFormat_DRM), + X(MFAudioFormat_MSP1), + X(MFAudioFormat_Vorbis), + X(MFAudioFormat_AAC), + X(MFVideoFormat_RGB24), + X(MFVideoFormat_ARGB32), + X(MFVideoFormat_RGB32), + X(MFVideoFormat_RGB565), + X(MFVideoFormat_RGB555), + X(MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_AUDCAP_GUID), + X(MFT_CATEGORY_MULTIPLEXER), + X(MFVideoFormat_A2R10G10B10), + X(MFT_CATEGORY_VIDEO_EFFECT), + X(MFMediaType_Script), + X(MFMediaType_Image), + X(MFMediaType_HTML), + X(MFMediaType_Binary), + X(MFVideoFormat_MPEG2), + X(MFMediaType_FileTransfer), + X(MFVideoFormat_RGB8), + X(MFAudioFormat_Dolby_AC3), + X(MFVideoFormat_L8), + X(MFAudioFormat_LPCM), + X(MFVideoFormat_420O), + X(MFVideoFormat_AI44), + X(MFVideoFormat_AV1), + X(MFVideoFormat_AYUV), + X(MFVideoFormat_H263), + X(MFVideoFormat_H264), + X(MFVideoFormat_H265), + X(MFVideoFormat_HEVC), + X(MFVideoFormat_HEVC_ES), + X(MFT_CATEGORY_AUDIO_EFFECT), + X(MFVideoFormat_I420), + X(MFVideoFormat_IYUV), + X(MFT_CATEGORY_VIDEO_DECODER), + X(MFVideoFormat_M4S2), + X(MFVideoFormat_MJPG), + X(MFVideoFormat_MP43), + X(MFVideoFormat_MP4S), + X(MFVideoFormat_MP4V), + X(MFVideoFormat_MPG1), + X(MFVideoFormat_MSS1), + X(MFVideoFormat_MSS2), + X(MFVideoFormat_NV11), + X(MFVideoFormat_NV12), + X(MFVideoFormat_ORAW), + X(MFAudioFormat_Opus), + X(MFAudioFormat_MPEG), + X(MFVideoFormat_D16), + X(MFVideoFormat_P010), + X(MFVideoFormat_P016), + X(MFVideoFormat_P210), + X(MFVideoFormat_P216), + X(MFVideoFormat_L16), + X(MFAudioFormat_MP3), + X(MFVideoFormat_UYVY), + X(MFVideoFormat_VP10), + X(MFVideoFormat_VP80), + X(MFVideoFormat_VP90), + X(MFVideoFormat_WMV1), + X(MFVideoFormat_WMV2), + X(MFVideoFormat_WMV3), + X(MFVideoFormat_WVC1), + X(MFT_CATEGORY_OTHER), + X(MFVideoFormat_Y210), + X(MFVideoFormat_Y216), + X(MFVideoFormat_Y410), + X(MFVideoFormat_Y416), + X(MFVideoFormat_Y41P), + X(MFVideoFormat_Y41T), + X(MFVideoFormat_Y42T), + X(MFVideoFormat_YUY2), + X(MFVideoFormat_YV12), + X(MFVideoFormat_YVU9), + X(MFVideoFormat_YVYU), + X(MFAudioFormat_WMAudioV8), + X(MFAudioFormat_ALAC), + X(MFAudioFormat_AMR_NB), + X(MFMediaType_Audio), + X(MFAudioFormat_WMAudioV9), + X(MFAudioFormat_AMR_WB), + X(MFAudioFormat_WMAudio_Lossless), + X(MFAudioFormat_AMR_WP), + X(MFAudioFormat_WMASPDIF), + X(MFVideoFormat_DV25), + X(MFVideoFormat_DV50), + X(MFVideoFormat_DVC), + X(MFVideoFormat_DVH1), + X(MFVideoFormat_DVHD), + X(MFVideoFormat_DVSD), + X(MFVideoFormat_DVSL), + X(MFVideoFormat_A16B16G16R16F), + X(MFVideoFormat_v210), + X(MFVideoFormat_v216), + X(MFVideoFormat_v410), + X(MFMediaType_Video), + X(MFAudioFormat_AAC_HDCP), + X(MFT_CATEGORY_DEMULTIPLEXER), + X(MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_GUID), + X(MFT_CATEGORY_VIDEO_ENCODER), + X(MFAudioFormat_Dolby_AC3_HDCP), + X(MFMediaType_Subtitle), + X(MFMediaType_Stream), + X(MFAudioFormat_Dolby_AC3_SPDIF), + X(MFAudioFormat_Float_SpatialObjects), + X(MFMediaType_SAMI), + X(MFAudioFormat_ADTS_HDCP), + X(MFAudioFormat_FLAC), + X(MFAudioFormat_Dolby_DDPlus), + X(MFMediaType_MultiplexedFrames), + X(MFT_CATEGORY_AUDIO_DECODER), + X(MFAudioFormat_Base_HDCP), + X(MFT_CATEGORY_AUDIO_ENCODER), + X(MFVideoFormat_Base_HDCP), + X(MFVideoFormat_H264_HDCP), + X(MFVideoFormat_HEVC_HDCP), + X(MFMediaType_Default), + X(MFMediaType_Protected), + X(MFVideoFormat_H264_ES), + X(MFMediaType_Perception), + X(MFT_CATEGORY_VIDEO_PROCESSOR), +#undef X + }; + struct guid_def *ret = NULL; + + if (guid) + ret = bsearch(guid, guid_defs, ARRAY_SIZE(guid_defs), sizeof(*guid_defs), debug_compare_guid); + + return ret ? wine_dbg_sprintf("%s", ret->name) : wine_dbgstr_guid(guid); +} + +const char *debugstr_media_type(IMFMediaType *media_type) +{ + UINT channels, sps; + GUID subtype = {0}; + UINT64 frame_size; + + if (!media_type) + return "{null}"; + + IMFMediaType_GetGUID(media_type, &MF_MT_SUBTYPE, &subtype); + + if (SUCCEEDED(IMFMediaType_GetUINT64(media_type, &MF_MT_FRAME_SIZE, &frame_size)) && frame_size) + { + return wine_dbg_sprintf("{%p %s %ux%u}", media_type, debugstr_mf_guid(&subtype), (UINT)(frame_size >> 32), (UINT32)frame_size); + } + else if (SUCCEEDED(IMFMediaType_GetUINT32(media_type, &MF_MT_AUDIO_NUM_CHANNELS, &channels)) && channels) + { + if (SUCCEEDED(IMFMediaType_GetUINT32(media_type, &MF_MT_AUDIO_SAMPLES_PER_SECOND, &sps))) + return wine_dbg_sprintf("{%p %s %u-ch %u}", media_type, debugstr_mf_guid(&subtype), channels, sps); + return wine_dbg_sprintf("{%p %s %u-ch}", media_type, debugstr_mf_guid(&subtype), channels); + } + else + { + return wine_dbg_sprintf("{%p %s ?}", media_type, debugstr_mf_guid(&subtype)); + } +} + struct activate_object { IMFActivate IMFActivate_iface; diff --git a/dlls/mf/mf_private.h b/dlls/mf/mf_private.h index c1e83b2d71a..0658db1de15 100644 --- a/dlls/mf/mf_private.h +++ b/dlls/mf/mf_private.h @@ -113,6 +113,8 @@ static inline const char *debugstr_propvar(const PROPVARIANT *v) } } +extern const char *debugstr_media_type(IMFMediaType *media_type); + extern HRESULT file_scheme_handler_construct(REFIID riid, void **obj); extern HRESULT urlmon_scheme_handler_construct(REFIID riid, void **obj); diff --git a/dlls/mf/topology_loader.c b/dlls/mf/topology_loader.c index 65d9a5e1df8..d9ff302389d 100644 --- a/dlls/mf/topology_loader.c +++ b/dlls/mf/topology_loader.c @@ -144,9 +144,23 @@ struct topology_branch struct list entry; }; +static const char *debugstr_topology_type(MF_TOPOLOGY_TYPE type) +{ + switch (type) + { + case MF_TOPOLOGY_OUTPUT_NODE: return "sink"; + case MF_TOPOLOGY_SOURCESTREAM_NODE: return "source"; + case MF_TOPOLOGY_TRANSFORM_NODE: return "transform"; + case MF_TOPOLOGY_TEE_NODE: return "tee"; + default: return "unknown"; + } +} + static const char *debugstr_topology_branch(struct topology_branch *branch) { - return wine_dbg_sprintf("%p:%lu to %p:%lu", branch->up.node, branch->up.stream, branch->down.node, branch->down.stream); + return wine_dbg_sprintf("%s %p:%lu to %s %p:%lu", debugstr_topology_type(topology_node_get_type(branch->up.node)), + branch->up.node, branch->up.stream, debugstr_topology_type(topology_node_get_type(branch->down.node)), + branch->down.node, branch->down.stream); } static HRESULT topology_branch_create(IMFTopologyNode *source, DWORD source_stream, @@ -279,8 +293,8 @@ static HRESULT topology_branch_connect_indirect(IMFTopology *topology, MF_CONNEC GUID category, guid; HRESULT hr; - TRACE("topology %p, method_mask %#x, branch %s, up_type %p, down_type %p.\n", - topology, method_mask, debugstr_topology_branch(branch), up_type, down_type); + TRACE("topology %p, method_mask %#x, branch %s, up_type %s, down_type %s.\n", topology, method_mask, + debugstr_topology_branch(branch), debugstr_media_type(up_type), debugstr_media_type(down_type)); if (FAILED(hr = IMFMediaType_GetMajorType(up_type, &input_info.guidMajorType))) return hr; @@ -418,8 +432,8 @@ static HRESULT topology_branch_connect_down(IMFTopology *topology, MF_CONNECT_ME DWORD flags; HRESULT hr; - TRACE("topology %p, method_mask %#x, branch %s, up_type %p.\n", - topology, method_mask, debugstr_topology_branch(branch), up_type); + TRACE("topology %p, method_mask %#x, branch %s, up_type %s.\n", + topology, method_mask, debugstr_topology_branch(branch), debugstr_media_type(up_type)); if (FAILED(IMFTopologyNode_GetUINT32(branch->down.node, &MF_TOPONODE_CONNECT_METHOD, &method))) method = MF_CONNECT_ALLOW_DECODER; @@ -430,14 +444,14 @@ static HRESULT topology_branch_connect_down(IMFTopology *topology, MF_CONNECT_ME 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); + TRACE("Connecting branch %s with current type %s.\n", debugstr_topology_branch(branch), debugstr_media_type(up_type)); hr = IMFTopologyNode_ConnectOutput(branch->up.node, branch->up.stream, branch->down.node, branch->down.stream); goto done; } 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); + TRACE("Connected branch %s with upstream type %s.\n", debugstr_topology_branch(branch), debugstr_media_type(up_type)); if (topology_node_get_type(branch->down.node) == MF_TOPOLOGY_TRANSFORM_NODE && FAILED(hr = IMFMediaTypeHandler_SetCurrentMediaType(down_handler, up_type))) -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10474
From: Conor McCarthy <cmccarthy@codeweavers.com> This is not necessary and results in some branches being connected twice. --- dlls/mf/topology_loader.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/dlls/mf/topology_loader.c b/dlls/mf/topology_loader.c index d9ff302389d..ff4f192ff0a 100644 --- a/dlls/mf/topology_loader.c +++ b/dlls/mf/topology_loader.c @@ -550,7 +550,6 @@ static HRESULT topology_branch_connect(IMFTopology *topology, MF_CONNECT_METHOD static HRESULT topology_loader_resolve_branches(struct topoloader_context *context, struct list *branches, BOOL enumerate_source_types) { - struct list new_branches = LIST_INIT(new_branches); struct topology_branch *branch, *next; HRESULT hr = S_OK; @@ -558,9 +557,7 @@ static HRESULT topology_loader_resolve_branches(struct topoloader_context *conte { list_remove(&branch->entry); - if (FAILED(hr = topology_node_list_branches(branch->down.node, &new_branches))) - WARN("Failed to list branches from branch %s\n", debugstr_topology_branch(branch)); - else if (FAILED(hr = topology_branch_clone_nodes(context, branch))) + if (FAILED(hr = topology_branch_clone_nodes(context, branch))) WARN("Failed to clone nodes for branch %s\n", debugstr_topology_branch(branch)); else { @@ -574,7 +571,6 @@ static HRESULT topology_loader_resolve_branches(struct topoloader_context *conte break; } - list_move_tail(branches, &new_branches); return hr; } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10474
From: Conor McCarthy <cmccarthy@codeweavers.com> --- dlls/mf/topology_loader.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/dlls/mf/topology_loader.c b/dlls/mf/topology_loader.c index ff4f192ff0a..20d8a80e32b 100644 --- a/dlls/mf/topology_loader.c +++ b/dlls/mf/topology_loader.c @@ -121,18 +121,6 @@ struct transform_output_type IMFActivate *activate; }; -struct connect_context -{ - struct topoloader_context *context; - IMFTopologyNode *upstream_node; - IMFTopologyNode *sink; - IMFMediaTypeHandler *sink_handler; - unsigned int output_index; - unsigned int input_index; - GUID converter_category; - GUID decoder_category; -}; - struct topology_branch { struct -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10474
From: Conor McCarthy <cmccarthy@codeweavers.com> This method is used only for connecting source nodes down, and MF_CONNECT_RESOLVE_INDEPENDENT_OUTPUTTYPES is the only valid flag. --- dlls/mf/topology_loader.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/dlls/mf/topology_loader.c b/dlls/mf/topology_loader.c index 20d8a80e32b..05f999fcaec 100644 --- a/dlls/mf/topology_loader.c +++ b/dlls/mf/topology_loader.c @@ -494,16 +494,18 @@ static HRESULT topology_branch_foreach_up_types(IMFTopology *topology, MF_CONNEC static HRESULT topology_branch_connect(IMFTopology *topology, MF_CONNECT_METHOD method_mask, struct topology_branch *branch, BOOL enumerate_source_types) { - UINT32 method; HRESULT hr; TRACE("topology %p, method_mask %#x, branch %s.\n", topology, method_mask, debugstr_topology_branch(branch)); - if (FAILED(IMFTopologyNode_GetUINT32(branch->up.node, &MF_TOPONODE_CONNECT_METHOD, &method))) - method = MF_CONNECT_DIRECT; - if (enumerate_source_types) { + UINT32 method; + + if (topology_node_get_type(branch->up.node) != MF_TOPOLOGY_SOURCESTREAM_NODE + || FAILED(IMFTopologyNode_GetUINT32(branch->up.node, &MF_TOPONODE_CONNECT_METHOD, &method))) + method = MF_CONNECT_DIRECT; + if (method & MF_CONNECT_RESOLVE_INDEPENDENT_OUTPUTTYPES) hr = topology_branch_foreach_up_types(topology, method_mask & MF_CONNECT_ALLOW_DECODER, branch); else -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10474
This merge request was approved by Rémi Bernon. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10474
participants (3)
-
Conor McCarthy -
Rémi Bernon -
Rémi Bernon (@rbernon)