Medialooks Knowledge Base Support Center

Contact Us

Reinitialization of a live source

To close a device you should close the MLive object with the ObjectClose method:

(m_objMLive as IMObject).ObjectClose();

or close the device with the DeviceClose method for the MFLive object:

myLiveSource.DeviceClose();

Once the device is closed, the MLive object is flushed, and all the parameters are released. After this, there is no information about available input lines or video formats to be set for the object. 

To get the parameters back you should set a device again with the DeviceSet method. By default, once the object is closed, information about the previous session is kept within the object (only the last session). So you can initialize the source again with the same parameters by calling

(m_objMLive as IMObject).ObjectStart(null);

for MPlatform, and by grabbing a frame from the MFLive object.

To specify a video format or an input line when the object is closed, there are 2 ways: 

1. Set the device again

Before setting an input line of a video format you should call:

m_objMLive.DeviceSet("video", "UltraStudio Express, ""); // MPlatform SDK
myLiveSource.DeviceSet(eMFDeviceType.eMFDT_Video, targetIndex, ""); // MFormats SDK

2. Set a video format right after you start the device

For MPlatform SDK only: 

(m_objMLive as IMObject).ObjectStart(null); 
(m_objMLive as IMFormat).FormatVideoSet(eMFT_Input, ref desiredProps);