diff options
5 files changed, 81 insertions, 3 deletions
diff --git a/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs b/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs index be72f0b9d..9d8470cb6 100644 --- a/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs +++ b/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs @@ -4097,6 +4097,19 @@ namespace HandBrakeWPF.Properties { } /// <summary> + /// Looks up a localized string similar to The preset you have selected is not available for use on this system. + /// + ///This is typically an indication that your system does not support the hardware required to utilise it. + /// + ///Please choose a different preset.. + /// </summary> + public static string Presets_NotAvailableForUse { + get { + return ResourceManager.GetString("Presets_NotAvailableForUse", resourceCulture); + } + } + + /// <summary> /// Looks up a localized string similar to HandBrake is unable to upgrade your presets file to a new version format. ///Your preset file will be archived and new one created. You will need to re-create your own presets.. /// </summary> diff --git a/win/CS/HandBrakeWPF/Properties/Resources.resx b/win/CS/HandBrakeWPF/Properties/Resources.resx index 7acca6007..2ffb0543a 100644 --- a/win/CS/HandBrakeWPF/Properties/Resources.resx +++ b/win/CS/HandBrakeWPF/Properties/Resources.resx @@ -2215,4 +2215,11 @@ This will also stop any existing running jobs.</value> <data name="OptionsView_WorkerDefaultPort" xml:space="preserve">
<value>Default network port for worker:</value>
</data>
+ <data name="Presets_NotAvailableForUse" xml:space="preserve">
+ <value>The preset you have selected is not available for use on this system.
+
+This is typically an indication that your system does not support the hardware required to utilise it.
+
+Please choose a different preset.</value>
+ </data>
</root>
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/Services/Presets/Model/Preset.cs b/win/CS/HandBrakeWPF/Services/Presets/Model/Preset.cs index ca747c341..df21ccf9b 100644 --- a/win/CS/HandBrakeWPF/Services/Presets/Model/Preset.cs +++ b/win/CS/HandBrakeWPF/Services/Presets/Model/Preset.cs @@ -146,6 +146,8 @@ namespace HandBrakeWPF.Services.Presets.Model /// </summary>
public SubtitleBehaviours SubtitleTrackBehaviours { get; set; }
+ public bool IsPresetDisabled { get; set; }
+
#endregion
#region Public Methods
diff --git a/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs b/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs index 6c715fa8f..0879c67d8 100644 --- a/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs +++ b/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs @@ -23,6 +23,7 @@ namespace HandBrakeWPF.Services.Presets using HandBrake.Interop.Interop;
using HandBrake.Interop.Interop.Json.Presets;
using HandBrake.Interop.Interop.Model;
+ using HandBrake.Interop.Interop.Model.Encoding;
using HandBrake.Interop.Model;
using HandBrake.Interop.Utilities;
@@ -41,6 +42,7 @@ namespace HandBrakeWPF.Services.Presets using Newtonsoft.Json;
using GeneralApplicationException = HandBrakeWPF.Exceptions.GeneralApplicationException;
+ using SystemInfo = HandBrake.Interop.Utilities.SystemInfo;
/// <summary>
/// The preset service manages HandBrake's presets
@@ -192,6 +194,7 @@ namespace HandBrakeWPF.Services.Presets foreach (HBPreset hbPreset in category.ChildrenArray)
{
Preset preset = this.ConvertHbPreset(hbPreset);
+ preset.IsPresetDisabled = this.IsPresetDisabled(preset);
if (preset != null && !preset.IsBuildIn)
{
this.AddOrUpdateImportedPreset(preset);
@@ -208,6 +211,7 @@ namespace HandBrakeWPF.Services.Presets if (hbPreset != null)
{
Preset preset = this.ConvertHbPreset(hbPreset);
+ preset.IsPresetDisabled = this.IsPresetDisabled(preset);
if (preset != null && !preset.IsBuildIn)
{
this.AddOrUpdateImportedPreset(preset);
@@ -751,6 +755,7 @@ namespace HandBrakeWPF.Services.Presets // Migration
preset.Category = category.PresetName == "User Presets" ? UserPresetCatgoryName : category.PresetName;
preset.IsBuildIn = hbpreset.Type == 0;
+ preset.IsPresetDisabled = this.IsPresetDisabled(preset);
// IF we are using Source Max, Set the Max Width / Height values.
if (preset.PictureSettingsMode == PresetPictureSettingsMode.SourceMaximum)
@@ -906,6 +911,46 @@ namespace HandBrakeWPF.Services.Presets }
}
+ private bool IsPresetDisabled(Preset preset)
+ {
+ if (preset.Task.VideoEncoder == VideoEncoder.QuickSync && !SystemInfo.IsQsvAvailable)
+ {
+ return true;
+ }
+
+ if (preset.Task.VideoEncoder == VideoEncoder.QuickSyncH265 && !SystemInfo.IsQsvAvailableH265)
+ {
+ return true;
+ }
+
+ if (preset.Task.VideoEncoder == VideoEncoder.QuickSyncH26510b && !SystemInfo.IsQsvAvailableH265)
+ {
+ return true;
+ }
+
+ if (preset.Task.VideoEncoder == VideoEncoder.VceH264 && !SystemInfo.IsVceH264Available)
+ {
+ return true;
+ }
+
+ if (preset.Task.VideoEncoder == VideoEncoder.VceH265 && !SystemInfo.IsVceH265Available)
+ {
+ return true;
+ }
+
+ if (preset.Task.VideoEncoder == VideoEncoder.NvencH264 && !SystemInfo.IsNVEncH264Available)
+ {
+ return true;
+ }
+
+ if (preset.Task.VideoEncoder == VideoEncoder.NvencH265 && !SystemInfo.IsNVEncH265Available)
+ {
+ return true;
+ }
+
+ return false;
+ }
+
protected void ServiceLogMessage(string message)
{
this.log.LogMessage(string.Format("Preset Service: {0}{1}{0}", Environment.NewLine, message));
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index 7c8c28e6b..878f03b4d 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -330,13 +330,13 @@ namespace HandBrakeWPF.ViewModels {
if (!object.Equals(this.selectedPreset, value))
{
- this.selectedPreset = value;
- this.NotifyOfPropertyChange(() => this.SelectedPreset);
-
if (value != null)
{
this.PresetSelect(value);
}
+
+ this.selectedPreset = value;
+ this.NotifyOfPropertyChange(() => this.SelectedPreset);
}
}
}
@@ -347,6 +347,7 @@ namespace HandBrakeWPF.ViewModels {
return this.isModifiedPreset;
}
+
set
{
if (value == this.isModifiedPreset) return;
@@ -2088,6 +2089,16 @@ namespace HandBrakeWPF.ViewModels Preset preset = tag as Preset;
if (preset != null)
{
+ if (preset.IsPresetDisabled)
+ {
+ this.errorService.ShowMessageBox(
+ Resources.Presets_NotAvailableForUse,
+ Resources.Warning,
+ MessageBoxButton.OK,
+ MessageBoxImage.Warning);
+ return;
+ }
+
if (this.SelectedPresetCategory == null || this.SelectedPresetCategory.Category != preset.Category)
{
this.SelectedPresetCategory = this.PresetsCategories.FirstOrDefault(c => c.Category == preset.Category);
|