private static void RTPInfoParse(ref RTSPResponse response, string RTPInfoString) { string[] trackSplits = RTPInfoString.Replace(" ", string.Empty).Split(','); foreach (string track in trackSplits) { RtpTrackInfo rtspTrack = new RtpTrackInfo(); string[] paramSplits = track.Split(';'); foreach (string param in paramSplits) { string[] valueSplits = param.Split('='); if (valueSplits.Length > 1) { string name = valueSplits[0]; string value = valueSplits[1]; switch (name) { case "url": if (valueSplits.Length == 2) { rtspTrack.URL = value; } else if (valueSplits.Length == 3) { rtspTrack.URL = String.Format("{0}={1}", value, valueSplits[2]); } break; case "seq": rtspTrack.Seq = uint.Parse(value, System.Globalization.NumberStyles.Integer); //... break; case "rtptime": rtspTrack.RTPTime = uint.Parse(value, System.Globalization.NumberStyles.Integer); //... break; } } } response.RtpTracks.Add(rtspTrack); } }
private static void RTPInfoParse(ref RTSPResponse response, string RTPInfoString) { string[] trackSplits = RTPInfoString.Replace(" ",string.Empty).Split(','); foreach (string track in trackSplits) { RtpTrackInfo rtspTrack = new RtpTrackInfo(); string[] paramSplits = track.Split(';'); foreach (string param in paramSplits) { string[] valueSplits = param.Split('='); if (valueSplits.Length > 1) { string name = valueSplits[0]; string value = valueSplits[1]; switch (name) { case "url": if(valueSplits.Length==2) { rtspTrack.URL=value; } else if (valueSplits.Length==3) { rtspTrack.URL=String.Format("{0}={1}",value,valueSplits[2] ); } break; case "seq": rtspTrack.Seq = uint.Parse(value, System.Globalization.NumberStyles.Integer); //... break; case "rtptime": rtspTrack.RTPTime = uint.Parse(value, System.Globalization.NumberStyles.Integer); //... break; } } } response.RtpTracks.Add(rtspTrack); } }