diff options
Diffstat (limited to 'MediaBrowser.Api')
| -rw-r--r-- | MediaBrowser.Api/Playback/BaseStreamingService.cs | 23 | ||||
| -rw-r--r-- | MediaBrowser.Api/UserService.cs | 50 |
2 files changed, 28 insertions, 45 deletions
diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs index 9d54458a6e..b77c6fd015 100644 --- a/MediaBrowser.Api/Playback/BaseStreamingService.cs +++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs @@ -806,6 +806,8 @@ namespace MediaBrowser.Api.Playback if (string.IsNullOrEmpty(state.MediaPath)) { + var checkCodecs = false; + if (string.Equals(state.ItemType, typeof(LiveTvChannel).Name)) { var streamInfo = await LiveTvManager.GetChannelStream(state.Request.Id, cancellationTokenSource.Token).ConfigureAwait(false); @@ -824,6 +826,9 @@ namespace MediaBrowser.Api.Playback state.MediaPath = streamInfo.Url; state.InputProtocol = MediaProtocol.Http; } + + AttachMediaStreamInfo(state, streamInfo.MediaStreams, state.VideoRequest, state.RequestedUrl); + checkCodecs = true; } else if (string.Equals(state.ItemType, typeof(LiveTvVideoRecording).Name) || @@ -845,6 +850,24 @@ namespace MediaBrowser.Api.Playback state.MediaPath = streamInfo.Url; state.InputProtocol = MediaProtocol.Http; } + + AttachMediaStreamInfo(state, streamInfo.MediaStreams, state.VideoRequest, state.RequestedUrl); + checkCodecs = true; + } + + var videoRequest = state.VideoRequest; + + if (videoRequest != null && checkCodecs) + { + if (state.VideoStream != null && CanStreamCopyVideo(videoRequest, state.VideoStream)) + { + state.OutputVideoCodec = "copy"; + } + + if (state.AudioStream != null && CanStreamCopyAudio(videoRequest, state.AudioStream, state.SupportedAudioCodecs)) + { + state.OutputAudioCodec = "copy"; + } } } } diff --git a/MediaBrowser.Api/UserService.cs b/MediaBrowser.Api/UserService.cs index 4ffe5b3911..6fe428274a 100644 --- a/MediaBrowser.Api/UserService.cs +++ b/MediaBrowser.Api/UserService.cs @@ -225,46 +225,6 @@ namespace MediaBrowser.Api //return ToOptimizedResult(new List<UserDto>()); } - private bool IsInLocalNetwork(string remoteEndpoint) - { - if (string.IsNullOrWhiteSpace(remoteEndpoint)) - { - throw new ArgumentNullException("remoteEndpoint"); - } - - IPAddress address; - if (!IPAddress.TryParse(remoteEndpoint, out address)) - { - return true; - } - - const int lengthMatch = 4; - - if (remoteEndpoint.Length >= lengthMatch) - { - var prefix = remoteEndpoint.Substring(0, lengthMatch); - - if (_networkManager.GetLocalIpAddresses() - .Any(i => i.StartsWith(prefix, StringComparison.OrdinalIgnoreCase))) - { - return true; - } - } - - // Private address space: - // http://en.wikipedia.org/wiki/Private_network - - return - - // If url was requested with computer name, we may see this - remoteEndpoint.IndexOf("::", StringComparison.OrdinalIgnoreCase) != -1 || - - remoteEndpoint.StartsWith("10.", StringComparison.OrdinalIgnoreCase) || - remoteEndpoint.StartsWith("192.", StringComparison.OrdinalIgnoreCase) || - remoteEndpoint.StartsWith("172.", StringComparison.OrdinalIgnoreCase) || - remoteEndpoint.StartsWith("169.", StringComparison.OrdinalIgnoreCase); - } - /// <summary> /// Gets the specified request. /// </summary> @@ -283,10 +243,10 @@ namespace MediaBrowser.Api { users = users.Where(i => i.Configuration.IsHidden == request.IsHidden.Value); } - + var result = users .OrderBy(u => u.Name) - .Select(_dtoService.GetUserDto) + .Select(i => _userManager.GetUserDto(i, Request.RemoteIp)) .ToList(); return ToOptimizedSerializedResultUsingCache(result); @@ -306,7 +266,7 @@ namespace MediaBrowser.Api throw new ResourceNotFoundException("User not found"); } - var result = _dtoService.GetUserDto(user); + var result = _userManager.GetUserDto(user, Request.RemoteIp); return ToOptimizedSerializedResultUsingCache(result); } @@ -410,7 +370,7 @@ namespace MediaBrowser.Api } else { - var success = _userManager.AuthenticateUser(user.Name, request.CurrentPassword).Result; + var success = _userManager.AuthenticateUser(user.Name, request.CurrentPassword, Request.RemoteIp).Result; if (!success) { @@ -488,7 +448,7 @@ namespace MediaBrowser.Api newUser.UpdateConfiguration(dtoUser.Configuration); - var result = _dtoService.GetUserDto(newUser); + var result = _userManager.GetUserDto(newUser, Request.RemoteIp); return ToOptimizedResult(result); } |
