aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Api/Playback/BaseStreamingService.cs
diff options
context:
space:
mode:
authorMichalis Adamidis <gsnerf@gsnerf.de>2014-08-30 02:05:33 +0200
committerMichalis Adamidis <gsnerf@gsnerf.de>2014-08-30 02:05:33 +0200
commit7c5613fc51738cb3af1ce3e7ada9eb19a54b3aed (patch)
treedfd23a717d87e1da776a74f9952a5fae8f215b4a /MediaBrowser.Api/Playback/BaseStreamingService.cs
parent5740a4c22d676d0050e875b0bd5455f5a303f5bd (diff)
parent6a9dbf6ae85b4e7abcf06f7f29ef9d8b0b890876 (diff)
Merge branch 'master' of https://github.com/MediaBrowser/MediaBrowser
Diffstat (limited to 'MediaBrowser.Api/Playback/BaseStreamingService.cs')
-rw-r--r--MediaBrowser.Api/Playback/BaseStreamingService.cs29
1 files changed, 24 insertions, 5 deletions
diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs
index b965bf6f1..a0a8ee61e 100644
--- a/MediaBrowser.Api/Playback/BaseStreamingService.cs
+++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs
@@ -353,11 +353,9 @@ namespace MediaBrowser.Api.Playback
{
case EncodingQuality.HighSpeed:
crf = "12";
- profileScore = 2;
break;
case EncodingQuality.HighQuality:
crf = "8";
- profileScore = 1;
break;
case EncodingQuality.MaxQuality:
crf = "4";
@@ -369,10 +367,11 @@ namespace MediaBrowser.Api.Playback
if (isVc1)
{
profileScore++;
- // Max of 2
- profileScore = Math.Min(profileScore, 2);
}
+ // Max of 2
+ profileScore = Math.Min(profileScore, 2);
+
// http://www.webmproject.org/docs/encoder-parameters/
param = string.Format("-speed 16 -quality good -profile:v {0} -slices 8 -crf {1}",
profileScore.ToString(UsCulture),
@@ -771,13 +770,31 @@ namespace MediaBrowser.Api.Playback
return "copy";
}
+ protected virtual bool SupportsThrottling
+ {
+ get { return false; }
+ }
+
/// <summary>
/// Gets the input argument.
/// </summary>
/// <param name="state">The state.</param>
/// <returns>System.String.</returns>
- protected virtual string GetInputArgument(StreamState state)
+ protected string GetInputArgument(StreamState state)
{
+ if (state.InputProtocol == MediaProtocol.File &&
+ state.RunTimeTicks.HasValue &&
+ state.VideoType == VideoType.VideoFile &&
+ !string.Equals(state.OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
+ {
+ if (state.RunTimeTicks.Value >= TimeSpan.FromMinutes(5).Ticks && state.IsInputVideo)
+ {
+ var url = "http://localhost:8096/mediabrowser/videos/" + state.Request.Id + "/stream?static=true&Throttle=true&mediaSourceId=" + state.Request.MediaSourceId;
+
+ return string.Format("\"{0}\"", url);
+ }
+ }
+
var protocol = state.InputProtocol;
var inputPath = new[] { state.MediaPath };
@@ -1494,6 +1511,7 @@ namespace MediaBrowser.Api.Playback
state.MediaPath = mediaSource.Path;
state.RunTimeTicks = item.RunTimeTicks;
state.RemoteHttpHeaders = mediaSource.RequiredHttpHeaders;
+ state.InputBitrate = mediaSource.Bitrate;
mediaStreams = mediaSource.MediaStreams;
}
else
@@ -1508,6 +1526,7 @@ namespace MediaBrowser.Api.Playback
state.MediaPath = mediaSource.Path;
state.InputProtocol = mediaSource.Protocol;
state.InputContainer = mediaSource.Container;
+ state.InputBitrate = mediaSource.Bitrate;
if (item is Video)
{