aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Model/Entities/MediaStream.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2016-05-14 14:02:06 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2016-05-14 14:02:06 -0400
commitff980dc42c4ebc31151a3dd4bc4d8dac738fd801 (patch)
tree7433f023ccb30c348630a3fac97a30347b155a07 /MediaBrowser.Model/Entities/MediaStream.cs
parent4d66f6dc6c1f0067479ce4845441ce713981c4fd (diff)
add DisplayTitle to media streams
Diffstat (limited to 'MediaBrowser.Model/Entities/MediaStream.cs')
-rw-r--r--MediaBrowser.Model/Entities/MediaStream.cs89
1 files changed, 88 insertions, 1 deletions
diff --git a/MediaBrowser.Model/Entities/MediaStream.cs b/MediaBrowser.Model/Entities/MediaStream.cs
index 25252956b..9b814c5cc 100644
--- a/MediaBrowser.Model/Entities/MediaStream.cs
+++ b/MediaBrowser.Model/Entities/MediaStream.cs
@@ -1,4 +1,6 @@
-using MediaBrowser.Model.Dlna;
+using System;
+using System.Collections.Generic;
+using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Extensions;
using System.Diagnostics;
@@ -34,6 +36,91 @@ namespace MediaBrowser.Model.Entities
/// <value>The comment.</value>
public string Comment { get; set; }
+ public string Title { get; set; }
+
+ public string DisplayTitle
+ {
+ get
+ {
+ if (!string.IsNullOrEmpty(Title))
+ {
+ return Title;
+ }
+
+ if (Type == MediaStreamType.Audio)
+ {
+ List<string> attributes = new List<string>();
+
+ if (!string.IsNullOrEmpty(Language))
+ {
+ attributes.Add(Language);
+ }
+ if (!string.IsNullOrEmpty(Codec) && !StringHelper.EqualsIgnoreCase(Codec, "dca"))
+ {
+ attributes.Add(Codec);
+ }
+ if (!string.IsNullOrEmpty(Profile) && !StringHelper.EqualsIgnoreCase(Profile, "lc"))
+ {
+ attributes.Add(Profile);
+ }
+
+ if (Channels.HasValue)
+ {
+ attributes.Add(StringHelper.ToStringCultureInvariant(Channels.Value) + " ch");
+ }
+
+ string name = string.Join(" ", attributes.ToArray());
+
+ if (IsDefault)
+ {
+ name += " (D)";
+ }
+
+ return name;
+ }
+
+ if (Type == MediaStreamType.Subtitle)
+ {
+ List<string> attributes = new List<string>();
+
+ if (!string.IsNullOrEmpty(Language))
+ {
+ attributes.Add(Language);
+ }
+ if (!string.IsNullOrEmpty(Codec))
+ {
+ attributes.Add(Codec);
+ }
+
+ string name = string.Join(" ", attributes.ToArray());
+
+ if (IsDefault)
+ {
+ name += " (D)";
+ }
+
+ if (IsForced)
+ {
+ name += " (F)";
+ }
+
+ if (IsExternal)
+ {
+ name += " (EXT)";
+ }
+
+ return name;
+ }
+
+ if (Type == MediaStreamType.Video)
+ {
+
+ }
+
+ return null;
+ }
+ }
+
public string NalLengthSize { get; set; }
/// <summary>