public bool PlaylistItemDelete(Item cItem, PlaylistItem[] aItems) { bool bRetVal = false; try { if (0 < Client.nID) { Item cItemLocal = GarbageCollector.ItemGet(cItem); if (null != cItemLocal) { ((Playlist)cItemLocal).PlaylistItemsDelete(aItems); bRetVal = true; } else (new Logger()).WriteError("skip: указанный элемент не зарегистрирован [item:" + cItem.GetHashCode() + "]"); } else (new Logger()).WriteError("skip: не инициирован механизм регистрации клиента"); } catch (Exception ex) { (new Logger()).WriteError(ex); } return bRetVal; }
public PlaylistItem[] AddVideo(Item cItem, PlaylistItem[] aItems) { bool bRetVal = false; try { if (0 < Client.nID) { Item cItemLocal = GarbageCollector.ItemGet(cItem); if (null != cItemLocal) { Playlist cPlaylist = (Playlist)cItemLocal; foreach (PlaylistItem cPLI in aItems) if (cPLI.bFileIsImage) cPlaylist.AddAnimation(cPLI); else cPlaylist.AddVideo(cPLI); bRetVal = true; } else (new Logger()).WriteError("add:video: указанный элемент не зарегистрирован [item:" + cItem.GetHashCode() + "]"); } else (new Logger()).WriteError("add:video: не инициирован механизм регистрации клиента"); } catch (Exception ex) { (new Logger()).WriteError(ex); } if (bRetVal) return aItems; else return null; }
public Item ItemCreate(string sPreset, PlaylistItem[] aItems, ushort nLayer, bool bStopOnEmpty) { Item cRetVal = null; try { if (0 < Client.nID) { string sInfo = "Player Playlist"; if (null != (cRetVal = (Item)GarbageCollector.ItemGet(sInfo)) && cRetVal.eStatus != Item.Status.Stopped && cRetVal.eStatus != Item.Status.Error) return cRetVal; cRetVal = new Playlist(nLayer, bStopOnEmpty); cRetVal.sPreset = sPreset; cRetVal.sInfo = sInfo; GarbageCollector.ItemAdd(cRetVal); if (null == AddVideo(cRetVal, aItems)) { (new Logger()).WriteWarning("player_create: deleting" + sInfo); GarbageCollector.ItemDelete(cRetVal); cRetVal = null; } } else (new Logger()).WriteError("create: не инициирован механизм регистрации клиента"); } catch (Exception ex) { (new Logger()).WriteError(ex); } return cRetVal; }
public void PlaylistItemsDelete(PlaylistItem[] aItems) { List<int> aEffectIDs = new List<int>(); List<PlaylistItem> aToDel = new List<PlaylistItem>(); PlaylistItem cPLI2del = null; foreach (PlaylistItem cPLI in aItems) { lock (_aPlaylistItems) if (null == _aPlaylistItems.FirstOrDefault(o => o.nID == cPLI.nID)) continue; if (null != cPLI) { aEffectIDs.Add(cPLI.nEffectID); cPLI2del = _aPlaylistItems.FirstOrDefault(o => o.nID == cPLI.nID); if (null != cPLI2del) aToDel.Add(cPLI2del); } } _cPlaylist.PLItemsDelete(aEffectIDs); lock (_aPlaylistItems) { foreach (PlaylistItem cPLI in aToDel) _aPlaylistItems.Remove(cPLI); } }
public void AddAnimation(PlaylistItem cItem) { Animation cAnimation = new Animation(); cAnimation.bKeepAlive = true; cAnimation.nLoopsQty = (ushort)cItem._nFramesQty; cAnimation.sFolder = cItem.sFilenameFull; cAnimation.stArea = new Area(0, 0, cPL_PrefTemplate.stScaleVideo.nWidth, cPL_PrefTemplate.stScaleVideo.nHeight); cAnimation.nPixelAspectRatio = cPL_PrefTemplate.nPixelAspectRatio; cItem.nAtomHashCode = cAnimation.GetHashCode(); _cPlaylist.EffectAdd(cAnimation, cItem.nTransDuration); _cPlaylist.EndTransDurationSet(cItem.nEndTransDuration); lock (_aPlaylistItems) _aPlaylistItems.Add(cItem); cItem.nEffectID = cAnimation.GetHashCode(); Player.dtPlaylistStopPlanned = dtPlaylistStopPlanned; }
public void AddVideo(PlaylistItem cItem) { Video cVideo = new Video(); cVideo.stArea = new Area(0, 0, cPL_PrefTemplate.stScaleVideo.nWidth, cPL_PrefTemplate.stScaleVideo.nHeight); cVideo.sFile = cItem.sFilenameFull; cItem.nAtomHashCode = cVideo.GetHashCode(); _cPlaylist.EffectAdd(cVideo, cItem.nTransDuration); _cPlaylist.EndTransDurationSet(cItem.nEndTransDuration); lock (_aPlaylistItems) _aPlaylistItems.Add(cItem); cItem.nEffectID = cVideo.GetHashCode(); Player.dtPlaylistStopPlanned = dtPlaylistStopPlanned; }