2 * Copyright 2017 Nikolay Sivov
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
31 #include "wine/debug.h"
33 #include "mf_private.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(mfplat
);
37 static LONG next_node_id
;
38 static TOPOID next_topology_id
;
42 IMFMediaType
*preferred_type
;
43 struct topology_node
*connection
;
44 DWORD connection_stream
;
49 struct node_stream
*streams
;
56 IMFTopologyNode IMFTopologyNode_iface
;
58 IMFAttributes
*attributes
;
59 MF_TOPOLOGY_TYPE node_type
;
62 IMFMediaType
*input_type
; /* Only for tee nodes. */
63 struct node_streams inputs
;
64 struct node_streams outputs
;
70 IMFTopology IMFTopology_iface
;
72 IMFAttributes
*attributes
;
75 struct topology_node
**nodes
;
84 IMFSequencerSource IMFSequencerSource_iface
;
85 IMFMediaSourceTopologyProvider IMFMediaSourceTopologyProvider_iface
;
89 static inline struct topology
*impl_from_IMFTopology(IMFTopology
*iface
)
91 return CONTAINING_RECORD(iface
, struct topology
, IMFTopology_iface
);
94 static struct topology_node
*impl_from_IMFTopologyNode(IMFTopologyNode
*iface
)
96 return CONTAINING_RECORD(iface
, struct topology_node
, IMFTopologyNode_iface
);
99 static const IMFTopologyNodeVtbl topologynodevtbl
;
101 static struct topology_node
*unsafe_impl_from_IMFTopologyNode(IMFTopologyNode
*iface
)
103 if (!iface
|| iface
->lpVtbl
!= &topologynodevtbl
)
105 return impl_from_IMFTopologyNode(iface
);
108 static HRESULT
create_topology_node(MF_TOPOLOGY_TYPE node_type
, struct topology_node
**node
);
109 static HRESULT
topology_node_connect_output(struct topology_node
*node
, DWORD output_index
,
110 struct topology_node
*connection
, DWORD input_index
);
112 static struct topology
*unsafe_impl_from_IMFTopology(IMFTopology
*iface
);
114 static struct seq_source
*impl_from_IMFSequencerSource(IMFSequencerSource
*iface
)
116 return CONTAINING_RECORD(iface
, struct seq_source
, IMFSequencerSource_iface
);
119 static struct seq_source
*impl_from_IMFMediaSourceTopologyProvider(IMFMediaSourceTopologyProvider
*iface
)
121 return CONTAINING_RECORD(iface
, struct seq_source
, IMFMediaSourceTopologyProvider_iface
);
124 static HRESULT
topology_node_reserve_streams(struct node_streams
*streams
, DWORD index
)
126 if (!mf_array_reserve((void **)&streams
->streams
, &streams
->size
, index
+ 1, sizeof(*streams
->streams
)))
127 return E_OUTOFMEMORY
;
129 if (index
>= streams
->count
)
131 memset(&streams
->streams
[streams
->count
], 0, (index
- streams
->count
+ 1) * sizeof(*streams
->streams
));
132 streams
->count
= index
+ 1;
138 static HRESULT WINAPI
topology_QueryInterface(IMFTopology
*iface
, REFIID riid
, void **out
)
140 struct topology
*topology
= impl_from_IMFTopology(iface
);
142 TRACE("%p, %s, %p.\n", iface
, debugstr_guid(riid
), out
);
144 if (IsEqualIID(riid
, &IID_IMFTopology
) ||
145 IsEqualIID(riid
, &IID_IMFAttributes
) ||
146 IsEqualIID(riid
, &IID_IUnknown
))
148 *out
= &topology
->IMFTopology_iface
;
152 FIXME("(%s, %p)\n", debugstr_guid(riid
), out
);
154 return E_NOINTERFACE
;
157 IUnknown_AddRef((IUnknown
*)*out
);
161 static ULONG WINAPI
topology_AddRef(IMFTopology
*iface
)
163 struct topology
*topology
= impl_from_IMFTopology(iface
);
164 ULONG refcount
= InterlockedIncrement(&topology
->refcount
);
166 TRACE("%p, refcount %lu.\n", iface
, refcount
);
171 static HRESULT
topology_node_disconnect_output(struct topology_node
*node
, DWORD output_index
)
173 struct topology_node
*connection
= NULL
;
174 struct node_stream
*stream
;
175 DWORD connection_stream
;
178 EnterCriticalSection(&node
->cs
);
180 if (output_index
< node
->outputs
.count
)
182 stream
= &node
->outputs
.streams
[output_index
];
184 if (stream
->connection
)
186 connection
= stream
->connection
;
187 connection_stream
= stream
->connection_stream
;
188 stream
->connection
= NULL
;
189 stream
->connection_stream
= 0;
197 LeaveCriticalSection(&node
->cs
);
201 EnterCriticalSection(&connection
->cs
);
203 if (connection_stream
< connection
->inputs
.count
)
205 stream
= &connection
->inputs
.streams
[connection_stream
];
207 if (stream
->connection
)
209 stream
->connection
= NULL
;
210 stream
->connection_stream
= 0;
214 LeaveCriticalSection(&connection
->cs
);
216 IMFTopologyNode_Release(&connection
->IMFTopologyNode_iface
);
217 IMFTopologyNode_Release(&node
->IMFTopologyNode_iface
);
223 static void topology_node_disconnect(struct topology_node
*node
)
225 struct node_stream
*stream
;
228 for (i
= 0; i
< node
->outputs
.count
; ++i
)
229 topology_node_disconnect_output(node
, i
);
231 for (i
= 0; i
< node
->inputs
.count
; ++i
)
233 stream
= &node
->inputs
.streams
[i
];
234 if (stream
->connection
)
235 topology_node_disconnect_output(stream
->connection
, stream
->connection_stream
);
239 static void topology_clear(struct topology
*topology
)
243 for (i
= 0; i
< topology
->nodes
.count
; ++i
)
245 topology_node_disconnect(topology
->nodes
.nodes
[i
]);
246 IMFTopologyNode_Release(&topology
->nodes
.nodes
[i
]->IMFTopologyNode_iface
);
248 free(topology
->nodes
.nodes
);
249 topology
->nodes
.nodes
= NULL
;
250 topology
->nodes
.count
= 0;
251 topology
->nodes
.size
= 0;
254 static ULONG WINAPI
topology_Release(IMFTopology
*iface
)
256 struct topology
*topology
= impl_from_IMFTopology(iface
);
257 ULONG refcount
= InterlockedDecrement(&topology
->refcount
);
259 TRACE("%p, refcount %lu.\n", iface
, refcount
);
263 if (topology
->attributes
)
264 IMFAttributes_Release(topology
->attributes
);
265 topology_clear(topology
);
272 static HRESULT WINAPI
topology_GetItem(IMFTopology
*iface
, REFGUID key
, PROPVARIANT
*value
)
274 struct topology
*topology
= impl_from_IMFTopology(iface
);
276 TRACE("%p, %s, %p.\n", iface
, debugstr_guid(key
), value
);
278 return IMFAttributes_GetItem(topology
->attributes
, key
, value
);
281 static HRESULT WINAPI
topology_GetItemType(IMFTopology
*iface
, REFGUID key
, MF_ATTRIBUTE_TYPE
*type
)
283 struct topology
*topology
= impl_from_IMFTopology(iface
);
285 TRACE("%p, %s, %p.\n", iface
, debugstr_guid(key
), type
);
287 return IMFAttributes_GetItemType(topology
->attributes
, key
, type
);
290 static HRESULT WINAPI
topology_CompareItem(IMFTopology
*iface
, REFGUID key
, REFPROPVARIANT value
, BOOL
*result
)
292 struct topology
*topology
= impl_from_IMFTopology(iface
);
294 TRACE("%p, %s, %p, %p.\n", iface
, debugstr_guid(key
), value
, result
);
296 return IMFAttributes_CompareItem(topology
->attributes
, key
, value
, result
);
299 static HRESULT WINAPI
topology_Compare(IMFTopology
*iface
, IMFAttributes
*theirs
, MF_ATTRIBUTES_MATCH_TYPE type
,
302 struct topology
*topology
= impl_from_IMFTopology(iface
);
304 TRACE("%p, %p, %d, %p.\n", iface
, theirs
, type
, result
);
306 return IMFAttributes_Compare(topology
->attributes
, theirs
, type
, result
);
309 static HRESULT WINAPI
topology_GetUINT32(IMFTopology
*iface
, REFGUID key
, UINT32
*value
)
311 struct topology
*topology
= impl_from_IMFTopology(iface
);
313 TRACE("%p, %s, %p.\n", iface
, debugstr_guid(key
), value
);
315 return IMFAttributes_GetUINT32(topology
->attributes
, key
, value
);
318 static HRESULT WINAPI
topology_GetUINT64(IMFTopology
*iface
, REFGUID key
, UINT64
*value
)
320 struct topology
*topology
= impl_from_IMFTopology(iface
);
322 TRACE("%p, %s, %p.\n", iface
, debugstr_guid(key
), value
);
324 return IMFAttributes_GetUINT64(topology
->attributes
, key
, value
);
327 static HRESULT WINAPI
topology_GetDouble(IMFTopology
*iface
, REFGUID key
, double *value
)
329 struct topology
*topology
= impl_from_IMFTopology(iface
);
331 TRACE("%p, %s, %p.\n", iface
, debugstr_guid(key
), value
);
333 return IMFAttributes_GetDouble(topology
->attributes
, key
, value
);
336 static HRESULT WINAPI
topology_GetGUID(IMFTopology
*iface
, REFGUID key
, GUID
*value
)
338 struct topology
*topology
= impl_from_IMFTopology(iface
);
340 TRACE("%p, %s, %p.\n", iface
, debugstr_guid(key
), value
);
342 return IMFAttributes_GetGUID(topology
->attributes
, key
, value
);
345 static HRESULT WINAPI
topology_GetStringLength(IMFTopology
*iface
, REFGUID key
, UINT32
*length
)
347 struct topology
*topology
= impl_from_IMFTopology(iface
);
349 TRACE("%p, %s, %p.\n", iface
, debugstr_guid(key
), length
);
351 return IMFAttributes_GetStringLength(topology
->attributes
, key
, length
);
354 static HRESULT WINAPI
topology_GetString(IMFTopology
*iface
, REFGUID key
, WCHAR
*value
,
355 UINT32 size
, UINT32
*length
)
357 struct topology
*topology
= impl_from_IMFTopology(iface
);
359 TRACE("%p, %s, %p, %d, %p.\n", iface
, debugstr_guid(key
), value
, size
, length
);
361 return IMFAttributes_GetString(topology
->attributes
, key
, value
, size
, length
);
364 static HRESULT WINAPI
topology_GetAllocatedString(IMFTopology
*iface
, REFGUID key
,
365 WCHAR
**value
, UINT32
*length
)
367 struct topology
*topology
= impl_from_IMFTopology(iface
);
369 TRACE("%p, %s, %p, %p.\n", iface
, debugstr_guid(key
), value
, length
);
371 return IMFAttributes_GetAllocatedString(topology
->attributes
, key
, value
, length
);
374 static HRESULT WINAPI
topology_GetBlobSize(IMFTopology
*iface
, REFGUID key
, UINT32
*size
)
376 struct topology
*topology
= impl_from_IMFTopology(iface
);
378 TRACE("%p, %s, %p.\n", iface
, debugstr_guid(key
), size
);
380 return IMFAttributes_GetBlobSize(topology
->attributes
, key
, size
);
383 static HRESULT WINAPI
topology_GetBlob(IMFTopology
*iface
, REFGUID key
, UINT8
*buf
,
384 UINT32 bufsize
, UINT32
*blobsize
)
386 struct topology
*topology
= impl_from_IMFTopology(iface
);
388 TRACE("%p, %s, %p, %d, %p.\n", iface
, debugstr_guid(key
), buf
, bufsize
, blobsize
);
390 return IMFAttributes_GetBlob(topology
->attributes
, key
, buf
, bufsize
, blobsize
);
393 static HRESULT WINAPI
topology_GetAllocatedBlob(IMFTopology
*iface
, REFGUID key
, UINT8
**buf
, UINT32
*size
)
395 struct topology
*topology
= impl_from_IMFTopology(iface
);
397 TRACE("%p, %s, %p, %p.\n", iface
, debugstr_guid(key
), buf
, size
);
399 return IMFAttributes_GetAllocatedBlob(topology
->attributes
, key
, buf
, size
);
402 static HRESULT WINAPI
topology_GetUnknown(IMFTopology
*iface
, REFGUID key
, REFIID riid
, void **ppv
)
404 struct topology
*topology
= impl_from_IMFTopology(iface
);
406 TRACE("%p, %s, %s, %p.\n", iface
, debugstr_guid(key
), debugstr_guid(riid
), ppv
);
408 return IMFAttributes_GetUnknown(topology
->attributes
, key
, riid
, ppv
);
411 static HRESULT WINAPI
topology_SetItem(IMFTopology
*iface
, REFGUID key
, REFPROPVARIANT value
)
413 struct topology
*topology
= impl_from_IMFTopology(iface
);
415 TRACE("%p, %s, %p.\n", iface
, debugstr_guid(key
), value
);
417 return IMFAttributes_SetItem(topology
->attributes
, key
, value
);
420 static HRESULT WINAPI
topology_DeleteItem(IMFTopology
*iface
, REFGUID key
)
422 struct topology
*topology
= impl_from_IMFTopology(iface
);
424 TRACE("%p, %s.\n", topology
, debugstr_guid(key
));
426 return IMFAttributes_DeleteItem(topology
->attributes
, key
);
429 static HRESULT WINAPI
topology_DeleteAllItems(IMFTopology
*iface
)
431 struct topology
*topology
= impl_from_IMFTopology(iface
);
433 TRACE("%p.\n", iface
);
435 return IMFAttributes_DeleteAllItems(topology
->attributes
);
438 static HRESULT WINAPI
topology_SetUINT32(IMFTopology
*iface
, REFGUID key
, UINT32 value
)
440 struct topology
*topology
= impl_from_IMFTopology(iface
);
442 TRACE("%p, %s, %d.\n", iface
, debugstr_guid(key
), value
);
444 return IMFAttributes_SetUINT32(topology
->attributes
, key
, value
);
447 static HRESULT WINAPI
topology_SetUINT64(IMFTopology
*iface
, REFGUID key
, UINT64 value
)
449 struct topology
*topology
= impl_from_IMFTopology(iface
);
451 TRACE("%p, %s, %s.\n", iface
, debugstr_guid(key
), wine_dbgstr_longlong(value
));
453 return IMFAttributes_SetUINT64(topology
->attributes
, key
, value
);
456 static HRESULT WINAPI
topology_SetDouble(IMFTopology
*iface
, REFGUID key
, double value
)
458 struct topology
*topology
= impl_from_IMFTopology(iface
);
460 TRACE("%p, %s, %f.\n", iface
, debugstr_guid(key
), value
);
462 return IMFAttributes_SetDouble(topology
->attributes
, key
, value
);
465 static HRESULT WINAPI
topology_SetGUID(IMFTopology
*iface
, REFGUID key
, REFGUID value
)
467 struct topology
*topology
= impl_from_IMFTopology(iface
);
469 TRACE("%p, %s, %s.\n", iface
, debugstr_guid(key
), debugstr_guid(value
));
471 return IMFAttributes_SetGUID(topology
->attributes
, key
, value
);
474 static HRESULT WINAPI
topology_SetString(IMFTopology
*iface
, REFGUID key
, const WCHAR
*value
)
476 struct topology
*topology
= impl_from_IMFTopology(iface
);
478 TRACE("%p, %s, %s.\n", iface
, debugstr_guid(key
), debugstr_w(value
));
480 return IMFAttributes_SetString(topology
->attributes
, key
, value
);
483 static HRESULT WINAPI
topology_SetBlob(IMFTopology
*iface
, REFGUID key
, const UINT8
*buf
, UINT32 size
)
485 struct topology
*topology
= impl_from_IMFTopology(iface
);
487 TRACE("%p, %s, %p, %d.\n", iface
, debugstr_guid(key
), buf
, size
);
489 return IMFAttributes_SetBlob(topology
->attributes
, key
, buf
, size
);
492 static HRESULT WINAPI
topology_SetUnknown(IMFTopology
*iface
, REFGUID key
, IUnknown
*unknown
)
494 struct topology
*topology
= impl_from_IMFTopology(iface
);
496 TRACE("%p, %s, %p.\n", iface
, debugstr_guid(key
), unknown
);
498 return IMFAttributes_SetUnknown(topology
->attributes
, key
, unknown
);
501 static HRESULT WINAPI
topology_LockStore(IMFTopology
*iface
)
503 struct topology
*topology
= impl_from_IMFTopology(iface
);
505 TRACE("%p.\n", iface
);
507 return IMFAttributes_LockStore(topology
->attributes
);
510 static HRESULT WINAPI
topology_UnlockStore(IMFTopology
*iface
)
512 struct topology
*topology
= impl_from_IMFTopology(iface
);
514 TRACE("%p.\n", iface
);
516 return IMFAttributes_UnlockStore(topology
->attributes
);
519 static HRESULT WINAPI
topology_GetCount(IMFTopology
*iface
, UINT32
*count
)
521 struct topology
*topology
= impl_from_IMFTopology(iface
);
523 TRACE("%p, %p.\n", iface
, count
);
525 return IMFAttributes_GetCount(topology
->attributes
, count
);
528 static HRESULT WINAPI
topology_GetItemByIndex(IMFTopology
*iface
, UINT32 index
, GUID
*key
, PROPVARIANT
*value
)
530 struct topology
*topology
= impl_from_IMFTopology(iface
);
532 TRACE("%p, %u, %p, %p.\n", iface
, index
, key
, value
);
534 return IMFAttributes_GetItemByIndex(topology
->attributes
, index
, key
, value
);
537 static HRESULT WINAPI
topology_CopyAllItems(IMFTopology
*iface
, IMFAttributes
*dest
)
539 struct topology
*topology
= impl_from_IMFTopology(iface
);
541 TRACE("%p, %p.\n", iface
, dest
);
543 return IMFAttributes_CopyAllItems(topology
->attributes
, dest
);
546 static HRESULT WINAPI
topology_GetTopologyID(IMFTopology
*iface
, TOPOID
*id
)
548 struct topology
*topology
= impl_from_IMFTopology(iface
);
550 TRACE("%p, %p.\n", iface
, id
);
560 static HRESULT
topology_get_node_by_id(const struct topology
*topology
, TOPOID id
, struct topology_node
**node
)
564 for (i
= 0; i
< topology
->nodes
.count
; ++i
)
566 if (topology
->nodes
.nodes
[i
]->id
== id
)
568 *node
= topology
->nodes
.nodes
[i
];
573 return MF_E_NOT_FOUND
;
576 static HRESULT
topology_add_node(struct topology
*topology
, struct topology_node
*node
)
578 struct topology_node
*match
;
583 if (SUCCEEDED(topology_get_node_by_id(topology
, node
->id
, &match
)))
586 if (!mf_array_reserve((void **)&topology
->nodes
.nodes
, &topology
->nodes
.size
, topology
->nodes
.count
+ 1,
587 sizeof(*topology
->nodes
.nodes
)))
589 return E_OUTOFMEMORY
;
592 topology
->nodes
.nodes
[topology
->nodes
.count
++] = node
;
593 IMFTopologyNode_AddRef(&node
->IMFTopologyNode_iface
);
598 static HRESULT WINAPI
topology_AddNode(IMFTopology
*iface
, IMFTopologyNode
*node_iface
)
600 struct topology
*topology
= impl_from_IMFTopology(iface
);
601 struct topology_node
*node
= unsafe_impl_from_IMFTopologyNode(node_iface
);
603 TRACE("%p, %p.\n", iface
, node_iface
);
605 return topology_add_node(topology
, node
);
608 static HRESULT WINAPI
topology_RemoveNode(IMFTopology
*iface
, IMFTopologyNode
*node
)
610 struct topology
*topology
= impl_from_IMFTopology(iface
);
613 TRACE("%p, %p.\n", iface
, node
);
615 for (i
= 0; i
< topology
->nodes
.count
; ++i
)
617 if (&topology
->nodes
.nodes
[i
]->IMFTopologyNode_iface
== node
)
619 topology_node_disconnect(topology
->nodes
.nodes
[i
]);
620 IMFTopologyNode_Release(&topology
->nodes
.nodes
[i
]->IMFTopologyNode_iface
);
621 count
= topology
->nodes
.count
- i
- 1;
624 memmove(&topology
->nodes
.nodes
[i
], &topology
->nodes
.nodes
[i
+ 1],
625 count
* sizeof(*topology
->nodes
.nodes
));
627 topology
->nodes
.count
--;
635 static HRESULT WINAPI
topology_GetNodeCount(IMFTopology
*iface
, WORD
*count
)
637 struct topology
*topology
= impl_from_IMFTopology(iface
);
639 TRACE("%p, %p.\n", iface
, count
);
644 *count
= topology
->nodes
.count
;
649 static HRESULT WINAPI
topology_GetNode(IMFTopology
*iface
, WORD index
, IMFTopologyNode
**node
)
651 struct topology
*topology
= impl_from_IMFTopology(iface
);
653 TRACE("%p, %u, %p.\n", iface
, index
, node
);
658 if (index
>= topology
->nodes
.count
)
659 return MF_E_INVALIDINDEX
;
661 *node
= &topology
->nodes
.nodes
[index
]->IMFTopologyNode_iface
;
662 IMFTopologyNode_AddRef(*node
);
667 static HRESULT WINAPI
topology_Clear(IMFTopology
*iface
)
669 struct topology
*topology
= impl_from_IMFTopology(iface
);
671 TRACE("%p.\n", iface
);
673 topology_clear(topology
);
677 static HRESULT WINAPI
topology_CloneFrom(IMFTopology
*iface
, IMFTopology
*src
)
679 struct topology
*topology
= impl_from_IMFTopology(iface
);
680 struct topology
*src_topology
= unsafe_impl_from_IMFTopology(src
);
681 struct topology_node
*node
;
685 TRACE("%p, %p.\n", iface
, src
);
687 topology_clear(topology
);
690 for (i
= 0; i
< src_topology
->nodes
.count
; ++i
)
692 if (FAILED(hr
= create_topology_node(src_topology
->nodes
.nodes
[i
]->node_type
, &node
)))
694 WARN("Failed to create a node, hr %#lx.\n", hr
);
698 if (SUCCEEDED(hr
= IMFTopologyNode_CloneFrom(&node
->IMFTopologyNode_iface
,
699 &src_topology
->nodes
.nodes
[i
]->IMFTopologyNode_iface
)))
701 topology_add_node(topology
, node
);
704 IMFTopologyNode_Release(&node
->IMFTopologyNode_iface
);
707 /* Clone connections. */
708 for (i
= 0; i
< src_topology
->nodes
.count
; ++i
)
710 const struct node_streams
*outputs
= &src_topology
->nodes
.nodes
[i
]->outputs
;
712 for (j
= 0; j
< outputs
->count
; ++j
)
714 DWORD input_index
= outputs
->streams
[j
].connection_stream
;
715 TOPOID id
= outputs
->streams
[j
].connection
->id
;
717 /* Skip node lookup in destination topology, assuming same node order. */
718 if (SUCCEEDED(hr
= topology_get_node_by_id(topology
, id
, &node
)))
719 topology_node_connect_output(topology
->nodes
.nodes
[i
], j
, node
, input_index
);
723 /* Copy attributes and id. */
724 hr
= IMFTopology_CopyAllItems(src
, (IMFAttributes
*)&topology
->IMFTopology_iface
);
726 topology
->id
= src_topology
->id
;
731 static HRESULT WINAPI
topology_GetNodeByID(IMFTopology
*iface
, TOPOID id
, IMFTopologyNode
**ret
)
733 struct topology
*topology
= impl_from_IMFTopology(iface
);
734 struct topology_node
*node
;
737 TRACE("%p, %p.\n", iface
, ret
);
739 if (SUCCEEDED(hr
= topology_get_node_by_id(topology
, id
, &node
)))
741 *ret
= &node
->IMFTopologyNode_iface
;
742 IMFTopologyNode_AddRef(*ret
);
750 static HRESULT
topology_get_node_collection(const struct topology
*topology
, MF_TOPOLOGY_TYPE node_type
,
751 IMFCollection
**collection
)
759 if (FAILED(hr
= MFCreateCollection(collection
)))
762 for (i
= 0; i
< topology
->nodes
.count
; ++i
)
764 if (topology
->nodes
.nodes
[i
]->node_type
== node_type
)
766 if (FAILED(hr
= IMFCollection_AddElement(*collection
,
767 (IUnknown
*)&topology
->nodes
.nodes
[i
]->IMFTopologyNode_iface
)))
769 IMFCollection_Release(*collection
);
779 static HRESULT WINAPI
topology_GetSourceNodeCollection(IMFTopology
*iface
, IMFCollection
**collection
)
781 struct topology
*topology
= impl_from_IMFTopology(iface
);
783 TRACE("%p, %p.\n", iface
, collection
);
785 return topology_get_node_collection(topology
, MF_TOPOLOGY_SOURCESTREAM_NODE
, collection
);
788 static HRESULT WINAPI
topology_GetOutputNodeCollection(IMFTopology
*iface
, IMFCollection
**collection
)
790 struct topology
*topology
= impl_from_IMFTopology(iface
);
792 TRACE("%p, %p.\n", iface
, collection
);
794 return topology_get_node_collection(topology
, MF_TOPOLOGY_OUTPUT_NODE
, collection
);
797 static const IMFTopologyVtbl topologyvtbl
=
799 topology_QueryInterface
,
803 topology_GetItemType
,
804 topology_CompareItem
,
810 topology_GetStringLength
,
812 topology_GetAllocatedString
,
813 topology_GetBlobSize
,
815 topology_GetAllocatedBlob
,
819 topology_DeleteAllItems
,
828 topology_UnlockStore
,
830 topology_GetItemByIndex
,
831 topology_CopyAllItems
,
832 topology_GetTopologyID
,
835 topology_GetNodeCount
,
839 topology_GetNodeByID
,
840 topology_GetSourceNodeCollection
,
841 topology_GetOutputNodeCollection
,
844 static struct topology
*unsafe_impl_from_IMFTopology(IMFTopology
*iface
)
846 if (!iface
|| iface
->lpVtbl
!= &topologyvtbl
)
848 return impl_from_IMFTopology(iface
);
851 static TOPOID
topology_generate_id(void)
857 old
= next_topology_id
;
859 while (InterlockedCompareExchange64((LONG64
*)&next_topology_id
, old
+ 1, old
) != old
);
861 return next_topology_id
;
864 /***********************************************************************
865 * MFCreateTopology (mf.@)
867 HRESULT WINAPI
MFCreateTopology(IMFTopology
**topology
)
869 struct topology
*object
;
872 TRACE("%p.\n", topology
);
877 if (!(object
= calloc(1, sizeof(*object
))))
878 return E_OUTOFMEMORY
;
880 object
->IMFTopology_iface
.lpVtbl
= &topologyvtbl
;
881 object
->refcount
= 1;
883 hr
= MFCreateAttributes(&object
->attributes
, 0);
886 IMFTopology_Release(&object
->IMFTopology_iface
);
890 object
->id
= topology_generate_id();
892 *topology
= &object
->IMFTopology_iface
;
897 static HRESULT WINAPI
topology_node_QueryInterface(IMFTopologyNode
*iface
, REFIID riid
, void **out
)
899 struct topology_node
*node
= impl_from_IMFTopologyNode(iface
);
901 TRACE("%p, %s, %p.\n", iface
, debugstr_guid(riid
), out
);
903 if (IsEqualIID(riid
, &IID_IMFTopologyNode
) ||
904 IsEqualIID(riid
, &IID_IMFAttributes
) ||
905 IsEqualIID(riid
, &IID_IUnknown
))
907 *out
= &node
->IMFTopologyNode_iface
;
908 IMFTopologyNode_AddRef(iface
);
912 WARN("Unsupported interface %s.\n", debugstr_guid(riid
));
915 return E_NOINTERFACE
;
918 static ULONG WINAPI
topology_node_AddRef(IMFTopologyNode
*iface
)
920 struct topology_node
*node
= impl_from_IMFTopologyNode(iface
);
921 ULONG refcount
= InterlockedIncrement(&node
->refcount
);
923 TRACE("%p, refcount %lu.\n", iface
, refcount
);
928 static ULONG WINAPI
topology_node_Release(IMFTopologyNode
*iface
)
930 struct topology_node
*node
= impl_from_IMFTopologyNode(iface
);
931 ULONG refcount
= InterlockedDecrement(&node
->refcount
);
934 TRACE("%p, refcount %lu.\n", iface
, refcount
);
939 IUnknown_Release(node
->object
);
940 if (node
->input_type
)
941 IMFMediaType_Release(node
->input_type
);
942 for (i
= 0; i
< node
->inputs
.count
; ++i
)
944 if (node
->inputs
.streams
[i
].preferred_type
)
945 IMFMediaType_Release(node
->inputs
.streams
[i
].preferred_type
);
947 for (i
= 0; i
< node
->outputs
.count
; ++i
)
949 if (node
->outputs
.streams
[i
].preferred_type
)
950 IMFMediaType_Release(node
->outputs
.streams
[i
].preferred_type
);
952 free(node
->inputs
.streams
);
953 free(node
->outputs
.streams
);
954 IMFAttributes_Release(node
->attributes
);
955 DeleteCriticalSection(&node
->cs
);
962 static HRESULT WINAPI
topology_node_GetItem(IMFTopologyNode
*iface
, REFGUID key
, PROPVARIANT
*value
)
964 struct topology_node
*node
= impl_from_IMFTopologyNode(iface
);
966 TRACE("%p, %s, %p.\n", iface
, debugstr_guid(key
), value
);
968 return IMFAttributes_GetItem(node
->attributes
, key
, value
);
971 static HRESULT WINAPI
topology_node_GetItemType(IMFTopologyNode
*iface
, REFGUID key
, MF_ATTRIBUTE_TYPE
*type
)
973 struct topology_node
*node
= impl_from_IMFTopologyNode(iface
);
975 TRACE("%p, %s, %p.\n", iface
, debugstr_guid(key
), type
);
977 return IMFAttributes_GetItemType(node
->attributes
, key
, type
);
980 static HRESULT WINAPI
topology_node_CompareItem(IMFTopologyNode
*iface
, REFGUID key
, REFPROPVARIANT value
, BOOL
*result
)
982 struct topology_node
*node
= impl_from_IMFTopologyNode(iface
);
984 TRACE("%p, %s, %p, %p.\n", iface
, debugstr_guid(key
), value
, result
);
986 return IMFAttributes_CompareItem(node
->attributes
, key
, value
, result
);
989 static HRESULT WINAPI
topology_node_Compare(IMFTopologyNode
*iface
, IMFAttributes
*theirs
,
990 MF_ATTRIBUTES_MATCH_TYPE type
, BOOL
*result
)
992 struct topology_node
*node
= impl_from_IMFTopologyNode(iface
);
994 TRACE("%p, %p, %d, %p.\n", iface
, theirs
, type
, result
);
996 return IMFAttributes_Compare(node
->attributes
, theirs
, type
, result
);
999 static HRESULT WINAPI
topology_node_GetUINT32(IMFTopologyNode
*iface
, REFGUID key
, UINT32
*value
)
1001 struct topology_node
*node
= impl_from_IMFTopologyNode(iface
);
1003 TRACE("%p, %s, %p.\n", iface
, debugstr_guid(key
), value
);
1005 return IMFAttributes_GetUINT32(node
->attributes
, key
, value
);
1008 static HRESULT WINAPI
topology_node_GetUINT64(IMFTopologyNode
*iface
, REFGUID key
, UINT64
*value
)
1010 struct topology_node
*node
= impl_from_IMFTopologyNode(iface
);
1012 TRACE("%p, %s, %p.\n", iface
, debugstr_guid(key
), value
);
1014 return IMFAttributes_GetUINT64(node
->attributes
, key
, value
);
1017 static HRESULT WINAPI
topology_node_GetDouble(IMFTopologyNode
*iface
, REFGUID key
, double *value
)
1019 struct topology_node
*node
= impl_from_IMFTopologyNode(iface
);
1021 TRACE("%p, %s, %p.\n", iface
, debugstr_guid(key
), value
);
1023 return IMFAttributes_GetDouble(node
->attributes
, key
, value
);
1026 static HRESULT WINAPI
topology_node_GetGUID(IMFTopologyNode
*iface
, REFGUID key
, GUID
*value
)
1028 struct topology_node
*node
= impl_from_IMFTopologyNode(iface
);
1030 TRACE("%p, %s, %p.\n", iface
, debugstr_guid(key
), value
);
1032 return IMFAttributes_GetGUID(node
->attributes
, key
, value
);
1035 static HRESULT WINAPI
topology_node_GetStringLength(IMFTopologyNode
*iface
, REFGUID key
, UINT32
*length
)
1037 struct topology_node
*node
= impl_from_IMFTopologyNode(iface
);
1039 TRACE("%p, %s, %p.\n", iface
, debugstr_guid(key
), length
);
1041 return IMFAttributes_GetStringLength(node
->attributes
, key
, length
);
1044 static HRESULT WINAPI
topology_node_GetString(IMFTopologyNode
*iface
, REFGUID key
, WCHAR
*value
,
1045 UINT32 size
, UINT32
*length
)
1047 struct topology_node
*node
= impl_from_IMFTopologyNode(iface
);
1049 TRACE("%p, %s, %p, %d, %p.\n", iface
, debugstr_guid(key
), value
, size
, length
);
1051 return IMFAttributes_GetString(node
->attributes
, key
, value
, size
, length
);
1054 static HRESULT WINAPI
topology_node_GetAllocatedString(IMFTopologyNode
*iface
, REFGUID key
,
1055 WCHAR
**value
, UINT32
*length
)
1057 struct topology_node
*node
= impl_from_IMFTopologyNode(iface
);
1059 TRACE("%p, %s, %p, %p.\n", iface
, debugstr_guid(key
), value
, length
);
1061 return IMFAttributes_GetAllocatedString(node
->attributes
, key
, value
, length
);
1064 static HRESULT WINAPI
topology_node_GetBlobSize(IMFTopologyNode
*iface
, REFGUID key
, UINT32
*size
)
1066 struct topology_node
*node
= impl_from_IMFTopologyNode(iface
);
1068 TRACE("%p, %s, %p.\n", iface
, debugstr_guid(key
), size
);
1070 return IMFAttributes_GetBlobSize(node
->attributes
, key
, size
);
1073 static HRESULT WINAPI
topology_node_GetBlob(IMFTopologyNode
*iface
, REFGUID key
, UINT8
*buf
,
1074 UINT32 bufsize
, UINT32
*blobsize
)
1076 struct topology_node
*node
= impl_from_IMFTopologyNode(iface
);
1078 TRACE("%p, %s, %p, %d, %p.\n", iface
, debugstr_guid(key
), buf
, bufsize
, blobsize
);
1080 return IMFAttributes_GetBlob(node
->attributes
, key
, buf
, bufsize
, blobsize
);
1083 static HRESULT WINAPI
topology_node_GetAllocatedBlob(IMFTopologyNode
*iface
, REFGUID key
, UINT8
**buf
, UINT32
*size
)
1085 struct topology_node
*node
= impl_from_IMFTopologyNode(iface
);
1087 TRACE("%p, %s, %p, %p.\n", iface
, debugstr_guid(key
), buf
, size
);
1089 return IMFAttributes_GetAllocatedBlob(node
->attributes
, key
, buf
, size
);
1092 static HRESULT WINAPI
topology_node_GetUnknown(IMFTopologyNode
*iface
, REFGUID key
, REFIID riid
, void **ppv
)
1094 struct topology_node
*node
= impl_from_IMFTopologyNode(iface
);
1096 TRACE("%p, %s, %s, %p.\n", iface
, debugstr_guid(key
), debugstr_guid(riid
), ppv
);
1098 return IMFAttributes_GetUnknown(node
->attributes
, key
, riid
, ppv
);
1101 static HRESULT WINAPI
topology_node_SetItem(IMFTopologyNode
*iface
, REFGUID key
, REFPROPVARIANT value
)
1103 struct topology_node
*node
= impl_from_IMFTopologyNode(iface
);
1105 TRACE("%p, %s, %p.\n", iface
, debugstr_guid(key
), value
);
1107 return IMFAttributes_SetItem(node
->attributes
, key
, value
);
1110 static HRESULT WINAPI
topology_node_DeleteItem(IMFTopologyNode
*iface
, REFGUID key
)
1112 struct topology_node
*node
= impl_from_IMFTopologyNode(iface
);
1114 TRACE("%p, %s.\n", iface
, debugstr_guid(key
));
1116 return IMFAttributes_DeleteItem(node
->attributes
, key
);
1119 static HRESULT WINAPI
topology_node_DeleteAllItems(IMFTopologyNode
*iface
)
1121 struct topology_node
*node
= impl_from_IMFTopologyNode(iface
);
1123 TRACE("%p.\n", iface
);
1125 return IMFAttributes_DeleteAllItems(node
->attributes
);
1128 static HRESULT WINAPI
topology_node_SetUINT32(IMFTopologyNode
*iface
, REFGUID key
, UINT32 value
)
1130 struct topology_node
*node
= impl_from_IMFTopologyNode(iface
);
1132 TRACE("%p, %s, %d.\n", iface
, debugstr_guid(key
), value
);
1134 return IMFAttributes_SetUINT32(node
->attributes
, key
, value
);
1137 static HRESULT WINAPI
topology_node_SetUINT64(IMFTopologyNode
*iface
, REFGUID key
, UINT64 value
)
1139 struct topology_node
*node
= impl_from_IMFTopologyNode(iface
);
1141 TRACE("%p, %s, %s.\n", iface
, debugstr_guid(key
), wine_dbgstr_longlong(value
));
1143 return IMFAttributes_SetUINT64(node
->attributes
, key
, value
);
1146 static HRESULT WINAPI
topology_node_SetDouble(IMFTopologyNode
*iface
, REFGUID key
, double value
)
1148 struct topology_node
*node
= impl_from_IMFTopologyNode(iface
);
1150 TRACE("%p, %s, %f.\n", iface
, debugstr_guid(key
), value
);
1152 return IMFAttributes_SetDouble(node
->attributes
, key
, value
);
1155 static HRESULT WINAPI
topology_node_SetGUID(IMFTopologyNode
*iface
, REFGUID key
, REFGUID value
)
1157 struct topology_node
*node
= impl_from_IMFTopologyNode(iface
);
1159 TRACE("%p, %s, %s.\n", iface
, debugstr_guid(key
), debugstr_guid(value
));
1161 return IMFAttributes_SetGUID(node
->attributes
, key
, value
);
1164 static HRESULT WINAPI
topology_node_SetString(IMFTopologyNode
*iface
, REFGUID key
, const WCHAR
*value
)
1166 struct topology_node
*node
= impl_from_IMFTopologyNode(iface
);
1168 TRACE("%p, %s, %s.\n", iface
, debugstr_guid(key
), debugstr_w(value
));
1170 return IMFAttributes_SetString(node
->attributes
, key
, value
);
1173 static HRESULT WINAPI
topology_node_SetBlob(IMFTopologyNode
*iface
, REFGUID key
, const UINT8
*buf
, UINT32 size
)
1175 struct topology_node
*node
= impl_from_IMFTopologyNode(iface
);
1177 TRACE("%p, %s, %p, %d.\n", iface
, debugstr_guid(key
), buf
, size
);
1179 return IMFAttributes_SetBlob(node
->attributes
, key
, buf
, size
);
1182 static HRESULT WINAPI
topology_node_SetUnknown(IMFTopologyNode
*iface
, REFGUID key
, IUnknown
*unknown
)
1184 struct topology_node
*node
= impl_from_IMFTopologyNode(iface
);
1186 TRACE("%p, %s, %p.\n", iface
, debugstr_guid(key
), unknown
);
1188 return IMFAttributes_SetUnknown(node
->attributes
, key
, unknown
);
1191 static HRESULT WINAPI
topology_node_LockStore(IMFTopologyNode
*iface
)
1193 struct topology_node
*node
= impl_from_IMFTopologyNode(iface
);
1195 TRACE("%p.\n", iface
);
1197 return IMFAttributes_LockStore(node
->attributes
);
1200 static HRESULT WINAPI
topology_node_UnlockStore(IMFTopologyNode
*iface
)
1202 struct topology_node
*node
= impl_from_IMFTopologyNode(iface
);
1204 TRACE("%p.\n", iface
);
1206 return IMFAttributes_UnlockStore(node
->attributes
);
1209 static HRESULT WINAPI
topology_node_GetCount(IMFTopologyNode
*iface
, UINT32
*count
)
1211 struct topology_node
*node
= impl_from_IMFTopologyNode(iface
);
1213 TRACE("%p, %p.\n", iface
, count
);
1215 return IMFAttributes_GetCount(node
->attributes
, count
);
1218 static HRESULT WINAPI
topology_node_GetItemByIndex(IMFTopologyNode
*iface
, UINT32 index
, GUID
*key
, PROPVARIANT
*value
)
1220 struct topology_node
*node
= impl_from_IMFTopologyNode(iface
);
1222 TRACE("%p, %u, %p, %p.\n", iface
, index
, key
, value
);
1224 return IMFAttributes_GetItemByIndex(node
->attributes
, index
, key
, value
);
1227 static HRESULT WINAPI
topology_node_CopyAllItems(IMFTopologyNode
*iface
, IMFAttributes
*dest
)
1229 struct topology_node
*node
= impl_from_IMFTopologyNode(iface
);
1231 TRACE("%p, %p.\n", iface
, dest
);
1233 return IMFAttributes_CopyAllItems(node
->attributes
, dest
);
1236 static HRESULT
topology_node_set_object(struct topology_node
*node
, IUnknown
*object
)
1238 static const GUID
*iids
[3] = { &IID_IPersist
, &IID_IPersistStorage
, &IID_IPersistPropertyBag
};
1239 IPersist
*persist
= NULL
;
1245 has_object_id
= IMFAttributes_GetGUID(node
->attributes
, &MF_TOPONODE_TRANSFORM_OBJECTID
, &object_id
) == S_OK
;
1247 if (object
&& !has_object_id
)
1249 for (i
= 0; i
< ARRAY_SIZE(iids
); ++i
)
1252 if (SUCCEEDED(hr
= IUnknown_QueryInterface(object
, iids
[i
], (void **)&persist
)))
1258 if (FAILED(hr
= IPersist_GetClassID(persist
, &object_id
)))
1260 IPersist_Release(persist
);
1266 EnterCriticalSection(&node
->cs
);
1269 IUnknown_Release(node
->object
);
1270 node
->object
= object
;
1272 IUnknown_AddRef(node
->object
);
1275 IMFAttributes_SetGUID(node
->attributes
, &MF_TOPONODE_TRANSFORM_OBJECTID
, &object_id
);
1277 LeaveCriticalSection(&node
->cs
);
1280 IPersist_Release(persist
);
1285 static HRESULT WINAPI
topology_node_SetObject(IMFTopologyNode
*iface
, IUnknown
*object
)
1287 struct topology_node
*node
= impl_from_IMFTopologyNode(iface
);
1289 TRACE("%p, %p.\n", iface
, object
);
1291 return topology_node_set_object(node
, object
);
1294 static HRESULT WINAPI
topology_node_GetObject(IMFTopologyNode
*iface
, IUnknown
**object
)
1296 struct topology_node
*node
= impl_from_IMFTopologyNode(iface
);
1298 TRACE("%p, %p.\n", iface
, object
);
1303 EnterCriticalSection(&node
->cs
);
1305 *object
= node
->object
;
1307 IUnknown_AddRef(*object
);
1309 LeaveCriticalSection(&node
->cs
);
1311 return *object
? S_OK
: E_FAIL
;
1314 static HRESULT WINAPI
topology_node_GetNodeType(IMFTopologyNode
*iface
, MF_TOPOLOGY_TYPE
*node_type
)
1316 struct topology_node
*node
= impl_from_IMFTopologyNode(iface
);
1318 TRACE("%p, %p.\n", iface
, node_type
);
1320 *node_type
= node
->node_type
;
1325 static HRESULT WINAPI
topology_node_GetTopoNodeID(IMFTopologyNode
*iface
, TOPOID
*id
)
1327 struct topology_node
*node
= impl_from_IMFTopologyNode(iface
);
1329 TRACE("%p, %p.\n", iface
, id
);
1336 static HRESULT WINAPI
topology_node_SetTopoNodeID(IMFTopologyNode
*iface
, TOPOID id
)
1338 struct topology_node
*node
= impl_from_IMFTopologyNode(iface
);
1340 TRACE("%p, %s.\n", iface
, wine_dbgstr_longlong(id
));
1347 static HRESULT WINAPI
topology_node_GetInputCount(IMFTopologyNode
*iface
, DWORD
*count
)
1349 struct topology_node
*node
= impl_from_IMFTopologyNode(iface
);
1351 TRACE("%p, %p.\n", iface
, count
);
1353 *count
= node
->inputs
.count
;
1358 static HRESULT WINAPI
topology_node_GetOutputCount(IMFTopologyNode
*iface
, DWORD
*count
)
1360 struct topology_node
*node
= impl_from_IMFTopologyNode(iface
);
1362 TRACE("%p, %p.\n", iface
, count
);
1364 *count
= node
->outputs
.count
;
1369 static void topology_node_set_stream_type(struct node_stream
*stream
, IMFMediaType
*mediatype
)
1371 if (stream
->preferred_type
)
1372 IMFMediaType_Release(stream
->preferred_type
);
1373 stream
->preferred_type
= mediatype
;
1374 if (stream
->preferred_type
)
1375 IMFMediaType_AddRef(stream
->preferred_type
);
1378 static HRESULT
topology_node_connect_output(struct topology_node
*node
, DWORD output_index
,
1379 struct topology_node
*connection
, DWORD input_index
)
1381 struct node_stream
*stream
;
1384 if (node
->node_type
== MF_TOPOLOGY_OUTPUT_NODE
|| connection
->node_type
== MF_TOPOLOGY_SOURCESTREAM_NODE
)
1387 EnterCriticalSection(&node
->cs
);
1388 EnterCriticalSection(&connection
->cs
);
1390 topology_node_disconnect_output(node
, output_index
);
1391 if (input_index
< connection
->inputs
.count
)
1393 stream
= &connection
->inputs
.streams
[input_index
];
1394 if (stream
->connection
)
1395 topology_node_disconnect_output(stream
->connection
, stream
->connection_stream
);
1398 hr
= topology_node_reserve_streams(&node
->outputs
, output_index
);
1401 size_t old_count
= connection
->inputs
.count
;
1402 hr
= topology_node_reserve_streams(&connection
->inputs
, input_index
);
1403 if (SUCCEEDED(hr
) && !old_count
&& connection
->input_type
)
1405 topology_node_set_stream_type(connection
->inputs
.streams
, connection
->input_type
);
1406 IMFMediaType_Release(connection
->input_type
);
1407 connection
->input_type
= NULL
;
1413 node
->outputs
.streams
[output_index
].connection
= connection
;
1414 IMFTopologyNode_AddRef(&node
->outputs
.streams
[output_index
].connection
->IMFTopologyNode_iface
);
1415 node
->outputs
.streams
[output_index
].connection_stream
= input_index
;
1416 connection
->inputs
.streams
[input_index
].connection
= node
;
1417 IMFTopologyNode_AddRef(&connection
->inputs
.streams
[input_index
].connection
->IMFTopologyNode_iface
);
1418 connection
->inputs
.streams
[input_index
].connection_stream
= output_index
;
1421 LeaveCriticalSection(&connection
->cs
);
1422 LeaveCriticalSection(&node
->cs
);
1427 static HRESULT WINAPI
topology_node_ConnectOutput(IMFTopologyNode
*iface
, DWORD output_index
,
1428 IMFTopologyNode
*peer
, DWORD input_index
)
1430 struct topology_node
*node
= impl_from_IMFTopologyNode(iface
);
1431 struct topology_node
*connection
= unsafe_impl_from_IMFTopologyNode(peer
);
1433 TRACE("%p, %lu, %p, %lu.\n", iface
, output_index
, peer
, input_index
);
1437 WARN("External node implementations are not supported.\n");
1438 return E_UNEXPECTED
;
1441 return topology_node_connect_output(node
, output_index
, connection
, input_index
);
1444 static HRESULT WINAPI
topology_node_DisconnectOutput(IMFTopologyNode
*iface
, DWORD output_index
)
1446 struct topology_node
*node
= impl_from_IMFTopologyNode(iface
);
1448 TRACE("%p, %lu.\n", iface
, output_index
);
1450 return topology_node_disconnect_output(node
, output_index
);
1453 static HRESULT WINAPI
topology_node_GetInput(IMFTopologyNode
*iface
, DWORD input_index
, IMFTopologyNode
**ret
,
1454 DWORD
*output_index
)
1456 struct topology_node
*node
= impl_from_IMFTopologyNode(iface
);
1459 TRACE("%p, %lu, %p, %p.\n", iface
, input_index
, ret
, output_index
);
1461 EnterCriticalSection(&node
->cs
);
1463 if (input_index
< node
->inputs
.count
)
1465 const struct node_stream
*stream
= &node
->inputs
.streams
[input_index
];
1467 if (stream
->connection
)
1469 *ret
= &stream
->connection
->IMFTopologyNode_iface
;
1470 IMFTopologyNode_AddRef(*ret
);
1471 *output_index
= stream
->connection_stream
;
1474 hr
= MF_E_NOT_FOUND
;
1479 LeaveCriticalSection(&node
->cs
);
1484 static HRESULT WINAPI
topology_node_GetOutput(IMFTopologyNode
*iface
, DWORD output_index
, IMFTopologyNode
**ret
,
1487 struct topology_node
*node
= impl_from_IMFTopologyNode(iface
);
1490 TRACE("%p, %lu, %p, %p.\n", iface
, output_index
, ret
, input_index
);
1492 EnterCriticalSection(&node
->cs
);
1494 if (output_index
< node
->outputs
.count
)
1496 const struct node_stream
*stream
= &node
->outputs
.streams
[output_index
];
1498 if (stream
->connection
)
1500 *ret
= &stream
->connection
->IMFTopologyNode_iface
;
1501 IMFTopologyNode_AddRef(*ret
);
1502 *input_index
= stream
->connection_stream
;
1505 hr
= MF_E_NOT_FOUND
;
1510 LeaveCriticalSection(&node
->cs
);
1515 static HRESULT WINAPI
topology_node_SetOutputPrefType(IMFTopologyNode
*iface
, DWORD index
, IMFMediaType
*mediatype
)
1517 struct topology_node
*node
= impl_from_IMFTopologyNode(iface
);
1520 TRACE("%p, %lu, %p.\n", iface
, index
, mediatype
);
1522 EnterCriticalSection(&node
->cs
);
1524 if (node
->node_type
!= MF_TOPOLOGY_OUTPUT_NODE
)
1526 if (SUCCEEDED(hr
= topology_node_reserve_streams(&node
->outputs
, index
)))
1527 topology_node_set_stream_type(&node
->outputs
.streams
[index
], mediatype
);
1532 LeaveCriticalSection(&node
->cs
);
1537 static HRESULT
topology_node_get_pref_type(struct node_streams
*streams
, unsigned int index
, IMFMediaType
**mediatype
)
1539 *mediatype
= streams
->streams
[index
].preferred_type
;
1542 IMFMediaType_AddRef(*mediatype
);
1549 static HRESULT WINAPI
topology_node_GetOutputPrefType(IMFTopologyNode
*iface
, DWORD index
, IMFMediaType
**mediatype
)
1551 struct topology_node
*node
= impl_from_IMFTopologyNode(iface
);
1554 TRACE("%p, %lu, %p.\n", iface
, index
, mediatype
);
1556 EnterCriticalSection(&node
->cs
);
1558 if (index
< node
->outputs
.count
)
1559 hr
= topology_node_get_pref_type(&node
->outputs
, index
, mediatype
);
1563 LeaveCriticalSection(&node
->cs
);
1568 static HRESULT WINAPI
topology_node_SetInputPrefType(IMFTopologyNode
*iface
, DWORD index
, IMFMediaType
*mediatype
)
1570 struct topology_node
*node
= impl_from_IMFTopologyNode(iface
);
1573 TRACE("%p, %lu, %p.\n", iface
, index
, mediatype
);
1575 EnterCriticalSection(&node
->cs
);
1577 switch (node
->node_type
)
1579 case MF_TOPOLOGY_TEE_NODE
:
1582 hr
= MF_E_INVALIDTYPE
;
1585 if (node
->inputs
.count
)
1586 topology_node_set_stream_type(&node
->inputs
.streams
[index
], mediatype
);
1589 if (node
->input_type
)
1590 IMFMediaType_Release(node
->input_type
);
1591 node
->input_type
= mediatype
;
1592 if (node
->input_type
)
1593 IMFMediaType_AddRef(node
->input_type
);
1596 case MF_TOPOLOGY_SOURCESTREAM_NODE
:
1600 if (SUCCEEDED(hr
= topology_node_reserve_streams(&node
->inputs
, index
)))
1601 topology_node_set_stream_type(&node
->inputs
.streams
[index
], mediatype
);
1604 LeaveCriticalSection(&node
->cs
);
1609 static HRESULT WINAPI
topology_node_GetInputPrefType(IMFTopologyNode
*iface
, DWORD index
, IMFMediaType
**mediatype
)
1611 struct topology_node
*node
= impl_from_IMFTopologyNode(iface
);
1614 TRACE("%p, %lu, %p.\n", iface
, index
, mediatype
);
1616 EnterCriticalSection(&node
->cs
);
1618 if (index
< node
->inputs
.count
)
1620 hr
= topology_node_get_pref_type(&node
->inputs
, index
, mediatype
);
1622 else if (node
->node_type
== MF_TOPOLOGY_TEE_NODE
&& node
->input_type
)
1624 *mediatype
= node
->input_type
;
1625 IMFMediaType_AddRef(*mediatype
);
1630 LeaveCriticalSection(&node
->cs
);
1635 static HRESULT WINAPI
topology_node_CloneFrom(IMFTopologyNode
*iface
, IMFTopologyNode
*src_node
)
1637 struct topology_node
*node
= impl_from_IMFTopologyNode(iface
);
1638 MF_TOPOLOGY_TYPE node_type
;
1639 IMFMediaType
*mediatype
;
1645 TRACE("%p, %p.\n", iface
, src_node
);
1647 if (FAILED(hr
= IMFTopologyNode_GetNodeType(src_node
, &node_type
)))
1650 if (node
->node_type
!= node_type
)
1651 return MF_E_INVALIDREQUEST
;
1653 if (FAILED(hr
= IMFTopologyNode_GetTopoNodeID(src_node
, &topoid
)))
1657 IMFTopologyNode_GetObject(src_node
, &object
);
1659 EnterCriticalSection(&node
->cs
);
1661 hr
= IMFTopologyNode_CopyAllItems(src_node
, node
->attributes
);
1664 hr
= topology_node_set_object(node
, object
);
1669 if (SUCCEEDED(IMFTopologyNode_GetInputCount(src_node
, &count
)))
1671 for (i
= 0; i
< count
; ++i
)
1673 if (SUCCEEDED(IMFTopologyNode_GetInputPrefType(src_node
, i
, &mediatype
)))
1675 IMFTopologyNode_SetInputPrefType(iface
, i
, mediatype
);
1676 IMFMediaType_Release(mediatype
);
1681 if (SUCCEEDED(IMFTopologyNode_GetOutputCount(src_node
, &count
)))
1683 for (i
= 0; i
< count
; ++i
)
1685 if (SUCCEEDED(IMFTopologyNode_GetOutputPrefType(src_node
, i
, &mediatype
)))
1687 IMFTopologyNode_SetOutputPrefType(iface
, i
, mediatype
);
1688 IMFMediaType_Release(mediatype
);
1693 LeaveCriticalSection(&node
->cs
);
1696 IUnknown_Release(object
);
1701 static const IMFTopologyNodeVtbl topologynodevtbl
=
1703 topology_node_QueryInterface
,
1704 topology_node_AddRef
,
1705 topology_node_Release
,
1706 topology_node_GetItem
,
1707 topology_node_GetItemType
,
1708 topology_node_CompareItem
,
1709 topology_node_Compare
,
1710 topology_node_GetUINT32
,
1711 topology_node_GetUINT64
,
1712 topology_node_GetDouble
,
1713 topology_node_GetGUID
,
1714 topology_node_GetStringLength
,
1715 topology_node_GetString
,
1716 topology_node_GetAllocatedString
,
1717 topology_node_GetBlobSize
,
1718 topology_node_GetBlob
,
1719 topology_node_GetAllocatedBlob
,
1720 topology_node_GetUnknown
,
1721 topology_node_SetItem
,
1722 topology_node_DeleteItem
,
1723 topology_node_DeleteAllItems
,
1724 topology_node_SetUINT32
,
1725 topology_node_SetUINT64
,
1726 topology_node_SetDouble
,
1727 topology_node_SetGUID
,
1728 topology_node_SetString
,
1729 topology_node_SetBlob
,
1730 topology_node_SetUnknown
,
1731 topology_node_LockStore
,
1732 topology_node_UnlockStore
,
1733 topology_node_GetCount
,
1734 topology_node_GetItemByIndex
,
1735 topology_node_CopyAllItems
,
1736 topology_node_SetObject
,
1737 topology_node_GetObject
,
1738 topology_node_GetNodeType
,
1739 topology_node_GetTopoNodeID
,
1740 topology_node_SetTopoNodeID
,
1741 topology_node_GetInputCount
,
1742 topology_node_GetOutputCount
,
1743 topology_node_ConnectOutput
,
1744 topology_node_DisconnectOutput
,
1745 topology_node_GetInput
,
1746 topology_node_GetOutput
,
1747 topology_node_SetOutputPrefType
,
1748 topology_node_GetOutputPrefType
,
1749 topology_node_SetInputPrefType
,
1750 topology_node_GetInputPrefType
,
1751 topology_node_CloneFrom
,
1754 static HRESULT
create_topology_node(MF_TOPOLOGY_TYPE node_type
, struct topology_node
**node
)
1758 if (!(*node
= calloc(1, sizeof(**node
))))
1759 return E_OUTOFMEMORY
;
1761 (*node
)->IMFTopologyNode_iface
.lpVtbl
= &topologynodevtbl
;
1762 (*node
)->refcount
= 1;
1763 (*node
)->node_type
= node_type
;
1764 hr
= MFCreateAttributes(&(*node
)->attributes
, 0);
1770 (*node
)->id
= ((TOPOID
)GetCurrentProcessId() << 32) | InterlockedIncrement(&next_node_id
);
1771 InitializeCriticalSection(&(*node
)->cs
);
1776 HRESULT
topology_node_get_object(IMFTopologyNode
*node
, REFIID riid
, void **obj
)
1783 if (SUCCEEDED(hr
= IMFTopologyNode_GetObject(node
, &unk
)))
1785 hr
= IUnknown_QueryInterface(unk
, riid
, obj
);
1786 IUnknown_Release(unk
);
1792 /***********************************************************************
1793 * MFCreateTopologyNode (mf.@)
1795 HRESULT WINAPI
MFCreateTopologyNode(MF_TOPOLOGY_TYPE node_type
, IMFTopologyNode
**node
)
1797 struct topology_node
*object
;
1800 TRACE("%d, %p.\n", node_type
, node
);
1805 hr
= create_topology_node(node_type
, &object
);
1807 *node
= &object
->IMFTopologyNode_iface
;
1812 /* private helper for node types without an actual IMFMediaTypeHandler */
1815 IMFMediaTypeHandler IMFMediaTypeHandler_iface
;
1818 IMFTopologyNode
*node
;
1822 IMFTransform
*transform
;
1825 static struct type_handler
*impl_from_IMFMediaTypeHandler(IMFMediaTypeHandler
*iface
)
1827 return CONTAINING_RECORD(iface
, struct type_handler
, IMFMediaTypeHandler_iface
);
1830 static HRESULT WINAPI
type_handler_QueryInterface(IMFMediaTypeHandler
*iface
, REFIID riid
, void **obj
)
1832 if (IsEqualIID(riid
, &IID_IMFMediaTypeHandler
)
1833 || IsEqualIID(riid
, &IID_IUnknown
))
1835 IMFMediaTypeHandler_AddRef((*obj
= iface
));
1840 return E_NOINTERFACE
;
1843 static ULONG WINAPI
type_handler_AddRef(IMFMediaTypeHandler
*iface
)
1845 struct type_handler
*handler
= impl_from_IMFMediaTypeHandler(iface
);
1846 ULONG refcount
= InterlockedIncrement(&handler
->refcount
);
1850 static ULONG WINAPI
type_handler_Release(IMFMediaTypeHandler
*iface
)
1852 struct type_handler
*handler
= impl_from_IMFMediaTypeHandler(iface
);
1853 ULONG refcount
= InterlockedDecrement(&handler
->refcount
);
1857 if (handler
->transform
)
1858 IMFTransform_Release(handler
->transform
);
1859 IMFTopologyNode_Release(handler
->node
);
1866 static HRESULT WINAPI
type_handler_IsMediaTypeSupported(IMFMediaTypeHandler
*iface
, IMFMediaType
*in_type
,
1867 IMFMediaType
**out_type
)
1869 struct type_handler
*handler
= impl_from_IMFMediaTypeHandler(iface
);
1877 if (handler
->transform
)
1879 if (handler
->output
)
1880 return IMFTransform_SetOutputType(handler
->transform
, handler
->stream
, in_type
, MFT_SET_TYPE_TEST_ONLY
);
1882 return IMFTransform_SetInputType(handler
->transform
, handler
->stream
, in_type
, MFT_SET_TYPE_TEST_ONLY
);
1885 if (FAILED(hr
= IMFMediaTypeHandler_GetCurrentMediaType(iface
, &type
)))
1888 hr
= IMFMediaType_IsEqual(type
, in_type
, &flags
);
1889 IMFMediaType_Release(type
);
1893 static HRESULT WINAPI
type_handler_GetMediaTypeCount(IMFMediaTypeHandler
*iface
, DWORD
*count
)
1898 static HRESULT WINAPI
type_handler_GetMediaTypeByIndex(IMFMediaTypeHandler
*iface
, DWORD index
,
1899 IMFMediaType
**type
)
1901 struct type_handler
*handler
= impl_from_IMFMediaTypeHandler(iface
);
1903 if (handler
->transform
)
1905 if (handler
->output
)
1906 return IMFTransform_GetOutputAvailableType(handler
->transform
, handler
->stream
, index
, type
);
1908 return IMFTransform_GetInputAvailableType(handler
->transform
, handler
->stream
, index
, type
);
1912 return MF_E_NO_MORE_TYPES
;
1914 return IMFMediaTypeHandler_GetCurrentMediaType(iface
, type
);
1917 static HRESULT WINAPI
type_handler_SetCurrentMediaType(IMFMediaTypeHandler
*iface
, IMFMediaType
*type
)
1919 struct type_handler
*handler
= impl_from_IMFMediaTypeHandler(iface
);
1921 if (handler
->transform
)
1923 if (handler
->output
)
1924 return IMFTransform_SetOutputType(handler
->transform
, handler
->stream
, type
, 0);
1926 return IMFTransform_SetInputType(handler
->transform
, handler
->stream
, type
, 0);
1929 return IMFTopologyNode_SetInputPrefType(handler
->node
, handler
->stream
, type
);
1932 static HRESULT WINAPI
type_handler_GetCurrentMediaType(IMFMediaTypeHandler
*iface
, IMFMediaType
**type
)
1934 struct type_handler
*handler
= impl_from_IMFMediaTypeHandler(iface
);
1937 if (handler
->transform
)
1939 if (handler
->output
)
1940 return IMFTransform_GetOutputCurrentType(handler
->transform
, handler
->stream
, type
);
1942 return IMFTransform_GetInputCurrentType(handler
->transform
, handler
->stream
, type
);
1945 if (SUCCEEDED(IMFTopologyNode_GetInputPrefType(handler
->node
, 0, type
)))
1948 if (FAILED(IMFTopologyNode_GetUINT32(handler
->node
, &MF_TOPONODE_PRIMARYOUTPUT
, &output
)))
1951 return IMFTopologyNode_GetOutputPrefType(handler
->node
, output
, type
);
1954 static HRESULT WINAPI
type_handler_GetMajorType(IMFMediaTypeHandler
*iface
, GUID
*type
)
1956 IMFMediaType
*media_type
;
1959 if (FAILED(hr
= IMFMediaTypeHandler_GetCurrentMediaType(iface
, &media_type
)))
1962 hr
= IMFMediaType_GetMajorType(media_type
, type
);
1963 IMFMediaType_Release(media_type
);
1967 static const IMFMediaTypeHandlerVtbl type_handler_vtbl
=
1969 type_handler_QueryInterface
,
1970 type_handler_AddRef
,
1971 type_handler_Release
,
1972 type_handler_IsMediaTypeSupported
,
1973 type_handler_GetMediaTypeCount
,
1974 type_handler_GetMediaTypeByIndex
,
1975 type_handler_SetCurrentMediaType
,
1976 type_handler_GetCurrentMediaType
,
1977 type_handler_GetMajorType
,
1980 static HRESULT
type_handler_create(IMFTopologyNode
*node
, DWORD stream
, BOOL output
, IMFTransform
*transform
, IMFMediaTypeHandler
**out
)
1982 struct type_handler
*handler
;
1984 if (!(handler
= calloc(1, sizeof(*handler
)))) return E_OUTOFMEMORY
;
1985 handler
->IMFMediaTypeHandler_iface
.lpVtbl
= &type_handler_vtbl
;
1986 handler
->refcount
= 1;
1987 handler
->stream
= stream
;
1988 handler
->output
= output
;
1989 IMFTopologyNode_AddRef((handler
->node
= node
));
1991 IMFTransform_AddRef((handler
->transform
= transform
));
1993 *out
= &handler
->IMFMediaTypeHandler_iface
;
1997 HRESULT
topology_node_get_type_handler(IMFTopologyNode
*node
, DWORD stream
,
1998 BOOL output
, IMFMediaTypeHandler
**handler
)
2000 MF_TOPOLOGY_TYPE node_type
;
2001 IMFStreamSink
*stream_sink
;
2002 IMFStreamDescriptor
*sd
;
2003 IMFTransform
*transform
;
2006 if (FAILED(hr
= IMFTopologyNode_GetNodeType(node
, &node_type
)))
2011 case MF_TOPOLOGY_OUTPUT_NODE
:
2012 if (output
|| stream
)
2013 return MF_E_INVALIDSTREAMNUMBER
;
2015 if (SUCCEEDED(hr
= topology_node_get_object(node
, &IID_IMFStreamSink
, (void **)&stream_sink
)))
2017 hr
= IMFStreamSink_GetMediaTypeHandler(stream_sink
, handler
);
2018 IMFStreamSink_Release(stream_sink
);
2021 case MF_TOPOLOGY_SOURCESTREAM_NODE
:
2022 if (!output
|| stream
)
2023 return MF_E_INVALIDSTREAMNUMBER
;
2025 if (SUCCEEDED(hr
= IMFTopologyNode_GetUnknown(node
, &MF_TOPONODE_STREAM_DESCRIPTOR
,
2026 &IID_IMFStreamDescriptor
, (void **)&sd
)))
2028 hr
= IMFStreamDescriptor_GetMediaTypeHandler(sd
, handler
);
2029 IMFStreamDescriptor_Release(sd
);
2032 case MF_TOPOLOGY_TRANSFORM_NODE
:
2033 if (SUCCEEDED(hr
= topology_node_get_object(node
, &IID_IMFTransform
, (void **)&transform
)))
2035 hr
= type_handler_create(node
, stream
, output
, transform
, handler
);
2036 IMFTransform_Release(transform
);
2039 case MF_TOPOLOGY_TEE_NODE
:
2040 hr
= type_handler_create(node
, stream
, output
, NULL
, handler
);
2043 WARN("Unexpected node type %u.\n", node_type
);
2044 return MF_E_UNEXPECTED
;
2050 /***********************************************************************
2051 * MFGetTopoNodeCurrentType (mf.@)
2053 HRESULT WINAPI
MFGetTopoNodeCurrentType(IMFTopologyNode
*node
, DWORD stream
, BOOL output
, IMFMediaType
**type
)
2055 IMFMediaTypeHandler
*handler
;
2058 TRACE("%p, %lu, %d, %p.\n", node
, stream
, output
, type
);
2060 if (FAILED(hr
= topology_node_get_type_handler(node
, stream
, output
, &handler
)))
2063 hr
= IMFMediaTypeHandler_GetCurrentMediaType(handler
, type
);
2064 IMFMediaTypeHandler_Release(handler
);
2068 static HRESULT WINAPI
seq_source_QueryInterface(IMFSequencerSource
*iface
, REFIID riid
, void **out
)
2070 struct seq_source
*seq_source
= impl_from_IMFSequencerSource(iface
);
2072 TRACE("%p, %s, %p.\n", iface
, debugstr_guid(riid
), out
);
2076 if (IsEqualIID(riid
, &IID_IMFSequencerSource
) ||
2077 IsEqualIID(riid
, &IID_IUnknown
))
2079 *out
= &seq_source
->IMFSequencerSource_iface
;
2081 else if (IsEqualIID(riid
, &IID_IMFMediaSourceTopologyProvider
))
2083 *out
= &seq_source
->IMFMediaSourceTopologyProvider_iface
;
2087 WARN("Unimplemented %s.\n", debugstr_guid(riid
));
2088 return E_NOINTERFACE
;
2092 IUnknown_AddRef((IUnknown
*)*out
);
2097 static ULONG WINAPI
seq_source_AddRef(IMFSequencerSource
*iface
)
2099 struct seq_source
*seq_source
= impl_from_IMFSequencerSource(iface
);
2100 ULONG refcount
= InterlockedIncrement(&seq_source
->refcount
);
2102 TRACE("%p, refcount %lu.\n", iface
, refcount
);
2107 static ULONG WINAPI
seq_source_Release(IMFSequencerSource
*iface
)
2109 struct seq_source
*seq_source
= impl_from_IMFSequencerSource(iface
);
2110 ULONG refcount
= InterlockedDecrement(&seq_source
->refcount
);
2112 TRACE("%p, refcount %lu.\n", iface
, refcount
);
2120 static HRESULT WINAPI
seq_source_AppendTopology(IMFSequencerSource
*iface
, IMFTopology
*topology
,
2121 DWORD flags
, MFSequencerElementId
*id
)
2123 FIXME("%p, %p, %lx, %p.\n", iface
, topology
, flags
, id
);
2128 static HRESULT WINAPI
seq_source_DeleteTopology(IMFSequencerSource
*iface
, MFSequencerElementId id
)
2130 FIXME("%p, %#lx.\n", iface
, id
);
2135 static HRESULT WINAPI
seq_source_GetPresentationContext(IMFSequencerSource
*iface
,
2136 IMFPresentationDescriptor
*descriptor
, MFSequencerElementId
*id
, IMFTopology
**topology
)
2138 FIXME("%p, %p, %p, %p.\n", iface
, descriptor
, id
, topology
);
2143 static HRESULT WINAPI
seq_source_UpdateTopology(IMFSequencerSource
*iface
, MFSequencerElementId id
,
2144 IMFTopology
*topology
)
2146 FIXME("%p, %#lx, %p.\n", iface
, id
, topology
);
2151 static HRESULT WINAPI
seq_source_UpdateTopologyFlags(IMFSequencerSource
*iface
, MFSequencerElementId id
, DWORD flags
)
2153 FIXME("%p, %#lx, %#lx.\n", iface
, id
, flags
);
2158 static HRESULT WINAPI
seq_source_topology_provider_QueryInterface(IMFMediaSourceTopologyProvider
*iface
, REFIID riid
,
2161 struct seq_source
*seq_source
= impl_from_IMFMediaSourceTopologyProvider(iface
);
2162 return IMFSequencerSource_QueryInterface(&seq_source
->IMFSequencerSource_iface
, riid
, obj
);
2165 static ULONG WINAPI
seq_source_topology_provider_AddRef(IMFMediaSourceTopologyProvider
*iface
)
2167 struct seq_source
*seq_source
= impl_from_IMFMediaSourceTopologyProvider(iface
);
2168 return IMFSequencerSource_AddRef(&seq_source
->IMFSequencerSource_iface
);
2171 static ULONG WINAPI
seq_source_topology_provider_Release(IMFMediaSourceTopologyProvider
*iface
)
2173 struct seq_source
*seq_source
= impl_from_IMFMediaSourceTopologyProvider(iface
);
2174 return IMFSequencerSource_Release(&seq_source
->IMFSequencerSource_iface
);
2177 static HRESULT WINAPI
seq_source_topology_provider_GetMediaSourceTopology(IMFMediaSourceTopologyProvider
*iface
,
2178 IMFPresentationDescriptor
*pd
, IMFTopology
**topology
)
2180 FIXME("%p, %p, %p.\n", iface
, pd
, topology
);
2185 static const IMFMediaSourceTopologyProviderVtbl seq_source_topology_provider_vtbl
=
2187 seq_source_topology_provider_QueryInterface
,
2188 seq_source_topology_provider_AddRef
,
2189 seq_source_topology_provider_Release
,
2190 seq_source_topology_provider_GetMediaSourceTopology
,
2193 static const IMFSequencerSourceVtbl seqsourcevtbl
=
2195 seq_source_QueryInterface
,
2198 seq_source_AppendTopology
,
2199 seq_source_DeleteTopology
,
2200 seq_source_GetPresentationContext
,
2201 seq_source_UpdateTopology
,
2202 seq_source_UpdateTopologyFlags
,
2205 /***********************************************************************
2206 * MFCreateSequencerSource (mf.@)
2208 HRESULT WINAPI
MFCreateSequencerSource(IUnknown
*reserved
, IMFSequencerSource
**seq_source
)
2210 struct seq_source
*object
;
2212 TRACE("%p, %p.\n", reserved
, seq_source
);
2217 if (!(object
= calloc(1, sizeof(*object
))))
2218 return E_OUTOFMEMORY
;
2220 object
->IMFSequencerSource_iface
.lpVtbl
= &seqsourcevtbl
;
2221 object
->IMFMediaSourceTopologyProvider_iface
.lpVtbl
= &seq_source_topology_provider_vtbl
;
2222 object
->refcount
= 1;
2224 *seq_source
= &object
->IMFSequencerSource_iface
;