Ejemplo n.º 1
0
        static LivingcastStreamDesc parse_stream_node(XmlNode s)
        {
            int aid = -2, vid = -2; // 在 MCU 中,不可能出现 -2 的情况

            foreach (XmlNode n in s.ChildNodes)
            {
                if (n.Name == "aid")
                {
                    aid = int.Parse(n.InnerText);
                }
                else if (n.Name == "vid")
                {
                    vid = int.Parse(n.InnerText);
                }
            }

            if (aid != -2 && vid != -2)
            {
                LivingcastStreamDesc desc = new LivingcastStreamDesc();
                desc.aid = aid;
                desc.vid = vid;
                return(desc);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 2
0
        static LivingcastStartParam parse_cmd_node(XmlElement node, string mcu_jid, int mcu_cid)
        {
            // 根据 cmd node 构造 LivingcastStartParam

            XmlNode uuid = null, subject = null, streams = null;

            foreach (XmlNode c in node.ChildNodes)
            {
                if (c.Name == "uuid")
                {
                    uuid = c;
                }
                else if (c.Name == "subject")
                {
                    subject = c;
                }
                else if (c.Name == "streams")
                {
                    streams = c;
                }
            }

            if (uuid == null || subject == null || streams == null)
            {
                return(null);
            }

            LivingcastStartParam param = new LivingcastStartParam();

            param.uuid    = uuid.InnerText;
            param.subject = subject.InnerText;
            foreach (XmlNode s in streams.ChildNodes)
            {
                if (s.Name != "stream")
                {
                    continue;
                }
                LivingcastStreamDesc d = parse_stream_node(s);
                if (d != null)
                {
                    param.streams.Add(d);
                }
            }

            param.mcu_cid = mcu_cid;
            param.mcu_jid = mcu_jid;

            return(param);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 生成 rtmp url
 /// </summary>
 /// <param name="cid"></param>
 /// <param name="sd"></param>
 /// <returns></returns>
 string build_rtmp_livingcast_url(int cid, LivingcastStreamDesc sd)
 {
     string url = string.Format("rtmp://{0}/livepkgr/{1}_{2}?adbe-live-event=liveevent", config["fms_ip"], cid, sd.vid);
     return url;
 }
Ejemplo n.º 4
0
        static LivingcastStreamDesc parse_stream_node(XmlNode s)
        {
            int aid = -2, vid = -2; // 在 MCU 中,不可能出现 -2 的情况
            foreach (XmlNode n in s.ChildNodes) {
                if (n.Name == "aid")
                    aid = int.Parse(n.InnerText);
                else if (n.Name == "vid")
                    vid = int.Parse(n.InnerText);
            }

            if (aid != -2 && vid != -2) {
                LivingcastStreamDesc desc = new LivingcastStreamDesc();
                desc.aid = aid;
                desc.vid = vid;
                return desc;
            }
            else
                return null;
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 生成 rtmp url
        /// </summary>
        /// <param name="cid"></param>
        /// <param name="sd"></param>
        /// <returns></returns>
        string build_rtmp_livingcast_url(int cid, LivingcastStreamDesc sd)
        {
            string url = string.Format("rtmp://{0}/livepkgr/{1}_{2}?adbe-live-event=liveevent", config["fms_ip"], cid, sd.vid);

            return(url);
        }