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(); }
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(); }
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); } }