aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2017-09-25 01:06:15 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2017-09-25 01:06:15 -0400
commit978eedbcb7a778248acd03b7f924260db70cd406 (patch)
tree034fcf627081d6b0f5b60c62e5147127de438371 /MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs
parent768f20b1bbc16c9f0eb013a486d472dc7d2684a2 (diff)
improve support for compressed xmltv
Diffstat (limited to 'MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs')
-rw-r--r--MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs98
1 files changed, 86 insertions, 12 deletions
diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs b/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs
index fb8aa9767..450bbf7c1 100644
--- a/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs
+++ b/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs
@@ -180,6 +180,61 @@ namespace MediaBrowser.Controller.MediaEncoding
return false;
}
+ public string[] GetRequestedProfiles(string codec)
+ {
+ if (!string.IsNullOrWhiteSpace(BaseRequest.Profile))
+ {
+ return BaseRequest.Profile.Split(new[] { '|', ',' }, StringSplitOptions.RemoveEmptyEntries);
+ }
+
+ if (!string.IsNullOrWhiteSpace(codec))
+ {
+ var profile = BaseRequest.GetOption(codec, "profile");
+
+ if (!string.IsNullOrWhiteSpace(profile))
+ {
+ return profile.Split(new[] { '|', ',' }, StringSplitOptions.RemoveEmptyEntries);
+ }
+ }
+
+ return new string[] { };
+ }
+
+ public string GetRequestedLevel(string codec)
+ {
+ if (!string.IsNullOrWhiteSpace(BaseRequest.Level))
+ {
+ return BaseRequest.Level;
+ }
+
+ if (!string.IsNullOrWhiteSpace(codec))
+ {
+ return BaseRequest.GetOption(codec, "level");
+ }
+
+ return null;
+ }
+
+ public int? GetRequestedMaxRefFrames(string codec)
+ {
+ if (!string.IsNullOrWhiteSpace(BaseRequest.Level))
+ {
+ return BaseRequest.MaxRefFrames;
+ }
+
+ if (!string.IsNullOrWhiteSpace(codec))
+ {
+ var value = BaseRequest.GetOption(codec, "maxrefframes");
+ int result;
+ if (!string.IsNullOrWhiteSpace(value) && int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out result))
+ {
+ return result;
+ }
+ }
+
+ return null;
+ }
+
public bool IsVideoRequest { get; set; }
public TranscodingJobType TranscodingType { get; set; }
@@ -188,7 +243,7 @@ namespace MediaBrowser.Controller.MediaEncoding
_logger = logger;
TranscodingType = jobType;
RemoteHttpHeaders = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
- PlayableStreamFileNames = new string[]{};
+ PlayableStreamFileNames = new string[] { };
SupportedAudioCodecs = new List<string>();
SupportedVideoCodecs = new List<string>();
SupportedSubtitleCodecs = new List<string>();
@@ -338,12 +393,19 @@ namespace MediaBrowser.Controller.MediaEncoding
{
get
{
- var stream = VideoStream;
- var request = BaseRequest;
+ if (BaseRequest.Static)
+ {
+ return VideoStream == null ? null : VideoStream.Level;
+ }
+
+ var level = GetRequestedLevel(ActualOutputVideoCodec);
+ double result;
+ if (!string.IsNullOrWhiteSpace(level) && double.TryParse(level, NumberStyles.Any, CultureInfo.InvariantCulture, out result))
+ {
+ return result;
+ }
- return !string.IsNullOrEmpty(request.Level) && !request.Static
- ? double.Parse(request.Level, CultureInfo.InvariantCulture)
- : stream == null ? null : stream.Level;
+ return null;
}
}
@@ -367,8 +429,12 @@ namespace MediaBrowser.Controller.MediaEncoding
{
get
{
- var stream = VideoStream;
- return stream == null || !BaseRequest.Static ? null : stream.RefFrames;
+ if (BaseRequest.Static)
+ {
+ return VideoStream == null ? null : VideoStream.RefFrames;
+ }
+
+ return null;
}
}
@@ -423,10 +489,18 @@ namespace MediaBrowser.Controller.MediaEncoding
{
get
{
- var stream = VideoStream;
- return !string.IsNullOrEmpty(BaseRequest.Profile) && !BaseRequest.Static
- ? BaseRequest.Profile
- : stream == null ? null : stream.Profile;
+ if (BaseRequest.Static)
+ {
+ return VideoStream == null ? null : VideoStream.Profile;
+ }
+
+ var requestedProfile = GetRequestedProfiles(ActualOutputVideoCodec).FirstOrDefault();
+ if (!string.IsNullOrWhiteSpace(requestedProfile))
+ {
+ return requestedProfile;
+ }
+
+ return null;
}
}