diff options
author | sr55 <[email protected]> | 2018-06-29 21:23:07 +0100 |
---|---|---|
committer | sr55 <[email protected]> | 2018-06-29 21:23:07 +0100 |
commit | 79825db0caa3a5d7cd6293eefdc095e7884b1b56 (patch) | |
tree | a7dd564726c6c3c56b56d911f80484b8b186c228 /win/CS/HandBrakeWPF/ViewModels | |
parent | dbf898635dc12608b78c33916137465ce08937bf (diff) |
WinGui: Extend the "Video" preference tab to allow the hardware encoders to be disabled.
Diffstat (limited to 'win/CS/HandBrakeWPF/ViewModels')
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs | 93 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs | 25 |
2 files changed, 92 insertions, 26 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs index 8d542a3b0..3ad88a97e 100644 --- a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs @@ -101,6 +101,12 @@ namespace HandBrakeWPF.ViewModels private bool playSoundWhenDone;
private bool playSoundWhenQueueDone;
+ private bool enableQuickSyncEncoding;
+
+ private bool enableVceEncoder;
+
+ private bool enableNvencEncoder;
+
#endregion
#region Constructors and Destructors
@@ -986,15 +992,58 @@ namespace HandBrakeWPF.ViewModels #region Video
- /// <summary>
- /// Gets or sets a value indicating whether disable quick sync decoding.
- /// </summary>
+ public bool EnableQuickSyncEncoding
+ {
+ get => this.enableQuickSyncEncoding && this.IsQuickSyncAvailable;
+ set
+ {
+ if (value == this.enableQuickSyncEncoding)
+ {
+ return;
+ }
+
+ this.enableQuickSyncEncoding = value;
+ this.NotifyOfPropertyChange(() => this.EnableQuickSyncEncoding);
+ }
+ }
+
+ public bool EnableVceEncoder
+ {
+ get => this.enableVceEncoder && this.IsVceAvailable;
+ set
+ {
+ if (value == this.enableVceEncoder)
+ {
+ return;
+ }
+
+ this.enableVceEncoder = value;
+ this.NotifyOfPropertyChange(() => this.EnableVceEncoder);
+ }
+ }
+
+ public bool EnableNvencEncoder
+ {
+ get => this.enableNvencEncoder && this.IsNvencAvailable;
+ set
+ {
+ if (value == this.enableNvencEncoder)
+ {
+ return;
+ }
+
+ this.enableNvencEncoder = value;
+ this.NotifyOfPropertyChange(() => this.EnableNvencEncoder);
+ }
+ }
+
public bool EnableQuickSyncDecoding
{
get
{
return this.enableQuickSyncDecoding;
}
+
set
{
if (value.Equals(this.enableQuickSyncDecoding))
@@ -1007,14 +1056,8 @@ namespace HandBrakeWPF.ViewModels }
}
- /// <summary>
- /// Gets or sets the selected scaling mode.
- /// </summary>
public VideoScaler SelectedScalingMode { get; set; }
- /// <summary>
- /// Gets a value indicating whether is quick sync available.
- /// </summary>
public bool IsQuickSyncAvailable
{
get
@@ -1023,6 +1066,23 @@ namespace HandBrakeWPF.ViewModels }
}
+ public bool IsVceAvailable
+ {
+ get
+ {
+ string foundGpu = Utilities.SystemInfo.GetGPUInfo.FirstOrDefault(g => g.Contains("AMD"));
+ return SystemInfo.IsVceH264Available && !string.IsNullOrEmpty(foundGpu);
+ }
+ }
+
+ public bool IsNvencAvailable
+ {
+ get
+ {
+ return SystemInfo.IsNVEncH264Available;
+ }
+ }
+
/// <summary>
/// Gets a value indicating whether is use qsv dec available.
/// </summary>
@@ -1034,15 +1094,13 @@ namespace HandBrakeWPF.ViewModels }
}
- /// <summary>
- /// Gets or sets a value indicating whether to use qsv decode for non qsv encoders
- /// </summary>
public bool UseQSVDecodeForNonQSVEnc
{
get
{
return this.useQsvDecodeForNonQsvEnc;
}
+
set
{
if (value == this.useQsvDecodeForNonQsvEnc) return;
@@ -1051,9 +1109,6 @@ namespace HandBrakeWPF.ViewModels }
}
- /// <summary>
- /// Gets the scaling options.
- /// </summary>
public BindingList<VideoScaler> ScalingOptions
{
get
@@ -1348,6 +1403,10 @@ namespace HandBrakeWPF.ViewModels this.SelectedScalingMode = this.userSettingService.GetUserSetting<VideoScaler>(UserSettingConstants.ScalingMode);
this.UseQSVDecodeForNonQSVEnc = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.UseQSVDecodeForNonQSVEnc);
+ this.EnableQuickSyncEncoding = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.EnableQuickSyncEncoding);
+ this.EnableVceEncoder = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.EnableVceEncoder);
+ this.EnableNvencEncoder = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.EnableNvencEncoder);
+
// #############################
// CLI
// #############################
@@ -1484,6 +1543,10 @@ namespace HandBrakeWPF.ViewModels this.userSettingService.SetUserSetting(UserSettingConstants.ScalingMode, this.SelectedScalingMode);
this.userSettingService.SetUserSetting(UserSettingConstants.UseQSVDecodeForNonQSVEnc, this.UseQSVDecodeForNonQSVEnc);
+ this.userSettingService.SetUserSetting(UserSettingConstants.EnableQuickSyncEncoding, this.EnableQuickSyncEncoding);
+ this.userSettingService.SetUserSetting(UserSettingConstants.EnableVceEncoder, this.EnableVceEncoder);
+ this.userSettingService.SetUserSetting(UserSettingConstants.EnableNvencEncoder, this.EnableNvencEncoder);
+
/* System and Logging */
userSettingService.SetUserSetting(UserSettingConstants.ProcessPriority, this.SelectedPriority);
userSettingService.SetUserSetting(UserSettingConstants.PreventSleep, this.PreventSleep);
diff --git a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs index 74ac53a85..7c14e1594 100644 --- a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs @@ -101,6 +101,8 @@ namespace HandBrakeWPF.ViewModels #region Public Properties
+ public IUserSettingService UserSettingService => this.userSettingService;
+
/// <summary>
/// Gets or sets the current Encode Task.
/// </summary>
@@ -530,17 +532,6 @@ namespace HandBrakeWPF.ViewModels }
}
- private void HandleRFChange()
- {
- double displayRF = this.DisplayRF;
- if (displayRF > this.QualityMax || displayRF < this.QualityMin)
- {
- displayRF = this.qualityMax / 2;
- }
-
- this.SetRF(displayRF);
- }
-
/// <summary>
/// Gets or sets a value indicating whether ShowPeakFramerate.
/// </summary>
@@ -1279,6 +1270,7 @@ namespace HandBrakeWPF.ViewModels if (e.Key == UserSettingConstants.ShowAdvancedTab)
{
this.NotifyOfPropertyChange(() => this.IsAdvancedTabOptionEnabled);
+ this.NotifyOfPropertyChange(() => this.VideoEncoders);
}
}
@@ -1507,5 +1499,16 @@ namespace HandBrakeWPF.ViewModels string result;
this.ExtraArguments = this.encoderOptions.TryGetValue(EnumHelper<VideoEncoder>.GetShortName(selectedEncoder), out result) ? result : string.Empty;
}
+
+ private void HandleRFChange()
+ {
+ double displayRF = this.DisplayRF;
+ if (displayRF > this.QualityMax || displayRF < this.QualityMin)
+ {
+ displayRF = this.qualityMax / 2;
+ }
+
+ this.SetRF(displayRF);
+ }
}
}
\ No newline at end of file |