RtcpSourceDescriptionPacket.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using System.Collections.ObjectModel;
  2. /*
  3. Copyright (C) <2007-2016> <Kay Diefenthal>
  4. SatIp.RtspSample is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, either version 3 of the License, or
  7. (at your option) any later version.
  8. SatIp.RtspSample is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with SatIp.RtspSample. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. using System.Text;
  16. namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.SatIp.Rtcp
  17. {
  18. class RtcpSourceDescriptionPacket :RtcpPacket
  19. { /// <summary>
  20. /// Get the list of source descriptions.
  21. /// </summary>
  22. public Collection<SourceDescriptionBlock> Descriptions;
  23. public override void Parse(byte[] buffer, int offset)
  24. {
  25. base.Parse(buffer, offset);
  26. Descriptions = new Collection<SourceDescriptionBlock>();
  27. int index = 4;
  28. while (Descriptions.Count < ReportCount)
  29. {
  30. SourceDescriptionBlock descriptionBlock = new SourceDescriptionBlock();
  31. descriptionBlock.Process(buffer, offset + index);
  32. Descriptions.Add(descriptionBlock);
  33. index += descriptionBlock.BlockLength;
  34. }
  35. }
  36. public override string ToString()
  37. {
  38. StringBuilder sb = new StringBuilder();
  39. sb.AppendFormat("Source Description.\n");
  40. sb.AppendFormat("Version : {0} .\n", Version);
  41. sb.AppendFormat("Padding : {0} .\n", Padding);
  42. sb.AppendFormat("Report Count : {0} .\n", ReportCount);
  43. sb.AppendFormat("PacketType: {0} .\n", Type);
  44. sb.AppendFormat("Length : {0} .\n", Length);
  45. sb.AppendFormat("Descriptions : {0} .\n", Descriptions);
  46. sb.AppendFormat(".\n");
  47. return sb.ToString();
  48. }
  49. }
  50. }