private void Form1_Load(object sender, EventArgs e) { mcc = new MCCDisplay(); m_objPlaylist = new MPlaylistClass(); m_objPlaylist.PreviewWindowSet("", panelPrev.Handle.ToInt32()); m_objPlaylist.PreviewEnable("", 0, 1); m_objPlaylist.PropsSet("object::on_frame.sync", "true"); m_objPlaylist.PropsSet("object::on_frame.data", "true"); m_objPlaylist.OnEventSafe += M_objPlaylist_OnEventSafe; m_objPlaylist.OnFrameSafe += M_objPlaylist_OnFrameSafe; m_objPlaylist.PluginsAdd(mcc, 0); }
private void Form1_Load(object sender, EventArgs e) { m_objWriter = new MWriterClass(); m_objLive = new MLiveClass(); m_objFile = new MFileClass(); m_objPlaylist = new MPlaylistClass(); m_objPlaylist.PreviewWindowSet("", panelPlaylist.Handle.ToInt32()); m_objPlaylist.PreviewEnable("", 0, 1); m_objFile.PreviewWindowSet("", panelFile.Handle.ToInt32()); m_objFile.PreviewEnable("", 0, 1); m_objLive.PreviewWindowSet("", livePanel.Handle.ToInt32()); m_objLive.PreviewEnable("", 0, 1); m_objLive.OnFrameSafe += M_objLive_OnFrameSafe; m_objFile.OnEventSafe += M_objFile_OnEventSafe; m_objPlaylist.OnFrameSafe += M_objPlaylist_OnFrameSafe; m_objWriter.PropsSet("embed_scte35", "true"); m_objFile.PropsSet("object::on_event.sync", "true"); m_objPlaylist.PropsSet("object::on_frame.sync", "true"); m_objLive.PropsSet("object::on_event.sync", "true"); int count = 0; m_objLive.DeviceGetCount(0, "video", out count); string[] arr = new string[count]; string name; string xml; for (int i = 0; i < count; i++) { m_objLive.DeviceGetByIndex(0, "video", i, out name, out xml); arr[i] = name; } m_objLive.DeviceSet("video", arr[5], ""); m_objLive.ObjectStart(null); MItem item; //m_objPlaylist.PlaylistBackgroundSet(m_objLive, "live", "live", out item); //m_objPlaylist.FilePlayStart(); m_objWriter.WriterNameSet(streamPath_txb.Text, " format='mpegts' protocol='udp://' video::codec='mpeg2video' video::b='5M' audio::codec='mp2'"); m_objWriter.ObjectStart(m_objLive); }
private void ChangePreviewType_btn_Click(object sender, EventArgs e) { m_objMPlaylist.PropsSet("preview.type", previewTypes[n]); ChangePreviewType_btn.Text = "ChangePreviewType Cur- " + previewTypes[n]; n = ++n == 3 ? 0 : n; }
/// <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_objPlaylist = new MPlaylistClass(); //m_objFile = new MFileClass(); m_objRenderer = new MRendererClass(); } catch (Exception ex) { MessageBox.Show("Can't create MPlatform objects: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); return; } //Loop playlist m_objPlaylist.PropsSet("loop", "true"); m_objPlaylist.PropsSet("object::on_frame.sync", "true"); m_objPlaylist.OnEvent += new IMEvents_OnEventEventHandler(m_objFile_OnEvent); m_objPlaylist.OnFrameSafe += M_objPlaylist_OnFrameSafe; //Initialize preview m_objPlaylist.PreviewWindowSet("", panelPreview.Handle.ToInt32()); m_objPlaylist.PreviewEnable("", checkBoxAudio.Checked ? 1 : 0, checkBoxVideo.Checked ? 1 : 0); //Start mFile object m_objPlaylist.ObjectStart(new object()); //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; //Start playlist m_objPlaylist.FilePlayStart(); }