Esempio n. 1
0
        /// <summary>
        /// 获取gb28181设备实时流的ssrc信息
        /// </summary>
        /// <param name="deivceId"></param>
        /// <param name="channelId"></param>
        /// <returns>第一返回是用于sip推流的ssrc,第二个返回是用于zlm的streamid</returns>
        public static KeyValuePair <string, string> GetSSRCInfo(string deivceId, string channelId)
        {
            var tag = "0" + channelId.Substring(3, 5) +
                      deivceId + channelId;
            var crc32    = CRC32Helper.GetCRC32(tag);
            var crc32Str = crc32.ToString().PadLeft(10, '0');

            char[] tmpChars = crc32Str.ToCharArray();
            tmpChars[0] = '0'; //实时流ssrc第一位是0
            string ssrcid = new string(tmpChars);

            return(new KeyValuePair <string, string>(ssrcid, string.Format("{0:X8}", uint.Parse(ssrcid))));
        }
Esempio n. 2
0
        /// <summary>
        /// 非gb28181设备的streamid计算
        /// </summary>
        /// <param name="videoSrcUrl"></param>
        /// <returns></returns>
        public static string GetDisGB28181VideoChannelMainId(string videoSrcUrl)
        {
            var crc32 = CRC32Helper.GetCRC32(videoSrcUrl.ToUpper().Trim());

            return(string.Format("{0:X8}", crc32));
        }