Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        void MarshalAll()
        {
            SendMes("ReleaseAll");
            try
            {
                m_objMPlaylist.FilePlayStop(0);
                m_objMPlaylist.ObjectClose();
                Marshal.ReleaseComObject(m_objMPlaylist);
            }
            catch { }

            try
            {
                m_objMFile.FilePlayStop(0);
                m_objMFile.ObjectClose();
                Marshal.ReleaseComObject(m_objMFile);
            }
            catch { }
            try
            {
                m_objMixer.FilePlayStop(0);
                m_objMixer.ObjectClose();
                Marshal.ReleaseComObject(m_objMixer);
            }
            catch { }

            Thread.Sleep(200);
            GC.Collect();
            SendMes("----------------------------");
            SendMes("");
        }
Ejemplo n.º 3
0
 private void Form1_FormClosed(object sender, FormClosedEventArgs e)
 {
     if (m_objFile != null)
     {
         m_objFile.ObjectClose();
     }
     if (m_objRenderer != null)
     {
         m_objRenderer.ObjectClose();
     }
     if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\settings.json"))
     {
         File.Delete(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\settings.json");
     }
     System.IO.File.WriteAllText(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\settings.json", textBox3.Text);
 }
Ejemplo n.º 4
0
        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();
        }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
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));
        }