Beispiel #1
0
        public Preferences(string sData)
        {
            try
            {
                XmlDocument cXmlDocument = new XmlDocument();
                cXmlDocument.LoadXml(sData);
                XmlNode cXmlNode  = cXmlDocument.NodeGet("data");
                XmlNode cNodeRoll = cXmlNode.NodeGet("roll");

                _nRollPrerenderQueueMax = cNodeRoll.AttributeOrDefaultGet <int>("prerender_queue", 40);

                RollNode cRN = new RollNode(cNodeRoll);
                if (null != cRN.aTextItems.FirstOrDefault(o => o.nDuration < nRollPrerenderQueueMax * 2))
                {
                    throw new Exception("duration of any text must be > " + nRollPrerenderQueueMax * 2);
                }
                _aTextItems = cRN.aTextItems;
                _cPlaylist  = new Playlist(cRN.cNodePL);
                _cRoll      = new btl.Roll(cNodeRoll);
            }
            catch (Exception ex)
            {
                (new Logger()).WriteDebug("Preferences error: [error=" + ex.ToString() + "][source_xml=" + sData + "]");
                throw;
            }
        }
Beispiel #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();
            }
        }
Beispiel #3
0
        public void Prepare()
        {
            try
            {
                DisCom.Init();

                _cPlaylist = new btl.Playlist();
                _cPlaylist.stArea = _cPreferences.stArea;
                _cPlaylist.bCUDA = _cPreferences.bCuda;
                _cPlaylist.nLayer = _cPreferences.nLayer;
                _cPlaylist.bOpacity = false;
                _cPlaylist.Prepare();
                
                if (null != Prepared)
                    Plugin.EventSend(Prepared, this);
                (new Logger()).WriteDebug3("ok");
            }
            catch (Exception ex)
            {
                (new Logger()).WriteError(ex);
            }
        }
