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.cs44
1 files changed, 18 insertions, 26 deletions
diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs
index bb55b893a..e588068d0 100644
--- a/MediaBrowser.Api/Playback/BaseStreamingService.cs
+++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs
@@ -185,9 +185,9 @@ namespace MediaBrowser.Api.Playback
{
var args = string.Empty;
- if (state.IsRemote || !state.HasMediaStreams)
+ if (!state.HasMediaStreams)
{
- return string.Empty;
+ return state.IsInputVideo ? "-sn" : string.Empty;
}
if (state.VideoStream != null)
@@ -1341,6 +1341,12 @@ namespace MediaBrowser.Api.Playback
RequestedUrl = url
};
+ if (!string.IsNullOrWhiteSpace(request.AudioCodec))
+ {
+ state.SupportedAudioCodecs = request.AudioCodec.Split(',').Where(i => !string.IsNullOrWhiteSpace(i)).ToList();
+ state.Request.AudioCodec = state.SupportedAudioCodecs.FirstOrDefault();
+ }
+
var item = string.IsNullOrEmpty(request.MediaSourceId) ?
DtoService.GetItemByDtoId(request.Id) :
DtoService.GetItemByDtoId(request.MediaSourceId);
@@ -1487,33 +1493,27 @@ namespace MediaBrowser.Api.Playback
if (videoRequest != null)
{
- if (state.VideoStream != null && CanStreamCopyVideo(videoRequest, state.VideoStream, state.VideoType))
+ if (state.VideoStream != null && CanStreamCopyVideo(videoRequest, state.VideoStream))
{
videoRequest.VideoCodec = "copy";
}
- //if (state.AudioStream != null && CanStreamCopyAudio(request, state.AudioStream))
- //{
- // request.AudioCodec = "copy";
- //}
+ if (state.AudioStream != null && CanStreamCopyAudio(request, state.AudioStream, state.SupportedAudioCodecs))
+ {
+ request.AudioCodec = "copy";
+ }
}
return state;
}
- private bool CanStreamCopyVideo(VideoStreamRequest request, MediaStream videoStream, VideoType videoType)
+ private bool CanStreamCopyVideo(VideoStreamRequest request, MediaStream videoStream)
{
if (videoStream.IsInterlaced)
{
return false;
}
- // Not going to attempt this with folder rips
- if (videoType != VideoType.VideoFile)
- {
- return false;
- }
-
// Source and target codecs must match
if (!string.Equals(request.VideoCodec, videoStream.Codec, StringComparison.OrdinalIgnoreCase))
{
@@ -1584,13 +1584,13 @@ namespace MediaBrowser.Api.Playback
}
}
- return SupportsAutomaticVideoStreamCopy;
+ return request.EnableAutoStreamCopy;
}
- private bool CanStreamCopyAudio(StreamRequest request, MediaStream audioStream)
+ private bool CanStreamCopyAudio(StreamRequest request, MediaStream audioStream, List<string> supportedAudioCodecs)
{
// Source and target codecs must match
- if (string.IsNullOrEmpty(request.AudioCodec) || !string.Equals(request.AudioCodec, audioStream.Codec, StringComparison.OrdinalIgnoreCase))
+ if (string.IsNullOrEmpty(audioStream.Codec) || !supportedAudioCodecs.Contains(audioStream.Codec, StringComparer.OrdinalIgnoreCase))
{
return false;
}
@@ -1623,15 +1623,7 @@ namespace MediaBrowser.Api.Playback
}
}
- return SupportsAutomaticVideoStreamCopy;
- }
-
- protected virtual bool SupportsAutomaticVideoStreamCopy
- {
- get
- {
- return false;
- }
+ return true;
}
private void ApplyDeviceProfileSettings(StreamState state)