/* Copyright (C) <2007-2016> SatIp.RtspSample is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. SatIp.RtspSample is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with SatIp.RtspSample. If not, see . */ using System.Text; namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.SatIp.Rtcp { class RtcpAppPacket : RtcpPacket { /// /// Get the synchronization source. /// public int SynchronizationSource { get; private set; } /// /// Get the name. /// public string Name { get; private set; } /// /// Get the identity. /// public int Identity { get; private set; } /// /// Get the variable data portion. /// public string Data { get; private set; } public override void Parse(byte[] buffer, int offset) { base.Parse(buffer, offset); SynchronizationSource = Utils.Convert4BytesToInt(buffer, offset + 4); Name = Utils.ConvertBytesToString(buffer, offset + 8, 4); Identity = Utils.Convert2BytesToInt(buffer, offset + 12); int dataLength = Utils.Convert2BytesToInt(buffer, offset + 14); if (dataLength != 0) Data = Utils.ConvertBytesToString(buffer, offset + 16, dataLength); } public override string ToString() { StringBuilder sb = new StringBuilder(); sb.AppendFormat("Application Specific.\n"); sb.AppendFormat("Version : {0} .\n", Version); sb.AppendFormat("Padding : {0} .\n", Padding); sb.AppendFormat("Report Count : {0} .\n", ReportCount); sb.AppendFormat("PacketType: {0} .\n", Type); sb.AppendFormat("Length : {0} .\n", Length); sb.AppendFormat("SynchronizationSource : {0} .\n", SynchronizationSource); sb.AppendFormat("Name : {0} .\n", Name); sb.AppendFormat("Identity : {0} .\n", Identity); sb.AppendFormat("Data : {0} .\n", Data); sb.AppendFormat(".\n"); return sb.ToString(); } } }