How to change the existing stream?

From AVObjects Knowledge Base
Jump to: navigation, search

There is no way to add/remove streams without re-initialization of Vision Mixer object, but you easily can change the existing one. This feature allows you to operate with streams any way you need.

Here is a sequence of actions to change stream in Vision Mixer C# sample:

  • Run sample and add a couple of streams. If can be File streams, Live Source streams, Empty streams (like "bars") or something else.

Press "Apply" to initialize Vision Mixer object with your streams. Please note that you can change only existing streams but cannot add/remove them, so if you plan to show one more stream some time later you need to add fake stream ("bars") for it before initialization.

ChangeStream1.jpg


  • Double click on a stream you need to change in upper left table. The "change stream" dialog will appear.

ChangeStream2.jpg


  • If you need to change stream to file, select "File" radio button, choose needed file and press "Apply".

ChangeStream3.jpg

You'll see that your stream is changed to file stream.

ChangeStream4.jpg

Code sample:

MGVIDEOMIXERLib.IMGMixerFiles pMixerFiles = (MGVIDEOMIXERLib.IMGMixerFiles)m_pMixerConfig;

pMixerFiles.ChangeFile(m_nStream, textPath.Text, dblIn, dblOut);


  • If you need to change stream to Live Source, select "Live Source" radio button, choose needed source and it's properties and press "Apply".

ChangeStream5.jpg

You'll see that your stream is changed to Live Source stream.

Code sample:

MGVIDEOMIXERLib.IMLVideoMixerScene pMixerScene = (MGVIDEOMIXERLib.IMLVideoMixerScene)m_pMixerConfig;

m_pMixerConfig.SetTargetStream(m_nStream);

MGVIDEOMIXERLib.IMGDeviceConfig pDeviceConfig = (MGVIDEOMIXERLib.IMGDeviceConfig)m_pMixerConfig;

//Set audio device

pDeviceConfig.SetDevice(comboAudDevice.SelectedItem.ToString(), MGVIDEOMIXERLib.eMGDeviceType.eMGDT_Audio);

//Set video device

pDeviceConfig.SetDevice(comboVidDevice.SelectedItem.ToString(), MGVIDEOMIXERLib.eMGDeviceType.eMGDT_Video);

pDeviceConfig.SetFormat(comboFormatVid.SelectedIndex, MGVIDEOMIXERLib.eMGDeviceType.eMGDT_Video);

m_pMixerConfig.SetPreparedDevice(m_nStream, 1);

Personal tools