private void InitMixerLayer() { MElement root; m_objMixer.ElementsGetByIndex(0, out root); (root as IMElements).ElementsAdd("", "video", $"stream_id='Layer_1' h=1 w=1 x=0 y=0 show=1 pos=top-left alpha=1 audio_gain=0", out m_Layer, 0); }
private void OpenFileMMixer_btn_Click(object sender, EventArgs e) { MarshalAll(); m_objMixer = new MMixerClass(); m_objMixer.ObjectStart(null); ReInitPr("MMixer"); if (openFileDialog1.ShowDialog() == DialogResult.OK && openFileDialog1.FileNames.Length != 0) { for (int i = 0; i < openFileDialog1.FileNames.Length; i++) { MItem pItem; startTime = DateTime.Now; m_objMixer.StreamsAdd("", null, openFileDialog1.FileNames[i], addParams.Text, out pItem, 1.00); endTime = DateTime.Now; CalcTimeSpan(); SendMes("StreamsAdd takes: " + duration.TotalMilliseconds.ToString() + " TotalMilliseconds"); SendMes("With this Params : " + addParams.Text); if (pItem != null) { System.Runtime.InteropServices.Marshal.ReleaseComObject(pItem); GC.Collect(); } } MElement root; m_objMixer.ElementsGetByIndex(0, out root); MElement pChild; startTime = DateTime.Now; (root as IMElements).ElementsAdd("", "video", "stream_id=stream-000 h=0.5 w=0.5 show=1", out pChild, 0); endTime = DateTime.Now; CalcTimeSpan(); SendMes("ElementsAdd takes: " + duration.TotalMilliseconds.ToString() + " TotalMilliseconds"); SendMes("With this Params : " + addParams.Text); Marshal.ReleaseComObject(pChild); m_objMixer.FilePlayStart(); } }
private void listOfStreams_ltb_SelectedIndexChanged(object sender, EventArgs e) { ListBox comboBox = (ListBox)sender; string selected = (string)comboBox.SelectedItem; string strStreamID; Parse(selected, out strStreamID); string sceneID; int sceneIndex; MElement root; m_objMixer.ElementsGetByIndex(0, out root); MElement pChild; (root as IMElements).ElementsAdd("", "video", "stream_id=" + strStreamID + " h=0.5 w=0.5 show=1", out pChild, 0); m_objMixer.FilePlayStart(); }
private void Button1_Click(object sender, EventArgs e) { m_objMixerInternal.ObjectStart(null); MItem pItem; if (openMediaFile.ShowDialog() == DialogResult.OK && openMediaFile.FileNames.Length != 0) { for (int i = 0; i < openMediaFile.FileNames.Length; i++) { m_objMixerInternal.StreamsAdd("", null, openMediaFile.FileNames[i], "", out pItem, 1.00); if (pItem != null) { System.Runtime.InteropServices.Marshal.ReleaseComObject(pItem); GC.Collect(); } } updateStreamList(); } MElement root; m_objMixerInternal.ElementsGetByIndex(0, out root); MElement child; (root as IMElements).ElementsAdd("", "video", "stream_id=stream-000 h=1 w=1 show=1 audio_gain=-100", out child, 0); m_objMixerInternal.FilePlayStart(); string InternalMixerName; m_objMixerInternal.ObjectNameGet(out InternalMixerName); m_objMixer.StreamsAdd("", null, "mp://" + InternalMixerName, "", out pItem, 0); updateStreamList(); }
/// <summary> /// Initialization of Medialooks objects and form controls /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Form1_Load(object sender, EventArgs e) { try { this.Text += " - MPlatform SDK " + CheckVersionClass.GetVersion(); } catch { } try { //Initialize objects m_objMixer = new MMixerClass(); m_objRenderer = new MRendererClass(); m_objMixerInternal = new MMixerClass(); m_objrenderIN = new MRendererClass(); m_objLive = new MLiveClass(); } catch (Exception ex) { MessageBox.Show("Can't create MPlatform objects: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); return; } //Initialize preview m_objMixer.PreviewWindowSet("", panelPreview.Handle.ToInt32()); m_objMixer.PreviewEnable("", checkBoxAudio.Checked ? 1 : 0, checkBoxVideo.Checked ? 1 : 0); //Start mixer object m_objMixer.ObjectStart(null); m_objMixer.FilePlayStart(); //Look for renderers int nDevices = 0; m_objRenderer.DeviceGetCount(0, "renderer", out nDevices); if (nDevices > 0) { checkBoxOutput.Enabled = true; comboBoxRenderer.Enabled = true; for (int i = 0; i < nDevices; i++) { string strName; string strXML; m_objRenderer.DeviceGetByIndex(0, "renderer", i, out strName, out strXML); comboBoxRenderer.Items.Add(strName); } comboBoxRenderer.SelectedIndex = 0; } else { checkBoxOutput.Enabled = false; comboBoxRenderer.Enabled = false; } //Fill audio and video formats FillVideoFormats(); FillAudioFormats(); comboBoxVF.SelectedIndex = startVideoFormat; comboBoxAF.SelectedIndex = startAudioFormat; //Fill scenen tree mElementsTree.SetControlledObject(m_objMixer); MElement rootNode; m_objMixer.ElementsGetByIndex(0, out rootNode); if (rootNode != null) { mElementsTree.SetSelectedElement(rootNode); } if (rootNode == null) { return; } System.Runtime.InteropServices.Marshal.ReleaseComObject(rootNode); GC.Collect(); }