예제 #1
0
        private void Form7_Load(object sender, EventArgs e)
        {
            comboBox1.DataSource    = db.Carparks.ToList();
            comboBox1.DisplayMember = "ParkCode";
            comboBox1.ValueMember   = "CarParkID";

            timer1.Start();
            //Set and enable a preview,bunları her projede yaz
            myPlaylist.PreviewWindowSet("", panel1.Handle.ToInt32());
            myPlaylist.PreviewEnable("", 1, 1);
            myPlaylist.PropsSet("loop", "false");
            //Start mFile object
            myPlaylist.ObjectStart(new object());
            //Fill video formats
            int         nCount;
            int         nIndex;
            string      strFormat;
            M_VID_PROPS vidProps;

            comboBox2.Items.Add("1");
            comboBox2.Items.Add("2");
            comboBox2.Items.Add("3");
            comboBox2.Items.Add("4");
            comboBox2.Items.Add("5");
            comboBox2.Items.Add("6");
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            timer1.Start();
            //Set and enable a preview,bunları her projede yaz
            myPlaylist.PreviewWindowSet("", panel1.Handle.ToInt32());
            myPlaylist.PreviewEnable("", 1, 1);
            myPlaylist.PropsSet("loop", "false");
            //Start mFile object
            myPlaylist.ObjectStart(new object());
            //Fill video formats
            int         nCount;
            int         nIndex;
            string      strFormat;
            M_VID_PROPS vidProps;

            comboBox1.Items.Clear();
            //Get video format count
            myPlaylist.FormatVideoGetCount(eMFormatType.eMFT_Convert, out nCount);
            comboBox1.Enabled = nCount > 0;
            if (nCount <= 0)
            {
                return;
            }
            for (int i = 0; i < nCount; i++)
            {
                //Get format by index
                myPlaylist.FormatVideoGetByIndex(eMFormatType.eMFT_Convert, i, out vidProps, out strFormat);
                comboBox1.Items.Add(strFormat);
            }
            //Check if there is selected format
            myPlaylist.FormatVideoGet(eMFormatType.eMFT_Convert, out vidProps, out nIndex, out strFormat);
            comboBox1.SelectedIndex = nIndex > 0 ? nIndex : 0;
            //Fill audio formats
            M_AUD_PROPS audProps;

            comboBox2.Items.Clear();
            //Get video format count
            myPlaylist.FormatAudioGetCount(eMFormatType.eMFT_Convert, out nCount);
            comboBox2.Enabled = nCount > 0;
            if (nCount <= 0)
            {
                return;
            }
            for (int i = 0; i < nCount; i++)
            {
                //Get format by index
                myPlaylist.FormatAudioGetByIndex(eMFormatType.eMFT_Convert, i, out audProps, out strFormat);
                comboBox2.Items.Add(strFormat);
            }
            //Check if there is selected format
            myPlaylist.FormatAudioGet(eMFormatType.eMFT_Convert, out audProps, out nIndex, out strFormat);
            comboBox2.SelectedIndex = nIndex > 0 ? nIndex : 0;
            //set audio volume
            trackBar1.Value = 50;
            double dblPos = (double)trackBar1.Value / trackBar1.Maximum;

            myPlaylist.PreviewAudioVolumeSet("", -1, -30 * (1 - dblPos));
        }
예제 #3
0
            public void Open(string fileName)
            {
                this.Close();

                if (_mplaylist == null)
                {
                    _mplaylist = new MPlaylistClass();
                    if (_mplaylistSettings.VideoFormat != null)
                    {
                        SetVideoFormat(_mplaylist, _mplaylistSettings.VideoFormat);
                    }

                    if (_mplaylistSettings.AudioFormat != null)
                    {
                        SetAudioFormat(_mplaylist, _mplaylistSettings.AudioFormat);
                    }
                    _mplaylist.PropsSet("loop", "true");
                    _mplaylist.OnEvent += MFile_OnEvent;
                }

                //if (_mitem != null)
                //{
                //    _mplaylist.FilePlayStop(0.0);

                //    _mplaylist.PlaylistRemove(_mitem);
                //    Marshal.ReleaseComObject(_mitem);  // ?
                //    _mitem = null;
                //}

                _fileName = fileName;
                int index = -1;

                _mplaylist.PlaylistAdd(null, _fileName, "", ref index, out _mitem);
                _mplaylist.ObjectStart(null);


                double dblIn = 0.0, dblOut = 0.0, dblDuration = 0.0;

                _mplaylist.FileInOutGet(out dblIn, out dblOut, out dblDuration);

                //_mitem.FileInOutGet(out dblIn, out dblOut, out dblDuration);

                this.Duration = dblDuration;

                string name = null;

                _mplaylist.ObjectNameGet(out name);
                this.Name = name;

                this.Status = PlayerStatus.Stopped;

                OnOpened();
            }
