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"); } }
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; } }