// POST: api/VideoTrack public IHttpActionResult Post([FromBody] CCTVVideoTrack control) { if (control == null) { return(BadRequest("提交的数据是空值")); } if (string.IsNullOrWhiteSpace(control.VideoId)) { return(BadRequest("无效的VideoId标识")); } VideoTrackPersistence.Instance.Put(control.VideoId, control); return(Ok("添加视频跟踪信息成功")); }
//Put:api/VideoTrack/5 public IHttpActionResult Put(string id, [FromBody] CCTVVideoTrack control) { if (id == null) { return(BadRequest("无效的VideoId标识")); } if (control == null) { return(BadRequest("提交的数据是空值")); } VideoTrackPersistence.Instance.Put(id, control); return(Ok("修改视频跟踪信息成功")); }
public void PutAllVideoTrackInfo(CCTVVideoTrack info, bool isDeleted) { PutDefaultInfo <CCTVVideoTrack>(CCTVInfoType.VideoTrackInfo, info.VideoId, info, isDeleted); }
private void classifyInfo(VideoParser.Front front, VideoParser.Video video, int channel, string serverId) { //在线标识。 var videoId = getNodeId(video.Id); if (video.DvrChannel > 0) { channel = video.DvrChannel; } _onlineStatus[videoId] = new CCTVOnlineStatus() { VideoId = videoId, Online = video.Online }; CCTVStaticInfo info = new CCTVStaticInfo() { VideoId = videoId, Name = video.Name, ImageType = video.HighDef ? ImageType.HighDef : ImageType.Unknow, Platform = CCTVPlatformType.CCTV1, Streams = getStreamInfos(video, channel), }; if (video.PanTiltUnit != null && video.PanTiltUnit.Trackable) { var ptz = video.PanTiltUnit; info.Latitude = ptz.Latitude; info.Longitude = ptz.Longitude; info.Altitude = ptz.Altitude; //生成摄像机象限信息 CCTVCameraLimits camera = new CCTVCameraLimits() { VideoId = info.VideoId, UpLimit = ptz.UpLimit, DownLimit = ptz.DownLimit, LeftLimit = ptz.LeftLimit, RightLimit = ptz.RightLimit, MaxViewPort = ptz.WideView, MinViewPort = ptz.TeleView }; _cameras[camera.VideoId] = camera; } else { VideoPosition videoPosition; if (_vpSync.TryGetValue(info.VideoId, out videoPosition)) { info.Latitude = videoPosition.Latitude; info.Longitude = videoPosition.Longitude; info.Altitude = videoPosition.Altitude; info.Heading = videoPosition.Heading; info.ViewPort = videoPosition.ViewPort; } } _statics[info.VideoId] = info; //视频跟踪 var vTrackHost = ImageTrackInfoProvider.Instance.GetImageTrackHost(video.Id); if (!string.IsNullOrWhiteSpace(vTrackHost)) { var vTrack = new CCTVVideoTrack() { Ip = vTrackHost, RpcPort = 8068, SubPort = 8061, VideoId = info.VideoId }; _videoTracks[vTrack.VideoId] = vTrack; } //生成设备信息。 CCTVDeviceInfo di = new CCTVDeviceInfo() { VideoId = info.VideoId, DeviceType = DeviceType.HikIP, PreferredServerId = serverId, User = front.User, Password = front.Pass, Port = front.Port }; //大于33的认为是IP直连。 if (channel >= 33) { di.Ip = video.Host; } else { di.Ip = front.Host; } _devices[di.VideoId] = di; //TODO:生成控制信息。徐测试以此方法生成是否可行。 CCTVControlConfig cc = new CCTVControlConfig() { VideoId = info.VideoId, Type = getControlType(video.PanTiltUnit), Ip = di.Ip, Port = di.Port, Channel = channel, AuxSwitch = getAuxSwitch(video.PanTiltUnit) }; _controls[cc.VideoId] = cc; }