예제 #1
0
        public void Stop()
        {
            if (_mplaylist != null)
            {
                if (_nextItem != null)
                {
                    throw new InvalidOperationException();
                }

                if (_currentItem != null)
                {
                    //if (IsMLSource(_currentItem.MediaSource))
                    //{
                    //    M_StopCurrent();
                    //}

                    OnCurrentItemStopped();
                }

                if (_rendererManager != null)
                {
                    _rendererManager.DetachVideoDevice();
                    _rendererManager.Dispose();
                    _rendererManager = null;
                }

                _preview.MObject = null;
                //_preview.SetPreviewUri(null);
                //GlobalEventAggregator.Instance.RaiseMPlaylistDestroying();

                _cgManager.Dispose();
                _cgManager = null;

                _mplaylist.ObjectClose();
                _mplaylist.OnEvent -= MPlaylist_OnEvent;
                Marshal.ReleaseComObject(_mplaylist);
                _mplaylist = null;
            }
        }
예제 #2
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);
            }
        }