예제 #4
0
        public void Open(IPlayableItem playableItem)
        {
            this.Close();

            if (_mplaylist == null)
            {
                _mplaylist = new MPlaylistClass();
                if (_mplaylistSettings.VideoFormat != null)
                {
                    SetVideoFormat(_mplaylist, _mplaylistSettings.VideoFormat);
                }

                if (_mplaylistSettings.AudioFormat != null)
                {
                    SetAudioFormat(_mplaylist, _mplaylistSettings.AudioFormat);
                }
                _mplaylist.PropsSet("loop", "true");
                _mplaylist.OnEvent += MFile_OnEvent;

                _cgManager = new CGManager(_mplaylist);
                //_mplaylist.FileRateSet(_rate);
            }

            //_fileName = fileName;
            _playableItem = playableItem;
            //_fileName = _playableItem.FilePath;
            int index = -1;

            _mplaylist.PlaylistAdd(null, _playableItem.FilePath, "", ref index, out _mitem);
            _mplaylist.ObjectStart(null);

            _mplaylist.FileRateSet(_rate);

            SetAudioGain((MItemClass)_mitem, _playableItem.AudioGain);


            double dblIn = 0.0, dblOut = 0.0, dblDuration = 0.0;

            _mplaylist.FileInOutGet(out dblIn, out dblOut, out dblDuration);

            //_mitem.FileInOutGet(out dblIn, out dblOut, out dblDuration);

            this.Duration = dblDuration;

            string name = null;

            _mplaylist.ObjectNameGet(out name);
            this.Name = name;

            this.Status = PreviewPlayerStatus.Stopped;

            OnOpened();
        }
예제 #5
0
        public void Start()
        {
            if (_mplaylist == null)
            {
                CreateMPlaylist();

                _mplaylist.OnEvent += MPlaylist_OnEvent;
                _mplaylist.ObjectStart(null);

                string objName = null;
                _mplaylist.ObjectNameGet(out objName);
                //_preview.SetPreviewUri(new Uri("mplatform://" + objName));
                _preview.MObject = _mplaylist;

                if (_rendererInfo != null && !string.IsNullOrEmpty(_rendererInfo.VideoDevice))
                {
                    _rendererManager = new MRendererManager(_rendererInfo /*, 1*/);
                    _rendererManager.AttachVideoDevice(_mplaylist);
                }

                _cgManager = new CGManager(_mplaylist);
                //GlobalEventAggregator.Instance.RaiseMPlaylistCreated(_mplaylist);
            }
        }
