Beispiel #1
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();
        }
Beispiel #2
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();
            }
Beispiel #3
0
        /// <summary>
        /// Seeking routine
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void trackBarSeek_Scroll(object sender, EventArgs e)
        {
            int    nCount;
            double dblListLen;

            m_objPlaylist.PlaylistGetCount(out nCount, out dblListLen);
            if (nCount > 0)
            {
                double dblIn       = 0;
                double dblOut      = 0;
                double dblDuration = 0;
                m_objPlaylist.FileInOutGet(out dblIn, out dblOut, out dblDuration);
                dblDuration = (dblOut > dblIn ? dblOut : dblDuration) - dblIn;
                double dblPos = dblIn + dblDuration * (double)trackBarSeek.Value / (double)trackBarSeek.Maximum;
                m_objPlaylist.FilePosSet(dblPos, 0);

                int    nIndex, nNextIndex;
                double dblFileTime, dblListTime;
                m_objPlaylist.PlaylistPosGet(out nIndex, out nNextIndex, out dblFileTime, out dblListTime);
                dataGridViewFiles.CurrentCell = dataGridViewFiles.Rows[nIndex].Cells[0];
            }
        }