diff options
author | sr55 <[email protected]> | 2019-04-06 15:41:04 +0100 |
---|---|---|
committer | sr55 <[email protected]> | 2019-04-06 15:41:04 +0100 |
commit | 8065029c806e5e50e2ef7828f0ee1edf96c41031 (patch) | |
tree | 8e74496b38eb76f104c1883573fb78f5f13f7973 /win | |
parent | 42594b81c948bd55c862c680e8af5e2618989127 (diff) |
WinGui: Add "hardware.enabled" option to portable.ini
Diffstat (limited to 'win')
-rw-r--r-- | win/CS/HandBrakeWPF/App.xaml.cs | 2 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Utilities/Portable.cs | 16 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/portable.ini.template | 4 |
3 files changed, 20 insertions, 2 deletions
diff --git a/win/CS/HandBrakeWPF/App.xaml.cs b/win/CS/HandBrakeWPF/App.xaml.cs index c784eb7a5..ce31b066d 100644 --- a/win/CS/HandBrakeWPF/App.xaml.cs +++ b/win/CS/HandBrakeWPF/App.xaml.cs @@ -124,7 +124,7 @@ namespace HandBrakeWPF // NO-Hardware Mode
- bool noHardware = e.Args.Any(f => f.Equals("--no-hardware"));
+ bool noHardware = e.Args.Any(f => f.Equals("--no-hardware")) || (Portable.IsPortable() && !Portable.IsHardwareEnabled());
// Initialise the Engine
HandBrakeWPF.Helpers.LogManager.Init();
diff --git a/win/CS/HandBrakeWPF/Utilities/Portable.cs b/win/CS/HandBrakeWPF/Utilities/Portable.cs index 2cfbce6e9..ecde42d82 100644 --- a/win/CS/HandBrakeWPF/Utilities/Portable.cs +++ b/win/CS/HandBrakeWPF/Utilities/Portable.cs @@ -177,6 +177,22 @@ namespace HandBrakeWPF.Utilities return true; } + public static bool IsHardwareEnabled() + { + if (keyPairs.ContainsKey("hardware.enabled")) + { + string hardwareEnabled = keyPairs["hardware.enabled"]; + if (!string.IsNullOrEmpty(hardwareEnabled) && hardwareEnabled.Trim() == "true") + { + return true; + } + + return false; + } + + return true; // Default to On. + } + /// <summary> /// The get temp directory. /// </summary> diff --git a/win/CS/HandBrakeWPF/portable.ini.template b/win/CS/HandBrakeWPF/portable.ini.template index 495a73441..c667efece 100644 --- a/win/CS/HandBrakeWPF/portable.ini.template +++ b/win/CS/HandBrakeWPF/portable.ini.template @@ -6,6 +6,7 @@ # - storage.dir => Stores Presets, Settings and Log Files. # - tmp.dir => temporary files only. (i.e Preview images) # - update.check => true | false (enabled / disabled, default disabled for portable) +# - hardware.enabled => true | false (Enables the hardware encoders such as QSV, NVENC or VCE) # # Set to 'cwd' to use the current applications directory. It will automatically create "storage" and "tmp" folders in this instance. # Leave blank to use the system "TMP" directory and the "AppData" user profile folder. @@ -13,4 +14,5 @@ storage.dir = cwd tmp.dir = cwd -update.check = false
\ No newline at end of file +update.check = false +hardware.enabled = true
\ No newline at end of file |