IMFVideoMixerControl used to render video. You were on the right track looking at SourceReader.
Here is what I will do:
- Create an
IMFSourceReader for each video source. - Create an
IMFSinkWriter and configure it with a frame width equal to the sum of the frame width of the source reader.- Use
IMFSourceReader::GetCurrentMediaType to get the original media types. - Use
MFGetAttributeSize with the GUID MF_MT_FRAME_SIZE to get the frame sizes for each type of source. - Create a media type for SinkWriter using
MFCreateMediaType and use IMFMediaType::CopyAllItems to copy attributes from the source to flood media types. - Use the
MFSetAttributeSize with the GUID MF_MT_FRAME_SIZE to set the dimensions of the oversized sink frames. - Use
IMFSinkWriter::AddStream to create a video stream identical to the source type, except for the width attribute
- Call IMFSourceReader :: ReadSample for each source, giving you one IMFSample for each source.
- Highlight the new
IMFSample by adding a new IMFMediaBuffer with increased frame width. - Use
MFCopyImage to copy each of the source buffers to the corresponding side of the selected media buffer. - Use
IMFSinkWriter::WriteSample to write your IMFSample to a raster file.
See this example for some basic processing of the SourceReader / SinkWriter, although this example uses a video capture source instead of the source. You can create a SourceReader file using MFCreateSourceReaderFromURL instead of MFCreateSourceReaderFromMediaSource .
Edit: I realized that you were asking about audio too. My answer only concerns the layout of video streams.
source share