if (task.VideoEncoder == VideoEncoder.QuickSync)\r
{\r
string qsvPreset;\r
- switch (task.QsvPreset)\r
+\r
+ if (SystemInfo.IsHswOrNewer)\r
{\r
- case QsvPreset.Speed:\r
- qsvPreset = "7";\r
- break;\r
- case QsvPreset.Balanced:\r
- qsvPreset = "4";\r
- break;\r
- default:\r
- qsvPreset = "2";\r
- break;\r
+ switch (task.QsvPreset)\r
+ {\r
+ case QsvPreset.Speed:\r
+ qsvPreset = "6";\r
+ break;\r
+ case QsvPreset.Balanced:\r
+ qsvPreset = "4";\r
+ break;\r
+ default:\r
+ qsvPreset = "2";\r
+ break;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ switch (task.QsvPreset)\r
+ {\r
+ case QsvPreset.Speed:\r
+ qsvPreset = "4";\r
+ break;\r
+ case QsvPreset.Balanced:\r
+ qsvPreset = "2";\r
+ break;\r
+ default:\r
+ qsvPreset = "2";\r
+ break;\r
+ }\r
}\r
\r
query += string.IsNullOrEmpty(task.AdvancedEncoderOptions)\r
\r
namespace HandBrake.ApplicationServices.Utilities\r
{\r
+ using System.Text.RegularExpressions;\r
using System.Windows.Forms;\r
\r
using Microsoft.Win32;\r
}\r
}\r
\r
+ /// <summary>\r
+ /// Gets a value indicating whether is hsw or newer.\r
+ /// </summary>\r
+ public static bool IsHswOrNewer\r
+ {\r
+ get\r
+ {\r
+ string cpu = GetCpuCount.ToString();\r
+ if (cpu.Contains("Intel"))\r
+ {\r
+ Match match = Regex.Match(cpu, "([0-9]{4})");\r
+ if (match.Success)\r
+ {\r
+ string cpuId = match.Groups[0].ToString();\r
+ int cpuNumber;\r
+ if (int.TryParse(cpuId, out cpuNumber))\r
+ {\r
+ if (cpuNumber > 4000)\r
+ {\r
+ return true;\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ return false;\r
+ }\r
+ }\r
+\r
/// <summary>\r
/// Gets the System screen size information.\r
/// </summary>\r
throw new ArgumentException("height must be positive.");\r
}\r
\r
- HBFunctions.hb_init(0, 0);\r
- IntPtr ptr = HBFunctions.hb_x264_param_unparse(\r
- preset,\r
- string.Join(",", tunes),\r
- extraOptions,\r
- profile,\r
- level,\r
- width,\r
- height);\r
+ //HBFunctions.hb_init(0, 0);\r
+ //IntPtr ptr = HBFunctions.hb_x264_param_unparse(\r
+ // preset,\r
+ // string.Join(",", tunes),\r
+ // extraOptions,\r
+ // profile,\r
+ // level,\r
+ // width,\r
+ // height);\r
\r
- string x264Settings = Marshal.PtrToStringAnsi(ptr);\r
+ //string x264Settings = Marshal.PtrToStringAnsi(ptr);\r
\r
\r
- return x264Settings;\r
+ return "";\r
}\r
\r
/// <summary>\r
}\r
}\r
\r
+ /// <summary>\r
+ /// Gets the qsv slider max.\r
+ /// </summary>\r
+ public int QsvSliderMax\r
+ {\r
+ get\r
+ {\r
+ return SystemInfo.IsHswOrNewer ? 2 : 1;\r
+ }\r
+ }\r
+\r
#endregion\r
\r
#region Public Methods\r
\r
this.QsvPresetValue = preset.Task.VideoEncoder == VideoEncoder.QuickSync\r
? (int)preset.Task.QsvPreset\r
- : (int)QsvPreset.Quality;\r
+ : SystemInfo.IsHswOrNewer ? (int)QsvPreset.Quality : (int)QsvPreset.Balanced;\r
\r
this.UseAdvancedTab = !string.IsNullOrEmpty(preset.Task.AdvancedEncoderOptions) && this.ShowAdvancedTab;\r
}\r
Visibility="{Binding DisplayQSVOptions, Converter={StaticResource boolToVisConverter}}" />\r
<StackPanel Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3" Orientation="Horizontal"\r
Visibility="{Binding DisplayQSVOptions, Converter={StaticResource boolToVisConverter}}" >\r
- <Slider Minimum="0" Maximum="2" Width="150" Value="{Binding QsvPresetValue, Mode=Default, UpdateSourceTrigger=PropertyChanged}" \r
+ <Slider Minimum="0" Maximum="{Binding QsvSliderMax}" Width="150" Value="{Binding QsvPresetValue, Mode=Default, UpdateSourceTrigger=PropertyChanged}" \r
IsSnapToTickEnabled="True" TickFrequency="1" TickPlacement="BottomRight" />\r
<TextBlock Text="{Binding QsvPreset, Converter={StaticResource enumComboConverter}}" Margin="5,0,0,0" />\r
</StackPanel>\r