From 6c649a7e723454e94303d95d178e91b820ba6b50 Mon Sep 17 00:00:00 2001 From: nicknsy <20588554+nicknsy@users.noreply.github.com> Date: Thu, 23 Feb 2023 17:58:34 -0800 Subject: [PATCH] Options --- .../Encoder/MediaEncoder.cs | 6 +- .../Configuration/TrickplayOptions.cs | 61 +++++++++++++++++++ .../Configuration/TrickplayScanBehavior.cs | 18 ++++++ 3 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 MediaBrowser.Model/Configuration/TrickplayOptions.cs create mode 100644 MediaBrowser.Model/Configuration/TrickplayScanBehavior.cs diff --git a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs index 7f8ec03fac..9b58f83b48 100644 --- a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs +++ b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs @@ -853,10 +853,14 @@ namespace MediaBrowser.MediaEncoding.Encoder { filterParam = "-vf \"" + fps + "\""; } - else + else if (filterParam.IndexOf("\"", StringComparison.Ordinal) != -1) { filterParam = filterParam.Insert(filterParam.IndexOf("\"", StringComparison.Ordinal) + 1, fps + ","); } + else + { + filterParam += fps + ","; + } var targetDirectory = Path.Combine(_configurationManager.ApplicationPaths.TempDirectory, Guid.NewGuid().ToString("N")); Directory.CreateDirectory(targetDirectory); diff --git a/MediaBrowser.Model/Configuration/TrickplayOptions.cs b/MediaBrowser.Model/Configuration/TrickplayOptions.cs new file mode 100644 index 0000000000..d527baaa46 --- /dev/null +++ b/MediaBrowser.Model/Configuration/TrickplayOptions.cs @@ -0,0 +1,61 @@ +using System.Collections.Generic; +using System.Diagnostics; + +namespace MediaBrowser.Model.Configuration +{ + /// + /// Class TrickplayOptions. + /// + public class TrickplayOptions + { + /// + /// Gets or sets a value indicating whether or not to use HW acceleration. + /// + public bool EnableHwAcceleration { get; set; } = false; + + /// + /// Gets or sets the behavior used by trickplay provider on library scan/update. + /// + public TrickplayScanBehavior ScanBehavior { get; set; } = TrickplayScanBehavior.NonBlocking; + + /// + /// Gets or sets the process priority for the ffmpeg process. + /// + public ProcessPriorityClass ProcessPriority { get; set; } = ProcessPriorityClass.BelowNormal; + + /// + /// Gets or sets the interval, in ms, between each new trickplay image. + /// + public int Interval { get; set; } = 10000; + + /// + /// Gets or sets the target width resolutions, in px, to generates preview images for. + /// + public HashSet WidthResolutions { get; set; } = new HashSet { 320 }; + + /// + /// Gets or sets number of tile images to allow in X dimension. + /// + public int TileWidth { get; set; } = 10; + + /// + /// Gets or sets number of tile images to allow in Y dimension. + /// + public int TileHeight { get; set; } = 10; + + /// + /// Gets or sets the ffmpeg output quality level. + /// + public int Qscale { get; set; } = 10; + + /// + /// Gets or sets the jpeg quality to use for image tiles. + /// + public int JpegQuality { get; set; } = 90; + + /// + /// Gets or sets the number of threads to be used by ffmpeg. + /// + public int ProcessThreads { get; set; } = 0; + } +} diff --git a/MediaBrowser.Model/Configuration/TrickplayScanBehavior.cs b/MediaBrowser.Model/Configuration/TrickplayScanBehavior.cs new file mode 100644 index 0000000000..7997941768 --- /dev/null +++ b/MediaBrowser.Model/Configuration/TrickplayScanBehavior.cs @@ -0,0 +1,18 @@ +namespace MediaBrowser.Model.Configuration +{ + /// + /// Enum TrickplayScanBehavior. + /// + public enum TrickplayScanBehavior + { + /// + /// Starts generation, only return once complete. + /// + Blocking, + + /// + /// Start generation, return immediately. + /// + NonBlocking + } +}