aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.MediaEncoding/Encoder
diff options
context:
space:
mode:
authorBond-009 <bond.009@outlook.com>2019-01-16 19:10:42 +0100
committerGitHub <noreply@github.com>2019-01-16 19:10:42 +0100
commit900dc851e6c810f9e1772a6fb901a5a7e2801baf (patch)
tree205bac3cd6df971ee18739e59bd4da0ffe91718b /MediaBrowser.MediaEncoding/Encoder
parent07a8e49c4b1e4a2dddbaa49ab6f1ff4f271fbf20 (diff)
parent933ef438894ed233fec46badf58dd4f26492e832 (diff)
Merge branch 'dev' into cleanup
Diffstat (limited to 'MediaBrowser.MediaEncoding/Encoder')
-rw-r--r--MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs10
-rw-r--r--MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs2
-rw-r--r--MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs4
-rw-r--r--MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs49
4 files changed, 16 insertions, 49 deletions
diff --git a/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs b/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs
index b68961889..578e9f264 100644
--- a/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs
+++ b/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs
@@ -51,7 +51,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
return false;
}
- _logger.LogInformation("ffmpeg info: {0}", output);
+ _logger.LogDebug("ffmpeg output: {Output}", output);
if (output.IndexOf("Libav developers", StringComparison.OrdinalIgnoreCase) != -1)
{
@@ -160,10 +160,12 @@ namespace MediaBrowser.MediaEncoding.Encoder
Arguments = arguments,
IsHidden = true,
ErrorDialog = false,
- RedirectStandardOutput = true
+ RedirectStandardOutput = true,
+ // ffmpeg uses stderr to log info, don't show this
+ RedirectStandardError = true
});
- _logger.LogInformation("Running {Path} {Arguments}", path, arguments);
+ _logger.LogDebug("Running {Path} {Arguments}", path, arguments);
using (process)
{
@@ -175,7 +177,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
}
catch
{
- _logger.LogInformation("Killing process {path} {arguments}", path, arguments);
+ _logger.LogWarning("Killing process {Path} {Arguments}", path, arguments);
// Hate having to do this
try
diff --git a/MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs b/MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs
index 9761de98f..1edc5c201 100644
--- a/MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs
+++ b/MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs
@@ -46,7 +46,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
private readonly ILogger _logger;
private readonly IMediaSourceManager _mediaSourceManager;
- public EncodingJob(ILogger logger, IMediaSourceManager mediaSourceManager) :
+ public EncodingJob(ILogger logger, IMediaSourceManager mediaSourceManager) :
base(logger, mediaSourceManager, TranscodingJobType.Progressive)
{
_logger = logger;
diff --git a/MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs b/MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs
index 4e6ee89e1..34bc8d1b9 100644
--- a/MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs
+++ b/MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs
@@ -25,7 +25,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
private readonly IMediaEncoder _mediaEncoder;
protected static readonly CultureInfo UsCulture = new CultureInfo("en-US");
-
+
public EncodingJobFactory(ILogger logger, ILibraryManager libraryManager, IMediaSourceManager mediaSourceManager, IConfigurationManager config, IMediaEncoder mediaEncoder)
{
_logger = logger;
@@ -255,7 +255,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
if (profile == null)
{
- // Don't use settings from the default profile.
+ // Don't use settings from the default profile.
// Only use a specific profile if it was requested.
return;
}
diff --git a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs
index a93dd9742..b19271d11 100644
--- a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs
+++ b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs
@@ -70,7 +70,6 @@ namespace MediaBrowser.MediaEncoding.Encoder
private readonly string _originalFFMpegPath;
private readonly string _originalFFProbePath;
private readonly int DefaultImageExtractionTimeoutMs;
- private readonly IEnvironmentInfo _environmentInfo;
public MediaEncoder(ILogger logger,
IJsonSerializer jsonSerializer,
@@ -89,8 +88,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
IHttpClient httpClient,
IZipClient zipClient,
IProcessFactory processFactory,
- int defaultImageExtractionTimeoutMs,
- IEnvironmentInfo environmentInfo)
+ int defaultImageExtractionTimeoutMs)
{
_logger = logger;
_jsonSerializer = jsonSerializer;
@@ -107,46 +105,13 @@ namespace MediaBrowser.MediaEncoding.Encoder
_zipClient = zipClient;
_processFactory = processFactory;
DefaultImageExtractionTimeoutMs = defaultImageExtractionTimeoutMs;
- _environmentInfo = environmentInfo;
FFProbePath = ffProbePath;
FFMpegPath = ffMpegPath;
_originalFFProbePath = ffProbePath;
_originalFFMpegPath = ffMpegPath;
-
_hasExternalEncoder = hasExternalEncoder;
}
- private readonly object _logLock = new object();
- public void SetLogFilename(string name)
- {
- lock (_logLock)
- {
- try
- {
- _environmentInfo.SetProcessEnvironmentVariable("FFREPORT", "file=" + name + ":level=32");
- }
- catch (Exception ex)
- {
- _logger.LogError(ex, "Error setting FFREPORT environment variable");
- }
- }
- }
-
- public void ClearLogFilename()
- {
- lock (_logLock)
- {
- try
- {
- _environmentInfo.SetProcessEnvironmentVariable("FFREPORT", null);
- }
- catch (Exception ex)
- {
- _logger.LogError(ex, "Error setting FFREPORT environment variable");
- }
- }
- }
-
public string EncoderLocationType
{
get
@@ -246,7 +211,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
{
if (string.IsNullOrWhiteSpace(path))
{
- throw new ArgumentNullException("path");
+ throw new ArgumentNullException(nameof(path));
}
if (!FileSystem.FileExists(path) && !FileSystem.DirectoryExists(path))
@@ -362,7 +327,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
private Tuple<string, string> GetPathsFromDirectory(string path)
{
- // Since we can't predict the file extension, first try directly within the folder
+ // Since we can't predict the file extension, first try directly within the folder
// If that doesn't pan out, then do a recursive search
var files = FileSystem.GetFilePaths(path);
@@ -525,7 +490,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
CreateNoWindow = true,
UseShellExecute = false,
- // Must consume both or ffmpeg may hang due to deadlocks. See comments below.
+ // Must consume both or ffmpeg may hang due to deadlocks. See comments below.
RedirectStandardOutput = true,
FileName = FFProbePath,
Arguments = string.Format(args, probeSizeArgument, inputPath).Trim(),
@@ -642,13 +607,13 @@ namespace MediaBrowser.MediaEncoding.Encoder
{
if (string.IsNullOrEmpty(inputPath))
{
- throw new ArgumentNullException("inputPath");
+ throw new ArgumentNullException(nameof(inputPath));
}
var tempExtractPath = Path.Combine(ConfigurationManager.ApplicationPaths.TempDirectory, Guid.NewGuid() + ".jpg");
FileSystem.CreateDirectory(FileSystem.GetDirectoryName(tempExtractPath));
- // apply some filters to thumbnail extracted below (below) crop any black lines that we made and get the correct ar then scale to width 600.
+ // apply some filters to thumbnail extracted below (below) crop any black lines that we made and get the correct ar then scale to width 600.
// This filter chain may have adverse effects on recorded tv thumbnails if ar changes during presentation ex. commercials @ diff ar
var vf = "scale=600:trunc(600/dar/2)*2";
@@ -676,7 +641,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
break;
}
}
-
+
var mapArg = imageStreamIndex.HasValue ? (" -map 0:v:" + imageStreamIndex.Value.ToString(CultureInfo.InvariantCulture)) : string.Empty;
var enableThumbnail = !new List<string> { "wtv" }.Contains(container ?? string.Empty, StringComparer.OrdinalIgnoreCase);