CodecProfile.cs 1012 B

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