diff options
| author | tikuf <admin@nyalindee.com> | 2014-04-16 10:14:20 +1000 |
|---|---|---|
| committer | tikuf <admin@nyalindee.com> | 2014-04-16 10:14:20 +1000 |
| commit | 13196544c2ca525068e34d23bd98da551943bbca (patch) | |
| tree | ad9894c55a3f3078c15b7622f424b950524b4e2b /MediaBrowser.Api/Playback/BaseStreamingService.cs | |
| parent | f9eede391b2de2ce80e75d8345aade14f70f1b9d (diff) | |
| parent | ab5f8ed13679dbe1763cafc599a8f566a36a4a14 (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.cs | 44 |
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) |
