From be21d51742f3bd85f5401c925791148bdc4b0cbf Mon Sep 17 00:00:00 2001 From: gnattu Date: Thu, 28 Mar 2024 23:26:01 +0800 Subject: [PATCH] fix: move trickplay specific option into TrickplayOptions (#11229) --- .../Trickplay/TrickplayManager.cs | 1 + MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs | 2 ++ MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs | 3 ++- MediaBrowser.Model/Configuration/EncodingOptions.cs | 6 ------ MediaBrowser.Model/Configuration/TrickplayOptions.cs | 5 +++++ 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Jellyfin.Server.Implementations/Trickplay/TrickplayManager.cs b/Jellyfin.Server.Implementations/Trickplay/TrickplayManager.cs index 095bc9ed30..fed5dab696 100644 --- a/Jellyfin.Server.Implementations/Trickplay/TrickplayManager.cs +++ b/Jellyfin.Server.Implementations/Trickplay/TrickplayManager.cs @@ -141,6 +141,7 @@ public class TrickplayManager : ITrickplayManager width, TimeSpan.FromMilliseconds(options.Interval), options.EnableHwAcceleration, + options.EnableHwEncoding, options.ProcessThreads, options.Qscale, options.ProcessPriority, diff --git a/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs b/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs index c2cef4978f..e696fa52ce 100644 --- a/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs +++ b/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs @@ -149,6 +149,7 @@ namespace MediaBrowser.Controller.MediaEncoding /// The maximum width. /// The interval. /// Allow for hardware acceleration. + /// Use hardware mjpeg encoder. /// The input/output thread count for ffmpeg. /// The qscale value for ffmpeg. /// The process priority for the ffmpeg process. @@ -163,6 +164,7 @@ namespace MediaBrowser.Controller.MediaEncoding int maxWidth, TimeSpan interval, bool allowHwAccel, + bool enableHwEncoding, int? threads, int? qualityScale, ProcessPriorityClass? priority, diff --git a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs index 3df4442056..6c43315a87 100644 --- a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs +++ b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs @@ -800,6 +800,7 @@ namespace MediaBrowser.MediaEncoding.Encoder int maxWidth, TimeSpan interval, bool allowHwAccel, + bool enableHwEncoding, int? threads, int? qualityScale, ProcessPriorityClass? priority, @@ -828,7 +829,7 @@ namespace MediaBrowser.MediaEncoding.Encoder MediaPath = inputFile, OutputVideoCodec = "mjpeg" }; - var vidEncoder = options.AllowMjpegEncoding ? encodingHelper.GetVideoEncoder(jobState, options) : jobState.OutputVideoCodec; + var vidEncoder = enableHwEncoding ? encodingHelper.GetVideoEncoder(jobState, options) : jobState.OutputVideoCodec; // Get input and filter arguments var inputArg = encodingHelper.GetInputArgument(jobState, options, container).Trim(); diff --git a/MediaBrowser.Model/Configuration/EncodingOptions.cs b/MediaBrowser.Model/Configuration/EncodingOptions.cs index ab6f0d867c..9a192f584d 100644 --- a/MediaBrowser.Model/Configuration/EncodingOptions.cs +++ b/MediaBrowser.Model/Configuration/EncodingOptions.cs @@ -51,7 +51,6 @@ public class EncodingOptions EnableHardwareEncoding = true; AllowHevcEncoding = false; AllowAv1Encoding = false; - AllowMjpegEncoding = false; EnableSubtitleExtraction = true; AllowOnDemandMetadataBasedKeyframeExtractionForExtensions = new[] { "mkv" }; HardwareDecodingCodecs = new string[] { "h264", "vc1" }; @@ -262,11 +261,6 @@ public class EncodingOptions /// public bool AllowAv1Encoding { get; set; } - /// - /// Gets or sets a value indicating whether MJPEG encoding is enabled. - /// - public bool AllowMjpegEncoding { get; set; } - /// /// Gets or sets a value indicating whether subtitle extraction is enabled. /// diff --git a/MediaBrowser.Model/Configuration/TrickplayOptions.cs b/MediaBrowser.Model/Configuration/TrickplayOptions.cs index 92c16ee84f..a151d3429b 100644 --- a/MediaBrowser.Model/Configuration/TrickplayOptions.cs +++ b/MediaBrowser.Model/Configuration/TrickplayOptions.cs @@ -13,6 +13,11 @@ public class TrickplayOptions /// public bool EnableHwAcceleration { get; set; } = false; + /// + /// Gets or sets a value indicating whether or not to use HW accelerated MJPEG encoding. + /// + public bool EnableHwEncoding { get; set; } = false; + /// /// Gets or sets the behavior used by trickplay provider on library scan/update. ///