예제 #6
0
        private void Form1_Load(object sender, EventArgs e)
        {
            try
            {
                this.Text += " - MPlatform SDK " + CheckVersionClass.GetVersion();
            }
            catch { }

            try
            {
                m_objPlaylist = new MPlaylistClass();
            }
            catch (Exception exception)
            {
                MessageBox.Show("Can't create a MPlatform's object: " + exception.ToString(), "Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
                return;
            }

            try
            {
                m_objOverlayHTML = new MFOverlayHTMLClass();
            }
            catch (Exception exception)
            {
                checkBoxHTML.Enabled    = false;
                buttonHTMLProps.Enabled = false;
                textBoxHTMLURL.Enabled  = false;
            }

            if (File.Exists(m_strDemoFile))
            {
                m_strDemoURL        = Path.GetFullPath(m_strDemoFile);
                textBoxHTMLURL.Text = "demo";
            }

            m_objPlaylist.OnFrame += new IMEvents_OnFrameEventHandler(m_objPlaylist_OnFrame);
            m_objPlaylist.OnEvent += new IMEvents_OnEventEventHandler(m_objPlaylist_OnEvent);
            m_objPlaylist.ObjectStart(null);
            m_formCG = new FormCG();
            m_formCG.m_pParentForm = this;
            mPersistControl1.SetControlledObject(m_objPlaylist);
            mPlaylistControl1.SetControlledObject(m_objPlaylist);
            mPreviewControl1.SetControlledObject(m_objPlaylist);
            mFormatControl1.SetControlledObject(m_objPlaylist);
            mFileStateControl1.SetControlledObject(m_objPlaylist);
            mRateControl1.SetControlledObject(m_objPlaylist);
            mPlaylistStatus1.SetControlledObject(m_objPlaylist);

            mRendererCheckList1.SetSourceObject(m_objPlaylist);

            mSeekControl1.SetControlledObject(m_objPlaylist);

            mPlaylistTimeline1.SetControlledObject(m_objPlaylist);

            mAudioMeter1.SetControlledObject(m_objPlaylist);
            mAudioMeter1.SizeChanged += new EventHandler(mAudioMeter1_SizeChanged);


            mPlaylistBackground1.SetControlledObject(m_objPlaylist);

            mPlaylistControl1.OnPlaylistSelChanged += new EventHandler(mPlaylistControl1_OnPlaylistSelChanged);
            mPlaylistControl1.OnPlaylistChanged    += new EventHandler(mPlaylistControl1_OnPlaylistChanged);

            mRendererCheckList1.OnRenderingChange += new EventHandler(mRendererCheckList1_OnRenderingChange);

            mBreaksControl1.OnBreaksChanged += new EventHandler(mBreaksControl1_OnBreaksChanged);

            mPersistControl1.OnLoad += new EventHandler(mPersistControl1_OnLoad);

            mAudioMeter1_SizeChanged(null, null);
        }
예제 #7
0
        /// <summary>
        /// Initialization of Medialooks objects and form controls
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Form1_Load(object sender, EventArgs e)
        {
            try
            {
                this.Text += " - MPlatform SDK " + CheckVersionClass.GetVersion();
            }
            catch { }

            try
            {
                //Initialize objects
                m_objPlaylist = new MPlaylistClass();

                //m_objFile = new MFileClass();
                m_objRenderer = new MRendererClass();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Can't create MPlatform objects: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
                return;
            }

            //Loop playlist
            m_objPlaylist.PropsSet("loop", "true");
            m_objPlaylist.PropsSet("object::on_frame.sync", "true");
            m_objPlaylist.OnEvent     += new IMEvents_OnEventEventHandler(m_objFile_OnEvent);
            m_objPlaylist.OnFrameSafe += M_objPlaylist_OnFrameSafe;
            //Initialize preview
            m_objPlaylist.PreviewWindowSet("", panelPreview.Handle.ToInt32());
            m_objPlaylist.PreviewEnable("", checkBoxAudio.Checked ? 1 : 0, checkBoxVideo.Checked ? 1 : 0);

            //Start mFile object
            m_objPlaylist.ObjectStart(new object());

            //Look for renderers
            int nDevices = 0;

            m_objRenderer.DeviceGetCount(0, "renderer", out nDevices);
            if (nDevices > 0)
            {
                checkBoxOutput.Enabled   = true;
                comboBoxRenderer.Enabled = true;
                for (int i = 0; i < nDevices; i++)
                {
                    string strName;
                    string strXML;
                    m_objRenderer.DeviceGetByIndex(0, "renderer", i, out strName, out strXML);
                    comboBoxRenderer.Items.Add(strName);
                }
                comboBoxRenderer.SelectedIndex = 0;
            }
            else
            {
                checkBoxOutput.Enabled   = false;
                comboBoxRenderer.Enabled = false;
            }

            //Fill audio and video formats
            FillVideoFormats();
            FillAudioFormats();

            comboBoxVF.SelectedIndex = startVideoFormat;
            comboBoxAF.SelectedIndex = startAudioFormat;

            //Start playlist
            m_objPlaylist.FilePlayStart();
        }