Пример #1
0
        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");
            }
        }
Пример #2
0
        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);
        }
Пример #3
0
        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));
        }