예제 #1
0
 public void Start()
 {
     try
     {
         (new Logger()).WriteDebug("start_in");
         bool bFirst = true;
         foreach (hrc.plugins.PlaylistItem cPLI in _cPLCurrent.aItems)
         {
             if (bFirst)
             {
                 bFirst = false;
                 _cPlaylist.Start();                          // first pli was added in prepare!
                 continue;
             }
             Video cVideo;
             cVideo           = new Video(cPLI.oAsset.cFile.sFile);
             cVideo.nDuration = (ulong)(cPLI.nFramesQty == long.MaxValue || cPLI.nFramesQty < 1 ? cPLI.oAsset.nFramesQty : cPLI.nFramesQty);
             _cPlaylist.VideoAdd(cVideo);
             _ahVideoBinds.Add(cVideo, cPLI);
         }
         if (null != Started)
         {
             Plugin.EventSend(Started, this);
         }
         (new Logger()).WriteDebug("started");
     }
     catch (Exception ex)
     {
         (new Logger()).WriteError(ex);
         Stop();
     }
 }
예제 #2
0
        public void Prepare()
        {
            try
            {
                (new Logger()).WriteDebug2("prepare_in");
                _cDBI       = new DBInteract();
                _cPLCurrent = null;
                _nPLID      = _cDBI.TryToGetIDFromCommands();
                (new Logger()).WriteDebug2("pl_id=" + _nPLID);
                _ahVideoBinds = new Dictionary <Video, helpers.replica.cues.plugins.PlaylistItem>();

                _cPlaylist                 = new btl.Playlist();
                _cPlaylist.stArea          = _cPreferences.stArea;
                _cPlaylist.stMergingMethod = _cPreferences.stMerging;
                _cPlaylist.nLayer          = _cPreferences.nLayer;
                _cPlaylist.bOpacity        = false;
                _cPlaylist.bStopOnEmpty    = true;
                _cPlaylist.aChannelsAudio  = new byte[] { 0, 1 };
                _cPlaylist.EffectStarted  += _cPlaylist_EffectStarted;
                _cPlaylist.EffectStopped  += _cPlaylist_EffectStopped;
                _cPlaylist.EffectFailed   += _cPlaylist_EffectFailed;
                _cPlaylist.Stopped        += _cPlaylist_Stopped;
                _cPlaylist.Prepare();


                Video cVideo;
                _cPLCurrent = _cDBI.AdvancedPlaylistGet(_nPLID > 0 ? _nPLID : _cPreferences.nPlaylistID);
                (new Logger()).WriteDebug2("pl_id=" + (_nPLID > 0 ? _nPLID : _cPreferences.nPlaylistID));
                helpers.replica.cues.plugins.PlaylistItem cPLI = _cPLCurrent.aItems[0];
                cVideo           = new Video(cPLI.oAsset.cFile.sFile);
                cVideo.nDuration = (ulong)(cPLI.nFramesQty == long.MaxValue || cPLI.nFramesQty < 1 ? cPLI.oAsset.nFramesQty : cPLI.nFramesQty);
                cVideo.Prepare();
                _cPlaylist.VideoAdd(cVideo);
                _ahVideoBinds.Add(cVideo, cPLI);

                if (null != Prepared)
                {
                    Plugin.EventSend(Prepared, this);
                }
                (new Logger()).WriteDebug2("prepare_ok");
            }
            catch (Exception ex)
            {
                (new Logger()).WriteError(ex);
                Stop();
            }
        }