From a27b2c176c84d290339f3bb0dc5b9f9961817b30 Mon Sep 17 00:00:00 2001 From: sr55 Date: Sat, 21 Sep 2013 22:12:56 +0000 Subject: WinGui: Added a new tab in Options to host "Video" related settings including hardware acceleration. Only showing the QuickSync options. DXVA/OpenCl options are hidden for now. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5794 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- .../ASUserSettingConstants.cs | 15 + .../Services/Base/EncodeBase.cs | 3 +- .../Services/Encode.cs | 6 +- .../Utilities/QueryGeneratorUtility.cs | 35 +- .../HandBrakeWPF/Converters/EnumComboConverter.cs | 17 +- .../Converters/Options/OptionsTabConverter.cs | 3 + .../Converters/Video/ScalingConverter.cs | 79 ++++ .../Converters/Video/VideoEncoderConverter.cs | 6 +- win/CS/HandBrakeWPF/HandBrakeWPF.csproj | 2 + win/CS/HandBrakeWPF/Model/OptionsTab.cs | 3 + win/CS/HandBrakeWPF/Model/VideoScaler.cs | 28 ++ .../HandBrakeWPF/Properties/Resources.Designer.cs | 37 ++ win/CS/HandBrakeWPF/Properties/Resources.resx | 19 + win/CS/HandBrakeWPF/UserSettingConstants.cs | 5 + win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs | 3 +- win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs | 429 ++++++++++++++------- win/CS/HandBrakeWPF/Views/OptionsView.xaml | 85 +++- win/CS/HandBrakeWPF/defaultsettings.xml | 33 ++ 18 files changed, 631 insertions(+), 177 deletions(-) create mode 100644 win/CS/HandBrakeWPF/Converters/Video/ScalingConverter.cs create mode 100644 win/CS/HandBrakeWPF/Model/VideoScaler.cs (limited to 'win/CS') diff --git a/win/CS/HandBrake.ApplicationServices/ASUserSettingConstants.cs b/win/CS/HandBrake.ApplicationServices/ASUserSettingConstants.cs index 78f5b18ab..f5ca3bef5 100644 --- a/win/CS/HandBrake.ApplicationServices/ASUserSettingConstants.cs +++ b/win/CS/HandBrake.ApplicationServices/ASUserSettingConstants.cs @@ -63,5 +63,20 @@ namespace HandBrake.ApplicationServices /// Clear completed items from the queue automatically. /// public const string ClearCompletedFromQueue = "ClearCompletedFromQueue"; + + /// + /// The disable quick sync decoding. + /// + public const string DisableQuickSyncDecoding = "DisableQuickSyncDecoding"; + + /// + /// The enable dxva. + /// + public const string EnableDxva = "EnableDxva"; + + /// + /// The scaling mode. + /// + public const string ScalingMode = "ScalingMode"; } } diff --git a/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs b/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs index db4ef3abd..959ab1b1b 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs @@ -323,7 +323,8 @@ namespace HandBrake.ApplicationServices.Services.Base string query = QueryGeneratorUtility.GenerateQuery(new EncodeTask(encodeQueueTask.Task), userSettingService.GetUserSetting(ASUserSettingConstants.PreviewScanCount), userSettingService.GetUserSetting(ASUserSettingConstants.Verbosity), - userSettingService.GetUserSetting(ASUserSettingConstants.DisableLibDvdNav)); + userSettingService.GetUserSetting(ASUserSettingConstants.DisableLibDvdNav), + userSettingService.GetUserSetting(ASUserSettingConstants.DisableQuickSyncDecoding)); this.logBuffer = new StringBuilder(); this.logBuffer.AppendLine(String.Format("CLI Query: {0}", query)); this.logBuffer.AppendLine(String.Format("User Query: {0}", encodeQueueTask.CustomQuery)); diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode.cs index 806c08fa5..9e95b31cd 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Encode.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/Encode.cs @@ -137,11 +137,13 @@ namespace HandBrake.ApplicationServices.Services this.currentTask.Task.PreviewEncodeStartAt, userSettingService.GetUserSetting(ASUserSettingConstants.PreviewScanCount), userSettingService.GetUserSetting(ASUserSettingConstants.Verbosity), - userSettingService.GetUserSetting(ASUserSettingConstants.DisableLibDvdNav)) + userSettingService.GetUserSetting(ASUserSettingConstants.DisableLibDvdNav), + userSettingService.GetUserSetting(ASUserSettingConstants.DisableQuickSyncDecoding)) : QueryGeneratorUtility.GenerateQuery(new EncodeTask(this.currentTask.Task), userSettingService.GetUserSetting(ASUserSettingConstants.PreviewScanCount), userSettingService.GetUserSetting(ASUserSettingConstants.Verbosity), - userSettingService.GetUserSetting(ASUserSettingConstants.DisableLibDvdNav)); + userSettingService.GetUserSetting(ASUserSettingConstants.DisableLibDvdNav), + userSettingService.GetUserSetting(ASUserSettingConstants.DisableQuickSyncDecoding)); ProcessStartInfo cliStart = new ProcessStartInfo(handbrakeCLIPath, query) { diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs b/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs index 9e38d15d9..92cbdf4aa 100644 --- a/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs +++ b/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs @@ -15,8 +15,11 @@ namespace HandBrake.ApplicationServices.Utilities using System.Globalization; using System.IO; + using Caliburn.Micro; + using HandBrake.ApplicationServices.Model; using HandBrake.ApplicationServices.Model.Encoding; + using HandBrake.ApplicationServices.Services.Interfaces; using HandBrake.Interop.Model.Encoding; using HandBrake.Interop.Model.Encoding.x264; @@ -40,10 +43,13 @@ namespace HandBrake.ApplicationServices.Utilities /// /// The disable Lib Dvd Nav. /// + /// + /// The disable Qsv Decode. + /// /// /// A Cli Query /// - public static string GenerateQuery(EncodeTask task, int previewScanCount, int verbosity, bool disableLibDvdNav) + public static string GenerateQuery(EncodeTask task, int previewScanCount, int verbosity, bool disableLibDvdNav, bool disableQsvDecode) { if (string.IsNullOrEmpty(task.Source)) { @@ -53,7 +59,7 @@ namespace HandBrake.ApplicationServices.Utilities string query = string.Empty; query += SourceQuery(task, null, null, previewScanCount); query += DestinationQuery(task); - query += GenerateTabbedComponentsQuery(task, true, verbosity, disableLibDvdNav); + query += GenerateTabbedComponentsQuery(task, true, verbosity, disableLibDvdNav, disableQsvDecode); return query; } @@ -79,15 +85,18 @@ namespace HandBrake.ApplicationServices.Utilities /// /// The disable Lib Dvd Nav. /// + /// + /// The disable Qsv Decode. + /// /// /// A Cli query suitable for generating a preview video. /// - public static string GeneratePreviewQuery(EncodeTask task, int duration, string startAtPreview, int previewScanCount, int verbosity, bool disableLibDvdNav) + public static string GeneratePreviewQuery(EncodeTask task, int duration, string startAtPreview, int previewScanCount, int verbosity, bool disableLibDvdNav, bool disableQsvDecode) { string query = string.Empty; query += SourceQuery(task, duration, startAtPreview, previewScanCount); query += DestinationQuery(task); - query += GenerateTabbedComponentsQuery(task, true, verbosity, disableLibDvdNav); + query += GenerateTabbedComponentsQuery(task, true, verbosity, disableLibDvdNav, disableQsvDecode); return query; } @@ -109,10 +118,13 @@ namespace HandBrake.ApplicationServices.Utilities /// /// The disable Lib Dvd Nav. /// + /// + /// The disable Qsv Decode. + /// /// /// The CLI query for the Tabbed section of the main window UI /// - private static string GenerateTabbedComponentsQuery(EncodeTask task, bool enableFilters, int verbosity, bool disableLibDvdNav) + private static string GenerateTabbedComponentsQuery(EncodeTask task, bool enableFilters, int verbosity, bool disableLibDvdNav, bool disableQsvDecode) { string query = string.Empty; @@ -142,7 +154,7 @@ namespace HandBrake.ApplicationServices.Utilities query += AdvancedQuery(task); // Extra Settings - query += ExtraSettings(verbosity, disableLibDvdNav); + query += ExtraSettings(verbosity, disableLibDvdNav, disableQsvDecode); return query; } @@ -265,7 +277,7 @@ namespace HandBrake.ApplicationServices.Utilities //if (task.HasCropping) //{ - query += string.Format(" --crop {0}:{1}:{2}:{3}", task.Cropping.Top, task.Cropping.Bottom, task.Cropping.Left, task.Cropping.Right); + query += string.Format(" --crop {0}:{1}:{2}:{3}", task.Cropping.Top, task.Cropping.Bottom, task.Cropping.Left, task.Cropping.Right); //} switch (task.Anamorphic) @@ -1009,10 +1021,13 @@ namespace HandBrake.ApplicationServices.Utilities /// /// The disable Libdvd Nav. /// + /// + /// The disable Qsv Decode. + /// /// /// A Cli Query as a string /// - private static string ExtraSettings(int verbosity, bool disableLibdvdNav) + private static string ExtraSettings(int verbosity, bool disableLibdvdNav, bool disableQsvDecode) { string query = string.Empty; @@ -1023,6 +1038,10 @@ namespace HandBrake.ApplicationServices.Utilities if (disableLibdvdNav) query += " --no-dvdnav"; + if (disableQsvDecode) + query += " --disable-qsv-decoding"; + + return query; } diff --git a/win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs b/win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs index d65b7f9f1..1d3a4e208 100644 --- a/win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs +++ b/win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs @@ -19,6 +19,8 @@ namespace HandBrakeWPF.Converters using HandBrake.Interop.Model.Encoding; using HandBrake.Interop.Model.Encoding.x264; + using HandBrakeWPF.Model; + /// /// Enum Combo Converter /// @@ -91,6 +93,11 @@ namespace HandBrakeWPF.Converters return EnumHelper.GetEnumDisplayValues(typeof(Denoise)); } + if (value is IEnumerable) + { + return EnumHelper.GetEnumDisplayValues(typeof(VideoScaler)); + } + // Single Items @@ -140,6 +147,11 @@ namespace HandBrakeWPF.Converters return EnumHelper.GetDisplay((QueueItemStatus)value); } + if (targetType == typeof(VideoScaler) || value.GetType() == typeof(VideoScaler)) + { + return EnumHelper.GetDisplay((VideoScaler)value); + } + return null; } @@ -190,7 +202,6 @@ namespace HandBrakeWPF.Converters { return EnumHelper.GetValue(value.ToString()); } - if (targetType == typeof(PresetPictureSettingsMode) || value.GetType() == typeof(PresetPictureSettingsMode)) { return EnumHelper.GetValue(value.ToString()); @@ -211,6 +222,10 @@ namespace HandBrakeWPF.Converters { return EnumHelper.GetValue(value.ToString()); } + if (targetType == typeof(VideoScaler) || value.GetType() == typeof(VideoScaler)) + { + return EnumHelper.GetValue(value.ToString()); + } return null; } diff --git a/win/CS/HandBrakeWPF/Converters/Options/OptionsTabConverter.cs b/win/CS/HandBrakeWPF/Converters/Options/OptionsTabConverter.cs index 128596f3f..2911bb4fc 100644 --- a/win/CS/HandBrakeWPF/Converters/Options/OptionsTabConverter.cs +++ b/win/CS/HandBrakeWPF/Converters/Options/OptionsTabConverter.cs @@ -53,6 +53,9 @@ namespace HandBrakeWPF.Converters.Options case OptionsTab.About: if ((OptionsTab)parameter == OptionsTab.About) return Visibility.Visible; break; + case OptionsTab.Video: + if ((OptionsTab)parameter == OptionsTab.Video) return Visibility.Visible; + break; } } diff --git a/win/CS/HandBrakeWPF/Converters/Video/ScalingConverter.cs b/win/CS/HandBrakeWPF/Converters/Video/ScalingConverter.cs new file mode 100644 index 000000000..1eeedd653 --- /dev/null +++ b/win/CS/HandBrakeWPF/Converters/Video/ScalingConverter.cs @@ -0,0 +1,79 @@ +// -------------------------------------------------------------------------------------------------------------------- +// +// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. +// +// +// Scaling Converter +// +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrakeWPF.Converters.Video +{ + using System; + using System.Globalization; + using System.Windows.Data; + + using HandBrake.ApplicationServices.Utilities; + + using HandBrakeWPF.Model; + + /// + /// Video Scaling Converter + /// + public class ScalingConverter : IValueConverter + { + /// + /// The convert. + /// + /// + /// The value. + /// + /// + /// The target type. + /// + /// + /// The parameter. + /// + /// + /// The culture. + /// + /// + /// The . + /// + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value != null) + { + return EnumHelper.GetDisplay((VideoScaler)value); + } + + return VideoScaler.Lanczos; + } + + /// + /// The convert back. + /// + /// + /// The value. + /// + /// + /// The target type. + /// + /// + /// The parameter. + /// + /// + /// The culture. + /// + /// + /// The . + /// + /// + /// Not Required. + /// + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/win/CS/HandBrakeWPF/Converters/Video/VideoEncoderConverter.cs b/win/CS/HandBrakeWPF/Converters/Video/VideoEncoderConverter.cs index e7f76f813..594f2c912 100644 --- a/win/CS/HandBrakeWPF/Converters/Video/VideoEncoderConverter.cs +++ b/win/CS/HandBrakeWPF/Converters/Video/VideoEncoderConverter.cs @@ -15,8 +15,11 @@ namespace HandBrakeWPF.Converters.Video using System.Linq; using System.Windows.Data; + using Caliburn.Micro; + using HandBrake.ApplicationServices.Model; using HandBrake.ApplicationServices.Model.Encoding; + using HandBrake.ApplicationServices.Services.Interfaces; using HandBrake.ApplicationServices.Utilities; using HandBrake.Interop.Model.Encoding; @@ -55,7 +58,8 @@ namespace HandBrakeWPF.Converters.Video encoders.Remove(VideoEncoder.Theora); } - if (!SystemInfo.IsQsvAvailable) + IUserSettingService userSettingService = IoC.Get(); + if (!SystemInfo.IsQsvAvailable || !userSettingService.GetUserSetting(UserSettingConstants.EnableQuickSync)) { encoders.Remove(VideoEncoder.QuickSync); } diff --git a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj index 66eb70257..02b1f0bc7 100644 --- a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj +++ b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj @@ -135,6 +135,8 @@ + + diff --git a/win/CS/HandBrakeWPF/Model/OptionsTab.cs b/win/CS/HandBrakeWPF/Model/OptionsTab.cs index 93692d13d..e895b6159 100644 --- a/win/CS/HandBrakeWPF/Model/OptionsTab.cs +++ b/win/CS/HandBrakeWPF/Model/OptionsTab.cs @@ -25,6 +25,9 @@ namespace HandBrakeWPF.Model [Display(Name = "Audio and Subtitles")] AudioAndSubtitles, + [Display(Name = "Video")] + Video, + [Display(Name = "Advanced")] Advanced, diff --git a/win/CS/HandBrakeWPF/Model/VideoScaler.cs b/win/CS/HandBrakeWPF/Model/VideoScaler.cs new file mode 100644 index 000000000..53ff3eb1b --- /dev/null +++ b/win/CS/HandBrakeWPF/Model/VideoScaler.cs @@ -0,0 +1,28 @@ +// -------------------------------------------------------------------------------------------------------------------- +// +// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. +// +// +// The different scaling modes available in HandBrake +// +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrakeWPF.Model +{ + using System.ComponentModel.DataAnnotations; + + /// + /// The different scaling modes available in HandBrake + /// + public enum VideoScaler + { + [Display(Name = "Lanczos")] + Lanczos = 0, + + [Display(Name = "Bicubic")] + Bicubic, + + [Display(Name = "Bicubic (OpenCL)")] + BicubicCl, + } +} diff --git a/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs b/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs index 7dd8fdcf3..322d15fb6 100644 --- a/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs +++ b/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs @@ -383,6 +383,16 @@ namespace HandBrakeWPF.Properties { } } + /// + /// Looks up a localized string similar to Please note, this option is suitable only for slower systems. + ///Hardware decoders are designed for playback, not for re-encoding video so will likely bottleneck on faster systems.. + /// + public static string Video_DxvaDecode { + get { + return ResourceManager.GetString("Video_DxvaDecode", resourceCulture); + } + } + /// /// Looks up a localized string similar to Higher Quality |. /// @@ -451,6 +461,33 @@ namespace HandBrakeWPF.Properties { } } + /// + /// Looks up a localized string similar to QuickSync hardware not detected! + /// + ///In order to use the QuickSync encoder, you must: + /// + ///- Have a Intel Core series CPU with HD Graphics. + ///- Have a monitor connected to the HD Graphics + ///- Note in multi-GPU enviroments, there may be workarounds but these are not officially supported.. + /// + public static string Video_QuickSyncNotAvailable { + get { + return ResourceManager.GetString("Video_QuickSyncNotAvailable", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Lanczos - This is HandBrakes default scaler. It provides the best quality downscaling. + ///Bicubic - Bicubic is faster but quality may not be as good. Video may not appear as soft and as a result file sizes may be larger + ///Bicubic OpenCL - A hardware accelerated version of the CPU based Bicubic scaler. + /// This can be around 5~7% faster than software bicubic on a fast modern graphics card.. + /// + public static string Video_ScalingModes { + get { + return ResourceManager.GetString("Video_ScalingModes", resourceCulture); + } + } + /// /// Looks up a localized string similar to The full x264 list of parameters: ///{0}. diff --git a/win/CS/HandBrakeWPF/Properties/Resources.resx b/win/CS/HandBrakeWPF/Properties/Resources.resx index 2fd4015ed..08164ecdb 100644 --- a/win/CS/HandBrakeWPF/Properties/Resources.resx +++ b/win/CS/HandBrakeWPF/Properties/Resources.resx @@ -350,4 +350,23 @@ If you do not use this tab, it can be hidden from: Tools Menu > Options > Placebo Quality | + + Please note, this option is suitable only for slower systems. +Hardware decoders are designed for playback, not for re-encoding video so will likely bottleneck on faster systems. + + + QuickSync hardware not detected! + +In order to use the QuickSync encoder, you must: + +- Have a Intel Core series CPU with HD Graphics. +- Have a monitor connected to the HD Graphics +- Note in multi-GPU enviroments, there may be workarounds but these are not officially supported. + + + Lanczos - This is HandBrakes default scaler. It provides the best quality downscaling. +Bicubic - Bicubic is faster but quality may not be as good. Video may not appear as soft and as a result file sizes may be larger +Bicubic OpenCL - A hardware accelerated version of the CPU based Bicubic scaler. + This can be around 5~7% faster than software bicubic on a fast modern graphics card. + \ No newline at end of file diff --git a/win/CS/HandBrakeWPF/UserSettingConstants.cs b/win/CS/HandBrakeWPF/UserSettingConstants.cs index e841005b2..91c34e818 100644 --- a/win/CS/HandBrakeWPF/UserSettingConstants.cs +++ b/win/CS/HandBrakeWPF/UserSettingConstants.cs @@ -236,6 +236,11 @@ namespace HandBrakeWPF /// public const string ResetWhenDoneAction = "ResetWhenDoneAction"; + /// + /// The enable quick sync. + /// + public const string EnableQuickSync = "EnableQuickSync"; + #endregion } } \ No newline at end of file diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index 819609f20..f1acf2624 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -1341,7 +1341,8 @@ namespace HandBrakeWPF.ViewModels QueryGeneratorUtility.GenerateQuery(this.CurrentTask, userSettingService.GetUserSetting(ASUserSettingConstants.PreviewScanCount), userSettingService.GetUserSetting(ASUserSettingConstants.Verbosity), - userSettingService.GetUserSetting(ASUserSettingConstants.DisableLibDvdNav)), + userSettingService.GetUserSetting(ASUserSettingConstants.DisableLibDvdNav), + userSettingService.GetUserSetting(ASUserSettingConstants.DisableQuickSyncDecoding)), "CLI Query", MessageBoxButton.OK, MessageBoxImage.Information); diff --git a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs index 1ad006447..e6d47241f 100644 --- a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs @@ -358,6 +358,23 @@ namespace HandBrakeWPF.ViewModels /// private bool resetWhenDoneAction; + /// + /// The selected scaling mode. + /// + private VideoScaler selectedScalingMode; + + /// + /// The enable dxva decoding. + /// + private bool enableDxvaDecoding; + + /// + /// The disable quick sync decoding. + /// + private bool disableQuickSyncDecoding; + + private bool enableQuickSync; + #endregion #region Constructors and Destructors @@ -1390,6 +1407,106 @@ namespace HandBrakeWPF.ViewModels #endregion + #region Video + + /// + /// Gets or sets a value indicating whether enable quick sync. + /// + public bool EnableQuickSync + { + get + { + return this.enableQuickSync; + } + set + { + if (value.Equals(this.enableQuickSync)) + { + return; + } + this.enableQuickSync = value; + this.NotifyOfPropertyChange(() => this.EnableQuickSync); + } + } + + /// + /// Gets or sets a value indicating whether disable quick sync decoding. + /// + public bool DisableQuickSyncDecoding + { + get + { + return this.disableQuickSyncDecoding; + } + set + { + if (value.Equals(this.disableQuickSyncDecoding)) + { + return; + } + this.disableQuickSyncDecoding = value; + this.NotifyOfPropertyChange(() => this.DisableQuickSyncDecoding); + } + } + + /// + /// Gets or sets a value indicating whether enable dxva decoding. + /// + public bool EnableDxvaDecoding + { + get + { + return this.enableDxvaDecoding; + } + set + { + if (value.Equals(this.enableDxvaDecoding)) + { + return; + } + this.enableDxvaDecoding = value; + this.NotifyOfPropertyChange(() => this.EnableDxvaDecoding); + } + } + + /// + /// Gets or sets the selected scaling mode. + /// + public VideoScaler SelectedScalingMode + { + get + { + return this.selectedScalingMode; + } + set + { + this.selectedScalingMode = value; + } + } + + /// + /// Gets a value indicating whether is quick sync available. + /// + public bool IsQuickSyncAvailable + { + get + { + return SystemInfo.IsQsvAvailable; + } + } + + /// + /// Gets the scaling options. + /// + public BindingList ScalingOptions + { + get + { + return new BindingList(EnumHelper.GetEnumList().ToList()); + } + } + #endregion + #endregion #region About HandBrake @@ -1466,6 +1583,151 @@ namespace HandBrakeWPF.ViewModels base.OnActivate(); } + /// + /// Close this window. + /// + public void Close() + { + this.Save(); + this.shellViewModel.DisplayWindow(ShellWindow.MainWindow); + } + + /// + /// Browse - Send File To + /// + public void BrowseSendFileTo() + { + VistaOpenFileDialog dialog = new VistaOpenFileDialog { Filter = "All files (*.*)|*.*" }; + dialog.ShowDialog(); + this.SendFileTo = Path.GetFileNameWithoutExtension(dialog.FileName); + this.sendFileToPath = dialog.FileName; + } + + /// + /// Browse Auto Name Path + /// + public void BrowseAutoNamePath() + { + VistaFolderBrowserDialog dialog = new VistaFolderBrowserDialog { Description = "Please select a folder.", UseDescriptionForTitle = true }; + dialog.ShowDialog(); + this.AutoNameDefaultPath = dialog.SelectedPath; + } + + /// + /// Browse VLC Path + /// + public void BrowseVlcPath() + { + VistaOpenFileDialog dialog = new VistaOpenFileDialog { Filter = "All files (*.exe)|*.exe" }; + dialog.ShowDialog(); + this.VLCPath = dialog.FileName; + } + + /// + /// Audio List Move Left + /// + public void LanguageMoveRight() + { + if (this.SelectedAvailableToMove.Count > 0) + { + List copiedList = SelectedAvailableToMove.ToList(); + foreach (string item in copiedList) + { + this.AvailableLanguages.Remove(item); + this.SelectedLangauges.Add(item); + } + + this.AvailableLanguages = new BindingList(this.AvailableLanguages.OrderBy(o => o).ToList()); + } + } + + /// + /// Audio List Move Right + /// + public void LanguageMoveLeft() + { + if (this.SelectedLangaugesToMove.Count > 0) + { + List copiedList = SelectedLangaugesToMove.ToList(); + foreach (string item in copiedList) + { + this.SelectedLangauges.Remove(item); + this.AvailableLanguages.Add(item); + } + } + + this.AvailableLanguages = new BindingList(this.AvailableLanguages.OrderBy(o => o).ToList()); + } + + /// + /// Audio List Clear all selected languages + /// + public void LanguageClearAll() + { + foreach (string item in this.SelectedLangauges) + { + this.AvailableLanguages.Add(item); + } + this.AvailableLanguages = new BindingList(this.AvailableLanguages.OrderBy(o => o).ToList()); + + this.SelectedLangauges.Clear(); + } + + /// + /// Browse - Log Path + /// + public void BrowseLogPath() + { + VistaFolderBrowserDialog dialog = new VistaFolderBrowserDialog { Description = "Please select a folder.", UseDescriptionForTitle = true }; + dialog.ShowDialog(); + this.LogDirectory = dialog.SelectedPath; + } + + /// + /// View the Default Log Directory for HandBrake + /// + public void ViewLogDirectory() + { + string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs"; + string windir = Environment.GetEnvironmentVariable("WINDIR"); + Process prc = new Process { StartInfo = { FileName = windir + @"\explorer.exe", Arguments = logDir } }; + prc.Start(); + } + + /// + /// Clear HandBrakes log directory. + /// + public void ClearLogHistory() + { + MessageBoxResult result = MessageBox.Show("Are you sure you wish to clear the log file directory?", "Clear Logs", + MessageBoxButton.YesNoCancel, MessageBoxImage.Question); + if (result == MessageBoxResult.Yes) + { + GeneralUtilities.ClearLogFiles(0); + MessageBox.Show("HandBrake's Log file directory has been cleared!", "Notice", MessageBoxButton.OK, MessageBoxImage.Information); + } + } + + /// + /// Download an Update + /// + public void DownloadUpdate() + { + this.UpdateMessage = "Preparing for Update ..."; + this.updateService.DownloadFile(this.updateInfo.DownloadFile, this.DownloadComplete, this.DownloadProgress); + } + + /// + /// Check for updates + /// + public void PerformUpdateCheck() + { + this.UpdateMessage = "Checking for Updates ..."; + this.updateService.CheckForUpdates(this.UpdateCheckComplete); + } + + #endregion + /// /// Load User Settings /// @@ -1492,7 +1754,7 @@ namespace HandBrakeWPF.ViewModels case 7: this.CheckForUpdatesFrequency = 1; break; - case 30: + default: this.CheckForUpdatesFrequency = 2; break; } @@ -1615,6 +1877,15 @@ namespace HandBrakeWPF.ViewModels this.AddClosedCaptions = this.userSettingService.GetUserSetting(UserSettingConstants.UseClosedCaption); this.ShowAdvancedPassthruOpts = this.userSettingService.GetUserSetting(UserSettingConstants.ShowAdvancedAudioPassthruOpts); + + // ############################# + // Video + // ############################# + this.EnableQuickSync = this.userSettingService.GetUserSetting(UserSettingConstants.EnableQuickSync); + this.DisableQuickSyncDecoding = this.userSettingService.GetUserSetting(ASUserSettingConstants.DisableQuickSyncDecoding); + this.EnableDxvaDecoding = this.userSettingService.GetUserSetting(ASUserSettingConstants.EnableDxva); + this.SelectedScalingMode = this.userSettingService.GetUserSetting(ASUserSettingConstants.ScalingMode); + // ############################# // CLI // ############################# @@ -1691,154 +1962,6 @@ namespace HandBrakeWPF.ViewModels this.EnableLibHb = userSettingService.GetUserSetting(UserSettingConstants.EnableLibHb); } - /// - /// Close this window. - /// - public void Close() - { - this.Save(); - this.shellViewModel.DisplayWindow(ShellWindow.MainWindow); - } - - /// - /// Browse - Send File To - /// - public void BrowseSendFileTo() - { - VistaOpenFileDialog dialog = new VistaOpenFileDialog { Filter = "All files (*.*)|*.*" }; - dialog.ShowDialog(); - this.SendFileTo = Path.GetFileNameWithoutExtension(dialog.FileName); - this.sendFileToPath = dialog.FileName; - } - - /// - /// Browse Auto Name Path - /// - public void BrowseAutoNamePath() - { - VistaFolderBrowserDialog dialog = new VistaFolderBrowserDialog { Description = "Please select a folder.", UseDescriptionForTitle = true }; - dialog.ShowDialog(); - this.AutoNameDefaultPath = dialog.SelectedPath; - } - - /// - /// Browse VLC Path - /// - public void BrowseVlcPath() - { - VistaOpenFileDialog dialog = new VistaOpenFileDialog { Filter = "All files (*.exe)|*.exe" }; - dialog.ShowDialog(); - this.VLCPath = dialog.FileName; - } - - /// - /// Audio List Move Left - /// - public void LanguageMoveRight() - { - if (this.SelectedAvailableToMove.Count > 0) - { - List copiedList = SelectedAvailableToMove.ToList(); - foreach (string item in copiedList) - { - this.AvailableLanguages.Remove(item); - this.SelectedLangauges.Add(item); - } - - this.AvailableLanguages = new BindingList(this.AvailableLanguages.OrderBy(o => o).ToList()); - } - } - - /// - /// Audio List Move Right - /// - public void LanguageMoveLeft() - { - if (this.SelectedLangaugesToMove.Count > 0) - { - List copiedList = SelectedLangaugesToMove.ToList(); - foreach (string item in copiedList) - { - this.SelectedLangauges.Remove(item); - this.AvailableLanguages.Add(item); - } - } - - this.AvailableLanguages = new BindingList(this.AvailableLanguages.OrderBy(o => o).ToList()); - } - - /// - /// Audio List Clear all selected languages - /// - public void LanguageClearAll() - { - foreach (string item in this.SelectedLangauges) - { - this.AvailableLanguages.Add(item); - } - this.AvailableLanguages = new BindingList(this.AvailableLanguages.OrderBy(o => o).ToList()); - - this.SelectedLangauges.Clear(); - } - - /// - /// Browse - Log Path - /// - public void BrowseLogPath() - { - VistaFolderBrowserDialog dialog = new VistaFolderBrowserDialog { Description = "Please select a folder.", UseDescriptionForTitle = true }; - dialog.ShowDialog(); - this.LogDirectory = dialog.SelectedPath; - } - - /// - /// View the Default Log Directory for HandBrake - /// - public void ViewLogDirectory() - { - string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs"; - string windir = Environment.GetEnvironmentVariable("WINDIR"); - Process prc = new Process { StartInfo = { FileName = windir + @"\explorer.exe", Arguments = logDir } }; - prc.Start(); - } - - /// - /// Clear HandBrakes log directory. - /// - public void ClearLogHistory() - { - MessageBoxResult result = MessageBox.Show("Are you sure you wish to clear the log file directory?", "Clear Logs", - MessageBoxButton.YesNoCancel, MessageBoxImage.Question); - if (result == MessageBoxResult.Yes) - { - GeneralUtilities.ClearLogFiles(0); - MessageBox.Show("HandBrake's Log file directory has been cleared!", "Notice", MessageBoxButton.OK, MessageBoxImage.Information); - } - } - #endregion - - #region Updates - - /// - /// Download an Update - /// - public void DownloadUpdate() - { - this.UpdateMessage = "Preparing for Update ..."; - this.updateService.DownloadFile(this.updateInfo.DownloadFile, this.DownloadComplete, this.DownloadProgress); - } - - /// - /// Check for updates - /// - public void PerformUpdateCheck() - { - this.UpdateMessage = "Checking for Updates ..."; - this.updateService.CheckForUpdates(this.UpdateCheckComplete); - } - - #endregion - /// /// Save the settings selected /// @@ -1880,6 +2003,14 @@ namespace HandBrakeWPF.ViewModels this.userSettingService.SetUserSetting(UserSettingConstants.DubModeSubtitle, this.SelectedAddSubtitleMode); this.userSettingService.SetUserSetting(UserSettingConstants.ShowAdvancedAudioPassthruOpts, this.ShowAdvancedPassthruOpts); + + /* Video */ + this.userSettingService.SetUserSetting(UserSettingConstants.EnableQuickSync, this.EnableQuickSync); + this.userSettingService.SetUserSetting(ASUserSettingConstants.DisableQuickSyncDecoding, this.DisableQuickSyncDecoding); + this.userSettingService.SetUserSetting(ASUserSettingConstants.EnableDxva, this.EnableDxvaDecoding); + this.userSettingService.SetUserSetting(ASUserSettingConstants.ScalingMode, this.SelectedScalingMode); + + /* System and Logging */ userSettingService.SetUserSetting(ASUserSettingConstants.ProcessPriority, this.SelectedPriority); userSettingService.SetUserSetting(UserSettingConstants.PreventSleep, this.PreventSleep); diff --git a/win/CS/HandBrakeWPF/Views/OptionsView.xaml b/win/CS/HandBrakeWPF/Views/OptionsView.xaml index 22058e0fb..df7edf4e8 100644 --- a/win/CS/HandBrakeWPF/Views/OptionsView.xaml +++ b/win/CS/HandBrakeWPF/Views/OptionsView.xaml @@ -4,6 +4,8 @@ xmlns:Options="clr-namespace:HandBrakeWPF.Converters.Options" xmlns:dd="clr-namespace:GongSolutions.Wpf.DragDrop;assembly=GongSolutions.Wpf.DragDrop" xmlns:Converters="clr-namespace:HandBrakeWPF.Converters" xmlns:local="clr-namespace:HandBrakeWPF.Model" + xmlns:Properties="clr-namespace:HandBrakeWPF.Properties" + xmlns:video="clr-namespace:HandBrakeWPF.Converters.Video" Style="{StaticResource whiteUserControlStyle}"> @@ -34,7 +36,8 @@ - + + - + @@ -201,8 +204,8 @@ - - + + @@ -228,7 +231,7 @@ - + @@ -243,7 +246,7 @@ ItemsSource="{Binding AddAudioModeOptions}" SelectedIndex="{Binding SelectedAddAudioMode}" Width="120" Margin="0,0,5,0" /> - +