aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Api/Playback/BaseStreamingService.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Api/Playback/BaseStreamingService.cs')
-rw-r--r--MediaBrowser.Api/Playback/BaseStreamingService.cs56
1 files changed, 24 insertions, 32 deletions
diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs
index 9d2c8c444..2c3abe95e 100644
--- a/MediaBrowser.Api/Playback/BaseStreamingService.cs
+++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs
@@ -1,12 +1,10 @@
using MediaBrowser.Common.Extensions;
-using MediaBrowser.Common.IO;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Devices;
using MediaBrowser.Controller.Dlna;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.MediaEncoding;
-using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
@@ -616,7 +614,7 @@ namespace MediaBrowser.Api.Playback
if (!string.IsNullOrEmpty(state.SubtitleStream.Language))
{
- var charenc = SubtitleEncoder.GetSubtitleFileCharacterSet(subtitlePath, state.MediaSource.Protocol, CancellationToken.None).Result;
+ var charenc = SubtitleEncoder.GetSubtitleFileCharacterSet(subtitlePath, state.SubtitleStream.Language, state.MediaSource.Protocol, CancellationToken.None).Result;
if (!string.IsNullOrEmpty(charenc))
{
@@ -1028,7 +1026,7 @@ namespace MediaBrowser.Api.Playback
StartStreamingLog(transcodingJob, state, process.StandardError.BaseStream, state.LogFileStream);
// Wait for the file to exist before proceeeding
- while (!FileSystem.FileExists(state.WaitForPath ?? outputPath) && !transcodingJob.HasExited)
+ while (!FileSystem.FileExists(state.WaitForPath ?? outputPath) && !transcodingJob.HasExited)
{
await Task.Delay(100, cancellationTokenSource.Token).ConfigureAwait(false);
}
@@ -1454,10 +1452,7 @@ namespace MediaBrowser.Api.Playback
}
else if (i == 19)
{
- if (videoRequest != null)
- {
- videoRequest.Cabac = string.Equals("true", val, StringComparison.OrdinalIgnoreCase);
- }
+ // cabac no longer used
}
else if (i == 20)
{
@@ -1548,7 +1543,7 @@ namespace MediaBrowser.Api.Playback
double digit;
if (double.TryParse(time, NumberStyles.Any, UsCulture, out digit))
{
- secondsSum += (digit * timeFactor);
+ secondsSum += digit * timeFactor;
}
else
{
@@ -1656,9 +1651,9 @@ namespace MediaBrowser.Api.Playback
if (state.OutputVideoBitrate.HasValue)
{
var resolution = ResolutionNormalizer.Normalize(
- state.VideoStream == null ? (int?)null : state.VideoStream.BitRate,
- state.OutputVideoBitrate.Value,
- state.VideoStream == null ? null : state.VideoStream.Codec,
+ state.VideoStream == null ? (int?)null : state.VideoStream.BitRate,
+ state.OutputVideoBitrate.Value,
+ state.VideoStream == null ? null : state.VideoStream.Codec,
state.OutputVideoCodec,
videoRequest.MaxWidth,
videoRequest.MaxHeight);
@@ -1682,12 +1677,12 @@ namespace MediaBrowser.Api.Playback
private void TryStreamCopy(StreamState state, VideoStreamRequest videoRequest)
{
- if (state.VideoStream != null && CanStreamCopyVideo(videoRequest, state.VideoStream))
+ if (state.VideoStream != null && CanStreamCopyVideo(state))
{
state.OutputVideoCodec = "copy";
}
- if (state.AudioStream != null && CanStreamCopyAudio(videoRequest, state.AudioStream, state.SupportedAudioCodecs))
+ if (state.AudioStream != null && CanStreamCopyAudio(state, state.SupportedAudioCodecs))
{
state.OutputAudioCodec = "copy";
}
@@ -1775,8 +1770,11 @@ namespace MediaBrowser.Api.Playback
state.MediaSource = mediaSource;
}
- protected virtual bool CanStreamCopyVideo(VideoStreamRequest request, MediaStream videoStream)
+ protected virtual bool CanStreamCopyVideo(StreamState state)
{
+ var request = state.VideoRequest;
+ var videoStream = state.VideoStream;
+
if (videoStream.IsInterlaced)
{
return false;
@@ -1786,7 +1784,7 @@ namespace MediaBrowser.Api.Playback
{
return false;
}
-
+
// Can't stream copy if we're burning in subtitles
if (request.SubtitleStreamIndex.HasValue)
{
@@ -1807,10 +1805,10 @@ namespace MediaBrowser.Api.Playback
{
if (string.IsNullOrEmpty(videoStream.Profile))
{
- return false;
+ //return false;
}
- if (!string.Equals(request.Profile, videoStream.Profile, StringComparison.OrdinalIgnoreCase))
+ if (!string.IsNullOrEmpty(videoStream.Profile) && !string.Equals(request.Profile, videoStream.Profile, StringComparison.OrdinalIgnoreCase))
{
var currentScore = GetVideoProfileScore(videoStream.Profile);
var requestedScore = GetVideoProfileScore(request.Profile);
@@ -1886,24 +1884,16 @@ namespace MediaBrowser.Api.Playback
{
if (!videoStream.Level.HasValue)
{
- return false;
+ //return false;
}
- if (videoStream.Level.Value > requestLevel)
+ if (videoStream.Level.HasValue && videoStream.Level.Value > requestLevel)
{
return false;
}
}
}
- if (request.Cabac.HasValue && request.Cabac.Value)
- {
- if (videoStream.IsCabac.HasValue && !videoStream.IsCabac.Value)
- {
- return false;
- }
- }
-
return request.EnableAutoStreamCopy;
}
@@ -1923,8 +1913,11 @@ namespace MediaBrowser.Api.Playback
return Array.FindIndex(list.ToArray(), t => string.Equals(t, profile, StringComparison.OrdinalIgnoreCase));
}
- protected virtual bool CanStreamCopyAudio(VideoStreamRequest request, MediaStream audioStream, List<string> supportedAudioCodecs)
+ protected virtual bool CanStreamCopyAudio(StreamState state, List<string> supportedAudioCodecs)
{
+ var request = state.VideoRequest;
+ var audioStream = state.AudioStream;
+
// Source and target codecs must match
if (string.IsNullOrEmpty(audioStream.Codec) || !supportedAudioCodecs.Contains(audioStream.Codec, StringComparer.OrdinalIgnoreCase))
{
@@ -2030,7 +2023,6 @@ namespace MediaBrowser.Api.Playback
state.TargetPacketLength,
state.TargetTimestamp,
state.IsTargetAnamorphic,
- state.IsTargetCabac,
state.TargetRefFrames,
state.TargetVideoStreamCount,
state.TargetAudioStreamCount,
@@ -2056,6 +2048,7 @@ namespace MediaBrowser.Api.Playback
if (state.VideoRequest != null)
{
state.VideoRequest.CopyTimestamps = transcodingProfile.CopyTimestamps;
+ state.VideoRequest.ForceLiveStream = transcodingProfile.ForceLiveStream;
}
}
}
@@ -2133,7 +2126,6 @@ namespace MediaBrowser.Api.Playback
state.TargetPacketLength,
state.TranscodeSeekInfo,
state.IsTargetAnamorphic,
- state.IsTargetCabac,
state.TargetRefFrames,
state.TargetVideoStreamCount,
state.TargetAudioStreamCount,
@@ -2225,7 +2217,7 @@ namespace MediaBrowser.Api.Playback
inputModifier += " -noaccurate_seek";
}
}
-
+
return inputModifier;
}