Commit a343a317 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

mf/topoloader: Set MF_TOPONODE_DECODER for the decoders.

parent 940adfdd
......@@ -1740,7 +1740,6 @@ static void test_topology_loader(void)
{
/* PCM -> PCM, different bps. */
&MFMediaType_Audio,
/* Source type */
{
{
{ &MF_MT_SUBTYPE, WAVE_FORMAT_PCM },
......@@ -1751,7 +1750,6 @@ static void test_topology_loader(void)
{ &MF_MT_AUDIO_BITS_PER_SAMPLE, 8 },
}
},
/* Sink type */
{
{
{ &MF_MT_SUBTYPE, WAVE_FORMAT_PCM },
......@@ -2039,6 +2037,14 @@ todo_wine {
hr = IMFTopologyNode_GetObject(mft_node, &node_object);
ok(hr == S_OK, "Failed to get object of transform node, hr %#x.\n", hr);
if (test->flags & LOADER_EXPECTED_DECODER)
{
value = 0;
hr = IMFTopologyNode_GetUINT32(mft_node, &MF_TOPONODE_DECODER, &value);
ok(hr == S_OK, "Failed to get attribute, hr %#x.\n", hr);
ok(value == 1, "Unexpected value.\n");
}
hr = IUnknown_QueryInterface(node_object, &IID_IMFTransform, (void **)&transform);
ok(hr == S_OK, "Failed to get IMFTransform from transform node's object, hr %#x.\n", hr);
IUnknown_Release(node_object);
......
......@@ -1996,6 +1996,7 @@ struct transform_output_type
{
IMFMediaType *type;
IMFTransform *transform;
const GUID *category;
};
struct connect_context
......@@ -2053,6 +2054,7 @@ static HRESULT topology_loader_enumerate_output_types(const GUID *category, IMFM
unsigned int output_count = 0;
output_type.transform = transform;
output_type.category = category;
while (SUCCEEDED(IMFTransform_GetOutputAvailableType(transform, 0, output_count++, &output_type.type)))
{
hr = connect_func(&output_type, context);
......@@ -2073,6 +2075,24 @@ static HRESULT topology_loader_enumerate_output_types(const GUID *category, IMFM
return hr;
}
static HRESULT topology_loader_create_transform(const struct transform_output_type *output_type,
IMFTopologyNode **node)
{
HRESULT hr;
if (FAILED(hr = MFCreateTopologyNode(MF_TOPOLOGY_TRANSFORM_NODE, node)))
return hr;
IMFTopologyNode_SetObject(*node, (IUnknown *)output_type->transform);
if (IsEqualGUID(output_type->category, &MFT_CATEGORY_AUDIO_DECODER) ||
IsEqualGUID(output_type->category, &MFT_CATEGORY_VIDEO_DECODER))
{
IMFTopologyNode_SetUINT32(*node, &MF_TOPONODE_DECODER, 1);
}
return hr;
}
static HRESULT connect_to_sink(struct transform_output_type *output_type, struct connect_context *context)
{
IMFTopologyNode *node;
......@@ -2081,10 +2101,9 @@ static HRESULT connect_to_sink(struct transform_output_type *output_type, struct
if (FAILED(IMFMediaTypeHandler_IsMediaTypeSupported(context->sink_handler, output_type->type, NULL)))
return MF_E_TRANSFORM_NOT_POSSIBLE_FOR_CURRENT_MEDIATYPE_COMBINATION;
if (FAILED(hr = MFCreateTopologyNode(MF_TOPOLOGY_TRANSFORM_NODE, &node)))
if (FAILED(hr = topology_loader_create_transform(output_type, &node)))
return hr;
IMFTopologyNode_SetObject(node, (IUnknown *)output_type->transform);
IMFTopology_AddNode(context->context->output_topology, node);
IMFTopologyNode_ConnectOutput(context->upstream_node, 0, node, 0);
IMFTopologyNode_ConnectOutput(node, 0, context->sink, 0);
......@@ -2107,11 +2126,9 @@ static HRESULT connect_to_converter(struct transform_output_type *output_type, s
if (SUCCEEDED(connect_to_sink(output_type, context)))
return S_OK;
if (FAILED(hr = MFCreateTopologyNode(MF_TOPOLOGY_TRANSFORM_NODE, &node)))
if (FAILED(hr = topology_loader_create_transform(output_type, &node)))
return hr;
IMFTopologyNode_SetObject(node, (IUnknown *)output_type->transform);
sink_ctx = *context;
sink_ctx.upstream_node = node;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment