public JsonResult GetAllIngestByDeviceId(string deviceId) { ResponseStruct rss = CommonFunctions.CheckParams(new object[] { deviceId }); if (rss.Code != ErrorNumber.None) { return(Program.CommonFunctions.DelApisResult(null !, rss)); } var rt = FastUsefulApis.GetAllIngestByDeviceId(deviceId, out ResponseStruct rs); return(Program.CommonFunctions.DelApisResult(rt, rs)); }
private void rewriteMonitorType() { if (Common.SrsManagers != null) { foreach (var srs in Common.SrsManagers) { if (srs.IsInit && srs.Srs != null && srs.IsRunning) { var onPublishList = FastUsefulApis.GetOnPublishMonitorListByDeviceId(srs.SrsDeviceId, out ResponseStruct rs); if (onPublishList == null || onPublishList.Count == 0) { continue; } var ingestList = FastUsefulApis.GetAllIngestByDeviceId(srs.SrsDeviceId, out rs); ushort? port = srs.Srs.Http_api !.Listen; List <Channels> ret28181 = null !; if (port != null && srs.Srs != null && srs.Srs.Http_api != null && srs.Srs.Http_api.Enabled == true) { ret28181 = GetGB28181Channels("http://127.0.0.1:" + port.ToString()); } foreach (var client in onPublishList) { if (srs.Srs !.Http_api == null || srs.Srs.Http_api.Enabled == false) { continue; } #region 处理28181设备 if (ret28181 != null) { foreach (var r in ret28181) { if (!string.IsNullOrEmpty(r.Stream) && r.Stream.Equals(client.Stream)) { lock (SrsManageCommon.Common.LockDbObjForOnlineClient) { var reti = OrmService.Db.Update <OnlineClient>() .Set(x => x.MonitorType, MonitorType.GBT28181) .Where(x => x.Client_Id == client.Client_Id) .ExecuteAffrows(); } } } } #endregion #region 处理onvif设备 if (ingestList != null && ingestList.Count > 0) { foreach (var ingest in ingestList) { if (ingest != null && ingest.Input != null && client.RtspUrl != null && ingest.Input !.Url !.Equals(client.RtspUrl)) { lock (SrsManageCommon.Common.LockDbObjForOnlineClient) { var reti = OrmService.Db.Update <OnlineClient>() .Set(x => x.MonitorType, MonitorType.Onvif) .Where(x => x.Client_Id == client.Client_Id) .ExecuteAffrows(); } } } } #endregion #region 处理直播流 int retj = OrmService.Db.Update <OnlineClient>() .Set(x => x.MonitorType, MonitorType.Webcast) .Where(x => x.MonitorType == MonitorType.Unknow && x.ClientType == ClientType.Monitor) .ExecuteAffrows(); #endregion } } } } }