diff options
author | sr55 <[email protected]> | 2012-12-28 11:21:14 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2012-12-28 11:21:14 +0000 |
commit | 93235d2c7d15e031015ebbbfeefa14778fe9a56e (patch) | |
tree | ba2f077297096a07af0d68d178292532655bd182 /win | |
parent | f89475c8a426907cc85a335460cc1d6e7750614b (diff) |
WinGui: Initial work to implement x264 Preset/Tune/Profile/Level options in-gui.
Still some stuff to tidy up but should be usable for now.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5113 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win')
25 files changed, 732 insertions, 221 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs b/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs index e7869459b..9f5c043a0 100644 --- a/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs +++ b/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs @@ -34,8 +34,8 @@ namespace HandBrake.ApplicationServices.Model this.SubtitleTracks = new ObservableCollection<SubtitleTrack>();
this.ChapterNames = new ObservableCollection<ChapterMarker>();
this.AllowedPassthruOptions = new AllowedPassthru();
- this.x264Preset = x264Preset.None;
- this.x264Profile = x264Profile.None;
+ this.X264Preset = x264Preset.Medium;
+ this.H264Profile = x264Profile.None;
this.X264Tune = x264Tune.None;
this.Modulus = 16;
}
@@ -60,7 +60,6 @@ namespace HandBrake.ApplicationServices.Model this.AudioTracks.Add(new AudioTrack(track));
}
-
this.ChapterNames = new ObservableCollection<ChapterMarker>();
foreach (ChapterMarker track in task.ChapterNames)
{
@@ -115,9 +114,10 @@ namespace HandBrake.ApplicationServices.Model this.VideoEncoder = task.VideoEncoder;
this.VideoEncodeRateType = task.VideoEncodeRateType;
this.Width = task.Width;
- this.x264Preset = task.x264Preset;
- this.x264Profile = task.x264Profile;
+ this.X264Preset = task.X264Preset;
+ this.H264Profile = task.H264Profile;
this.X264Tune = task.X264Tune;
+ this.FastDecode = task.FastDecode;
this.PreviewStartAt = task.PreviewStartAt;
this.PreviewDuration = task.PreviewDuration;
@@ -399,18 +399,28 @@ namespace HandBrake.ApplicationServices.Model /// <summary>
/// Gets or sets x264Preset.
/// </summary>
- public x264Preset x264Preset { get; set; }
+ public x264Preset X264Preset { get; set; }
/// <summary>
/// Gets or sets x264Profile.
/// </summary>
- public x264Profile x264Profile { get; set; }
+ public x264Profile H264Profile { get; set; }
+
+ /// <summary>
+ /// Gets or sets the x 264 level.
+ /// </summary>
+ public string H264Level { get; set; }
/// <summary>
/// Gets or sets X264Tune.
/// </summary>
public x264Tune X264Tune { get; set; }
+ /// <summary>
+ /// Gets or sets a value indicating whether fast decode.
+ /// </summary>
+ public bool FastDecode { get; set; }
+
#endregion
#region Preview
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode.cs index 0c35c8f41..ce75267c5 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Encode.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/Encode.cs @@ -67,8 +67,7 @@ namespace HandBrake.ApplicationServices.Services : base(userSettingService)
{
this.userSettingService = userSettingService;
- this.EncodeStarted += this.EncodeEncodeStarted;
-
+ this.EncodeStarted += this.EncodeEncodeStarted;
}
#region Properties
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/Converters.cs b/win/CS/HandBrake.ApplicationServices/Utilities/Converters.cs index 0638a8e28..46e696ca1 100644 --- a/win/CS/HandBrake.ApplicationServices/Utilities/Converters.cs +++ b/win/CS/HandBrake.ApplicationServices/Utilities/Converters.cs @@ -470,8 +470,6 @@ namespace HandBrake.ApplicationServices.Utilities return x264Tune.Ssim;
case "fastdecode":
return x264Tune.Fastdecode;
- case "zerolatency":
- return x264Tune.Zerolatency;
default:
return x264Tune.Film;
}
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs b/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs index a6dc97758..b6fc06faf 100644 --- a/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs +++ b/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs @@ -45,6 +45,11 @@ namespace HandBrake.ApplicationServices.Utilities /// </returns>
public static string GenerateQuery(EncodeTask task, int previewScanCount, int verbosity, bool disableLibDvdNav)
{
+ if (string.IsNullOrEmpty(task.Source))
+ {
+ return "No source selected";
+ }
+
string query = string.Empty;
query += SourceQuery(task, null, null, previewScanCount);
query += DestinationQuery(task);
@@ -898,19 +903,37 @@ namespace HandBrake.ApplicationServices.Utilities {
string query = string.Empty;
- if (task.x264Preset != x264Preset.None)
+ if (task.X264Preset != x264Preset.Medium)
{
- query += string.Format("--x264-preset={0} ", task.x264Preset.ToString().ToLower().Replace(" ", string.Empty));
+ query += string.Format(" --x264-preset={0} ", task.X264Preset.ToString().ToLower().Replace(" ", string.Empty));
}
- if (task.x264Profile != x264Profile.None)
+ if (task.H264Profile != x264Profile.None)
{
- query += string.Format("--x264-profile={0} ", task.x264Profile.ToString().ToLower().Replace(" ", string.Empty));
+ query += string.Format(" --x264-profile={0} ", task.H264Profile.ToString().ToLower().Replace(" ", string.Empty));
}
if (task.X264Tune != x264Tune.None)
{
- query += string.Format("--x264-tune={0} ", task.X264Tune.ToString().ToLower().Replace(" ", string.Empty));
+ string tune = string.Empty;
+
+ if (task.FastDecode)
+ {
+ tune = "fastdecode";
+ }
+
+ string tuneDropdown = task.X264Tune.ToString().ToLower().Replace(" ", string.Empty);
+ if (task.X264Tune != x264Tune.None && !string.IsNullOrEmpty(tuneDropdown))
+ {
+ tune = string.IsNullOrEmpty(tune) ? tuneDropdown : string.Format(",{0}", tuneDropdown);
+ }
+
+ query += string.Format(" --x264-tune=\"{0}\" ", tune);
+ }
+
+ if (task.H264Level != "Auto")
+ {
+ query += string.Format(" --h264-level=\"{0}\" ", task.H264Level);
}
if (!string.IsNullOrEmpty(task.AdvancedEncoderOptions))
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/QueryParserUtility.cs b/win/CS/HandBrake.ApplicationServices/Utilities/QueryParserUtility.cs index f0b5d65e3..eae37e2b5 100644 --- a/win/CS/HandBrake.ApplicationServices/Utilities/QueryParserUtility.cs +++ b/win/CS/HandBrake.ApplicationServices/Utilities/QueryParserUtility.cs @@ -91,12 +91,9 @@ namespace HandBrake.ApplicationServices.Utilities Match turboFirstPass = Regex.Match(input, @" -T");
Match optimizeMP4 = Regex.Match(input, @" -O");
Match pfr = Regex.Match(input, @" --pfr");
- Match vfr = Regex.Match(input, @" --vfr");
Match cfr = Regex.Match(input, @" --cfr");
// Audio Settings Tab
- Match noAudio = Regex.Match(input, @"-a none");
- Match audioTracks = Regex.Match(input, @"-a ([0-9,]+)");
Match audioTrackMixes = Regex.Match(input, @"-6 ([0-9a-zA-Z,]+)");
Match audioEncoders = Regex.Match(input, @"-E ([a-zA-Z0-9+,:\*]+)");
Match audioBitrates = Regex.Match(input, @"-B ([0-9a-zA-Z,]+)"); // Auto = a-z
@@ -112,9 +109,11 @@ namespace HandBrake.ApplicationServices.Utilities // Advanced Tab
Match advanced = Regex.Match(input, @"-x ([.,/a-zA-Z0-9=:-]*)");
- Match x264Preset = Regex.Match(input, @"--x264-preset([=a-zA-Z0-9\s]*)");
- Match x264Tune = Regex.Match(input, @"--x264-tune([=a-zA-Z0-9\s]*)");
- Match x264Profile = Regex.Match(input, @"--x264-profile([=a-zA-Z0-9\s]*)");
+ Match x264Preset = Regex.Match(input, @"--x264-preset([=a-zA-Z0-9\s ]*)");
+ Match x264Tune = Regex.Match(input, @"--x264-tune([=,a-zA-Z0-9\s ]*)");
+ Match h264Profile = Regex.Match(input, @"--h264-profile([=a-zA-Z0-9\s ]*)");
+ Match x264Profile = Regex.Match(input, @"--x264-profile([=a-zA-Z0-9\s ]*)");
+ Match h264Level = Regex.Match(input, @"--h264-level([=a-zA-Z0-9.\s ]*)");
#endregion
@@ -243,7 +242,6 @@ namespace HandBrake.ApplicationServices.Utilities parsed.CustomDecomb = value;
parsed.Decomb = parsed.CustomDecomb == "7:2:6:9:1:80" ? Decomb.Fast : Decomb.Custom;
}
-
}
}
@@ -364,7 +362,6 @@ namespace HandBrake.ApplicationServices.Utilities }
// Get the data from the regular expression results
- string[] trackData = null;
string[] trackMixes = null;
string[] trackEncoders = null;
string[] trackBitrates = null;
@@ -372,8 +369,6 @@ namespace HandBrake.ApplicationServices.Utilities string[] trackDRCvalues = null;
string[] trackGainValues = null;
- if (audioTracks.Success)
- trackData = audioTracks.ToString().Replace("-a ", string.Empty).Split(',');
if (audioTrackMixes.Success)
trackMixes = audioTrackMixes.ToString().Replace("-6 ", string.Empty).Split(',');
if (audioEncoders.Success)
@@ -392,9 +387,6 @@ namespace HandBrake.ApplicationServices.Utilities for (int x = 0; x < encoderCount; x++)
{
AudioTrack track = new AudioTrack();
- //if (trackData != null)
- // if (trackData.Length >= (x + 1)) // Audio Track
- // track.ScannedTrack = trackData[x].Trim();
if (trackMixes != null)
if (trackMixes.Length >= (x + 1)) // Audio Mix
@@ -457,17 +449,35 @@ namespace HandBrake.ApplicationServices.Utilities parsed.AdvancedEncoderOptions = advanced.ToString().Replace("-x ", string.Empty);
if (x264Preset.Success)
- parsed.x264Preset =
+ parsed.X264Preset =
Converters.Getx264PresetFromCli(x264Preset.ToString().Replace("--x264-preset", string.Empty).Replace("=", string.Empty).Trim());
+ if (h264Profile.Success)
+ parsed.H264Profile =
+ Converters.Getx264ProfileFromCli(h264Profile.ToString().Replace("--h264-profile", string.Empty).Replace("=", string.Empty).Trim());
+
if (x264Profile.Success)
- parsed.x264Profile =
- Converters.Getx264ProfileFromCli(x264Profile.ToString().Replace("--x264-profile", string.Empty).Replace("=", string.Empty).Trim());
+ parsed.H264Profile =
+ Converters.Getx264ProfileFromCli(x264Profile.ToString().Replace("--x264-profile", string.Empty).Replace("=", string.Empty).Trim());
+
+ if (h264Level.Success)
+ parsed.H264Level =
+ h264Level.ToString().Replace("--h264-level", string.Empty).Replace("=", string.Empty).Trim();
if (x264Tune.Success)
- parsed.X264Tune =
- Converters.Getx264TuneFromCli(x264Tune.ToString().Replace("--x264-tune", string.Empty).Replace("=", string.Empty).Trim());
+ {
+ string tuneOptions =
+ x264Tune.ToString().Replace("--x264-tune", string.Empty).Replace("=", string.Empty).Trim();
+ parsed.FastDecode = tuneOptions.Contains("fastdecode");
+
+ // Remove these options. They are not in the dropdown.
+ tuneOptions = tuneOptions.Replace("fastdecode", string.Empty).Replace(
+ ",", string.Empty);
+
+ parsed.X264Tune = Converters.Getx264TuneFromCli(tuneOptions);
+ }
+
#endregion
}
catch (Exception exc)
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/x264/x264Preset.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/x264/x264Preset.cs index d0bb915a4..f68c293e5 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/x264/x264Preset.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/x264/x264Preset.cs @@ -16,9 +16,6 @@ namespace HandBrake.Interop.Model.Encoding.x264 /// </summary>
public enum x264Preset
{
- [Display(Name = "None")]
- None = 0,
-
[Display(Name = "Ultrafast")]
Ultrafast,
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/x264/x264Profile.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/x264/x264Profile.cs index 9cbce6161..e82d772d6 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/x264/x264Profile.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/x264/x264Profile.cs @@ -16,7 +16,7 @@ namespace HandBrake.Interop.Model.Encoding.x264 /// </summary>
public enum x264Profile
{
- [Display(Name = "None")]
+ [Display(Name = "Auto")]
None = 0,
[Display(Name = "Baseline")]
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/x264/x264Tune.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/x264/x264Tune.cs index 60421cc02..1ae23c437 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/x264/x264Tune.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/x264/x264Tune.cs @@ -39,8 +39,5 @@ namespace HandBrake.Interop.Model.Encoding.x264 [Display(Name = "Fast Decode")]
Fastdecode,
-
- [Display(Name = "Zero Latency")]
- Zerolatency,
}
}
diff --git a/win/CS/HandBrakeWPF/Commands/AdvancedEncoderOptionsCommand.cs b/win/CS/HandBrakeWPF/Commands/AdvancedEncoderOptionsCommand.cs new file mode 100644 index 000000000..bb78e1c3c --- /dev/null +++ b/win/CS/HandBrakeWPF/Commands/AdvancedEncoderOptionsCommand.cs @@ -0,0 +1,40 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="AdvancedEncoderOptionsCommand.cs" company="HandBrake Project (http://handbrake.fr)">
+// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
+// </copyright>
+// <summary>
+// A Command for resetting the video / advnaced tabs encoder options.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.Commands
+{
+ using Caliburn.Micro;
+
+ using HandBrakeWPF.Commands.Interfaces;
+ using HandBrakeWPF.ViewModels.Interfaces;
+
+ /// <summary>
+ /// A Command for resetting the video / advnaced tabs encoder options.
+ /// </summary>
+ public class AdvancedEncoderOptionsCommand : IAdvancedEncoderOptionsCommand
+ {
+ /// <summary>
+ /// Clear out the advanced options
+ /// </summary>
+ public void ExecuteClearAdvanced()
+ {
+ IAdvancedViewModel advancedViewModel = IoC.Get<IAdvancedViewModel>();
+ advancedViewModel.Clear();
+ }
+
+ /// <summary>
+ /// Clear the advanced encoder options out on the video tab.
+ /// </summary>
+ public void ExecuteClearVideo()
+ {
+ IVideoViewModel videoViewModel = IoC.Get<IVideoViewModel>();
+ videoViewModel.ClearAdvancedSettings();
+ }
+ }
+}
diff --git a/win/CS/HandBrakeWPF/Commands/Interfaces/IAdvancedEncoderOptionsCommand.cs b/win/CS/HandBrakeWPF/Commands/Interfaces/IAdvancedEncoderOptionsCommand.cs new file mode 100644 index 000000000..5f0c96fb2 --- /dev/null +++ b/win/CS/HandBrakeWPF/Commands/Interfaces/IAdvancedEncoderOptionsCommand.cs @@ -0,0 +1,27 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="IAdvancedEncoderOptionsCommand.cs" company="HandBrake Project (http://handbrake.fr)">
+// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
+// </copyright>
+// <summary>
+// The AdvancedEncoderOptionsCommand interface.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.Commands.Interfaces
+{
+ /// <summary>
+ /// The AdvancedEncoderOptionsCommand interface.
+ /// </summary>
+ public interface IAdvancedEncoderOptionsCommand
+ {
+ /// <summary>
+ /// Clear out the advanced options
+ /// </summary>
+ void ExecuteClearAdvanced();
+
+ /// <summary>
+ /// Clear the advanced encoder options out on the video tab.
+ /// </summary>
+ void ExecuteClearVideo();
+ }
+}
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj index 2d6aa9896..4b3afd937 100644 --- a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj +++ b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj @@ -122,8 +122,10 @@ </ApplicationDefinition>
<Compile Include="AttachedProperties\MenuItemExtensions.cs" />
<Compile Include="Commands\CancelScanCommand.cs" />
+ <Compile Include="Commands\Interfaces\IAdvancedEncoderOptionsCommand.cs" />
<Compile Include="Commands\ProcessShortcutCommand.cs" />
<Compile Include="Commands\SourceMenuCommand.cs" />
+ <Compile Include="Commands\AdvancedEncoderOptionsCommand.cs" />
<Compile Include="Controls\Loading.xaml.cs">
<DependentUpon>Loading.xaml</DependentUpon>
</Compile>
@@ -137,6 +139,7 @@ <Compile Include="Converters\Options\OptionsTabConverter.cs" />
<Compile Include="Converters\Subtitles\SubtitlesQueueDisplayConverter.cs" />
<Compile Include="Converters\Video\VideoEncoderConverter.cs" />
+ <Compile Include="Helpers\GrayscaleImage.cs" />
<Compile Include="Helpers\GrowlCommunicator.cs" />
<Compile Include="Services\DriveDetectService.cs" />
<Compile Include="Services\EncodeServiceWrapper.cs" />
diff --git a/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs b/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs index 0978c2fca..ba0031cc6 100644 --- a/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs +++ b/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
-// Runtime Version:4.0.30319.269
+// Runtime Version:4.0.30319.296
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -285,5 +285,85 @@ namespace HandBrakeWPF.Properties { return ((System.Drawing.Bitmap)(obj));
}
}
+
+ /// <summary>
+ /// Looks up a localized string similar to Set the desired quality factor. The encoder targets a certain quality.
+ ///The scale used by each video encoder is different.
+ ///
+ ///x264's scale is logarithmic and lower values correspond to higher quality.
+ ///So small increases in value will result in progressively larger increases in the resulting file size.
+ ///A value of 0 means lossless and will result in a file size that is larger than the original source,
+ ///unless the source was also lossless.
+ ///Suggested values are: 18 to 20 for Standard Definition and 20 t [rest of string was truncated]";.
+ /// </summary>
+ public static string Video_QualitySlider {
+ get {
+ return ResourceManager.GetString("Video_QualitySlider", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The full x264 list of parameters: {0}.
+ /// </summary>
+ public static string Video_x264ExtraArgs {
+ get {
+ return ResourceManager.GetString("Video_x264ExtraArgs", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Reduce decoder CPU usage.
+ ///
+ ///Set this if your device is struggling to play the output. (i.e. dropped frames).
+ /// </summary>
+ public static string Video_x264FastDecode {
+ get {
+ return ResourceManager.GetString("Video_x264FastDecode", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Sets and ensures compliance with the specified H.264 Levels. This will override all other settings..
+ /// </summary>
+ public static string Video_x264Level {
+ get {
+ return ResourceManager.GetString("Video_x264Level", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Adjusts x264 settings to trade off compression efficiency against encoding speed.
+ ///
+ ///This establishes your default x264 settings. Tunes, profiles, levels and advanced options string will be applied to this.
+ ///
+ ///You should generally set this option to the slowest you can bear since slower settings will result in better quality or smaller files..
+ /// </summary>
+ public static string Video_x264Preset {
+ get {
+ return ResourceManager.GetString("Video_x264Preset", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Limit the H.264 profile of the output stream. This will override all other settings..
+ /// </summary>
+ public static string Video_x264Profile {
+ get {
+ return ResourceManager.GetString("Video_x264Profile", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Tune settings to optimise for common scenarios
+ ///
+ ///This can improve efficiency for particular source characteristics or set of characteristics of the output file.
+ ///
+ ///Changes will be applied after the preset but before all other parameters..
+ /// </summary>
+ public static string Video_x264Tune {
+ get {
+ return ResourceManager.GetString("Video_x264Tune", resourceCulture);
+ }
+ }
}
}
diff --git a/win/CS/HandBrakeWPF/Properties/Resources.resx b/win/CS/HandBrakeWPF/Properties/Resources.resx index 9c92427cb..6265c3fc9 100644 --- a/win/CS/HandBrakeWPF/Properties/Resources.resx +++ b/win/CS/HandBrakeWPF/Properties/Resources.resx @@ -237,4 +237,44 @@ may have problems with Weighted P-frame prediction: the Apple TV is completely i <data name="logo64" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\logo64.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
+ <data name="Video_x264ExtraArgs" xml:space="preserve">
+ <value>The full x264 list of parameters: {0}</value>
+ </data>
+ <data name="Video_x264FastDecode" xml:space="preserve">
+ <value>Reduce decoder CPU usage.
+
+Set this if your device is struggling to play the output. (i.e. dropped frames)</value>
+ </data>
+ <data name="Video_x264Level" xml:space="preserve">
+ <value>Sets and ensures compliance with the specified H.264 Levels. This will override all other settings.</value>
+ </data>
+ <data name="Video_x264Preset" xml:space="preserve">
+ <value>Adjusts x264 settings to trade off compression efficiency against encoding speed.
+
+This establishes your default x264 settings. Tunes, profiles, levels and advanced options string will be applied to this.
+
+You should generally set this option to the slowest you can bear since slower settings will result in better quality or smaller files.</value>
+ </data>
+ <data name="Video_x264Profile" xml:space="preserve">
+ <value>Limit the H.264 profile of the output stream. This will override all other settings.</value>
+ </data>
+ <data name="Video_x264Tune" xml:space="preserve">
+ <value>Tune settings to optimise for common scenarios
+
+This can improve efficiency for particular source characteristics or set of characteristics of the output file.
+
+Changes will be applied after the preset but before all other parameters.</value>
+ </data>
+ <data name="Video_QualitySlider" xml:space="preserve">
+ <value>Set the desired quality factor. The encoder targets a certain quality.
+The scale used by each video encoder is different.
+
+x264's scale is logarithmic and lower values correspond to higher quality.
+So small increases in value will result in progressively larger increases in the resulting file size.
+A value of 0 means lossless and will result in a file size that is larger than the original source,
+unless the source was also lossless.
+Suggested values are: 18 to 20 for Standard Definition and 20 to 23 for High Definition.
+
+FFMpeg's and Theora's scale is more linear. These encoders do not have a lossless mode.</value>
+ </data>
</root>
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs b/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs index 24666874c..5b06c97ba 100644 --- a/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs +++ b/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs @@ -23,6 +23,9 @@ namespace HandBrakeWPF.Startup using HandBrake.ApplicationServices;
using HandBrake.ApplicationServices.Services.Interfaces;
+ using HandBrakeWPF.Commands;
+ using HandBrakeWPF.Commands.Interfaces;
+
using ViewModels;
using ViewModels.Interfaces;
@@ -59,6 +62,9 @@ namespace HandBrakeWPF.Startup this.windsorContainer.Register(Component.For<IEncodeServiceWrapper>().ImplementedBy<EncodeServiceWrapper>().LifeStyle.Is(LifestyleType.Singleton));
this.windsorContainer.Register(Component.For<INotificationService>().ImplementedBy<NotificationService>().LifeStyle.Is(LifestyleType.Singleton));
+ // Commands
+ this.windsorContainer.Register(Component.For<IAdvancedEncoderOptionsCommand>().ImplementedBy<AdvancedEncoderOptionsCommand>().LifeStyle.Is(LifestyleType.Singleton));
+
// Shell
this.windsorContainer.Register(Component.For<IErrorService>().ImplementedBy<ErrorService>().LifeStyle.Is(LifestyleType.Singleton));
this.windsorContainer.Register(Component.For<IErrorViewModel>().ImplementedBy<ErrorViewModel>().LifeStyle.Is(LifestyleType.Singleton));
diff --git a/win/CS/HandBrakeWPF/UserSettingConstants.cs b/win/CS/HandBrakeWPF/UserSettingConstants.cs index fb35f0cdb..01fcea409 100644 --- a/win/CS/HandBrakeWPF/UserSettingConstants.cs +++ b/win/CS/HandBrakeWPF/UserSettingConstants.cs @@ -211,6 +211,11 @@ namespace HandBrakeWPF /// </summary>
public const string HandBrakePlatform = "HandBrakePlatform";
+ /// <summary>
+ /// The show advanced tab.
+ /// </summary>
+ public const string ShowAdvancedTab = "ShowAdvancedTab";
+
#endregion
}
}
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs index 8e3c13e37..29b4bed48 100644 --- a/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs @@ -18,6 +18,7 @@ namespace HandBrakeWPF.ViewModels using HandBrake.ApplicationServices.Parsing;
using HandBrake.Interop.Model.Encoding;
+ using HandBrakeWPF.Commands.Interfaces;
using HandBrakeWPF.Helpers;
using HandBrakeWPF.Model;
using HandBrakeWPF.ViewModels.Interfaces;
@@ -27,6 +28,11 @@ namespace HandBrakeWPF.ViewModels /// </summary>
public class AdvancedViewModel : ViewModelBase, IAdvancedViewModel
{
+ /// <summary>
+ /// The advanced encoder options command.
+ /// </summary>
+ private readonly IAdvancedEncoderOptionsCommand advancedEncoderOptionsCommand;
+
#region Constants and Fields
/// <summary>
@@ -166,8 +172,9 @@ namespace HandBrakeWPF.ViewModels /// <summary>
/// Initializes a new instance of the <see cref="AdvancedViewModel"/> class.
/// </summary>
- public AdvancedViewModel()
+ public AdvancedViewModel(IAdvancedEncoderOptionsCommand advancedEncoderOptionsCommand)
{
+ this.advancedEncoderOptionsCommand = advancedEncoderOptionsCommand;
this.Task = new EncodeTask();
this.UpdateUIFromAdvancedOptions();
}
@@ -243,6 +250,12 @@ namespace HandBrakeWPF.ViewModels this.Task.AdvancedEncoderOptions = value;
this.UpdateUIFromAdvancedOptions();
this.NotifyOfPropertyChange(() => this.AdvancedOptionsString);
+
+ // Reset the video tab if the user is using this tab.
+ if (!string.IsNullOrEmpty(this.Task.AdvancedEncoderOptions))
+ {
+ this.advancedEncoderOptionsCommand.ExecuteClearVideo();
+ }
}
}
@@ -631,14 +644,6 @@ namespace HandBrakeWPF.ViewModels #region Public Methods
/// <summary>
- /// The notify all changed.
- /// </summary>
- public void NotifyAllChanged()
- {
- this.NotifyOfPropertyChange(() => this.AdvancedOptionsString);
- }
-
- /// <summary>
/// The update ui from advanced options.
/// </summary>
public void UpdateUIFromAdvancedOptions()
@@ -885,8 +890,6 @@ namespace HandBrakeWPF.ViewModels }
break;
- default:
- break;
}
}
}
@@ -933,6 +936,14 @@ namespace HandBrakeWPF.ViewModels }
}
+ /// <summary>
+ /// The clear.
+ /// </summary>
+ public void Clear()
+ {
+ this.AdvancedOptionsString = string.Empty;
+ }
+
#endregion
#region ITabInterface
@@ -1042,7 +1053,7 @@ namespace HandBrakeWPF.ViewModels int equalsIndex = existingSegment.IndexOf('=');
if (equalsIndex >= 0)
{
- optionName = existingSegment.Substring(0, existingSegment.IndexOf("="));
+ optionName = existingSegment.Substring(0, existingSegment.IndexOf("=", System.StringComparison.Ordinal));
}
if (!this.uiOptions.Contains(optionName) && optionName != string.Empty)
@@ -1154,6 +1165,12 @@ namespace HandBrakeWPF.ViewModels this.Task.AdvancedEncoderOptions = string.Join(":", newOptions);
this.NotifyOfPropertyChange(() => this.AdvancedOptionsString);
+
+ // Reset the video tab if the user is using this tab.
+ if (!string.IsNullOrEmpty(this.Task.AdvancedEncoderOptions))
+ {
+ this.advancedEncoderOptionsCommand.ExecuteClearVideo();
+ }
}
#endregion
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAdvancedViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAdvancedViewModel.cs index 9114bea32..a84a79f6a 100644 --- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAdvancedViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAdvancedViewModel.cs @@ -23,5 +23,10 @@ namespace HandBrakeWPF.ViewModels.Interfaces /// The Video Encoder.
/// </param>
void SetEncoder(VideoEncoder encoder);
+
+ /// <summary>
+ /// Clear out the settings.
+ /// </summary>
+ void Clear();
}
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IVideoViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IVideoViewModel.cs index d3b162501..d3602e5e5 100644 --- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IVideoViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IVideoViewModel.cs @@ -18,5 +18,10 @@ namespace HandBrakeWPF.ViewModels.Interfaces /// Trigger a Notify Property Changed on the Task to force various UI elements to update.
/// </summary>
void RefreshTask();
+
+ /// <summary>
+ /// Clear the advanced x264 options.
+ /// </summary>
+ void ClearAdvancedSettings();
}
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index 6577dfc5c..fee34fcb7 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -621,10 +621,6 @@ namespace HandBrakeWPF.ViewModels /// </summary>
public CancelScanCommand CancelScanCommand { get; set; }
- #endregion
-
- #region Properties for Settings
-
/// <summary>
/// Gets or sets Destination.
/// </summary>
@@ -820,6 +816,17 @@ namespace HandBrakeWPF.ViewModels }
}
+ /// <summary>
+ /// Gets a value indicating whether show advanced tab.
+ /// </summary>
+ public bool ShowAdvancedTab
+ {
+ get
+ {
+ return this.userSettingService.GetUserSetting<bool>(UserSettingConstants.ShowAdvancedTab);
+ }
+ }
+
#endregion
#region Load and Shutdown Handling
diff --git a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs index 273a2f6d5..82c0daa3c 100644 --- a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs @@ -19,10 +19,7 @@ namespace HandBrakeWPF.ViewModels using System.Linq;
using System.Windows;
- using Caliburn.Micro;
-
using HandBrake.ApplicationServices;
- using HandBrake.ApplicationServices.Exceptions;
using HandBrake.ApplicationServices.Services.Interfaces;
using HandBrake.ApplicationServices.Utilities;
@@ -354,6 +351,11 @@ namespace HandBrakeWPF.ViewModels /// </summary>
private bool enableLibHb;
+ /// <summary>
+ /// The show advanced tab backing field.
+ /// </summary>
+ private bool showAdvancedTab;
+
#endregion
#region Constructors and Destructors
@@ -1373,6 +1375,22 @@ namespace HandBrakeWPF.ViewModels }
}
+ /// <summary>
+ /// Gets or sets a value indicating whether enable lib hb.
+ /// </summary>
+ public bool ShowAdvancedTab
+ {
+ get
+ {
+ return this.showAdvancedTab;
+ }
+ set
+ {
+ this.showAdvancedTab = value;
+ this.NotifyOfPropertyChange(() => this.ShowAdvancedTab);
+ }
+ }
+
#endregion
#endregion
@@ -1638,6 +1656,7 @@ namespace HandBrakeWPF.ViewModels this.MinimiseToTray = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.MainWindowMinimize);
this.DisablePresetUpdateCheckNotification = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.PresetNotification);
this.ClearQueueOnEncodeCompleted = userSettingService.GetUserSetting<bool>(ASUserSettingConstants.ClearCompletedFromQueue);
+ this.ShowAdvancedTab = userSettingService.GetUserSetting<bool>(UserSettingConstants.ShowAdvancedTab);
// Set the preview count
this.PreviewPicturesToScan.Clear();
@@ -1653,7 +1672,6 @@ namespace HandBrakeWPF.ViewModels this.ConstantQualityGranularity.Add("1.00");
this.ConstantQualityGranularity.Add("0.50");
this.ConstantQualityGranularity.Add("0.25");
- this.ConstantQualityGranularity.Add("0.20");
this.SelectedGranulairty = userSettingService.GetUserSetting<double>(UserSettingConstants.X264Step).ToString("0.00", CultureInfo.InvariantCulture);
// Min Title Length
@@ -1873,6 +1891,7 @@ namespace HandBrakeWPF.ViewModels userSettingService.SetUserSetting(ASUserSettingConstants.ClearCompletedFromQueue, this.ClearQueueOnEncodeCompleted);
userSettingService.SetUserSetting(ASUserSettingConstants.PreviewScanCount, this.SelectedPreviewCount);
userSettingService.SetUserSetting(UserSettingConstants.X264Step, double.Parse(this.SelectedGranulairty, CultureInfo.InvariantCulture));
+ userSettingService.SetUserSetting(UserSettingConstants.ShowAdvancedTab, this.ShowAdvancedTab);
int value;
if (int.TryParse(this.MinLength.ToString(CultureInfo.InvariantCulture), out value))
diff --git a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs index dba17ea7a..c4acd7fa8 100644 --- a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs @@ -11,7 +11,9 @@ namespace HandBrakeWPF.ViewModels {
using System;
using System.Collections.Generic;
+ using System.ComponentModel;
using System.Globalization;
+ using System.Linq;
using Caliburn.Micro;
@@ -20,8 +22,13 @@ namespace HandBrakeWPF.ViewModels using HandBrake.ApplicationServices.Parsing;
using HandBrake.ApplicationServices.Services.Interfaces;
using HandBrake.ApplicationServices.Utilities;
+ using HandBrake.Interop;
+ using HandBrake.Interop.HbLib;
using HandBrake.Interop.Model.Encoding;
+ using HandBrake.Interop.Model.Encoding.x264;
+ using HandBrakeWPF.Commands.Interfaces;
+ using HandBrakeWPF.Properties;
using HandBrakeWPF.ViewModels.Interfaces;
/// <summary>
@@ -30,16 +37,25 @@ namespace HandBrakeWPF.ViewModels public class VideoViewModel : ViewModelBase, IVideoViewModel
{
#region Constants and Fields
-
/// <summary>
/// Same as source constant.
/// </summary>
private const string SameAsSource = "Same as source";
/// <summary>
+ /// The possible h264 levels.
+ /// </summary>
+ private static readonly List<string> Levels = new List<string> { "Auto", "1.0", "1b", "1.1", "1.2", "1.3", "2.0", "2.1", "2.2", "3.0", "3.1", "3.2", "4.0", "4.1", "4.2", "5.0", "5.1", "5.2"};
+
+ /// <summary>
/// Backing field for the user setting service.
/// </summary>
- private IUserSettingService userSettingService;
+ private readonly IUserSettingService userSettingService;
+
+ /// <summary>
+ /// The advanced encoder options command
+ /// </summary>
+ private readonly IAdvancedEncoderOptionsCommand advancedEncoderOptionsCommand;
/// <summary>
/// Backing field used to display / hide the x264 options
@@ -66,6 +82,21 @@ namespace HandBrakeWPF.ViewModels /// </summary>
private int rf;
+ /// <summary>
+ /// The x264 preset value.
+ /// </summary>
+ private int x264PresetValue;
+
+ /// <summary>
+ /// The extra arguments.
+ /// </summary>
+ private string extraArguments;
+
+ /// <summary>
+ /// The can clear tracker.
+ /// </summary>
+ private bool canClear;
+
#endregion
#region Constructors and Destructors
@@ -73,24 +104,26 @@ namespace HandBrakeWPF.ViewModels /// <summary>
/// Initializes a new instance of the <see cref="VideoViewModel"/> class.
/// </summary>
- /// <param name="windowManager">
- /// The window manager.
- /// </param>
/// <param name="userSettingService">
/// The user Setting Service.
/// </param>
- public VideoViewModel(IWindowManager windowManager, IUserSettingService userSettingService)
+ /// <param name="advancedEncoderOptionsCommand">
+ /// The advanced Encoder Options Command.
+ /// </param>
+ public VideoViewModel(IUserSettingService userSettingService, IAdvancedEncoderOptionsCommand advancedEncoderOptionsCommand)
{
this.Task = new EncodeTask { VideoEncoder = VideoEncoder.X264 };
this.userSettingService = userSettingService;
+ this.advancedEncoderOptionsCommand = advancedEncoderOptionsCommand;
this.QualityMin = 0;
this.QualityMax = 51;
this.IsConstantQuantity = true;
this.VideoEncoders = EnumHelper<VideoEncoder>.GetEnumList();
- //X264Presets = EnumHelper<x264Preset>.GetEnumList();
- //X264Profiles = EnumHelper<x264Profile>.GetEnumList();
- //X264Tunes = EnumHelper<x264Tune>.GetEnumList();
+ X264Presets = new BindingList<x264Preset>(EnumHelper<x264Preset>.GetEnumList().ToList());
+ H264Profiles = EnumHelper<x264Profile>.GetEnumList();
+ X264Tunes = EnumHelper<x264Tune>.GetEnumList().Where(t => t != x264Tune.Fastdecode);
+ this.H264Levels = Levels;
}
#endregion
@@ -259,7 +292,7 @@ namespace HandBrakeWPF.ViewModels this.rf = value;
double cqStep = userSettingService.GetUserSetting<double>(UserSettingConstants.X264Step);
- this.SetQualitySliderBounds();
+ this.SetQualitySliderBounds();
switch (this.SelectedVideoEncoder)
{
case VideoEncoder.FFMpeg:
@@ -379,6 +412,193 @@ namespace HandBrakeWPF.ViewModels /// </summary>
public IEnumerable<VideoEncoder> VideoEncoders { get; set; }
+ /// <summary>
+ /// Gets or sets the extra arguments.
+ /// </summary>
+ public string ExtraArguments
+ {
+ get
+ {
+ return this.extraArguments;
+ }
+ set
+ {
+ if (!object.Equals(this.extraArguments, value))
+ {
+ this.extraArguments = value;
+ this.NotifyOfPropertyChange(() => this.ExtraArguments);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether display x 264 options.
+ /// </summary>
+ public bool DisplayX264Options
+ {
+ get
+ {
+ return this.displayX264Options;
+ }
+ set
+ {
+ this.displayX264Options = value;
+ this.NotifyOfPropertyChange(() => this.DisplayX264Options);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the x 264 preset value.
+ /// </summary>
+ public int X264PresetValue
+ {
+ get
+ {
+ return this.x264PresetValue;
+ }
+ set
+ {
+ if (!object.Equals(this.X264PresetValue, value))
+ {
+ this.x264PresetValue = value;
+ this.X264Preset = this.X264Presets[value];
+ this.NotifyOfPropertyChange(() => this.x264PresetValue);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets X264Preset.
+ /// </summary>
+ public x264Preset X264Preset
+ {
+ get
+ {
+ return this.Task.X264Preset;
+ }
+ set
+ {
+ if (!object.Equals(this.X264Preset, value))
+ {
+ this.Task.X264Preset = value;
+ this.NotifyOfPropertyChange(() => this.X264Preset);
+ ResetAdvancedTab();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets H264Profile.
+ /// </summary>
+ public x264Profile H264Profile
+ {
+ get
+ {
+ return this.Task.H264Profile;
+ }
+
+ set
+ {
+ if (!object.Equals(this.H264Profile, value))
+ {
+ this.Task.H264Profile = value;
+ this.NotifyOfPropertyChange(() => this.H264Profile);
+ ResetAdvancedTab();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets H264Profile.
+ /// </summary>
+ public string H264Level
+ {
+ get
+ {
+ return this.Task.H264Level;
+ }
+ set
+ {
+ if (!object.Equals(this.H264Level, value))
+ {
+ this.Task.H264Level = value;
+ this.NotifyOfPropertyChange(() => this.H264Level);
+ ResetAdvancedTab();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets X264Tune.
+ /// </summary>
+ public x264Tune X264Tune
+ {
+ get
+ {
+ return this.Task.X264Tune;
+ }
+ set
+ {
+ if (!object.Equals(this.X264Tune, value))
+ {
+ this.Task.X264Tune = value;
+ this.NotifyOfPropertyChange(() => this.X264Tune);
+ ResetAdvancedTab();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether fast decode.
+ /// </summary>
+ public bool FastDecode
+ {
+ get
+ {
+ return this.Task.FastDecode;
+ }
+ set
+ {
+ if (!object.Equals(this.FastDecode, value))
+ {
+ this.Task.FastDecode = value;
+ this.NotifyOfPropertyChange(() => this.FastDecode);
+ ResetAdvancedTab();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets X264Presets.
+ /// </summary>
+ public BindingList<x264Preset> X264Presets { get; set; }
+
+ /// <summary>
+ /// Gets or sets X264Profiles.
+ /// </summary>
+ public IEnumerable<x264Profile> H264Profiles { get; set; }
+
+ /// <summary>
+ /// Gets or sets X264Tunes.
+ /// </summary>
+ public IEnumerable<x264Tune> X264Tunes { get; set; }
+
+ /// <summary>
+ /// Gets or sets the x 264 levels.
+ /// </summary>
+ public IEnumerable<string> H264Levels { get; set; }
+
+ /// <summary>
+ /// Gets the full options tooltip.
+ /// </summary>
+ public string FullOptionsTooltip
+ {
+ get
+ {
+ return "You can provide additional arguments using the standard x264 format"; // string.Format(Resources.Video_x264ExtraArgs, this.GetActualx264Query());
+ }
+ }
+
#endregion
#region Public Methods
@@ -444,15 +664,15 @@ namespace HandBrakeWPF.ViewModels {
case VideoEncoder.FFMpeg:
case VideoEncoder.FFMpeg2:
- int cq;
if (preset.Task.Quality.HasValue)
{
+ int cq;
int.TryParse(preset.Task.Quality.Value.ToString(CultureInfo.InvariantCulture), out cq);
this.RF = 32 - cq;
}
break;
case VideoEncoder.X264:
-
+
double multiplier = 1.0 / cqStep;
if (preset.Task.Quality.HasValue)
{
@@ -477,15 +697,16 @@ namespace HandBrakeWPF.ViewModels this.NotifyOfPropertyChange(() => this.Task);
- //if (preset != null && preset.Task != null)
- //{
- // this.Query = preset.Task.AdvancedEncoderOptions;
- // this.SetEncoder(preset.Task.VideoEncoder);
-
- // this.X264Preset = preset.Task.x264Preset;
- // this.X264Profile = preset.Task.x264Profile;
- // this.X264Tune = preset.Task.X264Tune;
- //}
+ if (preset.Task != null)
+ {
+ this.SetEncoder(preset.Task.VideoEncoder);
+ this.X264PresetValue = preset.Task.VideoEncoder == VideoEncoder.X264
+ ? (int)preset.Task.X264Preset
+ : (int)x264Preset.Medium;
+ this.H264Profile = preset.Task.VideoEncoder == VideoEncoder.X264 ? preset.Task.H264Profile : x264Profile.None;
+ this.X264Tune = preset.Task.VideoEncoder == VideoEncoder.X264 ? preset.Task.X264Tune : x264Tune.None;
+ this.H264Level = preset.Task.H264Level;
+ }
}
/// <summary>
@@ -518,7 +739,7 @@ namespace HandBrakeWPF.ViewModels /// </param>
public void SetEncoder(VideoEncoder encoder)
{
- //this.DisplayX264Options = encoder == VideoEncoder.X264;
+ this.DisplayX264Options = encoder == VideoEncoder.X264;
}
/// <summary>
@@ -534,6 +755,21 @@ namespace HandBrakeWPF.ViewModels }
}
+ /// <summary>
+ /// Clear advanced settings.
+ /// </summary>
+ public void ClearAdvancedSettings()
+ {
+ this.canClear = false;
+ this.X264PresetValue = 5;
+ this.X264Tune = x264Tune.None;
+ this.H264Profile = x264Profile.None;
+ this.FastDecode = false;
+ this.H264Level = "Auto";
+ this.ExtraArguments = string.Empty;
+ this.canClear = true;
+ }
+
#endregion
/// <summary>
@@ -561,101 +797,44 @@ namespace HandBrakeWPF.ViewModels }
}
- #region Advanced
- ///// <summary>
- ///// Gets or sets State.
- ///// </summary>
- //public string Query
- //{
- // get
- // {
- // return this.Task.AdvancedEncoderOptions;
- // }
- // set
- // {
- // this.Task.AdvancedEncoderOptions = value;
- // this.NotifyOfPropertyChange(() => this.Query);
- // }
- //}
-
- ///// <summary>
- ///// Gets or sets X264Preset.
- ///// </summary>
- //public x264Preset X264Preset
- //{
- // get
- // {
- // return this.Task.x264Preset;
- // }
- // set
- // {
- // this.Task.x264Preset = value;
- // this.NotifyOfPropertyChange(() => this.X264Preset);
- // }
- //}
-
- ///// <summary>
- ///// Gets or sets X264Profile.
- ///// </summary>
- //public x264Profile X264Profile
- //{
- // get
- // {
- // return this.Task.x264Profile;
- // }
- // set
- // {
- // this.Task.x264Profile = value;
- // this.NotifyOfPropertyChange(() => this.X264Profile);
- // }
- //}
-
- ///// <summary>
- ///// Gets or sets X264Tune.
- ///// </summary>
- //public x264Tune X264Tune
- //{
- // get
- // {
- // return this.Task.X264Tune;
- // }
- // set
- // {
- // this.Task.X264Tune = value;
- // this.NotifyOfPropertyChange(() => this.X264Tune);
- // }
- //}
-
- ///// <summary>
- ///// Gets or sets X264Presets.
- ///// </summary>
- //public IEnumerable<x264Preset> X264Presets { get; set; }
-
- ///// <summary>
- ///// Gets or sets X264Profiles.
- ///// </summary>
- //public IEnumerable<x264Profile> X264Profiles { get; set; }
-
- ///// <summary>
- ///// Gets or sets X264Tunes.
- ///// </summary>
- //public IEnumerable<x264Tune> X264Tunes { get; set; }
-
- ///// <summary>
- ///// Gets or sets a value indicating whether DisplayX264Options.
- ///// </summary>
- //public bool DisplayX264Options
- //{
- // get
- // {
- // return this.displayX264Options;
- // }
- // set
- // {
- // this.displayX264Options = value;
- // this.NotifyOfPropertyChange(() => this.DisplayX264Options);
- // }
- //}
- #endregion
+ /// <summary>
+ /// Reset advanced tab.
+ /// </summary>
+ private void ResetAdvancedTab()
+ {
+ if (canClear)
+ {
+ this.advancedEncoderOptionsCommand.ExecuteClearAdvanced();
+ }
+ }
+
+ /// <summary>
+ /// The get actualx 264 query.
+ /// </summary>
+ /// <returns>
+ /// The <see cref="string"/>.
+ /// </returns>
+ private string GetActualx264Query()
+ {
+ string preset = EnumHelper<x264Preset>.GetDisplay(this.X264Preset);
+ string profile = EnumHelper<x264Profile>.GetDisplay(this.H264Profile);
+
+ List<string> tunes = new List<string>();
+ if (X264Tune != x264Tune.None)
+ {
+ tunes.Add(EnumHelper<x264Tune>.GetDisplay(this.X264Tune));
+ }
+ if (this.FastDecode)
+ {
+ tunes.Add("fastdecode");
+ }
+
+ // Get the width or height, default if we don't have it yet so we don't crash.
+ int width = this.Task.Width.HasValue ? this.Task.Width.Value : 720;
+ int height = this.Task.Height.HasValue ? this.Task.Height.Value : 576;
+
+ // TODO figure out what is wrong with this??
+ return HandBrakeUtils.CreateX264OptionsString(preset, tunes, this.ExtraArguments, profile, this.H264Level, width, height);
+ }
}
}
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/Views/MainView.xaml b/win/CS/HandBrakeWPF/Views/MainView.xaml index 5bed28974..76dbf7872 100644 --- a/win/CS/HandBrakeWPF/Views/MainView.xaml +++ b/win/CS/HandBrakeWPF/Views/MainView.xaml @@ -486,7 +486,7 @@ <TabItem Name="pictureTab" Header="Picture">
<ContentControl x:Name="PictureSettingsViewModel" />
</TabItem>
- <TabItem Name="filtersTab" Header="Video Filters">
+ <TabItem Name="filtersTab" Header="Filters">
<ContentControl x:Name="FiltersViewModel" />
</TabItem>
<TabItem Name="videoTab" Header="Video">
@@ -501,7 +501,7 @@ <TabItem Name="chaptersTab" Header="Chapters">
<ContentControl x:Name="ChaptersViewModel" />
</TabItem>
- <TabItem Name="advancedTab" Header="Advanced">
+ <TabItem Name="advancedTab" Header="Advanced" Visibility="{Binding ShowAdvancedTab, Converter={StaticResource boolToVisConverter}}">
<ContentControl x:Name="AdvancedViewModel" />
</TabItem>
</TabControl>
diff --git a/win/CS/HandBrakeWPF/Views/OptionsView.xaml b/win/CS/HandBrakeWPF/Views/OptionsView.xaml index 2f3213a7f..c5d5d3e60 100644 --- a/win/CS/HandBrakeWPF/Views/OptionsView.xaml +++ b/win/CS/HandBrakeWPF/Views/OptionsView.xaml @@ -279,6 +279,7 @@ <CheckBox Content="Display status messages from tray icon (balloon popups)" Visibility="Collapsed" IsChecked="{Binding DisplayStatusMessagesTrayIcon}" />
<CheckBox Content="Disable built-in preset update notification" IsChecked="{Binding DisablePresetUpdateCheckNotification}" />
<CheckBox Content="Always clear completed queue items after an encode completes" IsChecked="{Binding ClearQueueOnEncodeCompleted}" />
+ <CheckBox Content="Show Advanced Tab" IsChecked="{Binding ShowAdvancedTab}" />
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
<TextBlock Text="Number of picture previews to scan:" VerticalAlignment="Center" Width="250" />
<ComboBox Name="numberOfPreviews" ItemsSource="{Binding PreviewPicturesToScan}" SelectedItem="{Binding SelectedPreviewCount}" Width="120" />
diff --git a/win/CS/HandBrakeWPF/Views/VideoView.xaml b/win/CS/HandBrakeWPF/Views/VideoView.xaml index 27f2a2f30..ffc027786 100644 --- a/win/CS/HandBrakeWPF/Views/VideoView.xaml +++ b/win/CS/HandBrakeWPF/Views/VideoView.xaml @@ -4,13 +4,18 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:Converters="clr-namespace:HandBrakeWPF.Converters"
- xmlns:Video="clr-namespace:HandBrakeWPF.Converters.Video" mc:Ignorable="d" >
+ xmlns:Video="clr-namespace:HandBrakeWPF.Converters.Video"
+ xmlns:Properties="clr-namespace:HandBrakeWPF.Properties" mc:Ignorable="d" >
<UserControl.Resources>
<Converters:BooleanConverter x:Key="boolConverter" />
<Converters:BooleanToVisibilityConverter x:Key="boolToVisConverter" />
<Converters:EnumComboConverter x:Key="enumComboConverter" />
<Video:VideoEncoderConverter x:Key="videoEncoderConverter" />
+
+ <Style x:Key="LongToolTipHolder" TargetType="FrameworkElement">
+ <Setter Property="ToolTipService.ShowDuration" Value="20000" />
+ </Style>
</UserControl.Resources>
<Grid Margin="10,5,0,0">
@@ -25,6 +30,11 @@ <ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
+
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ </Grid.RowDefinitions>
<StackPanel Orientation="Vertical" Grid.Column="0" >
@@ -54,8 +64,10 @@ <StackPanel Orientation="Vertical">
<ComboBox Width="120" ItemsSource="{Binding Framerates}" SelectedItem="{Binding SelectedFramerate}" />
<RadioButton Content="Constant Framerate" IsChecked="{Binding IsConstantFramerate}" Margin="0,10,0,0" />
- <RadioButton Content="Variable Framerate" IsChecked="{Binding IsVariableFramerate}" Visibility="{Binding ShowPeakFramerate, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}" />
- <RadioButton Content="Peak Framerate" IsChecked="{Binding IsPeakFramerate}" Visibility="{Binding ShowPeakFramerate, Converter={StaticResource boolToVisConverter}, ConverterParameter=false}" />
+ <RadioButton Content="Variable Framerate" IsChecked="{Binding IsVariableFramerate}" Margin="0,5,0,0"
+ Visibility="{Binding ShowPeakFramerate, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}" />
+ <RadioButton Content="Peak Framerate" IsChecked="{Binding IsPeakFramerate}" Margin="0,5,0,0"
+ Visibility="{Binding ShowPeakFramerate, Converter={StaticResource boolToVisConverter}, ConverterParameter=false}" />
</StackPanel>
</StackPanel>
</StackPanel>
@@ -70,8 +82,10 @@ <TextBlock Text="RF" FontWeight="Bold" />
</StackPanel>
- <Slider Width="240" Value="{Binding RF}" Maximum="{Binding QualityMax}" Minimum="{Binding QualityMin}"
- IsEnabled="{Binding IsConstantQuantity}" Margin="0,0,0,20" />
+ <Slider Width="280" Value="{Binding RF}" HorizontalAlignment="Left" Maximum="{Binding QualityMax}" Minimum="{Binding QualityMin}"
+ IsEnabled="{Binding IsConstantQuantity}" Margin="20,0,0,20"
+ ToolTip="{x:Static Properties:Resources.Video_QualitySlider}" Style="{StaticResource LongToolTipHolder}"
+ IsSnapToTickEnabled="True" TickFrequency="1" TickPlacement="BottomRight" />
<StackPanel Orientation="Horizontal" Margin="0,0,0,10">
<RadioButton Content="Avg Bitrate (kbps):" IsChecked="{Binding IsConstantQuantity, Converter={StaticResource boolConverter}, ConverterParameter=true}" Margin="0,0,10,0"/>
@@ -87,46 +101,67 @@ </StackPanel>
-
- <!--<Grid Grid.Row="1" Margin="10,10,0,0" Visibility="{Binding DisplayX264Options, Converter={StaticResource boolToVisConverter}}">
+ <!-- H264 settings -->
+ <Grid Grid.Row="1" Grid.ColumnSpan="2" Margin="0,20,0,0" Visibility="{Binding DisplayX264Options, Converter={StaticResource boolToVisConverter}}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
-
- <StackPanel Grid.Row="0" Orientation="Vertical" Margin="0,0,0,10">
-
- <TextBlock Text="X264 Advanced Options:" Margin="0,0,0,5" FontWeight="Bold" VerticalAlignment="Center" />
-
- <StackPanel Grid.Row="1" Orientation="Horizontal" Margin="0,0,0,10">
- <TextBlock Text="Preset:" VerticalAlignment="Center" />
- <ComboBox Width="100" Grid.Column="3" Margin="5,0,5,0" Height="22"
- ItemsSource="{Binding X264Presets, Converter={StaticResource x264DisplayConverter}}"
- SelectedItem="{Binding X264Preset, Converter={StaticResource x264DisplayConverter}}"/>
-
- <TextBlock Text="Profile:" VerticalAlignment="Center" />
- <ComboBox Width="100" Grid.Column="3" Margin="5,0,5,0" Height="22"
- ItemsSource="{Binding X264Profiles, Converter={StaticResource x264DisplayConverter}}"
- SelectedItem="{Binding X264Profile, Converter={StaticResource x264DisplayConverter}}"/>
-
-
- <TextBlock Text="Tune:" VerticalAlignment="Center" />
- <ComboBox Width="100" Grid.Column="3" Margin="5,0,5,0" Height="22"
- ItemsSource="{Binding X264Tunes, Converter={StaticResource x264DisplayConverter}}"
- SelectedItem="{Binding X264Tune, Converter={StaticResource x264DisplayConverter}}"/>
- </StackPanel>
+
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="Auto" />
+ </Grid.ColumnDefinitions>
+
+ <TextBlock Text="Optimise Video:" Margin="0,0,0,8" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" FontWeight="Bold" VerticalAlignment="Center" />
+
+ <!-- Row 1 -->
+ <TextBlock Text="x264 Preset:" Grid.Row="1" Grid.Column="0" VerticalAlignment="Center" />
+ <StackPanel Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3" Orientation="Horizontal">
+ <Slider Minimum="0" Maximum="9" Width="150" Value="{Binding X264PresetValue, Mode=Default, UpdateSourceTrigger=PropertyChanged}"
+ IsSnapToTickEnabled="True" TickFrequency="1" TickPlacement="BottomRight" ToolTip="{x:Static Properties:Resources.Video_x264Preset}"
+ Style="{StaticResource LongToolTipHolder}" />
+ <TextBlock Text="{Binding X264Preset, Converter={StaticResource enumComboConverter}}" Margin="5,0,0,0" />
</StackPanel>
+ <TextBlock Text="x264 Tune:" Grid.Row="2" Grid.Column="0" VerticalAlignment="Center" Margin="0,10,0,0" />
+ <ComboBox Width="100" Grid.Row="2" Grid.Column="1" Margin="5,10,5,0" Height="22"
+ ItemsSource="{Binding X264Tunes, Converter={StaticResource enumComboConverter}}"
+ SelectedItem="{Binding X264Tune, Converter={StaticResource enumComboConverter}}"
+ ToolTip="{x:Static Properties:Resources.Video_x264Tune}"
+ Style="{StaticResource LongToolTipHolder}" />
+ <CheckBox IsChecked="{Binding FastDecode}" Content="Fast Decode" Grid.Row="2" Grid.Column="2" Margin="10,10,10,0" VerticalAlignment="Center"
+ ToolTip="{x:Static Properties:Resources.Video_x264FastDecode}"/>
+
+
+ <!-- Row 2-->
+ <TextBlock Text="H.264 Profile:" Grid.Row="3" Grid.Column="0" Margin="0,10,0,0" VerticalAlignment="Center" />
+ <ComboBox Width="100" Grid.Row="3" Grid.Column="1" Margin="5,10,5,0" Height="22" VerticalAlignment="Center"
+ ItemsSource="{Binding H264Profiles, Converter={StaticResource enumComboConverter}}"
+ SelectedItem="{Binding H264Profile, Converter={StaticResource enumComboConverter}}"
+ Style="{StaticResource LongToolTipHolder}"
+ ToolTip="{x:Static Properties:Resources.Video_x264Profile}" />
+
+ <TextBlock Text="H.264 Level:" Grid.Row="3" Grid.Column="2" Margin="10,10,0,0" VerticalAlignment="Center" />
+ <ComboBox Width="100" Grid.Row="3" Grid.Column="3" Margin="5,10,5,0" Height="22" VerticalAlignment="Center"
+ ItemsSource="{Binding H264Levels}"
+ SelectedItem="{Binding H264Level}"
+ Style="{StaticResource LongToolTipHolder}"
+ ToolTip="{x:Static Properties:Resources.Video_x264Level}"/>
+
+ <!-- Row 3 -->
+ <TextBlock Text="Extra Options:" Grid.Row="4" Grid.Column="0" Margin="0,10,0,0" VerticalAlignment="Center" HorizontalAlignment="Left" />
+ <TextBox Text="{Binding ExtraArguments}" Height="30" MaxLines="2" Grid.Row="4" Grid.Column="1" Grid.ColumnSpan="3" Margin="5,10,0,0" VerticalAlignment="Center"
+ ToolTip="{Binding FullOptionsTooltip}"/>
+
+
</Grid>
-
- <StackPanel Grid.Row="2" Margin="10" Height="100" VerticalAlignment="Top" >
- <TextBlock Text="Advanced Query" Margin="0,0,0,5" FontWeight="Bold" VerticalAlignment="Center" />
- <TextBox Text="{Binding Query}"
- VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="150" TextWrapping="Wrap" />
- </StackPanel>-->
-
-
-
</Grid>
</Grid>
diff --git a/win/CS/HandBrakeWPF/defaultsettings.xml b/win/CS/HandBrakeWPF/defaultsettings.xml index 80a1e6e2c..73d5742fc 100644 --- a/win/CS/HandBrakeWPF/defaultsettings.xml +++ b/win/CS/HandBrakeWPF/defaultsettings.xml @@ -5,7 +5,7 @@ <string>X264Step</string>
</key>
<value>
- <anyType xmlns:q1="http://www.w3.org/2001/XMLSchema" d4p1:type="q1:double" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">0.25</anyType>
+ <anyType xmlns:q1="http://www.w3.org/2001/XMLSchema" d4p1:type="q1:double" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">1.0</anyType>
</value>
</item>
<item>
@@ -473,4 +473,12 @@ <anyType xmlns:q1="http://www.w3.org/2001/XMLSchema" d4p1:type="q1:boolean" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">false</anyType>
</value>
</item>
+ <item>
+ <key>
+ <string>ShowAdvancedTab</string>
+ </key>
+ <value>
+ <anyType xmlns:q1="http://www.w3.org/2001/XMLSchema" d4p1:type="q1:boolean" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">true</anyType>
+ </value>
+ </item>
</dictionary>
\ No newline at end of file |