summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF/ViewModels
diff options
context:
space:
mode:
authorsr55 <[email protected]>2012-12-28 11:21:14 +0000
committersr55 <[email protected]>2012-12-28 11:21:14 +0000
commit93235d2c7d15e031015ebbbfeefa14778fe9a56e (patch)
treeba2f077297096a07af0d68d178292532655bd182 /win/CS/HandBrakeWPF/ViewModels
parentf89475c8a426907cc85a335460cc1d6e7750614b (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/CS/HandBrakeWPF/ViewModels')
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs41
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/Interfaces/IAdvancedViewModel.cs5
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/Interfaces/IVideoViewModel.cs5
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs15
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs27
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs415
6 files changed, 370 insertions, 138 deletions
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