2
0
Эх сурвалжийг харах

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>
nyanmisaka 3 жил өмнө
parent
commit
b2d85a02c2

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 216 - 232
MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs


+ 1 - 17
MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs

@@ -110,23 +110,7 @@ namespace MediaBrowser.Controller.MediaEncoding
 
         public string OutputContainer { get; set; }
 
-        public string OutputVideoSync
-        {
-            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 OutputVideoSync { get; set; }
 
         public string AlbumCoverPath { get; set; }
 

+ 24 - 24
MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs

@@ -25,6 +25,30 @@ namespace MediaBrowser.Controller.MediaEncoding
         /// <value>The encoder path.</value>
         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>
         /// Whether given encoder codec is supported.
         /// </summary>
@@ -60,30 +84,6 @@ namespace MediaBrowser.Controller.MediaEncoding
         /// <returns><c>true</c> if the filter is supported, <c>false</c> otherwise.</returns>
         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>
         /// Extracts the audio image.
         /// </summary>

+ 2 - 4
MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs

@@ -351,18 +351,16 @@ namespace MediaBrowser.MediaEncoding.Encoder
                 return false;
             }
 
-            string output;
             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)
             {
                 _logger.LogError(ex, "Error detecting the given vaapi render node path");
                 return false;
             }
-
-            return output.Contains(driverName, StringComparison.Ordinal);
         }
 
         private IEnumerable<string> GetHwaccelTypes()

+ 4 - 21
MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs

@@ -91,6 +91,10 @@ namespace MediaBrowser.MediaEncoding.Encoder
 
         /// <inheritdoc />
         public string EncoderPath => _ffmpegPath;
+        public Version EncoderVersion => _ffmpegVersion;
+        public bool IsVaapiDeviceAmd => _isVaapiDeviceAmd;
+        public bool IsVaapiDeviceInteliHD => _isVaapiDeviceInteliHD;
+        public bool IsVaapiDeviceInteli965 => _isVaapiDeviceInteli965;
 
         /// <summary>
         /// 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());
                 SetMediaEncoderVersion(validator);
 
-                options = _configurationManager.GetEncodingOptions();
                 _threads = EncodingHelper.GetNumberOfThreads(null, options, null);
 
                 // Check the Vaapi device vendor
@@ -329,26 +332,6 @@ namespace MediaBrowser.MediaEncoding.Encoder
             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)
         {
             if (string.Equals(codec, "opus", StringComparison.OrdinalIgnoreCase))

+ 2 - 2
MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs

@@ -772,12 +772,12 @@ namespace MediaBrowser.MediaEncoding.Probing
                             stream.BitDepth = 8;
                         }
                         else if (string.Equals(streamInfo.PixelFormat, "yuv420p10le", StringComparison.OrdinalIgnoreCase)
-                            || string.Equals(streamInfo.PixelFormat, "yuv444p10le", StringComparison.OrdinalIgnoreCase))
+                                 || string.Equals(streamInfo.PixelFormat, "yuv444p10le", StringComparison.OrdinalIgnoreCase))
                         {
                             stream.BitDepth = 10;
                         }
                         else if (string.Equals(streamInfo.PixelFormat, "yuv420p12le", StringComparison.OrdinalIgnoreCase)
-                            || string.Equals(streamInfo.PixelFormat, "yuv444p12le", StringComparison.OrdinalIgnoreCase))
+                                 || string.Equals(streamInfo.PixelFormat, "yuv444p12le", StringComparison.OrdinalIgnoreCase))
                         {
                             stream.BitDepth = 12;
                         }

+ 1 - 1
MediaBrowser.Model/Configuration/EncodingOptions.cs

@@ -18,7 +18,7 @@ namespace MediaBrowser.Model.Configuration
             VaapiDevice = "/dev/dri/renderD128";
             EnableTonemapping = false;
             EnableVppTonemapping = false;
-            TonemappingAlgorithm = "hable";
+            TonemappingAlgorithm = "bt2390";
             TonemappingRange = "auto";
             TonemappingDesat = 0;
             TonemappingThreshold = 0.8;

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно