aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Model/Dlna/CodecProfile.cs
blob: c2d36dc79254ef46fe18ace80919d520c2309a45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using MediaBrowser.Model.Extensions;
using System.Collections.Generic;
using System.Xml.Serialization;

namespace MediaBrowser.Model.Dlna
{
    public class CodecProfile
    {
        [XmlAttribute("type")]
        public CodecType Type { get; set; }
       
        public ProfileCondition[] Conditions { get; set; }

        [XmlAttribute("codec")]
        public string Codec { get; set; }

        public CodecProfile()
        {
            Conditions = new ProfileCondition[] {};
        }

        public List<string> GetCodecs()
        {
            List<string> list = new List<string>();
            foreach (string i in (Codec ?? string.Empty).Split(','))
            {
                if (!string.IsNullOrEmpty(i)) list.Add(i);
            }
            return list;
        }

        public bool ContainsCodec(string codec)
        {
            List<string> codecs = GetCodecs();

            return codecs.Count == 0 || ListHelper.ContainsIgnoreCase(codecs, codec);
        }
    }
}