summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsr55 <[email protected]>2020-07-03 19:20:32 +0100
committersr55 <[email protected]>2020-07-03 19:21:03 +0100
commit35e106c48f28b0769599a1757be89e97ff9d908f (patch)
treef2f708e2aac60692ec1ac6ae73817d37dea9b434
parentd3ea0cbb24a5da4fac6ead6656aacf09c13e5479 (diff)
WinGui: Disable simulatenous encode support on low end systems. Increase the limit to 8 where a system has > 8 physical cores.
-rw-r--r--win/CS/HandBrakeWPF/Properties/Resources.Designer.cs9
-rw-r--r--win/CS/HandBrakeWPF/Properties/Resources.resx3
-rw-r--r--win/CS/HandBrakeWPF/Utilities/GeneralUtilities.cs2
-rw-r--r--win/CS/HandBrakeWPF/Utilities/SystemInfo.cs22
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs18
-rw-r--r--win/CS/HandBrakeWPF/Views/OptionsView.xaml4
6 files changed, 48 insertions, 10 deletions
diff --git a/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs b/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs
index 32f288ff2..cb3f55f98 100644
--- a/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs
+++ b/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs
@@ -3583,6 +3583,15 @@ namespace HandBrakeWPF.Properties {
}
/// <summary>
+ /// Looks up a localized string similar to (Not supported on this system).
+ /// </summary>
+ public static string OptionsView_NotSupported {
+ get {
+ return ResourceManager.GetString("OptionsView_NotSupported", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Available Options: {source_path} {source_folder_name} {source}.
/// </summary>
public static string OptionsView_PathOptions {
diff --git a/win/CS/HandBrakeWPF/Properties/Resources.resx b/win/CS/HandBrakeWPF/Properties/Resources.resx
index 76159350c..0382d5614 100644
--- a/win/CS/HandBrakeWPF/Properties/Resources.resx
+++ b/win/CS/HandBrakeWPF/Properties/Resources.resx
@@ -2337,4 +2337,7 @@ Please choose a different preset.</value>
<data name="PresetManagerView_Delete" xml:space="preserve">
<value>Delete Preset</value>
</data>
+ <data name="OptionsView_NotSupported" xml:space="preserve">
+ <value>(Not supported on this system)</value>
+ </data>
</root> \ No newline at end of file
diff --git a/win/CS/HandBrakeWPF/Utilities/GeneralUtilities.cs b/win/CS/HandBrakeWPF/Utilities/GeneralUtilities.cs
index f03d16f2c..8329b9762 100644
--- a/win/CS/HandBrakeWPF/Utilities/GeneralUtilities.cs
+++ b/win/CS/HandBrakeWPF/Utilities/GeneralUtilities.cs
@@ -109,7 +109,7 @@ namespace HandBrakeWPF.Utilities
logHeader.AppendLine(string.Format("HandBrake {0}", VersionHelper.GetVersion()));
logHeader.AppendLine(string.Format("OS: {0}", Environment.OSVersion));
- logHeader.AppendLine(string.Format("CPU: {0}", SystemInfo.GetCpuCount));
+ logHeader.AppendLine(string.Format("CPU: {0}", SystemInfo.GetCpu));
logHeader.AppendLine(string.Format("Ram: {0} MB, ", SystemInfo.TotalPhysicalMemory));
logHeader.AppendLine(string.Format("GPU Information:{0}{1}", Environment.NewLine, gpuBuilder.ToString().TrimEnd()));
logHeader.AppendLine(string.Format("Screen: {0}x{1}", SystemInfo.ScreenBounds.Bounds.Width, SystemInfo.ScreenBounds.Bounds.Height));
diff --git a/win/CS/HandBrakeWPF/Utilities/SystemInfo.cs b/win/CS/HandBrakeWPF/Utilities/SystemInfo.cs
index ca32b7af4..28b1c2429 100644
--- a/win/CS/HandBrakeWPF/Utilities/SystemInfo.cs
+++ b/win/CS/HandBrakeWPF/Utilities/SystemInfo.cs
@@ -14,8 +14,6 @@ namespace HandBrakeWPF.Utilities
using System.Management;
using System.Windows.Forms;
- using HandBrake.Interop.Interop.HbLib;
-
using Microsoft.Win32;
/// <summary>
@@ -39,11 +37,7 @@ namespace HandBrakeWPF.Utilities
}
}
- /// <summary>
- /// Gets the number of CPU Cores
- /// </summary>
- /// <returns>Object</returns>
- public static object GetCpuCount
+ public static object GetCpu
{
get
{
@@ -53,6 +47,20 @@ namespace HandBrakeWPF.Utilities
}
}
+ public static int GetCpuCoreCount
+ {
+ get
+ {
+ int coreCount = 0;
+ foreach (var item in new System.Management.ManagementObjectSearcher("Select * from Win32_Processor").Get())
+ {
+ coreCount += int.Parse(item["NumberOfCores"].ToString());
+ }
+
+ return coreCount;
+ }
+ }
+
/// <summary>
/// Gets the System screen size information.
/// </summary>
diff --git a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs
index b0635f9ab..46a575bfb 100644
--- a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs
@@ -1355,10 +1355,26 @@ namespace HandBrakeWPF.ViewModels
{
get
{
- return new BindingList<int>() { 1, 2, 3, 4 };
+ if (Utilities.SystemInfo.GetCpuCoreCount > 8)
+ {
+ return new BindingList<int> { 1, 2, 3, 4, 5, 6, 7, 8 };
+ }
+
+ if (Utilities.SystemInfo.GetCpuCoreCount > 4 && Utilities.SystemInfo.GetCpuCoreCount <= 8)
+ {
+ return new BindingList<int> { 1, 2, 3, 4 };
+ }
+
+ if (Utilities.SystemInfo.GetCpuCoreCount >= 4)
+ {
+ return new BindingList<int> { 1, 2 };
+ }
+
+ return new BindingList<int> { 1 };
}
}
+ public bool IsSimultaneousEncodesSupported => Utilities.SystemInfo.GetCpuCoreCount >= 4;
#region Public Methods
diff --git a/win/CS/HandBrakeWPF/Views/OptionsView.xaml b/win/CS/HandBrakeWPF/Views/OptionsView.xaml
index d5ad61f31..6bb5316ad 100644
--- a/win/CS/HandBrakeWPF/Views/OptionsView.xaml
+++ b/win/CS/HandBrakeWPF/Views/OptionsView.xaml
@@ -438,9 +438,11 @@
<TextBox Text="{Binding RemoteServicePort}" Width="100" IsEnabled="{Binding RemoteServiceEnabled}" />
</StackPanel>
- <StackPanel Orientation="Horizontal" Margin="10,10,0,0" >
+ <StackPanel Orientation="Horizontal" Margin="10,10,0,0" IsEnabled="{Binding IsSimultaneousEncodesSupported}" >
<TextBlock Text="{x:Static Properties:Resources.OptionsView_SimultaneousEncodes}" VerticalAlignment="Center"/>
<ComboBox ItemsSource="{Binding SimultaneousEncodesList}" SelectedItem="{Binding SimultaneousEncodes}" IsEnabled="{Binding RemoteServiceEnabled}" />
+
+ <TextBlock Text="{x:Static Properties:Resources.OptionsView_NotSupported}" Margin="5,0,0,0" Visibility="{Binding IsSimultaneousEncodesSupported, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}" />
</StackPanel>
</StackPanel>