Beispiel #4
0
		public void PreparePlaylists()
        {
			_bBlenderDidNewVotes = false;
			_bBlenderIsPreparing = false;

			_cPLMatTop = new btl.Playlist()
			{
				bCUDA = _cPreferences.bCUDA,
				nLayer = _cPreferences.nLayer,
				nDelay = 0,
				cDock = new Dock(_cPreferences.nLeft, (short)(_cPreferences.nTop + 67)),
				bStopOnEmpty = true,
				bOpacity = false
			};
			_cPLMatMiddle = new btl.Playlist()
			{
				bCUDA = _cPreferences.bCUDA,
				nLayer = _cPreferences.nLayer,
				nDelay = 34,
				cDock = new Dock((short)(_cPreferences.nLeft + 186), (short)(_cPreferences.nTop + 87)),
				bStopOnEmpty = true,
				bOpacity = false
			};
			_cPLMatBottom = new btl.Playlist()
			{
				bCUDA = _cPreferences.bCUDA,
				nLayer = _cPreferences.nLayer,
				nDelay = 22,
				cDock = new Dock(_cPreferences.nLeft, (short)(_cPreferences.nTop + 87)),
				bStopOnEmpty = true,
				bOpacity = false
			};
			_cPLPhotoLeft = new btl.Playlist()   
			{   
				bCUDA = _cPreferences.bCUDA,
				nLayer = _cPreferences.nLayer, 
				nDelay = 50,
				cDock = new Dock(_cPreferences.nLeft, _cPreferences.nTop),
				bStopOnEmpty = false,
				bOpacity = false
			};
			_cPLPhotoRight = new btl.Playlist()
			{   
				bCUDA = _cPreferences.bCUDA,
				nLayer = _cPreferences.nLayer,
				nDelay = 50,
				cDock = new Dock((short)(_cPreferences.nLeft + 253), _cPreferences.nTop),
				bStopOnEmpty = false,
				bOpacity = false
			};
			Animation cLoop;

			_cPLMatTop.AnimationAdd(new Animation(Path.Combine(_cPreferences.sFolderMat, "voting_top_in")) { bCUDA = _cPreferences.bCUDA, bKeepAlive = false, bOpacity = false, nLoopsQty = 1 }, 0);
			cLoop = new Animation(Path.Combine(_cPreferences.sFolderMat, "voting_top_loop1")) { bCUDA = _cPreferences.bCUDA, bKeepAlive = true, bOpacity = false, nLoopsQty = _nLoopTop, oTag = "voting_top_loop1" };
			lock (_aLoops)
				_aLoops.Add(cLoop);
			_cPLMatTop.AnimationAdd(cLoop, 0);
			_cPLMatTop.EffectStarted += new ContainerVideoAudio.EventDelegate(_cPLMatTop_EffectStarted);
			_cPLMatTop.EffectStopped += new ContainerVideoAudio.EventDelegate(RemoveOnStopped);

			_cPLMatBottom.AnimationAdd(new Animation(Path.Combine(_cPreferences.sFolderMat, "voting_bot_in")) { bCUDA = _cPreferences.bCUDA, bKeepAlive = false, bOpacity = false, nLoopsQty = 1 }, 0);
			_cPLMatBottom.AnimationAdd(new Animation(Path.Combine(_cPreferences.sFolderMat, "voting_bot_loop")) { bCUDA = _cPreferences.bCUDA, bKeepAlive = true, bOpacity = false, nLoopsQty = 0 }, 0);

			_cPLMatMiddle.AnimationAdd(new Animation(Path.Combine(_cPreferences.sFolderVotes, "voting_mid_in")) { bCUDA = _cPreferences.bCUDA, bKeepAlive = false, bOpacity = false, nLoopsQty = 1 }, 0);
			cLoop = new Animation(Path.Combine(_cPreferences.sFolderVotes, "voting_mid_loop1")) { bCUDA = _cPreferences.bCUDA, bKeepAlive = true, bOpacity = false, nLoopsQty = _nLoopMid, oTag = "voting_mid_loop1" };
			_cPLMatMiddle.AnimationAdd(cLoop, 0);
			lock (_aLoops)
				_aLoops.Add(cLoop);
			_cPLMatMiddle.EffectStarted += new ContainerVideoAudio.EventDelegate(_cPLMatMiddle_EffectStarted);
			_cPLMatMiddle.EffectStopped += new ContainerVideoAudio.EventDelegate(RemoveOnStopped);

			_cPLMatTop.Stopped += new Effect.EventDelegate(PL_Stopped);
			_cPLMatBottom.Stopped += new Effect.EventDelegate(PL_Stopped);
			_cPLMatMiddle.Stopped += new Effect.EventDelegate(PL_Stopped);
			_cPLPhotoLeft.Stopped += new Effect.EventDelegate(PL_Stopped);
			_cPLPhotoRight.Stopped += new Effect.EventDelegate(PL_Stopped);
			_cPLPhotoLeft.EffectStopped += new ContainerVideoAudio.EventDelegate(RemoveOnStopped);
			_cPLPhotoRight.EffectStopped += new ContainerVideoAudio.EventDelegate(RemoveOnStopped);

			_cPLMatTop.Prepare();
			_cPLMatBottom.Prepare();  
			_cPLMatMiddle.Prepare();

			_cPLPhotoLeft.Prepare();
			_cPLPhotoRight.Prepare();
			_cPLPhotoLeft.Start();
			_cPLPhotoRight.Start();

            (new Logger()).WriteDebug3("ok");
        }
