aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Model/Dlna/CodecProfile.cs
diff options
context:
space:
mode:
authorAndrew Rabert <ar@nullsum.net>2018-12-27 18:27:57 -0500
committerAndrew Rabert <ar@nullsum.net>2018-12-27 18:27:57 -0500
commita86b71899ec52c44ddc6c3018e8cc5e9d7ff4d62 (patch)
treea74f6ea4a8abfa1664a605d31d48bc38245ccf58 /MediaBrowser.Model/Dlna/CodecProfile.cs
parent9bac3ac616b01f67db98381feb09d34ebe821f9a (diff)
Add GPL modules
Diffstat (limited to 'MediaBrowser.Model/Dlna/CodecProfile.cs')
-rw-r--r--MediaBrowser.Model/Dlna/CodecProfile.cs68
1 files changed, 68 insertions, 0 deletions
diff --git a/MediaBrowser.Model/Dlna/CodecProfile.cs b/MediaBrowser.Model/Dlna/CodecProfile.cs
new file mode 100644
index 000000000..6d143962d
--- /dev/null
+++ b/MediaBrowser.Model/Dlna/CodecProfile.cs
@@ -0,0 +1,68 @@
+using MediaBrowser.Model.Extensions;
+using System.Collections.Generic;
+using System.Xml.Serialization;
+using MediaBrowser.Model.Dlna;
+
+namespace MediaBrowser.Model.Dlna
+{
+ public class CodecProfile
+ {
+ [XmlAttribute("type")]
+ public CodecType Type { get; set; }
+
+ public ProfileCondition[] Conditions { get; set; }
+
+ public ProfileCondition[] ApplyConditions { get; set; }
+
+ [XmlAttribute("codec")]
+ public string Codec { get; set; }
+
+ [XmlAttribute("container")]
+ public string Container { get; set; }
+
+ public CodecProfile()
+ {
+ Conditions = new ProfileCondition[] {};
+ ApplyConditions = new ProfileCondition[] { };
+ }
+
+ public string[] GetCodecs()
+ {
+ return ContainerProfile.SplitValue(Codec);
+ }
+
+ private bool ContainsContainer(string container)
+ {
+ return ContainerProfile.ContainsContainer(Container, container);
+ }
+
+ public bool ContainsAnyCodec(string codec, string container)
+ {
+ return ContainsAnyCodec(ContainerProfile.SplitValue(codec), container);
+ }
+
+ public bool ContainsAnyCodec(string[] codec, string container)
+ {
+ if (!ContainsContainer(container))
+ {
+ return false;
+ }
+
+ var codecs = GetCodecs();
+ if (codecs.Length == 0)
+ {
+ return true;
+ }
+
+ foreach (var val in codec)
+ {
+ if (ListHelper.ContainsIgnoreCase(codecs, val))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+ }
+}