"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "dlls/mf/topology.c" between
wine-5.12.tar.xz and wine-5.13.tar.xz

About: Wine is an Open Source implementation of the MS Windows API on top of X, OpenGL, and Unix. Think of Wine as a compatibility layer for running Windows programs. Development release.

topology.c  (wine-5.12.tar.xz):topology.c  (wine-5.13.tar.xz)
skipping to change at line 28 skipping to change at line 28
#include <stdarg.h> #include <stdarg.h>
#define COBJMACROS #define COBJMACROS
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#undef INITGUID #undef INITGUID
#include <guiddef.h> #include <guiddef.h>
#include "mfapi.h"
#include "mferror.h"
#include "mfidl.h" #include "mfidl.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "mf_private.h" #include "mf_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(mfplat); WINE_DEFAULT_DEBUG_CHANNEL(mfplat);
static LONG next_node_id; static LONG next_node_id;
static TOPOID next_topology_id; static TOPOID next_topology_id;
skipping to change at line 1937 skipping to change at line 1935
TRACE("%p, refcount %u.\n", iface, refcount); TRACE("%p, refcount %u.\n", iface, refcount);
if (!refcount) if (!refcount)
{ {
heap_free(loader); heap_free(loader);
} }
return refcount; return refcount;
} }
struct topoloader_context
{
IMFTopology *input_topology;
IMFTopology *output_topology;
unsigned int marker;
GUID key;
};
static IMFTopologyNode *topology_loader_get_node_for_marker(struct topoloader_co
ntext *context, TOPOID *id)
{
IMFTopologyNode *node;
unsigned short i = 0;
unsigned int value;
while (SUCCEEDED(IMFTopology_GetNode(context->output_topology, i++, &node)))
{
if (SUCCEEDED(IMFTopologyNode_GetUINT32(node, &context->key, &value)) &&
value == context->marker)
{
IMFTopologyNode_GetTopoNodeID(node, id);
return node;
}
IMFTopologyNode_Release(node);
}
*id = 0;
return NULL;
}
static HRESULT topology_loader_clone_node(struct topoloader_context *context, IM
FTopologyNode *node,
IMFTopologyNode **ret, unsigned int marker)
{
IMFTopologyNode *cloned_node;
MF_TOPOLOGY_TYPE node_type;
HRESULT hr;
if (ret) *ret = NULL;
IMFTopologyNode_GetNodeType(node, &node_type);
if (FAILED(hr = MFCreateTopologyNode(node_type, &cloned_node)))
return hr;
if (SUCCEEDED(hr = IMFTopologyNode_CloneFrom(cloned_node, node)))
hr = IMFTopologyNode_SetUINT32(cloned_node, &context->key, marker);
if (SUCCEEDED(hr))
hr = IMFTopology_AddNode(context->output_topology, cloned_node);
if (SUCCEEDED(hr) && ret)
{
*ret = cloned_node;
IMFTopologyNode_AddRef(*ret);
}
IMFTopologyNode_Release(cloned_node);
return hr;
}
typedef HRESULT (*p_topology_loader_connect_func)(struct topoloader_context *con
text, IMFTopologyNode *upstream_node,
unsigned int output_index, IMFTopologyNode *downstream_node, unsigned in
t input_index);
static HRESULT topology_loader_connect_source_node(struct topoloader_context *co
ntext, IMFTopologyNode *upstream_node,
unsigned int output_index, IMFTopologyNode *downstream_node, unsigned in
t input_index)
{
FIXME("Unimplemented.\n");
return E_NOTIMPL;
}
static HRESULT topology_loader_resolve_branch(struct topoloader_context *context
, IMFTopologyNode *upstream_node,
unsigned int output_index, IMFTopologyNode *downstream_node, unsigned in
put_index)
{
static const p_topology_loader_connect_func connectors[MF_TOPOLOGY_TEE_NODE+
1][MF_TOPOLOGY_TEE_NODE+1] =
{
/* OUTPUT */ { NULL },
/* SOURCESTREAM */ { topology_loader_connect_source_node, NULL, NULL, NULL }
,
/* TRANSFORM */ { NULL },
/* TEE */ { NULL },
};
MF_TOPOLOGY_TYPE u_type, d_type;
IMFTopologyNode *node;
TOPOID id;
/* Downstream node might have already been cloned. */
IMFTopologyNode_GetTopoNodeID(downstream_node, &id);
if (FAILED(IMFTopology_GetNodeByID(context->output_topology, id, &node)))
topology_loader_clone_node(context, downstream_node, &node, context->mar
ker + 1);
IMFTopologyNode_ConnectOutput(upstream_node, output_index, node, input_index
);
IMFTopologyNode_GetNodeType(upstream_node, &u_type);
IMFTopologyNode_GetNodeType(downstream_node, &d_type);
if (!connectors[u_type][d_type])
{
WARN("Unsupported branch kind %d -> %d.\n", u_type, d_type);
return E_FAIL;
}
return connectors[u_type][d_type](context, upstream_node, output_index, down
stream_node, input_index);
}
static HRESULT topology_loader_resolve_nodes(struct topoloader_context *context,
unsigned int *layer_size)
{
IMFTopologyNode *downstream_node, *node, *orig_node;
unsigned int input_index, size = 0;
MF_TOPOLOGY_TYPE node_type;
HRESULT hr = S_OK;
TOPOID id;
while ((node = topology_loader_get_node_for_marker(context, &id)))
{
++size;
IMFTopology_GetNodeByID(context->input_topology, id, &orig_node);
IMFTopologyNode_GetNodeType(node, &node_type);
switch (node_type)
{
case MF_TOPOLOGY_SOURCESTREAM_NODE:
if (FAILED(IMFTopologyNode_GetOutput(orig_node, 0, &downstream_n
ode, &input_index)))
{
IMFTopology_RemoveNode(context->output_topology, node);
continue;
}
hr = topology_loader_resolve_branch(context, node, 0, downstream
_node, input_index);
break;
case MF_TOPOLOGY_TRANSFORM_NODE:
case MF_TOPOLOGY_TEE_NODE:
FIXME("Unsupported node type %d.\n", node_type);
break;
default:
WARN("Unexpected node type %d.\n", node_type);
}
IMFTopologyNode_DeleteItem(node, &context->key);
if (FAILED(hr))
break;
}
*layer_size = size;
return hr;
}
static HRESULT WINAPI topology_loader_Load(IMFTopoLoader *iface, IMFTopology *in put_topology, static HRESULT WINAPI topology_loader_Load(IMFTopoLoader *iface, IMFTopology *in put_topology,
IMFTopology **output_topology, IMFTopology *current_topology) IMFTopology **ret_topology, IMFTopology *current_topology)
{ {
struct topology *topology = unsafe_impl_from_IMFTopology(input_topology); struct topoloader_context context = { 0 };
IMFTopology *output_topology;
MF_TOPOLOGY_TYPE node_type;
unsigned int layer_size;
IMFTopologyNode *node;
unsigned short i = 0;
IMFStreamSink *sink; IMFStreamSink *sink;
HRESULT hr; IUnknown *object;
size_t i; HRESULT hr = E_FAIL;
FIXME("%p, %p, %p, %p.\n", iface, input_topology, output_topology, current_t opology); FIXME("%p, %p, %p, %p.\n", iface, input_topology, ret_topology, current_topo logy);
if (current_topology) if (current_topology)
FIXME("Current topology instance is ignored.\n"); FIXME("Current topology instance is ignored.\n");
for (i = 0; i < topology->nodes.count; ++i) /* Basic sanity checks for input topology:
- source nodes must have stream descriptor set;
- sink nodes must be resolved to stream sink objects;
*/
while (SUCCEEDED(IMFTopology_GetNode(input_topology, i++, &node)))
{ {
struct topology_node *node = topology->nodes.nodes[i]; IMFTopologyNode_GetNodeType(node, &node_type);
switch (node->node_type) switch (node_type)
{ {
case MF_TOPOLOGY_OUTPUT_NODE: case MF_TOPOLOGY_OUTPUT_NODE:
if (node->object) if (SUCCEEDED(hr = IMFTopologyNode_GetObject(node, &object)))
{ {
/* Sinks must be bound beforehand. */ /* Sinks must be bound beforehand. */
if (FAILED(IUnknown_QueryInterface(node->object, &IID_IMFStr if (FAILED(IUnknown_QueryInterface(object, &IID_IMFStreamSin
eamSink, (void **)&sink))) k, (void **)&sink)))
return MF_E_TOPO_SINK_ACTIVATES_UNSUPPORTED; hr = MF_E_TOPO_SINK_ACTIVATES_UNSUPPORTED;
IMFStreamSink_Release(sink); else if (sink)
IMFStreamSink_Release(sink);
IUnknown_Release(object);
} }
break; break;
case MF_TOPOLOGY_SOURCESTREAM_NODE: case MF_TOPOLOGY_SOURCESTREAM_NODE:
if (FAILED(hr = IMFAttributes_GetItem(node->attributes, &MF_TOPO hr = IMFTopologyNode_GetItem(node, &MF_TOPONODE_STREAM_DESCRIPTO
NODE_STREAM_DESCRIPTOR, NULL))) R, NULL);
return hr;
break; break;
default: default:
; ;
} }
IMFTopologyNode_Release(node);
if (FAILED(hr))
return hr;
} }
if (FAILED(hr = MFCreateTopology(output_topology))) if (FAILED(hr = MFCreateTopology(&output_topology)))
return hr; return hr;
return IMFTopology_CloneFrom(*output_topology, input_topology); context.input_topology = input_topology;
context.output_topology = output_topology;
memset(&context.key, 0xff, sizeof(context.key));
/* Clone source nodes, use initial marker value. */
i = 0;
while (SUCCEEDED(IMFTopology_GetNode(input_topology, i++, &node)))
{
IMFTopologyNode_GetNodeType(node, &node_type);
if (node_type == MF_TOPOLOGY_SOURCESTREAM_NODE)
{
if (FAILED(hr = topology_loader_clone_node(&context, node, NULL, 0))
)
WARN("Failed to clone source node, hr %#x.\n", hr);
}
IMFTopologyNode_Release(node);
}
for (context.marker = 0;; ++context.marker)
{
if (FAILED(hr = topology_loader_resolve_nodes(&context, &layer_size)))
{
WARN("Failed to resolve for marker %u, hr %#x.\n", context.marker, h
r);
break;
}
/* Reached last marker value. */
if (!layer_size)
break;
}
/* For now return original topology. */
*ret_topology = output_topology;
return IMFTopology_CloneFrom(output_topology, input_topology);
} }
static const IMFTopoLoaderVtbl topologyloadervtbl = static const IMFTopoLoaderVtbl topologyloadervtbl =
{ {
topology_loader_QueryInterface, topology_loader_QueryInterface,
topology_loader_AddRef, topology_loader_AddRef,
topology_loader_Release, topology_loader_Release,
topology_loader_Load, topology_loader_Load,
}; };
 End of changes. 15 change blocks. 
20 lines changed or deleted 236 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)