private bool ingestIsDead(string deviceId, Ingest ingest) { var onPublishList = FastUsefulApis.GetOnPublishMonitorListByDeviceId(deviceId, out ResponseStruct rs); if (onPublishList == null || onPublishList.Count == 0) { return(true); } var client = onPublishList.FindLast(x => !string.IsNullOrEmpty(x.RtspUrl) && x.RtspUrl ! == ingest.Input !.Url !); if (client != null) { if (client.IsOnline == false) { return(true); } return(false); } return(true); }
public JsonResult GetOnPublishMonitorById(string id) { ResponseStruct rss = CommonFunctions.CheckParams(new object[] { id }); if (rss.Code != ErrorNumber.None) { return(Program.CommonFunctions.DelApisResult(null !, rss)); } var rt = FastUsefulApis.GetOnPublishMonitorById(id, out ResponseStruct rs); return(Program.CommonFunctions.DelApisResult(rt, rs)); }
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)); }
public JsonResult KickoffClient(string deviceId, string clientId) { ResponseStruct rss = CommonFunctions.CheckParams(new object[] { deviceId, clientId }); if (rss.Code != ErrorNumber.None) { return(Program.CommonFunctions.DelApisResult(null !, rss)); } var rt = FastUsefulApis.KickoffClient(deviceId, clientId, out ResponseStruct rs); return(Program.CommonFunctions.DelApisResult(rt, rs)); }
public JsonResult GetClientInfoByStreamValue(string stream) { ResponseStruct rss = CommonFunctions.CheckParams(new object[] { stream }); if (rss.Code != ErrorNumber.None) { return(Program.CommonFunctions.DelApisResult(null !, rss)); } var rt = FastUsefulApis.GetClientInfoByStreamValue(stream, out ResponseStruct rs); return(Program.CommonFunctions.DelApisResult(rt, rs)); }
public JsonResult OnOrOffVhostMinDelay(string deviceId, string vhostDomain, bool enable) { ResponseStruct rss = CommonFunctions.CheckParams(new object[] { deviceId, vhostDomain, enable }); if (rss.Code != ErrorNumber.None) { return(Program.CommonFunctions.DelApisResult(null !, rss)); } var rt = FastUsefulApis.OnOrOffVhostMinDelay(deviceId, vhostDomain, enable, out ResponseStruct rs); return(Program.CommonFunctions.DelApisResult(rt, rs)); }
public JsonResult GetOnvifMonitorIngestTemplate(string username, string password, string rtspUrl) { ResponseStruct rss = CommonFunctions.CheckParams(new object[] { username, password, rtspUrl }); if (rss.Code != ErrorNumber.None) { return(Program.CommonFunctions.DelApisResult(null !, rss)); } var rt = FastUsefulApis.GetOnvifMonitorIngestTemplate(username, password, rtspUrl, out ResponseStruct rs); return(Program.CommonFunctions.DelApisResult(rt, rs)); }
public JsonResult GetStreamInfoByVhostIngestName(string deviceId, string vhostDomain, string ingestName) { ResponseStruct rss = CommonFunctions.CheckParams(new object[] { deviceId, vhostDomain, ingestName }); if (rss.Code != ErrorNumber.None) { return(Program.CommonFunctions.DelApisResult(null !, rss)); } var rt = FastUsefulApis.GetStreamInfoByVhostIngestName(deviceId, vhostDomain, ingestName, 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 } } } } }