コード例 #1
0
        //PLAYER ý yeniden yükleme iþlemi....
        public void ReLoad()
        {
            if (m_obj_MediaControl != null)
            {
                m_obj_MediaControl.Stop();
                m_CurrentStatus = MediaStatus.Stopped;
            }

            if (m_obj_MediaEventEx != null)
                m_obj_MediaEventEx.SetNotifyWindow(0, 0, 0);

            if (m_obj_VideoWindow != null)
            {
                m_obj_VideoWindow.Visible = 0;
                m_obj_VideoWindow.Owner = 0;
            }

            if (m_obj_MediaControl != null) m_obj_MediaControl = null;
            if (m_obj_MediaPosition != null) m_obj_MediaPosition = null;
            if (m_obj_MediaEventEx != null) m_obj_MediaEventEx = null;
            if (m_obj_MediaEvent != null) m_obj_MediaEvent = null;
            if (m_obj_VideoWindow != null) m_obj_VideoWindow = null;
            if (m_obj_BasicAudio != null) m_obj_BasicAudio = null;
            if (m_obj_FilterGraph != null) m_obj_FilterGraph = null;
            UpdateToolStrip();
            timer1.Stop();
            running = false;
        }
コード例 #2
0
        public void OpenFileFunc()
        {
            ReLoad();
            string openedfile = textBox1.Text;
            m_obj_FilterGraph = new FilgraphManager();
            try
            {
                m_obj_FilterGraph.RenderFile(openedfile);
            }
            catch (Exception)
            {
                MessageBox.Show("Please choose a valid file.\n Check the file path.\n File path could be changed.");
                return;
            }
            try
            {
                m_obj_BasicAudio = m_obj_FilterGraph as QuartzTypeLib.IBasicAudio;
                m_obj_BasicAudio.Volume = trackBar1.Value;
            }
            catch { }
            try
            {
                m_obj_VideoWindow = m_obj_FilterGraph as QuartzTypeLib.IVideoWindow;
                m_obj_VideoWindow.Owner = (int)panel1.Handle;
                m_obj_VideoWindow.WindowStyle = WS_CHILD;
                m_obj_VideoWindow.SetWindowPosition(panel1.ClientRectangle.Left,
                    panel1.ClientRectangle.Top,
                    panel1.ClientRectangle.Right,
                    panel1.ClientRectangle.Bottom);
                videoplaying = true;
                timer1.Start();
            }
            catch (Exception)
            {
                m_obj_VideoWindow = null;
                videoplaying = false;
            }

            if (videoplaying)
            {
                trackBar1.Enabled = true;
                timer1.Start();
            }
            else
            {
                MessageBox.Show("Choose a Valid Video File");
            }
            running = true;
            m_obj_MediaEvent = m_obj_FilterGraph as QuartzTypeLib.IMediaEvent;
            m_obj_MediaEventEx = m_obj_FilterGraph as QuartzTypeLib.IMediaEventEx;
            m_obj_MediaEventEx.SetNotifyWindow((int)this.Handle, WM_GRAPHNOTIFY, 0);
            m_obj_MediaPosition = m_obj_FilterGraph as QuartzTypeLib.IMediaPosition;
            m_obj_MediaControl = m_obj_FilterGraph as QuartzTypeLib.IMediaControl;
            trackBar1.Maximum = (int)m_obj_MediaPosition.Duration;
            trackBar1.Minimum = 0;
            trackBar1.Value = (int)m_obj_MediaPosition.CurrentPosition;
            m_obj_MediaControl.Run();
            m_CurrentStatus = MediaStatus.Running;
            this.Refresh();
            UpdateToolStrip();
        }