From 6c8ca30f7fc02170901a969c71dc35ec8992ad02 Mon Sep 17 00:00:00 2001 From: gnattu Date: Thu, 29 Aug 2024 02:43:37 +0800 Subject: Prevent server from starting if the ffmpeg path is invalid (#12463) --- .../Extensions/ConfigurationExtensions.cs | 13 +++++++++++++ MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs | 10 ++-------- 2 files changed, 15 insertions(+), 8 deletions(-) (limited to 'MediaBrowser.Controller') diff --git a/MediaBrowser.Controller/Extensions/ConfigurationExtensions.cs b/MediaBrowser.Controller/Extensions/ConfigurationExtensions.cs index 6c58064ce..0aaf4fcd9 100644 --- a/MediaBrowser.Controller/Extensions/ConfigurationExtensions.cs +++ b/MediaBrowser.Controller/Extensions/ConfigurationExtensions.cs @@ -29,6 +29,11 @@ namespace MediaBrowser.Controller.Extensions /// public const string FfmpegProbeSizeKey = "FFmpeg:probesize"; + /// + /// The key for the skipping FFmpeg validation. + /// + public const string FfmpegSkipValidationKey = "FFmpeg:novalidation"; + /// /// The key for the FFmpeg analyze duration option. /// @@ -89,6 +94,14 @@ namespace MediaBrowser.Controller.Extensions public static string? GetFFmpegAnalyzeDuration(this IConfiguration configuration) => configuration[FfmpegAnalyzeDurationKey]; + /// + /// Gets a value indicating whether the server should validate FFmpeg during startup. + /// + /// The configuration to read the setting from. + /// true if the server should validate FFmpeg during startup, otherwise false. + public static bool GetFFmpegSkipValidation(this IConfiguration configuration) + => configuration.GetValue(FfmpegSkipValidationKey); + /// /// Gets a value indicating whether playlists should allow duplicate entries from the . /// diff --git a/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs b/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs index 038c6c7f6..e36106e52 100644 --- a/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs +++ b/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs @@ -223,14 +223,8 @@ namespace MediaBrowser.Controller.MediaEncoding /// /// Sets the path to find FFmpeg. /// - void SetFFmpegPath(); - - /// - /// Updates the encoder path. - /// - /// The path. - /// The type of path. - void UpdateEncoderPath(string path, string pathType); + /// bool indicates whether a valid ffmpeg is found. + bool SetFFmpegPath(); /// /// Gets the primary playlist of .vob files. -- cgit v1.2.3