예제 #1
0
파일: SDP.cs 프로젝트: phychoz/TestOnvif
        public static string GetCodec(this SDP sdp, string MediaType)
        {
            string codec = string.Empty;

            MediaDescription description = sdp.Session.GetMediaDescriptionByName(MediaType);

            string attribute = description.GetAttributeValueByName("rtpmap");

            if (string.IsNullOrEmpty(attribute) == false)
            {
                string[] split = attribute.Split(' ');
                if (split.Length == 2)
                {
                    string[] values = split[1].Split('/');
                    codec = values[0];
                }
            }
            return(codec);
        }
예제 #2
0
파일: SDP.cs 프로젝트: phychoz/TestOnvif
        public static int GetSampleRate(this SDP sdp, string MediaType)
        {
            int result = int.MaxValue;

            MediaDescription description = sdp.Session.GetMediaDescriptionByName(MediaType);

            string attribute = description.GetAttributeValueByName("rtpmap");

            if (string.IsNullOrEmpty(attribute) == false)
            {
                string[] split = attribute.Split(' ');
                if (split.Length == 2)
                {
                    string[] values = split[1].Split('/');
                    string   str    = values[1];

                    int.TryParse(str, out result);
                }
            }

            return(result);
        }