public static void Render(SectionBody scbin, SrsSystemConfClass sccout, string instanceName = "") { if (sccout.Stats == null) { sccout.Stats = new SrsStatsConfClass(); } sccout.Stats.SectionsName = "stats"; if (scbin.BodyList != null) { foreach (string s in scbin.BodyList) { if (!s.Trim().EndsWith(";")) { continue; } KeyValuePair <string, string> tmpkv = Common.GetKV(s); if (string.IsNullOrEmpty(tmpkv.Key)) { continue; } string cmd = tmpkv.Key.Trim().ToLower(); switch (cmd) { case "network": sccout.Stats.Network = Common.str2byte(tmpkv.Value); break; case "disk": sccout.Stats.Disk = tmpkv.Value; break; } } } }
public static void Render(SectionBody scbin, SrsSystemConfClass sccout, string instanceName = "") { if (sccout.Srt_server == null) { sccout.Srt_server = new SrsSrtServerConfClass(); } sccout.Srt_server.SectionsName = "srt_server"; if (scbin.BodyList != null) { foreach (string s in scbin.BodyList) { if (!s.Trim().EndsWith(";")) { continue; } KeyValuePair <string, string> tmpkv = Common.GetKV(s); if (string.IsNullOrEmpty(tmpkv.Key)) { continue; } string cmd = tmpkv.Key.Trim().ToLower(); switch (cmd) { case "enabled": sccout.Srt_server.Enabled = Common.str2bool(tmpkv.Value); break; case "listen": sccout.Srt_server.Listen = Common.str2ushort(tmpkv.Value); break; case "maxbw": sccout.Srt_server.Maxbw = Common.str2int(tmpkv.Value); break; case "connect_timeout": sccout.Srt_server.Connect_timeout = Common.str2int(tmpkv.Value); break; case "peerlatency": sccout.Srt_server.Peerlatency = Common.str2int(tmpkv.Value); break; case "recvlatency": sccout.Srt_server.Recvlatency = Common.str2int(tmpkv.Value); break; case "default_app": sccout.Srt_server.Default_app = tmpkv.Value; break; } } } }
protected void Section(string name, SectionBody body) { GUILayout.Label(name, "HeaderLabel"); EditorGUILayout.Space(); MadGUI.Indent(() => { body(); }); EditorGUILayout.Space(); }
public static void Render_RawApi(SectionBody scbin, SrsSystemConfClass sccout, string instanceName = "") { if (sccout.Http_api?.Raw_Api == null) { if (sccout.Http_api != null) { sccout.Http_api.Raw_Api = new RawApi(); } } if (sccout.Http_api != null) { if (sccout.Http_api.Raw_Api != null) { sccout.Http_api.Raw_Api.SectionsName = "raw_api"; if (scbin.BodyList != null) { foreach (string s in scbin.BodyList) { if (!s.Trim().EndsWith(";")) { continue; } KeyValuePair <string, string> tmpkv = Common.GetKV(s); if (string.IsNullOrEmpty(tmpkv.Key)) { continue; } string cmd = tmpkv.Key.Trim().ToLower(); switch (cmd) { case "enabled": sccout.Http_api.Raw_Api.Enabled = Common.str2bool(tmpkv.Value); break; case "allow_reload": sccout.Http_api.Raw_Api.Allow_reload = Common.str2bool(tmpkv.Value); break; case "allow_query": sccout.Http_api.Raw_Api.Allow_query = Common.str2bool(tmpkv.Value); break; case "allow_update": sccout.Http_api.Raw_Api.Allow_update = Common.str2bool(tmpkv.Value); break; } } } } } }
private void AddEntryHeaderWithText(string header, SectionBody body) { var extraNewLine = body == null || string.IsNullOrEmpty(body.Text) || ShouldBreak(body.FormatOption); // Add header AddHeader(ModelTransformerBase.COMMAND_ENTRIES_HEADING_LEVEL, header, extraNewLine: extraNewLine); // to correctly handle empty text case, we are adding new-line here if (body != null && !string.IsNullOrEmpty(body.Text)) { AddParagraphs(body.Text); } }
public static void Render(SectionBody scbin, SrsSystemConfClass sccout, string instanceName = "") { if (sccout.Http_api == null) { sccout.Http_api = new SrsHttpApiConfClass(); } sccout.Http_api.SectionsName = "http_api"; if (scbin.BodyList != null) { foreach (string s in scbin.BodyList) { if (!s.Trim().EndsWith(";")) { continue; } KeyValuePair <string, string> tmpkv = Common.GetKV(s); if (string.IsNullOrEmpty(tmpkv.Key)) { continue; } string cmd = tmpkv.Key.Trim().ToLower(); switch (cmd) { case "enabled": sccout.Http_api.Enabled = Common.str2bool(tmpkv.Value); break; case "listen": sccout.Http_api.Listen = Common.str2ushort(tmpkv.Value); break; case "crossdomain": sccout.Http_api.Crossdomain = Common.str2bool(tmpkv.Value); break; case "device_id": break; } } } if (scbin.SubSections != null && scbin.SubSections.Count > 0) { foreach (SectionBody scb in scbin.SubSections) { Render_RawApi(scb, sccout); } } }
public static void Render(SectionBody scbin, SrsSystemConfClass sccout, string instanceName = "") { if (sccout.Heartbeat == null) { sccout.Heartbeat = new SrsHeartbeatConfClass(); } sccout.Heartbeat.SectionsName = "heartbeat"; if (scbin.BodyList != null) { foreach (string s in scbin.BodyList) { if (!s.Trim().EndsWith(";")) { continue; } KeyValuePair <string, string> tmpkv = Common.GetKV(s); if (string.IsNullOrEmpty(tmpkv.Key)) { continue; } string cmd = tmpkv.Key.Trim().ToLower(); switch (cmd) { case "enabled": sccout.Heartbeat.Enabled = Common.str2bool(tmpkv.Value); break; case "interval": sccout.Heartbeat.Interval = Common.str2float(tmpkv.Value); break; case "url": sccout.Heartbeat.Url = tmpkv.Value; break; case "device_id": sccout.Heartbeat.Device_id = tmpkv.Value; break; case "summaries": sccout.Heartbeat.Summaries = Common.str2bool(tmpkv.Value); break; } } } }
public static void Render_BlackHole(SectionBody scbin, SrsSystemConfClass sccout, string instanceName = "") { if (sccout.Rtc_server?.Black_hole == null) { if (sccout.Rtc_server != null) { sccout.Rtc_server.Black_hole = new BlackHole(); } } if (sccout.Rtc_server != null) { if (sccout.Rtc_server.Black_hole != null) { sccout.Rtc_server.Black_hole.SectionsName = "black_hole"; if (scbin.BodyList != null) { foreach (string s in scbin.BodyList) { if (!s.Trim().EndsWith(";")) { continue; } KeyValuePair <string, string> tmpkv = Common.GetKV(s); if (string.IsNullOrEmpty(tmpkv.Key)) { continue; } string cmd = tmpkv.Key.Trim().ToLower(); switch (cmd) { case "enabled": sccout.Rtc_server.Black_hole.Enabled = Common.str2bool(tmpkv.Value); break; case "publisher": sccout.Rtc_server.Black_hole.Publisher = tmpkv.Value; break; } } } } } }
public static void Render(SectionBody scbin, SrsSystemConfClass sccout, string instanceName = "") { if (sccout.Http_server == null) { sccout.Http_server = new SrsHttpServerConfClass(); } sccout.Http_server.SectionsName = "http_server"; if (scbin.BodyList != null) { foreach (string s in scbin.BodyList) { if (!s.Trim().EndsWith(";")) { continue; } KeyValuePair <string, string> tmpkv = Common.GetKV(s); if (string.IsNullOrEmpty(tmpkv.Key)) { continue; } string cmd = tmpkv.Key.Trim().ToLower(); switch (cmd) { case "enabled": sccout.Http_server.Enabled = Common.str2bool(tmpkv.Value); break; case "listen": sccout.Http_server.Listen = Common.str2ushort(tmpkv.Value); break; case "dir": sccout.Http_server.Dir = tmpkv.Value; break; case "crossdomain": sccout.Http_server.Crossdomain = Common.str2bool(tmpkv.Value); break; } } } }
public static void Render(SectionBody scbin, SrsSystemConfClass sccout, string instanceName = "") { if (sccout.Kafka == null) { sccout.Kafka = new SrsKafkaConfClass(); } sccout.Kafka.SectionsName = "kafka"; if (scbin.BodyList != null) { foreach (string s in scbin.BodyList) { if (!s.Trim().EndsWith(";")) { continue; } KeyValuePair <string, string> tmpkv = Common.GetKV(s); if (string.IsNullOrEmpty(tmpkv.Key)) { continue; } string cmd = tmpkv.Key.Trim().ToLower(); switch (cmd) { case "enabled": sccout.Kafka.Enabled = Common.str2bool(tmpkv.Value); break; case "brokers": sccout.Kafka.Brokers = tmpkv.Value; break; case "topic": sccout.Kafka.Topic = tmpkv.Value; break; } } } }
public static void Render(SectionBody scbin, SrsSystemConfClass sccout, string instanceName = "") { sccout.SectionsName = "root"; if (scbin.BodyList != null) { foreach (string s in scbin.BodyList) { if (!s.Trim().EndsWith(";")) { continue; } KeyValuePair <string, string> tmpkv = Common.GetKV(s); if (string.IsNullOrEmpty(tmpkv.Key)) { continue; } string cmd = tmpkv.Key.Trim().ToLower(); switch (cmd) { /*case "deviceid": * sccout.DeviceId = tmpkv.Value; * break;*/ case "listen": sccout.Listen = Common.str2ushort(tmpkv.Value); break; case "pid": sccout.Pid = tmpkv.Value; break; case "chunk_size": sccout.Chunk_size = Common.str2ushort(tmpkv.Value); break; case "ff_log_dir": sccout.Ff_log_dir = tmpkv.Value; break; case "ff_log_level": sccout.Ff_log_level = tmpkv.Value; break; case "srs_log_tank": sccout.Srs_log_tank = tmpkv.Value; break; case "srs_log_level": sccout.Srs_log_level = tmpkv.Value; break; case "srs_log_file": sccout.Srs_log_file = tmpkv.Value; break; case "max_connections": sccout.Max_connections = Common.str2ushort(tmpkv.Value); break; case "daemon": sccout.Daemon = Common.str2bool(tmpkv.Value); break; case "utc_time": sccout.Utc_time = Common.str2bool(tmpkv.Value); break; case "pithy_print_ms": sccout.Pithy_print_ms = Common.str2int(tmpkv.Value); break; case "work_dir": sccout.Work_dir = tmpkv.Value; break; case "asprocess": sccout.Asprocess = Common.str2bool(tmpkv.Value); break; case "empty_ip_ok": sccout.Empty_ip_ok = Common.str2bool(tmpkv.Value); break; case "grace_start_wait": sccout.Grace_start_wait = Common.str2int(tmpkv.Value); break; case "grace_final_wait": sccout.Grace_final_wait = Common.str2int(tmpkv.Value); break; case "force_grace_quit": sccout.Force_grace_quit = Common.str2bool(tmpkv.Value); break; case "disable_daemon_for_docker": sccout.Disable_daemon_for_docker = Common.str2bool(tmpkv.Value); break; case "inotify_auto_reload": sccout.Inotify_auto_reload = Common.str2bool(tmpkv.Value); break; case "auto_reload_for_docker": sccout.Auto_reload_for_docker = Common.str2bool(tmpkv.Value); break; case "tcmalloc_release_rate": sccout.Tcmalloc_release_rate = Common.str2float(tmpkv.Value); break; } } } }
public static void Render_Sip(SectionBody scbin, SrsStreamCasterConfClass sccout, string instanceName = "") { if (sccout.sip == null) { sccout.sip = new Sip(); } else { return; //只能有一个 } sccout.sip.SectionsName = "sip"; if (scbin.BodyList != null) { foreach (string s in scbin.BodyList) { if (!s.Trim().EndsWith(";")) { continue; } KeyValuePair <string, string> tmpkv = Common.GetKV(s); if (string.IsNullOrEmpty(tmpkv.Key)) { continue; } string cmd = tmpkv.Key.Trim().ToLower(); switch (cmd) { case "enabled": sccout.sip.Enabled = Common.str2bool(tmpkv.Value); break; case "listen": sccout.sip.Listen = Common.str2ushort(tmpkv.Value); break; case "serial": sccout.sip.Serial = tmpkv.Value; break; case "realm": sccout.sip.Realm = tmpkv.Value; break; case "ack_timeout": sccout.sip.Ack_timeout = Common.str2ushort(tmpkv.Value); break; case "keepalive_timeout": sccout.sip.Keepalive_timeout = Common.str2ushort(tmpkv.Value); break; case "auto_play": sccout.sip.Auto_play = Common.str2bool(tmpkv.Value); break; case "invite_port_fixed": sccout.sip.Invite_port_fixed = Common.str2bool(tmpkv.Value); break; case "query_catalog_interval": sccout.sip.Query_catalog_interval = Common.str2ushort(tmpkv.Value); break; } } } }
public static void Render(SectionBody scbin, SrsSystemConfClass sccout, string instanceName = "") { if (sccout.Stream_casters == null) { sccout.Stream_casters = new List <SrsStreamCasterConfClass>(); } if (null != sccout.Stream_casters.Find(s => s.InstanceName == instanceName)) { return; //filter the same streamcaster instance } SrsStreamCasterConfClass sccc = new SrsStreamCasterConfClass(); if (scbin.BodyList != null) { foreach (string s in scbin.BodyList) { if (!s.Trim().EndsWith(";")) { continue; } KeyValuePair <string, string> tmpkv = Common.GetKV(s); if (string.IsNullOrEmpty(tmpkv.Key)) { continue; } sccc.InstanceName = instanceName; sccc.SectionsName = "stream_caster"; string cmd = tmpkv.Key.Trim().ToLower(); switch (cmd) { case "enabled": sccc.Enabled = Common.str2bool(tmpkv.Value); break; case "caster": sccc.Caster = (CasterEnum)Enum.Parse(typeof(CasterEnum), tmpkv.Value); break; case "output": sccc.Output = tmpkv.Value; break; case "listen": sccc.Listen = Common.str2ushort(tmpkv.Value); break; case "rtp_port_min": sccc.Rtp_port_min = Common.str2ushort(tmpkv.Value); break; case "rtp_port_max": sccc.Rtp_port_max = Common.str2ushort(tmpkv.Value); break; case "host": sccc.Host = tmpkv.Value; break; case "audio_enable": sccc.Audio_enable = Common.str2bool(tmpkv.Value); break; case "wait_keyframe": sccc.Wait_keyframe = Common.str2bool(tmpkv.Value); break; case "rtp_idle_timeout": sccc.Rtp_idle_timeout = Common.str2ushort(tmpkv.Value); break; case "auto_create_channel": sccc.Auto_create_channel = Common.str2bool(tmpkv.Value); break; case "jitterbuffer_enable": sccc.Jitterbuffer_Enable = Common.str2bool(tmpkv.Value); break; } } } if (scbin.SubSections != null) { foreach (SectionBody scb in scbin.SubSections) { Render_Sip(scb, sccc); } } sccout.Stream_casters.Add(sccc); }
public static void Render(SectionBody scbin, SrsSystemConfClass sccout, string instanceName = "") { if (sccout.Rtc_server == null) { sccout.Rtc_server = new SrsRtcServerConfClass(); } sccout.Rtc_server.SectionsName = "rtc_server"; if (scbin.BodyList != null) { foreach (string s in scbin.BodyList) { if (!s.Trim().EndsWith(";")) { continue; } KeyValuePair <string, string> tmpkv = Common.GetKV(s); if (string.IsNullOrEmpty(tmpkv.Key)) { continue; } string cmd = tmpkv.Key.Trim().ToLower(); switch (cmd) { case "enabled": sccout.Rtc_server.Enabled = Common.str2bool(tmpkv.Value); break; case "listen": sccout.Rtc_server.Listen = Common.str2ushort(tmpkv.Value); break; case "candidate": sccout.Rtc_server.Candidate = tmpkv.Value; break; case "ecdsa": sccout.Rtc_server.Ecdsa = Common.str2bool(tmpkv.Value); break; case "sendmmsg": sccout.Rtc_server.Sendmmsg = Common.str2ushort(tmpkv.Value); break; case "encrypt": sccout.Rtc_server.Encrypt = Common.str2bool(tmpkv.Value); break; case "reuseport": sccout.Rtc_server.Reuseport = Common.str2ushort(tmpkv.Value); break; case "merge_nalus": sccout.Rtc_server.Merge_nalus = Common.str2bool(tmpkv.Value); break; case "gso": sccout.Rtc_server.Gso = Common.str2bool(tmpkv.Value); break; case "padding": sccout.Rtc_server.Padding = Common.str2ushort(tmpkv.Value); break; case "perf_stat": sccout.Rtc_server.Perf_stat = Common.str2bool(tmpkv.Value); break; case "queue_length": sccout.Rtc_server.Queue_length = Common.str2ushort(tmpkv.Value); break; } } } if (scbin.SubSections != null && scbin.SubSections.Count > 0) { foreach (SectionBody scb in scbin.SubSections) { Render_BlackHole(scb, sccout); } } }