summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
Diffstat (limited to 'win')
-rw-r--r--win/CS/HandBrake.Interop/Interop/HandBrakeHardwareEncoderHelper.cs40
-rw-r--r--win/CS/HandBrakeWPF/Properties/Resources.Designer.cs13
-rw-r--r--win/CS/HandBrakeWPF/Properties/Resources.resx7
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs4
-rw-r--r--win/CS/HandBrakeWPF/Views/OptionsView.xaml16
5 files changed, 66 insertions, 14 deletions
diff --git a/win/CS/HandBrake.Interop/Interop/HandBrakeHardwareEncoderHelper.cs b/win/CS/HandBrake.Interop/Interop/HandBrakeHardwareEncoderHelper.cs
index f0e55062a..168b7773d 100644
--- a/win/CS/HandBrake.Interop/Interop/HandBrakeHardwareEncoderHelper.cs
+++ b/win/CS/HandBrake.Interop/Interop/HandBrakeHardwareEncoderHelper.cs
@@ -11,6 +11,8 @@ namespace HandBrake.Interop.Interop
{
using System;
using System.Diagnostics;
+ using System.Dynamic;
+ using System.Runtime.InteropServices;
using HandBrake.Interop.Interop.HbLib;
@@ -19,6 +21,28 @@ namespace HandBrake.Interop.Interop
private static bool? isNvencH264Available; // Local cache to prevent log spam.
private static bool? isNvencH265Available;
+ public static bool IsSafeMode
+ {
+ get
+ {
+ try
+ {
+ if (RuntimeInformation.ProcessArchitecture == Architecture.Arm64)
+ {
+ return false;
+ }
+
+ return (HBFunctions.hb_qsv_available() + HBFunctions.hb_vce_h264_available()
+ + HBFunctions.hb_nvenc_h264_available()) == -3;
+ }
+ catch (Exception)
+ {
+ // Silent failure. Typically this means the dll hasn't been built with --enable-qsv
+ return false;
+ }
+ }
+ }
+
/* QuickSync Support */
public static bool IsQsvAvailable
@@ -27,7 +51,7 @@ namespace HandBrake.Interop.Interop
{
try
{
- return HBFunctions.hb_qsv_available() != 0;
+ return HBFunctions.hb_qsv_available() > 0;
}
catch (Exception)
{
@@ -43,7 +67,7 @@ namespace HandBrake.Interop.Interop
{
try
{
- return (HBFunctions.hb_qsv_available() & NativeConstants.HB_VCODEC_QSV_H264) != 0;
+ return (HBFunctions.hb_qsv_available() & NativeConstants.HB_VCODEC_QSV_H264) > 0;
}
catch (Exception)
{
@@ -59,7 +83,7 @@ namespace HandBrake.Interop.Interop
{
try
{
- return (HBFunctions.hb_qsv_available() & NativeConstants.HB_VCODEC_QSV_H265) != 0;
+ return (HBFunctions.hb_qsv_available() & NativeConstants.HB_VCODEC_QSV_H265) > 0;
}
catch (Exception)
{
@@ -94,7 +118,7 @@ namespace HandBrake.Interop.Interop
{
try
{
- return (HBFunctions.hb_qsv_available() & NativeConstants.HB_VCODEC_QSV_H265_10BIT) != 0;
+ return (HBFunctions.hb_qsv_available() & NativeConstants.HB_VCODEC_QSV_H265_10BIT) > 0;
}
catch (Exception)
{
@@ -112,7 +136,7 @@ namespace HandBrake.Interop.Interop
{
try
{
- return HBFunctions.hb_vce_h264_available() != 0;
+ return HBFunctions.hb_vce_h264_available() > 0;
}
catch (Exception)
{
@@ -128,7 +152,7 @@ namespace HandBrake.Interop.Interop
{
try
{
- return HBFunctions.hb_vce_h265_available() != 0;
+ return HBFunctions.hb_vce_h265_available() > 0;
}
catch (Exception)
{
@@ -148,7 +172,7 @@ namespace HandBrake.Interop.Interop
{
if (isNvencH264Available == null)
{
- isNvencH264Available = HBFunctions.hb_nvenc_h264_available() != 0;
+ isNvencH264Available = HBFunctions.hb_nvenc_h264_available() > 0;
}
return isNvencH264Available.Value;
@@ -174,7 +198,7 @@ namespace HandBrake.Interop.Interop
if (isNvencH265Available == null)
{
- isNvencH265Available = HBFunctions.hb_nvenc_h265_available() != 0;
+ isNvencH265Available = HBFunctions.hb_nvenc_h265_available() > 0;
}
return isNvencH265Available.Value;
diff --git a/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs b/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs
index 922b9f129..0b9f31970 100644
--- a/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs
+++ b/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs
@@ -3617,7 +3617,7 @@ namespace HandBrakeWPF.Properties {
}
/// <summary>
- /// Looks up a localized string similar to Run each queued job in a separate worker process. (Experimental).
+ /// Looks up a localized string similar to Run each queued job in a separate worker process..
/// </summary>
public static string OptionsView_EnableWorkerProcesses {
get {
@@ -3654,7 +3654,7 @@ namespace HandBrakeWPF.Properties {
}
/// <summary>
- /// Looks up a localized string similar to Hardware encoding support is currently disabled. Please make sure you are running up-to-date drivers for all graphics adaptors in this system.
+ /// Looks up a localized string similar to Hardware encoding support is currently disabled. If you did not start HandBrake with the &quot;--no-hardware&quot; option, please make sure you are running up-to-date drivers for all graphics adaptors in this system.
///
///This will not impact any of the software encoders..
/// </summary>
@@ -3809,6 +3809,15 @@ namespace HandBrakeWPF.Properties {
}
/// <summary>
+ /// Looks up a localized string similar to Warning: Please note that this is a &quot;Safe Mode&quot; build of HandBrake that does not include support for hardware encoders. If you wish to use hardware encoder support, please download a non-&quot;Safe Mode&quot; build from the website..
+ /// </summary>
+ public static string OptionsView_SafeMode {
+ get {
+ return ResourceManager.GetString("OptionsView_SafeMode", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Please select a folder..
/// </summary>
public static string OptionsView_SelectFolder {
diff --git a/win/CS/HandBrakeWPF/Properties/Resources.resx b/win/CS/HandBrakeWPF/Properties/Resources.resx
index f0ee417b4..2bc277e9a 100644
--- a/win/CS/HandBrakeWPF/Properties/Resources.resx
+++ b/win/CS/HandBrakeWPF/Properties/Resources.resx
@@ -1843,7 +1843,7 @@ VLC and MPC-HC are supported. Other players may also work but are not validated.
<value>Show 'Add Selection to Queue' on the toolbar</value>
</data>
<data name="OptionsView_HardwareDetectFailed" xml:space="preserve">
- <value>Hardware encoding support is currently disabled. Please make sure you are running up-to-date drivers for all graphics adaptors in this system.
+ <value>Hardware encoding support is currently disabled. If you did not start HandBrake with the "--no-hardware" option, please make sure you are running up-to-date drivers for all graphics adaptors in this system.
This will not impact any of the software encoders.</value>
</data>
@@ -2191,7 +2191,7 @@ This will also stop any existing running jobs.</value>
<value>Please select a single job to view summary information.</value>
</data>
<data name="OptionsView_EnableWorkerProcesses" xml:space="preserve">
- <value>Run each queued job in a separate worker process. (Experimental)</value>
+ <value>Run each queued job in a separate worker process.</value>
</data>
<data name="OptionsView_WorkerDefaultPort" xml:space="preserve">
<value>Default network port for worker:</value>
@@ -2457,4 +2457,7 @@ Fields are limited to:
<data name="Startup_HbDllMissing" xml:space="preserve">
<value>Missing file "hb.dll". Please re-install.</value>
</data>
+ <data name="OptionsView_SafeMode" xml:space="preserve">
+ <value>Warning: Please note that this is a "Safe Mode" build of HandBrake that does not include support for hardware encoders. If you wish to use hardware encoder support, please download a non-"Safe Mode" build from the website.</value>
+ </data>
</root> \ No newline at end of file
diff --git a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs
index 2eb5ce954..817fb4041 100644
--- a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs
@@ -881,6 +881,10 @@ namespace HandBrakeWPF.ViewModels
public bool IsHardwareFallbackMode => HandBrakeUtils.IsInitNoHardware();
+ public bool IsSafeMode => HandBrakeHardwareEncoderHelper.IsSafeMode;
+
+ public bool IsHardwareOptionsVisibile => !IsSafeMode && !IsHardwareFallbackMode;
+
/* About HandBrake */
diff --git a/win/CS/HandBrakeWPF/Views/OptionsView.xaml b/win/CS/HandBrakeWPF/Views/OptionsView.xaml
index dc7a7ab46..1709d0160 100644
--- a/win/CS/HandBrakeWPF/Views/OptionsView.xaml
+++ b/win/CS/HandBrakeWPF/Views/OptionsView.xaml
@@ -338,7 +338,19 @@
<TextBlock Text="{x:Static Properties:Resources.Options_Video}" FontSize="20" FontFamily="Segoe UI Light" />
- <Grid Visibility="{Binding IsHardwareFallbackMode, Converter={StaticResource boolToVisConverter}}" Margin="10,5,0,0" Grid.Row="1">
+
+ <Grid Visibility="{Binding IsSafeMode, Converter={StaticResource boolToVisConverter}}" Margin="10,5,10,0">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ </Grid.ColumnDefinitions>
+
+ <Image Source="Images/warningsmall.png" Width="16" Height="16" VerticalAlignment="Center" Margin="0,0,10,0" Grid.Column="0" />
+ <TextBlock Text="{x:Static Properties:Resources.OptionsView_SafeMode}" TextWrapping="Wrap" Grid.Column="1" FontSize="14" />
+ </Grid>
+
+
+ <Grid Visibility="{Binding IsHardwareFallbackMode, Converter={StaticResource boolToVisConverter}}" Margin="10,5,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
@@ -348,7 +360,7 @@
<TextBlock Text="{x:Static Properties:Resources.OptionsView_HardwareDetectFailed}" TextWrapping="Wrap" Grid.Column="1" />
</Grid>
- <StackPanel Orientation="Vertical" Margin="0,0,0,20">
+ <StackPanel Orientation="Vertical" Margin="0,0,0,20" Visibility="{Binding IsHardwareOptionsVisibile, Converter={StaticResource boolToVisConverter}}">
<TextBlock Text="{x:Static Properties:Resources.Options_Encoding}" FontSize="14" Margin="0,10,0,10" />
<StackPanel Orientation="Vertical" Margin="20,0,0,0">