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 Dispose() { if (_mplaylist != null) { if (this.Status != PreviewPlayerStatus.Closed) { this.Close(); } _cgManager.Dispose(); _cgManager = null; Marshal.ReleaseComObject(_mplaylist); _mplaylist = null; } }