private void changeStreamIndex(VideoControlActionEventArgs vca) { if (this.config.AutoChangeStreamIndex == false) { return; } if (vca.Camera == null) { return; } if (vca.VControl.CurrentCamera == null) { return; } if (vca.VControl.Mode != ShowMode.Real) { return; } VideoSourceBase vs = this.getVideoSourceByVideoControl(vca.VControl); VideoPanel panel = this.m_VideoPanelTable[vca.VControl.VideoPanelID] as VideoPanel; //if (vca.VControl.IsMax) // vs?.ChangeStreamIndex(vca.VControl.VControl, 0); //else //{ // if (this.CurLayout.ControlList.Count > 4) // { // this.m_StreamManager.ChangeStreamIndex(vca.VControl.VControl, 1); // } //} }
public Control CreateVideoPanel(string key, int VideoControlCount = 16, string layoutName = "1") { VideoPanel panel = this.m_VideoPanelTable[key] as VideoPanel; if (panel != null) { return(panel); } panel = new VideoPanel(); List <VideoControl> vcList = new List <VideoControl>(); for (int i = 0; i < VideoControlCount; i++) { VideoControl vc = this.CreateVideoControl($"{key}_{i}"); vcList.Add(vc); } panel.VCList = vcList; panel.ControlChanged += Panel_ControlChanged; panel.CurLayout = this.layoutConfig.Layouts.First(l => l.Name == layoutName) ?? this.layoutConfig.Layouts[0] ?? Layout.GetNormalLayou("1", 1, 1); panel.Init(); this.m_VideoPanelTable[key] = panel; return(panel); }
/// <summary> /// 获得面板的布局 /// </summary> /// <param name="panelID"></param> /// <returns></returns> public Layout GetPanelLayout(string panelID) { Layout ret = default; VideoPanel panel = this.m_VideoPanelTable[panelID] as VideoPanel; if (panel == null) { this.LogModule?.Error($"未找到相应的视频面板: {panelID}"); return(ret); } return(panel.CurLayout); }
public VideoControl GetVideoControl(string panelID, int index) { VideoControl ret = default; VideoPanel panel = this.m_VideoPanelTable[panelID] as VideoPanel; if (panel == null) { this.LogModule.Error($"未找到相应的视频面板: {panelID}"); return(ret); } if (index < 0 || index >= panel.CurLayout.ControlList.Count) { this.LogModule.Error($"索引有误: {index}"); return(ret); } return(panel.CurLayout.ControlList[index].Control); }
/// <summary> /// 设置布局 /// </summary> /// <param name="panelID"></param> /// <param name="layoutName"></param> public void SetLayout(string panelID, string layoutName) { VideoPanel panel = this.m_VideoPanelTable[panelID] as VideoPanel; if (panel == null) { this.LogModule?.Error($"未找到相应的视频面板: {panelID}"); return; } var layout = this.layoutConfig.Layouts.FirstOrDefault(l => l.Name == layoutName); if (layout == null) { this.LogModule?.Error($"未找到相应的预案名称: {layoutName}"); return; } if (panel.CurLayout.Name != layout.Name) { panel.CurLayout = layout; } }
private void Vc_ActionEvent(object sender, VideoControlActionEventArgs args) { var vs = this.getVideoSourceByVideoControl(args.VControl); switch (args.Type) { case VideoControlAction.CloseVideo: this.closeVideo(args.VControl); break; case VideoControlAction.PB_Play: if (args.Arg != null && args.Camera != null) { this.closeVideo(args.VControl); vs?.StartPlaybackByTime(args.Camera, args.VControl, ((PlaybackInfo)args.Arg).Start, ((PlaybackInfo)args.Arg).End); } break; case VideoControlAction.PB_Resume: vs?.PB_Resume(args.VControl); args.VControl.PBStatus = VideoControl.PB_Status.Play; break; case VideoControlAction.PB_Pause: vs?.PB_Pause(args.VControl); args.VControl.PBStatus = VideoControl.PB_Status.Pause; break; case VideoControlAction.PB_Stop: this.StopVideo(args.VControl); args.VControl.PBStatus = VideoControl.PB_Status.BeforeStart; break; case VideoControlAction.PB_Fast: vs?.PB_Fast(args.VControl); break; case VideoControlAction.PB_Slow: vs?.PB_Slow(args.VControl); break; case VideoControlAction.PB_Step: vs?.PB_Step(args.VControl); break; case VideoControlAction.Snap: this.snap(args.VControl); break; case VideoControlAction.Seleced: this.setSelected(args.VControl); break; case VideoControlAction.PB_SetPos: vs?.PB_SetPos(args.VControl, (int)args.Arg); break; case VideoControlAction.PB_StratDownload: this.startDownload(args.VControl); break; case VideoControlAction.PB_StopDownload: this.stopDownload(args.VControl); break; case VideoControlAction.ErrorReport: this.LogModule.Error(args.Arg.ToString()); break; case VideoControlAction.Transposition: try { int oldIndex = Convert.ToInt32(args.Arg.ToString()); int newIndex = Convert.ToInt32(args.VControl.Name); VideoPanel panel = this.m_VideoPanelTable[args.VControl.VideoPanelID] as VideoPanel; panel?.Transposition(oldIndex, newIndex); } catch { } break; case VideoControlAction.FullScreen: case VideoControlAction.NormalScreen: //this.changeStreamIndex(vca); break; case VideoControlAction.OpenSound: this.openSound_VC(args.VControl); break; case VideoControlAction.CloseSound: this.closeSound_VC(args.VControl); break; } }