Apply suggestions from code review
Co-authored-by: Cody Robibero <cody@robibe.ro> Co-authored-by: Claus Vium <cvium@users.noreply.github.com> Co-authored-by: Bond_009 <bond.009@outlook.com>
This commit is contained in:
parent
4b9c84c52e
commit
b2d85a02c2
File diff suppressed because it is too large
Load Diff
|
@ -110,23 +110,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||||
|
|
||||||
public string OutputContainer { get; set; }
|
public string OutputContainer { get; set; }
|
||||||
|
|
||||||
public string OutputVideoSync
|
public string OutputVideoSync { get; set; }
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
// For live tv + in progress recordings
|
|
||||||
if (string.Equals(InputContainer, "mpegts", StringComparison.OrdinalIgnoreCase)
|
|
||||||
|| string.Equals(InputContainer, "ts", StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
if (!MediaSource.RunTimeTicks.HasValue)
|
|
||||||
{
|
|
||||||
return "cfr";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return "-1";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string AlbumCoverPath { get; set; }
|
public string AlbumCoverPath { get; set; }
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,30 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||||
/// <value>The encoder path.</value>
|
/// <value>The encoder path.</value>
|
||||||
string EncoderPath { get; }
|
string EncoderPath { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the version of encoder.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The version of encoder.</returns>
|
||||||
|
Version EncoderVersion { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether the configured Vaapi device is from AMD(radeonsi/r600 Mesa driver).
|
||||||
|
/// </summary>
|
||||||
|
/// <value><c>true</c> if the Vaapi device is an AMD(radeonsi/r600 Mesa driver) GPU, <c>false</c> otherwise.</value>
|
||||||
|
bool IsVaapiDeviceAmd { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether the configured Vaapi device is from Intel(iHD driver).
|
||||||
|
/// </summary>
|
||||||
|
/// <value><c>true</c> if the Vaapi device is an Intel(iHD driver) GPU, <c>false</c> otherwise.</value>
|
||||||
|
bool IsVaapiDeviceInteliHD { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether the configured Vaapi device is from Intel(legacy i965 driver).
|
||||||
|
/// </summary>
|
||||||
|
/// <value><c>true</c> if the Vaapi device is an Intel(legacy i965 driver) GPU, <c>false</c> otherwise.</value>
|
||||||
|
bool IsVaapiDeviceInteli965 { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether given encoder codec is supported.
|
/// Whether given encoder codec is supported.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -60,30 +84,6 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||||
/// <returns><c>true</c> if the filter is supported, <c>false</c> otherwise.</returns>
|
/// <returns><c>true</c> if the filter is supported, <c>false</c> otherwise.</returns>
|
||||||
bool SupportsFilterWithOption(FilterOptionType option);
|
bool SupportsFilterWithOption(FilterOptionType option);
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Whether the configured Vaapi device is from AMD(radeonsi/r600 Mesa driver).
|
|
||||||
/// </summary>
|
|
||||||
/// <returns><c>true</c> if the Vaapi device is an AMD(radeonsi/r600 Mesa driver) GPU, <c>false</c> otherwise.</returns>
|
|
||||||
bool IsVaapiDeviceAmd();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Whether the configured Vaapi device is from Intel(iHD driver).
|
|
||||||
/// </summary>
|
|
||||||
/// <returns><c>true</c> if the Vaapi device is an Intel(iHD driver) GPU, <c>false</c> otherwise.</returns>
|
|
||||||
bool IsVaapiDeviceInteliHD();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Whether the configured Vaapi device is from Intel(legacy i965 driver).
|
|
||||||
/// </summary>
|
|
||||||
/// <returns><c>true</c> if the Vaapi device is an Intel(legacy i965 driver) GPU, <c>false</c> otherwise.</returns>
|
|
||||||
bool IsVaapiDeviceInteli965();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get the version of media encoder.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>The version of media encoder.</returns>
|
|
||||||
Version GetMediaEncoderVersion();
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Extracts the audio image.
|
/// Extracts the audio image.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -351,18 +351,16 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
string output;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
output = GetProcessOutput(_encoderPath, "-v verbose -hide_banner -init_hw_device vaapi=va:" + renderNodePath, true);
|
var output = GetProcessOutput(_encoderPath, "-v verbose -hide_banner -init_hw_device vaapi=va:" + renderNodePath, true);
|
||||||
|
return output.Contains(driverName, StringComparison.Ordinal);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Error detecting the given vaapi render node path");
|
_logger.LogError(ex, "Error detecting the given vaapi render node path");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return output.Contains(driverName, StringComparison.Ordinal);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<string> GetHwaccelTypes()
|
private IEnumerable<string> GetHwaccelTypes()
|
||||||
|
|
|
@ -91,6 +91,10 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public string EncoderPath => _ffmpegPath;
|
public string EncoderPath => _ffmpegPath;
|
||||||
|
public Version EncoderVersion => _ffmpegVersion;
|
||||||
|
public bool IsVaapiDeviceAmd => _isVaapiDeviceAmd;
|
||||||
|
public bool IsVaapiDeviceInteliHD => _isVaapiDeviceInteliHD;
|
||||||
|
public bool IsVaapiDeviceInteli965 => _isVaapiDeviceInteli965;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Run at startup or if the user removes a Custom path from transcode page.
|
/// Run at startup or if the user removes a Custom path from transcode page.
|
||||||
|
@ -138,7 +142,6 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||||
SetAvailableHwaccels(validator.GetHwaccels());
|
SetAvailableHwaccels(validator.GetHwaccels());
|
||||||
SetMediaEncoderVersion(validator);
|
SetMediaEncoderVersion(validator);
|
||||||
|
|
||||||
options = _configurationManager.GetEncodingOptions();
|
|
||||||
_threads = EncodingHelper.GetNumberOfThreads(null, options, null);
|
_threads = EncodingHelper.GetNumberOfThreads(null, options, null);
|
||||||
|
|
||||||
// Check the Vaapi device vendor
|
// Check the Vaapi device vendor
|
||||||
|
@ -329,26 +332,6 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsVaapiDeviceAmd()
|
|
||||||
{
|
|
||||||
return _isVaapiDeviceAmd;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsVaapiDeviceInteliHD()
|
|
||||||
{
|
|
||||||
return _isVaapiDeviceInteliHD;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsVaapiDeviceInteli965()
|
|
||||||
{
|
|
||||||
return _isVaapiDeviceInteli965;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Version GetMediaEncoderVersion()
|
|
||||||
{
|
|
||||||
return _ffmpegVersion;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool CanEncodeToAudioCodec(string codec)
|
public bool CanEncodeToAudioCodec(string codec)
|
||||||
{
|
{
|
||||||
if (string.Equals(codec, "opus", StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(codec, "opus", StringComparison.OrdinalIgnoreCase))
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace MediaBrowser.Model.Configuration
|
||||||
VaapiDevice = "/dev/dri/renderD128";
|
VaapiDevice = "/dev/dri/renderD128";
|
||||||
EnableTonemapping = false;
|
EnableTonemapping = false;
|
||||||
EnableVppTonemapping = false;
|
EnableVppTonemapping = false;
|
||||||
TonemappingAlgorithm = "hable";
|
TonemappingAlgorithm = "bt2390";
|
||||||
TonemappingRange = "auto";
|
TonemappingRange = "auto";
|
||||||
TonemappingDesat = 0;
|
TonemappingDesat = 0;
|
||||||
TonemappingThreshold = 0.8;
|
TonemappingThreshold = 0.8;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user