public override IntPtr GetHBitmap(string filePath, double position) { IntPtr result = IntPtr.Zero; if (_mfileObj != null) { try { _mfileObj.FileNameSet(filePath, string.Empty); _mfileObj.ObjectStart(null); try { result = GetHBitmapCore(position); } finally { _mfileObj.ObjectClose(); } } catch { result = IntPtr.Zero; } } return(result); }
private void button1_Click(object sender, EventArgs e) { if (listBox1.GetSelected(0) || listBox1.GetSelected(1)) { m_objMPFile.FileNameSet(listBox1.SelectedItem.ToString(), ""); } else { m_objMPFile.FileNameSet(textBox1.Text.ToString(), ""); } //m_objMPFile.FileNameSet(@"D:\Firefox\NUEVO Conejos con huron.mp4", ""); m_objMPFile.FilePlayStart(); m_objMPFile.FilePlayPause(0); M_VID_PROPS props; int index; string name; m_objMPFile.FormatVideoGet(eMFormatType.eMFT_Output, out props, out index, out name); double inTime; double outTime; double durTime; m_objMPFile.FileInOutGet(out inTime, out outTime, out durTime); double pos = 0.0; double curPos; double step = 60.0; bool ok = true; while (pos < durTime) { try { m_objMPFile.FilePosSet(pos, 0); Thread.Sleep(500); m_objMPFile.FilePosGet(out curPos); if (pos - curPos > step) { MessageBox.Show("Broken File"); ok = false; break; } } catch (Exception ex) { MessageBox.Show(ex.ToString() + "Broken File"); } pos += step; } if (ok) { MessageBox.Show("File is Ok"); } }
private void Start_btn_Click(object sender, EventArgs e) { string[] list = { @"M:\TEST_VIDEOS\!1080p 60fpsOri and the Will of the Wisps.mp4", @"M:\TEST_VIDEOS\!audi_a7_borussia_vfl.mp4", @"M:\TEST_VIDEOS\!LG Jazz 1080-30p.mp4", @"M:\TEST_VIDEOS\!NoAudio1080p 60fpsOri and the Will of the Wisps.mp4", @"M:\TEST_VIDEOS\!PATAGONIA 1080p.mp4", @"M:\TEST_VIDEOS\Adele.mp4", @"M:\TEST_VIDEOS\Avengers_2_1080p_6Ch_48kHz-HDTN.mp4" }; int period = 1000; (m_objMFile as IMPreview).PreviewWindowSet("", panelPr.Handle.ToInt32()); (m_objMFile as IMPreview).PreviewEnable("", 1, 1); Thread.Sleep(period); int index = -1; for (int i = 0; i < list.Length; i++) { m_objMFile.PreviewFullScreen("", 0, 0); //m_objMFile.PlaylistAdd(null, list[i], "", ref index, out MItem item); //m_objMFile.PlaylistPosSet(0, 0, 0); //m_objMPlaylist.PlaylistGetCount(out int nFiles, out double dblDuration); //m_objMPlaylist.PlaylistGetByIndex(nFiles, out double dblPos, out string strPathOrCommand, out MItem pItem); m_objMFile.FileNameSet(list[i], ""); m_objMFile.FilePlayStart(); Thread.Sleep(period * 2); m_objMFile.PreviewFullScreen("", 1, 0); Thread.Sleep(period); } m_objMFile.PreviewFullScreen("", 0, 0); }
void StartMFile() { m_objFile = new MFileClass(); m_objFile.PreviewWindowSet("", panel1.Handle.ToInt32()); m_objFile.PreviewEnable("", 0, 1); m_objFile.FileNameSet(@"\\MLDiskStation\MLFiles\MediaTest\MP4\!1080p 60fpsOri and the Will of the Wisps.mp4", ""); m_objFile.FilePlayStart(); }
private void openFile_btn_Click(object sender, EventArgs e) { OpenFileDialog a = new OpenFileDialog(); if (a.ShowDialog() == DialogResult.OK) { m_objFile.FileNameSet(a.FileName.ToString(), ""); m_objFile.FilePlayStart(); } }
private void button1_Click(object sender, EventArgs e) { string test_file = @"M:\MEDIA_TEST\!1080p 60fpsOri and the Will of the Wisps.mp4"; m_objFile.FileNameSet(test_file, ""); m_objFile.PreviewWindowSet("", panel1.Handle.ToInt64()); m_objFile.PreviewEnable("", 1, 1); m_objFile.OnEventSafe += File_OnEventSafe; m_objFile.FilePlayStart(); m_objFile.PropsSet("preview.type", "dx9"); }
private void OpenFile_btn_Click(object sender, EventArgs e) { if (openFileDialog1.ShowDialog() == DialogResult.OK && openFileDialog1.FileNames.Length != 0) { filePath = openFileDialog1.FileNames[0].ToString(); m_objMFile.FileNameSet(filePath, "loop=true"); m_objMFile.PreviewWindowSet("", panelPreview.Handle.ToInt32()); m_objMFile.PreviewEnable("", 1, 1); m_objMFile.FilePlayStart(); path_txb.Text = filePath; } }
private void OpenFile_btn_Click(object sender, EventArgs e) { if (openFileDialog1.ShowDialog() == DialogResult.OK && openFileDialog1.FileNames.Length != 0) { m_objFile.FileNameSet(openFileDialog1.FileNames.ToString(), ""); m_objFile.FilePlayStart(); string path = openFileDialog1.FileName; StartWrite(path, m_objFile); System.Runtime.InteropServices.Marshal.ReleaseComObject(m_objFile); GC.Collect(); } }
private void Form1_Load(object sender, EventArgs e) { m_objMPWriter = new MWriterClass(); m_objMPFile = new MFileClass(); m_objFile = new MFileClass(); m_objMPFile.PreviewWindowSet("", panel1.Handle.ToInt32()); m_objMPFile.PreviewEnable("", 0, 1); m_objMPFile.FileNameSet(@"M:\MEDIA_TEST\!PATAGONIA 1080p.mp4", ""); m_objMPFile.FilePlayStart(); m_objMPWriter.WriterNameSet(pathA, ""); m_objMPWriter.ObjectStart(m_objMPFile); }
private void buttonPlay_Click(object sender, EventArgs e) { try { string filePath = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\this.sdp"; m_objFile.FileNameSet(filePath, ""); m_objFile.FilePlayStart(); m_arrBufferMinMax[0] = GetDblProps(m_objFile, "file::network.buffer_min"); m_arrBufferMinMax[1] = GetDblProps(m_objFile, "file::network.buffer_max"); timerStat.Enabled = true; } catch (System.Exception ex) { MessageBox.Show(ex.ToString()); } }
void Restart(string quality) { m_objMPFile.ObjectClose(); Marshal.ReleaseComObject(m_objMPFile); Thread.Sleep(500); test = test == "false" ? "true" : "false"; m_objMPFile = new MFileClass(); (m_objMPFile as IMProps).PropsSet("preview.downscale", quality); (m_objMPFile as IMProps).PropsSet("preview.overlay_waveform", "true"); m_objMPFile.PreviewWindowSet("", panel1.Handle.ToInt32()); m_objMPFile.PreviewEnable("", 1, 1); m_objMPFile.FileNameSet(textBox1.Text, ""); m_objMPFile.FilePlayStart(); }
void TurnOnGPU_Pipeline() { if (!gpu_p) { m_objMFFactory = new MFFactoryClass(); m_objMFFactory.PropsSet("gpu_pipeline", "true"); gpu_p = true; GpuPipilineOn_btn.Text = "GPU PIPELINE = ON"; GpuPipilineOn_btn.BackColor = Color.Green; Reset_btn.Enabled = true; PredifinedMatrix_txb.Enabled = true; ColorLevel_cmb.Enabled = true; Red_trb.Enabled = true; Green_trb.Enabled = true; Blue_trb.Enabled = true; Constant_trb.Enabled = true; RedChannel_txb.Enabled = true; GreenChannel_txb.Enabled = true; BlueChannel_txb.Enabled = true; ConstantChannel_txb.Enabled = true; //When we turn on the gpu_pipeline we need to recreate objects. //To continue playback from same position we take current and save it m_objMFile.FilePosGet(out double position); m_objMFile.FilePlayStop(0); Marshal.ReleaseComObject(m_objMFile); m_objMFile = new MFileClass(); m_objMFile.PreviewWindowSet("", panelPreview.Handle.ToInt32()); m_objMFile.PreviewEnable("", 1, 1); if (filePath.Length > 1) { m_objMFile.FileNameSet(filePath, "loop=true"); m_objMFile.FilePosSet(position, 0); m_objMFile.FilePlayStart(); } PredifinedMatrix_txb.SelectedIndex = 0; } }
private void Form1_Load(object sender, EventArgs e) { m_objMFile = new MFileClass(); m_objPlaylist = new MPlaylistClass(); m_objMFile.PreviewWindowSet("", panelPr.Handle.ToInt32()); m_objMFile.PreviewEnable("", 0, 1); m_objMFile.FileNameSet(@"\\192.168.0.100\MLFiles\Trash\Roman\WorkFiles\FilesFromCostumer\2019.03.06Etere31735\MEM001M-20190306Z143546.mp4", "loop=true"); m_objMFile.FilePlayStart(); m_objPlaylist.PreviewWindowSet("", panelPrPl.Handle.ToInt32()); m_objPlaylist.PreviewEnable("", 0, 1); int index = -1; m_objPlaylist.PlaylistAdd(null, @"\\192.168.0.100\MLFiles\Trash\Roman\WorkFiles\FilesFromCostumer\2019.03.06Etere31735\MEM001M-20190306Z143546.mp4", "loop=true", index, out item); m_objPlaylist.FilePlayStart(); }
private void OpenFileMFile_btn_Click(object sender, EventArgs e) { MarshalAll(); m_objMFile = new MFileClass(); if (openFileDialog1.ShowDialog() == DialogResult.OK && openFileDialog1.FileNames.Length != 0) { filePath = openFileDialog1.FileNames[0].ToString(); SendMes("StatMFile"); startTime = DateTime.Now; m_objMFile.FileNameSet(filePath, addParams.Text); endTime = DateTime.Now; CalcTimeSpan(); SendMes("MFile takes: " + duration.TotalMilliseconds.ToString() + " TotalMilliseconds"); SendMes("With this Params : " + addParams.Text); ReInitPr("MFile"); m_objMFile.FilePlayStart(); } }
private IntPtr GetMediaFileInfoInternal(string filePath, out double dblDuration) { IntPtr hBitmap = IntPtr.Zero; dblDuration = 0; if (_mfileObj != null) { try { _mfileObj.FileNameSet(filePath, string.Empty); _mfileObj.ObjectStart(null); double dblIn, dblOut; try { _mfileObj.FileInOutGet(out dblIn, out dblOut, out dblDuration); if (dblDuration > 0) { MFrame mFrame = null; _mfileObj.FileFrameGet(dblDuration / 2.0, 0.0, out mFrame); long value = 0L; mFrame.FrameVideoGetHbitmap(out value); Marshal.ReleaseComObject(mFrame); mFrame = null; hBitmap = new System.IntPtr(value); } } finally { _mfileObj.ObjectClose(); } } catch { hBitmap = IntPtr.Zero; } } return(hBitmap); }
public override TimeSpan GetDuration(string filePath) { double dblDuration = 0; if (_mfileObj != null) { _mfileObj.FileNameSet(filePath, string.Empty); _mfileObj.ObjectStart(null); double dblIn, dblOut; try { _mfileObj.FileInOutGet(out dblIn, out dblOut, out dblDuration); } finally { _mfileObj.ObjectClose(); } } return(TimeSpan.FromSeconds(dblDuration)); }
private void Form1_Load(object sender, EventArgs e) { m_objFile = new MFileClass(); m_objPlaylist = new MPlaylistClass(); m_objFile.PreviewWindowSet("", panelPrFile.Handle.ToInt32()); m_objFile.PreviewEnable("", 1, 1); m_objPlaylist.PreviewWindowSet("", panelPrPlaylist.Handle.ToInt32()); m_objPlaylist.PreviewEnable("", 1, 1); int index = -1; m_objPlaylist.PlaylistAdd(null, path, "", ref index, out item); m_objPlaylist.FilePlayStart(); m_objFile.FileNameSet(path, ""); m_objFile.FilePlayStart(); }
private void Start_btn_Click(object sender, EventArgs e) { //int nIndex = -1; //MItem pFile; //m_objPlaylist.PropsSet("loop", "false"); //m_objPlaylist.PropsSet("active_frc", "false"); //m_objPlaylist.PropsSet("preview.drop_frames", "true"); //m_objPlaylist.PlaylistAdd(null, openFile_txb.Text, "external_process=false experimental.mfcodecs=true experimental.out_video_packets=true", ref nIndex, out pFile); // //m_objPlaylist.FilePlayStart(); int index; string name; M_AUD_PROPS propsA; m_objFile.FormatAudioGet(eMFormatType.eMFT_Input, out propsA, out index, out name); propsA.nChannels = 8; m_objFile.PropsSet("active_frc", "false"); m_objFile.PropsSet("preview.drop_frames", "true"); m_objFile.FileNameSet(openFile_txb.Text, "");//"external_process=false experimental.mfcodecs=true experimental.out_video_packets=true"); //m_objFile.FileNameSet(openFile_txb.Text, ""); //(m_objFile as IMProps).PropsSet("object::audio_channels", "0,1,2,3,4,5,6,7"); m_objFile.FormatAudioSet(eMFormatType.eMFT_Convert, ref propsA); m_objFile.FilePlayStart(); m_objWriter.PropsSet("external_process", "false"); m_objWriter.PropsSet("rate_control", "true"); m_objWriter.PropsSet("pull_mode", "false"); m_objWriter.FormatAudioSet(eMFormatType.eMFT_Convert, ref propsA); //m_objWriter.WriterNameSet(savePath_txb.Text, "format='mp4' video::codec='packets' audio::codec='audio_packets'"); m_objWriter.WriterNameSet(savePath_txb.Text, "format='mp4' video::codec='n264' audio::codec='aac'"); m_objWriter.ObjectStart(m_objFile); }
private void InitSource(int index) { listBox1.SelectedIndex = index % sources.Count; m_objMFile1.FileNameSet(sources[index % sources.Count], "network.open_async=true open_url.max_wait=0"); m_objMFile1.FilePlayStart(); listBox2.SelectedIndex = (index + 1) % sources.Count; m_objMFile2.FileNameSet(sources[(index + 1) % sources.Count], "network.open_async=true open_url.max_wait=0"); m_objMFile2.FilePlayStart(); listBox3.SelectedIndex = (index + 2) % sources.Count; m_objMFile3.FileNameSet(sources[(index + 2) % sources.Count], "network.open_async=true open_url.max_wait=0"); m_objMFile3.FilePlayStart(); listBox4.SelectedIndex = (index + 3) % sources.Count; m_objMFile4.FileNameSet(sources[(index + 3) % sources.Count], "network.open_async=true open_url.max_wait=0"); m_objMFile4.FilePlayStart(); turn++; }
private void Start_btn_Click(object sender, EventArgs e) { //m_objFile.PropsSet("active_frc", "false"); //m_objFile.PropsSet("preview.drop_frames", "true"); //m_objFile.FileNameSet(openFile_txb.Text, "external_process=false experimental.mfcodecs=true experimental.out_video_packets=true"); m_objFile.FileNameSet(tempPath, ""); m_objFile.FilePlayStart(); //m_objWriter.PropsSet("external_process", "false"); //m_objWriter.PropsSet("rate_control", "true"); //m_objWriter.PropsSet("pull_mode", "false"); if (savePath_txb != null) { //m_objWriter.WriterNameSet(savePath_txb.Text, "format='mp4' video::codec='packets' audio::codec='audio_packets'"); m_objWriter.WriterNameSet(savePath_txb.Text, "format='mp4' video::codec='n264' audio::codec='aac'"); } else { m_objWriter.WriterNameSet(destination, " format='mpegts' protocol='udp://' video::codec='packets' audio::codec='audio_packets'"); } m_objWriter.ObjectStart(m_objFile); }
private void button4_Click(object sender, EventArgs e) { m_objFile.FileNameSet(streamPath_txb.Text, ""); m_objFile.FilePlayStart(); }
void Start() { m_objMPFile.FileNameSet(textBox1.Text, ""); m_objMPFile.FilePlayStart(); }
private void Form1_Load(object sender, EventArgs e) { try { if (Properties.Settings.Default.UrlHistory != null) { object[] strHistory = NetworkPlaybackSample.Properties.Settings.Default.UrlHistory.ToArray(); } m_objFile = new MFileClass(); m_objFile.PreviewWindowSet("", panelPreview.Handle.ToInt32()); m_objFile.PreviewEnable("", 1, 1); m_objRenderer = new MRendererClass(); FillVideoFormats(); FillAudioFormats(); comboBoxVF.SelectedIndex = startVideoFormat; comboBoxAF.SelectedIndex = startAudioFormat; FillRenderers(); UpdateDelay(); } catch (System.Exception ex) { MessageBox.Show(ex.ToString()); Application.Exit(); } string JSON = "{ \"Number of Input Ports\": \"1\", \"Device List\": ["; for (int i = 0; i < comboBoxRenderer.Items.Count; i++) { if (i != comboBoxRenderer.Items.Count - 1) { JSON += "\"" + comboBoxRenderer.Items[i] + "\","; } else { JSON += "\"" + comboBoxRenderer.Items[i] + "\"]}"; } } var client = new HttpClient(); string serverIP = textBox1.Text; string serverPort = textBox2.Text; var stringContent = new StringContent(JSON); client.PostAsync("http://" + serverIP + ":" + serverPort + "/device_list", stringContent); var data = GetIP(serverIP, serverPort).Result; var sdpContent = GetSDP(serverIP, serverPort).Result; string sdp = sdpContent.Replace("\\n", Environment.NewLine); sdp = sdp.Replace("\"", ""); string[] lines = Regex.Split(sdp, "\r\n|\r|\n"); string result = ""; foreach (string line in lines) { result += line.Trim() + Environment.NewLine; } if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\stream.sdp")) { File.Delete(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\stream.sdp"); } System.IO.File.WriteAllText(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\stream.sdp", result); try { string filePath = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\stream.sdp"; m_objFile.FileNameSet(filePath, ""); m_objFile.FilePlayStart(); m_arrBufferMinMax[0] = GetDblProps(m_objFile, "file::network.buffer_min"); m_arrBufferMinMax[1] = GetDblProps(m_objFile, "file::network.buffer_max"); timerStat.Enabled = true; } catch (System.Exception ex) { MessageBox.Show(ex.ToString()); } if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\settings.json")) { string numberPorts = System.IO.File.ReadAllText(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\settings.json"); textBox3.Text = numberPorts; } }
private void SetMFile() { m_objFile1.FileNameSet(pathMFile1, ""); m_objFile2.FileNameSet(pathMFile2, ""); }
private void file_btn_Click(object sender, EventArgs e) { m_objMFile.FileNameSet(file_txb.Text, "network.reconnect = true"); m_objMFile.FilePlayStart(); }
private void Button1_Click(object sender, EventArgs e) { m_objFile.FileNameSet("https://www.youtube.com/watch?v=RVeVtBxoImI", ""); m_objFile.FilePlayStart(); }
private void Play_btn_Click(object sender, EventArgs e) { m_objMPFile.FileNameSet(textBox1.Text, ""); m_objMPFile.FilePlayStart(); }
private void Start_btn_Click(object sender, EventArgs e) { //string name; //string xml; //m_objLive11.DeviceGetByIndex(0, "video", 5, out name, out xml); //m_objLive1.DeviceSet("video", name, ""); //m_objLive1.ObjectStart(null); //m_objLive2.DeviceSet("video", name, ""); //m_objLive2.ObjectStart(null); //m_objLive3.DeviceSet("video", name, ""); //m_objLive3.ObjectStart(null); //m_objLive4.DeviceSet("video", name, ""); //m_objLive4.ObjectStart(null); //m_objLive5.DeviceSet("video", name, ""); //m_objLive5.ObjectStart(null); //m_objLive6.DeviceSet("video", name, ""); //m_objLive6.ObjectStart(null); //m_objLive7.DeviceSet("video", name, ""); //m_objLive7.ObjectStart(null); //m_objLive8.DeviceSet("video", name, ""); //m_objLive8.ObjectStart(null); //m_objLive9.DeviceSet("video", name, ""); //m_objLive9.ObjectStart(null); //m_objLive10.DeviceSet("video", name, ""); //m_objLive10.ObjectStart(null); //m_objLive11.DeviceSet("video", name, ""); //m_objLive11.ObjectStart(null); string path = @"M:\TempVideo\10\Adele.mp4"; m_objLive1.FileNameSet(path, ""); m_objLive1.FilePlayStart(); m_objLive2.FileNameSet(path, ""); m_objLive2.FilePlayStart(); m_objLive3.FileNameSet(path, ""); m_objLive3.FilePlayStart(); m_objLive4.FileNameSet(path, ""); m_objLive4.FilePlayStart(); m_objLive5.FileNameSet(path, ""); m_objLive5.FilePlayStart(); m_objLive6.FileNameSet(path, ""); m_objLive6.FilePlayStart(); m_objLive7.FileNameSet(path, ""); m_objLive7.FilePlayStart(); m_objLive8.FileNameSet(path, ""); m_objLive8.FilePlayStart(); m_objLive9.FileNameSet(path, ""); m_objLive9.FilePlayStart(); m_objLive10.FileNameSet(path, ""); m_objLive10.FilePlayStart(); m_objLive11.FileNameSet(path, ""); m_objLive11.FilePlayStart(); }
void GetMP() { m_objFile.FileNameSet(ListOffAllMPlinks_cmb.SelectedItem.ToString(), ""); m_objFile.FilePlayStart(); }