using ECMonitor.UC.Videos; using Prism.Events; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Controls; namespace ECMonitor.Manager { public class VideoPlayManager { private int _videoIndex = 0; private List UCVideoList = new List(); /// /// 获取显示模块 /// /// /// public UserControl GetUserControl(string cameraIp) { return UCVideoList.Find(c => c.GetCameraIp() == cameraIp).GetControl(); } public IUCPlayer GetUCVideo(string cameraIp) { return UCVideoList.Find(c => c.GetCameraIp() == cameraIp); } internal void Add(IUCPlayer videoShow) { videoShow.SetIndex(UCVideoList.Count); UCVideoList.Add(videoShow); } internal void Remove(IUCPlayer videoShow) { UCVideoList.Remove(videoShow); int icont = UCVideoList.Count; for(int i = 0; i < icont; i++) { UCVideoList[i].SetIndex(i); } } internal List GetUCVideoList() { return UCVideoList; } internal void SetALLUnSelected() { foreach (IUCPlayer videoPlay in UCVideoList) { videoPlay.SetSelected(false); } } public IUCPlayer CreateVideo(IEventAggregator ea,double _videoWidth, double _videoHeight, int videoType=0,bool showCloseButton=true) { switch (videoType) { case 0://Rtsp UCFFmpegPlayer rtspVideo = new UCFFmpegPlayer(ea,_videoWidth, _videoHeight, _videoIndex++, showCloseButton,true); rtspVideo._videoType = videoType; UCVideoList.Add(rtspVideo); return rtspVideo; //case 1://海康直连 // return null // break; default: UCFFmpegPlayer defaultVideo = new UCFFmpegPlayer(ea,_videoWidth, _videoHeight, _videoIndex++, showCloseButton); defaultVideo._videoType = videoType; UCVideoList.Add(defaultVideo); return defaultVideo; } } /// /// 创建视频预警线规划 /// /// /// /// /// /// public IUCPlayer CreateWarnCreateLinePlayer(IEventAggregator ea, double _videoWidth, double _videoHeight, int videoType = 0 ) { UCFFmpegPlayer rtspVideo = new UCFFmpegPlayer(ea, _videoWidth, _videoHeight, _videoIndex++, false, false); rtspVideo._videoType = videoType; UCVideoList.Add(rtspVideo); return rtspVideo; } public IUCPlayer CreateWaringVideo(IEventAggregator ea, double _videoWidth, double _videoHeight, int videoType = 0, bool showCloseButton = false) { UCAIWarningPlayer rtspVideo = new UCAIWarningPlayer(ea, _videoWidth, _videoHeight, _videoIndex++, showCloseButton); rtspVideo._videoType = videoType; UCVideoList.Add(rtspVideo); return rtspVideo; } public IUCPlayer CreateVideoAI(double _videoWidth, double _videoHeight, int videoType = 0, bool showCloseButton = true) { switch (videoType) { case 0://Rtsp UCFFmpegAIPlayer rtspVideo = new UCFFmpegAIPlayer(_videoWidth, _videoHeight, _videoIndex++, showCloseButton); rtspVideo.VideoType = videoType; UCVideoList.Add(rtspVideo); return rtspVideo; //case 1://海康直连 // return null // break; default: rtspVideo = new UCFFmpegAIPlayer(_videoWidth, _videoHeight, _videoIndex++, showCloseButton); rtspVideo.VideoType = videoType; UCVideoList.Add(rtspVideo); return rtspVideo; } } } }