Beispiel #5
0
        public void PreparePlaylists()
        {
            _bBlenderDidNewVotes = false;
            _bBlenderIsPreparing = false;

            _cPLMatTop = new btl.Playlist()
            {
                stMergingMethod = _cPreferences.stMerging,
                nLayer          = _cPreferences.nLayer,
                nDelay          = 0,
                cDock           = new Dock(_cPreferences.nLeft, (short)(_cPreferences.nTop + 67)),
                bStopOnEmpty    = true,
                bOpacity        = false
            };
            _cPLMatMiddle = new btl.Playlist()
            {
                stMergingMethod = _cPreferences.stMerging,
                nLayer          = _cPreferences.nLayer,
                nDelay          = 34,
                cDock           = new Dock((short)(_cPreferences.nLeft + 186), (short)(_cPreferences.nTop + 87)),
                bStopOnEmpty    = true,
                bOpacity        = false
            };
            _cPLMatBottom = new btl.Playlist()
            {
                stMergingMethod = _cPreferences.stMerging,
                nLayer          = _cPreferences.nLayer,
                nDelay          = 22,
                cDock           = new Dock(_cPreferences.nLeft, (short)(_cPreferences.nTop + 87)),
                bStopOnEmpty    = true,
                bOpacity        = false
            };
            _cPLPhotoLeft = new btl.Playlist()
            {
                stMergingMethod = _cPreferences.stMerging,
                nLayer          = _cPreferences.nLayer,
                nDelay          = 50,
                cDock           = new Dock(_cPreferences.nLeft, _cPreferences.nTop),
                bStopOnEmpty    = false,
                bOpacity        = false
            };
            _cPLPhotoRight = new btl.Playlist()
            {
                stMergingMethod = _cPreferences.stMerging,
                nLayer          = _cPreferences.nLayer,
                nDelay          = 50,
                cDock           = new Dock((short)(_cPreferences.nLeft + 253), _cPreferences.nTop),
                bStopOnEmpty    = false,
                bOpacity        = false
            };
            Animation cLoop;

            _cPLMatTop.AnimationAdd(new Animation(Path.Combine(_cPreferences.sFolderMat, "voting_top_in"))
            {
                stMergingMethod = _cPreferences.stMerging, bKeepAlive = false, bOpacity = false, nLoopsQty = 1
            }, 0);
            cLoop = new Animation(Path.Combine(_cPreferences.sFolderMat, "voting_top_loop1"))
            {
                stMergingMethod = _cPreferences.stMerging, bKeepAlive = true, bOpacity = false, nLoopsQty = _nLoopTop, oTag = "voting_top_loop1"
            };
            lock (_aLoops)
                _aLoops.Add(cLoop);
            _cPLMatTop.AnimationAdd(cLoop, 0);
            _cPLMatTop.EffectStarted += new ContainerVideoAudio.EventDelegate(_cPLMatTop_EffectStarted);
            _cPLMatTop.EffectStopped += new ContainerVideoAudio.EventDelegate(RemoveOnStopped);

            _cPLMatBottom.AnimationAdd(new Animation(Path.Combine(_cPreferences.sFolderMat, "voting_bot_in"))
            {
                stMergingMethod = _cPreferences.stMerging, bKeepAlive = false, bOpacity = false, nLoopsQty = 1
            }, 0);
            _cPLMatBottom.AnimationAdd(new Animation(Path.Combine(_cPreferences.sFolderMat, "voting_bot_loop"))
            {
                stMergingMethod = _cPreferences.stMerging, bKeepAlive = true, bOpacity = false, nLoopsQty = 0
            }, 0);

            _cPLMatMiddle.AnimationAdd(new Animation(Path.Combine(_cPreferences.sFolderVotes, "voting_mid_in"))
            {
                stMergingMethod = _cPreferences.stMerging, bKeepAlive = false, bOpacity = false, nLoopsQty = 1
            }, 0);
            cLoop = new Animation(Path.Combine(_cPreferences.sFolderVotes, "voting_mid_loop1"))
            {
                stMergingMethod = _cPreferences.stMerging, bKeepAlive = true, bOpacity = false, nLoopsQty = _nLoopMid, oTag = "voting_mid_loop1"
            };
            _cPLMatMiddle.AnimationAdd(cLoop, 0);
            lock (_aLoops)
                _aLoops.Add(cLoop);
            _cPLMatMiddle.EffectStarted += new ContainerVideoAudio.EventDelegate(_cPLMatMiddle_EffectStarted);
            _cPLMatMiddle.EffectStopped += new ContainerVideoAudio.EventDelegate(RemoveOnStopped);

            _cPLMatTop.Stopped           += new Effect.EventDelegate(PL_Stopped);
            _cPLMatBottom.Stopped        += new Effect.EventDelegate(PL_Stopped);
            _cPLMatMiddle.Stopped        += new Effect.EventDelegate(PL_Stopped);
            _cPLPhotoLeft.Stopped        += new Effect.EventDelegate(PL_Stopped);
            _cPLPhotoRight.Stopped       += new Effect.EventDelegate(PL_Stopped);
            _cPLPhotoLeft.EffectStopped  += new ContainerVideoAudio.EventDelegate(RemoveOnStopped);
            _cPLPhotoRight.EffectStopped += new ContainerVideoAudio.EventDelegate(RemoveOnStopped);

            _cPLMatTop.Prepare();
            _cPLMatBottom.Prepare();
            _cPLMatMiddle.Prepare();

            _cPLPhotoLeft.Prepare();
            _cPLPhotoRight.Prepare();
            _cPLPhotoLeft.Start();
            _cPLPhotoRight.Start();

            (new Logger()).WriteDebug3("ok");
        }
