aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs2
-rw-r--r--Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs19
-rw-r--r--MediaBrowser.Api/BaseApiService.cs4
-rw-r--r--MediaBrowser.Api/Images/ImageService.cs4
-rw-r--r--MediaBrowser.Api/TvShowsService.cs2
-rw-r--r--MediaBrowser.Api/UserService.cs8
-rw-r--r--MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs5
-rw-r--r--MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs24
-rw-r--r--MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs3
9 files changed, 34 insertions, 37 deletions
diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
index 666c1fdcd..5082f1b04 100644
--- a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
@@ -1765,7 +1765,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
if (regInfo.IsValid)
{
- return new EncodedRecorder(_logger, _fileSystem, _mediaEncoder, _config.ApplicationPaths, _jsonSerializer, config, _httpClient, _processFactory);
+ return new EncodedRecorder(_logger, _fileSystem, _mediaEncoder, _config.ApplicationPaths, _jsonSerializer, config, _httpClient, _processFactory, _config);
}
}
diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs
index 6cc5b6920..8ee3d71b5 100644
--- a/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs
+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs
@@ -11,14 +11,16 @@ using MediaBrowser.Model.IO;
using MediaBrowser.Common.IO;
using MediaBrowser.Common.Net;
using MediaBrowser.Controller;
-using MediaBrowser.Controller.IO;
+using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.MediaEncoding;
+using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Diagnostics;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.LiveTv;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Serialization;
+using MediaBrowser.Common.Configuration;
namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
@@ -37,8 +39,9 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
private readonly IProcessFactory _processFactory;
private readonly IJsonSerializer _json;
private readonly TaskCompletionSource<bool> _taskCompletionSource = new TaskCompletionSource<bool>();
+ private readonly IServerConfigurationManager _config;
- public EncodedRecorder(ILogger logger, IFileSystem fileSystem, IMediaEncoder mediaEncoder, IServerApplicationPaths appPaths, IJsonSerializer json, LiveTvOptions liveTvOptions, IHttpClient httpClient, IProcessFactory processFactory)
+ public EncodedRecorder(ILogger logger, IFileSystem fileSystem, IMediaEncoder mediaEncoder, IServerApplicationPaths appPaths, IJsonSerializer json, LiveTvOptions liveTvOptions, IHttpClient httpClient, IProcessFactory processFactory, IServerConfigurationManager config)
{
_logger = logger;
_fileSystem = fileSystem;
@@ -48,6 +51,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
_liveTvOptions = liveTvOptions;
_httpClient = httpClient;
_processFactory = processFactory;
+ _config = config;
}
private string OutputFormat
@@ -89,6 +93,11 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
_logger.Info("Recording completed to file {0}", targetFile);
}
+ private EncodingOptions GetEncodingOptions()
+ {
+ return _config.GetConfiguration<EncodingOptions>("encoding");
+ }
+
private Task RecordFromFile(MediaSourceInfo mediaSource, string inputFile, string targetFile, TimeSpan duration, Action onStarted, CancellationToken cancellationToken)
{
_targetPath = targetFile;
@@ -163,6 +172,12 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
var durationParam = " -t " + _mediaEncoder.GetTimeParameter(duration.Ticks);
var inputModifiers = "-fflags +genpts -async 1 -vsync -1";
+
+ if (!string.IsNullOrWhiteSpace(GetEncodingOptions().HardwareAccelerationType))
+ {
+ inputModifiers += " -hwaccel auto";
+ }
+
var commandLineArgs = "-i \"{0}\"{5} {2} -map_metadata -1 -threads 0 {3}{4}{6} -y \"{1}\"";
long startTimeTicks = 0;
diff --git a/MediaBrowser.Api/BaseApiService.cs b/MediaBrowser.Api/BaseApiService.cs
index 1f21a1dd1..a802e56af 100644
--- a/MediaBrowser.Api/BaseApiService.cs
+++ b/MediaBrowser.Api/BaseApiService.cs
@@ -66,7 +66,7 @@ namespace MediaBrowser.Api
return ResultFactory.GetOptimizedResult(Request, result);
}
- protected void AssertCanUpdateUser(IAuthorizationContext authContext, IUserManager userManager, string userId)
+ protected void AssertCanUpdateUser(IAuthorizationContext authContext, IUserManager userManager, string userId, bool restrictUserPreferences)
{
var auth = authContext.GetAuthorizationInfo(Request);
@@ -80,7 +80,7 @@ namespace MediaBrowser.Api
throw new SecurityException("Unauthorized access.");
}
}
- else
+ else if (restrictUserPreferences)
{
if (!authenticatedUser.Policy.EnableUserPreferenceAccess)
{
diff --git a/MediaBrowser.Api/Images/ImageService.cs b/MediaBrowser.Api/Images/ImageService.cs
index 392654aa2..9f144c8e4 100644
--- a/MediaBrowser.Api/Images/ImageService.cs
+++ b/MediaBrowser.Api/Images/ImageService.cs
@@ -427,7 +427,7 @@ namespace MediaBrowser.Api.Images
public void Post(PostUserImage request)
{
var userId = GetPathValue(1);
- AssertCanUpdateUser(_authContext, _userManager, userId);
+ AssertCanUpdateUser(_authContext, _userManager, userId, true);
request.Type = (ImageType)Enum.Parse(typeof(ImageType), GetPathValue(3), true);
@@ -462,7 +462,7 @@ namespace MediaBrowser.Api.Images
public void Delete(DeleteUserImage request)
{
var userId = request.Id;
- AssertCanUpdateUser(_authContext, _userManager, userId);
+ AssertCanUpdateUser(_authContext, _userManager, userId, true);
var item = _userManager.GetUserById(userId);
diff --git a/MediaBrowser.Api/TvShowsService.cs b/MediaBrowser.Api/TvShowsService.cs
index 126f1c753..bc2b08384 100644
--- a/MediaBrowser.Api/TvShowsService.cs
+++ b/MediaBrowser.Api/TvShowsService.cs
@@ -497,7 +497,7 @@ namespace MediaBrowser.Api
}
else
{
- episodes = series.GetSeasonEpisodes(season, user);
+ episodes = season.GetEpisodes(user);
}
}
else
diff --git a/MediaBrowser.Api/UserService.cs b/MediaBrowser.Api/UserService.cs
index fde03e1f2..49b7f6c15 100644
--- a/MediaBrowser.Api/UserService.cs
+++ b/MediaBrowser.Api/UserService.cs
@@ -444,7 +444,7 @@ namespace MediaBrowser.Api
public async Task PostAsync(UpdateUserPassword request)
{
- AssertCanUpdateUser(_authContext, _userManager, request.Id);
+ AssertCanUpdateUser(_authContext, _userManager, request.Id, true);
var user = _userManager.GetUserById(request.Id);
@@ -482,7 +482,7 @@ namespace MediaBrowser.Api
public async Task PostAsync(UpdateUserEasyPassword request)
{
- AssertCanUpdateUser(_authContext, _userManager, request.Id);
+ AssertCanUpdateUser(_authContext, _userManager, request.Id, true);
var user = _userManager.GetUserById(request.Id);
@@ -518,7 +518,7 @@ namespace MediaBrowser.Api
// https://code.google.com/p/servicestack/source/browse/trunk/Common/ServiceStack.Text/ServiceStack.Text/Controller/PathInfo.cs
var id = GetPathValue(1);
- AssertCanUpdateUser(_authContext, _userManager, id);
+ AssertCanUpdateUser(_authContext, _userManager, id, false);
var dtoUser = request;
@@ -568,7 +568,7 @@ namespace MediaBrowser.Api
public void Post(UpdateUserConfiguration request)
{
- AssertCanUpdateUser(_authContext, _userManager, request.Id);
+ AssertCanUpdateUser(_authContext, _userManager, request.Id, false);
var task = _userManager.UpdateConfiguration(request.Id, request);
diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs
index 22d09f34a..d6e4a61e4 100644
--- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs
+++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs
@@ -1725,6 +1725,11 @@ namespace MediaBrowser.Controller.MediaEncoding
if (state.VideoStream != null && !string.IsNullOrWhiteSpace(state.VideoStream.Codec))
{
+ if (!string.IsNullOrWhiteSpace(encodingOptions.HardwareAccelerationType))
+ {
+ return "-hwaccel auto";
+ }
+
if (string.Equals(encodingOptions.HardwareAccelerationType, "qsv", StringComparison.OrdinalIgnoreCase))
{
switch (state.MediaSource.VideoStream.Codec.ToLower())
diff --git a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs
index 816f14f82..130afa3e3 100644
--- a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs
+++ b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs
@@ -49,11 +49,6 @@ namespace MediaBrowser.MediaEncoding.Encoder
/// </summary>
private readonly SemaphoreSlim _thumbnailResourcePool = new SemaphoreSlim(1, 1);
- /// <summary>
- /// The FF probe resource pool
- /// </summary>
- private readonly SemaphoreSlim _ffProbeResourcePool = new SemaphoreSlim(2, 2);
-
public string FFMpegPath { get; private set; }
public string FFProbePath { get; private set; }
@@ -591,20 +586,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
using (var processWrapper = new ProcessWrapper(process, this, _logger))
{
- await _ffProbeResourcePool.WaitAsync(cancellationToken).ConfigureAwait(false);
-
- try
- {
- StartProcess(processWrapper);
- }
- catch (Exception ex)
- {
- _ffProbeResourcePool.Release();
-
- _logger.ErrorException("Error starting ffprobe", ex);
-
- throw;
- }
+ StartProcess(processWrapper);
try
{
@@ -655,10 +637,6 @@ namespace MediaBrowser.MediaEncoding.Encoder
throw;
}
- finally
- {
- _ffProbeResourcePool.Release();
- }
}
}
diff --git a/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs b/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs
index 231a2ae85..3f2ecae31 100644
--- a/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs
+++ b/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs
@@ -524,8 +524,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
{
if (!_fileSystem.FileExists(outputPath))
{
- await ExtractTextSubtitleInternal(_mediaEncoder.GetInputArgument(inputFiles, protocol), subtitleStreamIndex,
- outputCodec, outputPath, cancellationToken).ConfigureAwait(false);
+ await ExtractTextSubtitleInternal(_mediaEncoder.GetInputArgument(inputFiles, protocol), subtitleStreamIndex, outputCodec, outputPath, cancellationToken).ConfigureAwait(false);
}
}
finally