CodecProfile.cs 1004 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. using MediaBrowser.Model.Extensions;
  2. using System.Collections.Generic;
  3. using System.Xml.Serialization;
  4. namespace MediaBrowser.Model.Dlna
  5. {
  6. public class CodecProfile
  7. {
  8. [XmlAttribute("type")]
  9. public CodecType Type { get; set; }
  10. public ProfileCondition[] Conditions { get; set; }
  11. [XmlAttribute("codec")]
  12. public string Codec { get; set; }
  13. public CodecProfile()
  14. {
  15. Conditions = new ProfileCondition[] {};
  16. }
  17. public List<string> GetCodecs()
  18. {
  19. List<string> list = new List<string>();
  20. foreach (string i in (Codec ?? string.Empty).Split(','))
  21. {
  22. if (!string.IsNullOrEmpty(i)) list.Add(i);
  23. }
  24. return list;
  25. }
  26. public bool ContainsCodec(string codec)
  27. {
  28. List<string> codecs = GetCodecs();
  29. return codecs.Count == 0 || ListHelper.ContainsIgnoreCase(codecs, codec);
  30. }
  31. }
  32. }