1

There is one file with two video stream.

  1. I want to mix these two stream to make one output stream.(using media session)

  2. I think we can write the topology as shown below.

https://msdn.microsoft.com/en-us/library/windows/desktop/ms701605(v=vs.85).aspx

IMFActivate         *pSinkActivate = NULL;
IMFTopologyNode     *pOutputNode = NULL;

pPD->GetStreamDescriptorCount(&cSourceStreams);
// For each stream, create the topology nodes and add them to the topology.
for (DWORD i = 0; i < cSourceStreams; i++)
{
    IMFStreamDescriptor *pSD = NULL;
    IMFTopologyNode     *pSourceNode = NULL;

    pPD->GetStreamDescriptorByIndex(i, &fSelected, &pSD);
    // Create the media sink activation object.
    if (i == 0)
        CreateMediaSinkActivate(pSD, hVideoWnd, &pSinkActivate);
    // Add a source node for this stream.
    AddSourceNode(pTopology, pSource, pPD, pSD, &pSourceNode);
    // Create the output node for the renderer.
    if (i == 0)
        AddOutputNode(pTopology, pSinkActivate, 0, &pOutputNode);

    // Connect the source node to the output node.
    pSourceNode->ConnectOutput(0, pOutputNode, 0);

    SafeRelease(&pSD);
    SafeRelease(&pSourceNode);
}
SafeRelease(&pSinkActivate);
SafeRelease(&pOutputNode);

I don't know if I'm doing well.

please help me.

thanks.

pevrizz
  • 31
  • 3
  • You are doing it wrong. You have to add two different source nodes for each stream. You also have to create two different sinks if that's your intention. You cannot instantiate the same pSinkActivate and the same pSourceNode twice. You have to manually connect each source node to each sink, or if you have a single sink - to each input stream node of the sink. – VuVirt Oct 23 '17 at 09:22
  • @VuVirt sorry I made the wrong sample. I have rewritten the sample in detail, so please review it again. – pevrizz Oct 23 '17 at 12:13
  • still wrong. You need a separate outputNode for each stream of the renderer media sink. – VuVirt Oct 23 '17 at 12:15
  • @VuVirt Can i mixing the two streams by creating media sink and outputnode for each of the two streams? – pevrizz Oct 24 '17 at 05:01
  • It should be possible, but you have to take into consideration several limitations and requirements, like secondary stream input media types. I think you should better implement a custom MFT mixer as well. You can read more here: https://msdn.microsoft.com/en-us/library/windows/desktop/bb970394(v=vs.85).aspx and here: https://msdn.microsoft.com/en-us/library/windows/desktop/ms701624(v=vs.85).aspx – VuVirt Oct 24 '17 at 07:09
  • @VuVirt Is it right to add both media sink and output node to both streams? I'll try. thank you for helping me. – pevrizz Oct 24 '17 at 07:45
  • Only 1 media sink. 1 output node for each input stream. – VuVirt Oct 24 '17 at 07:48

0 Answers0