Beispiel #6
0
        public void Prepare()
        {
            try
            {
                //PixelsMap.DisComInit();

                _cRoll                   = new btl.Roll();
                _cRoll.eDirection        = _cPreferences.eDirection;
                _cRoll.nSpeed            = _cPreferences.nSpeed;
                _cRoll.stArea            = _cPreferences.stArea;
                _cRoll.stMergingMethod   = _cPreferences.stRollMerging;
                _cRoll.nLayer            = _cPreferences.nLayer;
                _cRoll.bOpacity          = false;
                _cRoll.EffectIsOnScreen += _cRoll_EffectIsOnScreen;
                _nWaitAndStop            = 0;

                if (_cPreferences.cBackground != null)
                {
                    _stAreaComposite = new Area((short)(_cPreferences.stArea.nLeft - _cPreferences.cBackground.stArea.nLeft), (short)(_cPreferences.stArea.nTop - _cPreferences.cBackground.stArea.nTop), _cPreferences.stArea.nWidth, _cPreferences.stArea.nHeight);
                    _cRoll.stArea    = _cPreferences.cBackground.stArea;

                    _cAnimIn = new Animation(_cPreferences.cBackground.sIn, 1, false);
                    _cAnimIn.Prepare();
                    _cAnimLoop = new Animation(_cPreferences.cBackground.sLoop, 0, true);
                    _cAnimLoop.Prepare();
                    _cAnimOut = new Animation(_cPreferences.cBackground.sOut, 1, false);
                    _cAnimOut.Prepare();
                    _cPLBackground = new Playlist();
                    _cPLBackground.bStopOnEmpty = true;
                    _cPLBackground.EffectAdd(_cAnimIn);
                    _cPLBackground.EffectAdd(_cAnimLoop);
                    _cPLBackground.EffectAdd(_cAnimOut);
                    _cPLBackground.Prepare();

                    if (_cPreferences.cBackground.sMaskIn != null && _cPreferences.cBackground.sMaskIn.Length > 0)
                    {
                        _cMaskIn = new Animation(_cPreferences.cBackground.sMaskIn, 1, false);
                        _cMaskIn.Prepare();
                        _cMaskLoop = new Animation(_cPreferences.cBackground.sMaskLoop, 0, true);
                        _cMaskLoop.Prepare();
                        _cMaskOut = new Animation(_cPreferences.cBackground.sMaskOut, 1, false);
                        _cMaskOut.Prepare();
                        _cMaskAllOff = new Animation(_cPreferences.cBackground.sMaskAllOff, 0, true);
                        _cMaskAllOff.Prepare();
                        _cPLMask = new Playlist();
                        _cPLMask.bStopOnEmpty = false;
                        _cPLMask.EffectAdd(_cMaskIn);
                        _cPLMask.EffectAdd(_cMaskLoop);
                        _cPLMask.EffectAdd(_cMaskOut);
                        _cPLMask.EffectAdd(_cMaskAllOff);
                        _cPLMask.Prepare();
                    }
                }
                else
                {
                    _stAreaComposite = new Area(0, 0, _cPreferences.stArea.nWidth, _cPreferences.stArea.nHeight);
                }
                _cRoll.Prepare();


                _aItems        = new List <Item>();
                _cTimerRequest = new System.Threading.Timer(TickRequest);
                TickRequest(null);
                _cRollFeed = new Thread(RollFeed);
                _cRollFeed.IsBackground = true;
                _cRollFeed.Start();
                _cTimerStop = new System.Threading.Timer(AsyncStop);
                if (null != Prepared)
                {
                    Plugin.EventSend(Prepared, this);
                }
                (new Logger()).WriteDebug3("ok");
            }
            catch (Exception ex)
            {
                (new Logger()).WriteError(ex);
            }
        }