summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--win/CS/HandBrakeWPF/HandBrakeWPF.csproj26
-rw-r--r--win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs2
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs1113
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/EncoderOptionsViewModel.cs114
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/Interfaces/IEncoderOptionsViewModel.cs32
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/Interfaces/IX264ViewModel.cs32
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/X264ViewModel.cs1155
-rw-r--r--win/CS/HandBrakeWPF/Views/AdvancedView.xaml544
-rw-r--r--win/CS/HandBrakeWPF/Views/EncoderOptionsView.xaml28
-rw-r--r--win/CS/HandBrakeWPF/Views/EncoderOptionsView.xaml.cs27
-rw-r--r--win/CS/HandBrakeWPF/Views/OptionsView.xaml3
-rw-r--r--win/CS/HandBrakeWPF/Views/X264View.xaml539
-rw-r--r--win/CS/HandBrakeWPF/Views/X264View.xaml.cs27
13 files changed, 2014 insertions, 1628 deletions
diff --git a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj
index 71bac458b..7622293d2 100644
--- a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj
+++ b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj
@@ -168,8 +168,18 @@
<Compile Include="Services\NotificationService.cs" />
<Compile Include="Services\ScanServiceWrapper.cs" />
<Compile Include="Services\UpdateService.cs" />
+ <Compile Include="ViewModels\AdvancedViewModel.cs" />
+ <Compile Include="ViewModels\EncoderOptionsViewModel.cs" />
+ <Compile Include="ViewModels\Interfaces\IEncoderOptionsViewModel.cs" />
+ <Compile Include="ViewModels\Interfaces\IX264ViewModel.cs" />
<Compile Include="ViewModels\Interfaces\IQueueSelectionViewModel.cs" />
<Compile Include="ViewModels\QueueSelectionViewModel.cs" />
+ <Compile Include="Views\AdvancedView.xaml.cs">
+ <DependentUpon>AdvancedView.xaml</DependentUpon>
+ </Compile>
+ <Compile Include="Views\EncoderOptionsView.xaml.cs">
+ <DependentUpon>EncoderOptionsView.xaml</DependentUpon>
+ </Compile>
<Compile Include="Views\QueueSelectionView.xaml.cs">
<DependentUpon>QueueSelectionView.xaml</DependentUpon>
</Compile>
@@ -204,7 +214,7 @@
<Compile Include="ViewModels\AboutViewModel.cs" />
<Compile Include="ViewModels\AddPresetViewModel.cs" />
<Compile Include="ViewModels\AudioViewModel.cs" />
- <Compile Include="ViewModels\AdvancedViewModel.cs" />
+ <Compile Include="ViewModels\X264ViewModel.cs" />
<Compile Include="ViewModels\Interfaces\ITabInterface.cs" />
<Compile Include="ViewModels\VideoViewModel.cs" />
<Compile Include="ViewModels\FiltersViewModel.cs" />
@@ -241,8 +251,8 @@
<SubType>Code</SubType>
</Compile>
<Compile Include="ViewModels\MainViewModel.cs" />
- <Compile Include="Views\AdvancedView.xaml.cs">
- <DependentUpon>AdvancedView.xaml</DependentUpon>
+ <Compile Include="Views\X264View.xaml.cs">
+ <DependentUpon>X264View.xaml</DependentUpon>
</Compile>
<Compile Include="Views\AudioView.xaml.cs">
<DependentUpon>AudioView.xaml</DependentUpon>
@@ -331,6 +341,14 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
+ <Page Include="Views\AdvancedView.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ <SubType>Designer</SubType>
+ </Page>
+ <Page Include="Views\EncoderOptionsView.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ <SubType>Designer</SubType>
+ </Page>
<Page Include="Views\QueueSelectionView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@@ -347,7 +365,7 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
- <Page Include="Views\AdvancedView.xaml">
+ <Page Include="Views\X264View.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
diff --git a/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs b/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs
index 97930ba4d..ae0369d7f 100644
--- a/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs
+++ b/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs
@@ -83,7 +83,9 @@ namespace HandBrakeWPF.Startup
// Tab Components
this.windsorContainer.Register(Component.For<IAudioViewModel>().ImplementedBy<AudioViewModel>().LifeStyle.Is(LifestyleType.Singleton));
+ this.windsorContainer.Register(Component.For<IX264ViewModel>().ImplementedBy<X264ViewModel>().LifeStyle.Is(LifestyleType.Singleton));
this.windsorContainer.Register(Component.For<IAdvancedViewModel>().ImplementedBy<AdvancedViewModel>().LifeStyle.Is(LifestyleType.Singleton));
+ this.windsorContainer.Register(Component.For<IEncoderOptionsViewModel>().ImplementedBy<EncoderOptionsViewModel>().LifeStyle.Is(LifestyleType.Singleton));
this.windsorContainer.Register(Component.For<IPictureSettingsViewModel>().ImplementedBy<PictureSettingsViewModel>().LifeStyle.Is(LifestyleType.Singleton));
this.windsorContainer.Register(Component.For<IChaptersViewModel>().ImplementedBy<ChaptersViewModel>().LifeStyle.Is(LifestyleType.Singleton));
this.windsorContainer.Register(Component.For<ISubtitlesViewModel>().ImplementedBy<SubtitlesViewModel>().LifeStyle.Is(LifestyleType.Singleton));
diff --git a/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs
index 1c0f9de67..470a27be2 100644
--- a/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs
@@ -9,18 +9,10 @@
namespace HandBrakeWPF.ViewModels
{
- using System;
- using System.Collections.Generic;
- using System.Globalization;
- using System.Linq;
-
using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Parsing;
using HandBrake.Interop.Model.Encoding;
- using HandBrakeWPF.Commands.Interfaces;
- using HandBrakeWPF.Helpers;
- using HandBrakeWPF.Model;
using HandBrakeWPF.ViewModels.Interfaces;
/// <summary>
@@ -28,920 +20,68 @@ 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>
- /// AdvancedOptionsCache;
- /// </summary>
- private string optionsCache = string.Empty;
-
- /// <summary>
/// Backing field for displaying x264 options
/// </summary>
private bool? displayX264Options;
/// <summary>
- /// The adaptive b frames.
- /// </summary>
- private AdvancedChoice adaptiveBFrames;
-
- /// <summary>
- /// The adaptive quantization strength.
- /// </summary>
- private double adaptiveQuantizationStrength;
-
- /// <summary>
- /// The analysis.
- /// </summary>
- private AdvancedChoice analysis;
-
- /// <summary>
- /// The b frames.
- /// </summary>
- private AdvancedChoice bFrames;
-
- /// <summary>
- /// The cabac entropy coding.
- /// </summary>
- private bool cabacEntropyCoding;
-
- /// <summary>
- /// The deblocking strength.
- /// </summary>
- private AdvancedChoice deblockingStrength;
-
- /// <summary>
- /// The deblocking threshold.
- /// </summary>
- private AdvancedChoice deblockingThreshold;
-
- /// <summary>
- /// The direct prediction.
- /// </summary>
- private AdvancedChoice directPrediction;
-
- /// <summary>
- /// The eight by eight dct.
+ /// The show x 264 panel.
/// </summary>
- private bool eightByEightDct;
-
- /// <summary>
- /// The motion estimation method.
- /// </summary>
- private AdvancedChoice motionEstimationMethod;
-
- /// <summary>
- /// The motion estimation range.
- /// </summary>
- private int motionEstimationRange;
-
- /// <summary>
- /// The no dct decimate.
- /// </summary>
- private bool noDctDecimate;
-
- /// <summary>
- /// The psychovisual rate distortion.
- /// </summary>
- private double psychovisualRateDistortion;
-
- /// <summary>
- /// The psychovisual trellis.
- /// </summary>
- private double psychovisualTrellis;
-
- /// <summary>
- /// The pyramidal b frames.
- /// </summary>
- private AdvancedChoice pyramidalBFrames;
-
- /// <summary>
- /// The reference frames.
- /// </summary>
- private AdvancedChoice referenceFrames;
-
- /// <summary>
- /// The subpixel motion estimation.
- /// </summary>
- private AdvancedChoice subpixelMotionEstimation;
-
- /// <summary>
- /// The trellis.
- /// </summary>
- private AdvancedChoice trellis;
-
- /// <summary>
- /// X264 options that have UI elements that correspond to them.
- /// </summary>
- private HashSet<string> uiOptions = new HashSet<string>
- {
- "ref",
- "bframes",
- "b-adapt",
- "direct",
- "weightp",
- "b-pyramid",
- "me",
- "subme",
- "subq",
- "merange",
- "analyse",
- "8x8dct",
- "cabac",
- "trellis",
- "aq-strength",
- "psy-rd",
- "no-dct-decimate",
- "deblock"
- };
-
- /// <summary>
- /// The weighted p frames.
- /// </summary>
- private bool weightedPFrames;
-
- #endregion
-
- #region Constructors and Destructors
-
- /// <summary>
- /// Initializes a new instance of the <see cref="AdvancedViewModel"/> class.
- /// </summary>
- /// <param name="advancedEncoderOptionsCommand">
- /// The advanced Encoder Options Command.
- /// </param>
- public AdvancedViewModel(IAdvancedEncoderOptionsCommand advancedEncoderOptionsCommand)
- {
- this.advancedEncoderOptionsCommand = advancedEncoderOptionsCommand;
- this.Task = new EncodeTask();
- this.UpdateUIFromAdvancedOptions();
- }
-
- /// <summary>
- /// The task object property changed.
- /// </summary>
- /// <param name="sender">
- /// The sender.
- /// </param>
- /// <param name="e">
- /// The PropertyChangedEventArgs.
- /// </param>
- private void Task_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
- {
- if (e.PropertyName == UserSettingConstants.ShowAdvancedTab)
- {
- ShowX264AdvancedOptions = this.Task.ShowAdvancedTab;
- this.NotifyOfPropertyChange(() => ShowX264AdvancedOptions);
- }
- }
+ private bool showX264Panel;
#endregion
#region Properties
/// <summary>
- /// Gets or sets a value indicating whether show x 264 advanced options.
+ /// Gets or sets the x 264 view model.
/// </summary>
- public bool ShowX264AdvancedOptions { get; set; }
-
- /// <summary>
- /// Gets or sets a value indicating whether DisplayX264Options.
- /// </summary>
- public bool? DisplayX264Options
- {
- get
- {
- return this.displayX264Options;
- }
- set
- {
- this.displayX264Options = value;
-
- if (this.displayX264Options == false)
- {
- this.ShowX264AdvancedOptions = false;
- }
-
- if (this.displayX264Options == true && this.Task.ShowAdvancedTab)
- {
- this.ShowX264AdvancedOptions = true;
- }
-
- this.NotifyOfPropertyChange(() => this.DisplayX264Options);
- this.NotifyOfPropertyChange(() => this.ShowX264AdvancedOptions);
- }
- }
+ public IX264ViewModel X264ViewModel { get; set; }
/// <summary>
- /// Gets or sets AdaptiveBFrames.
+ /// Gets or sets the encoder options view model.
/// </summary>
- public AdvancedChoice AdaptiveBFrames
- {
- get
- {
- return this.adaptiveBFrames;
- }
-
- set
- {
- this.adaptiveBFrames = value;
- this.NotifyOfPropertyChange(() => this.AdaptiveBFrames);
- this.UpdateOptionsString();
- }
- }
+ public IEncoderOptionsViewModel EncoderOptionsViewModel { get; set; }
/// <summary>
- /// Gets or sets AdaptiveQuantizationStrength.
+ /// Gets or sets a value indicating whether show x 264 panel.
/// </summary>
- public double AdaptiveQuantizationStrength
+ public bool ShowX264Panel
{
get
{
- return this.adaptiveQuantizationStrength;
+ return this.showX264Panel;
}
-
set
{
- this.adaptiveQuantizationStrength = value;
- this.NotifyOfPropertyChange(() => this.AdaptiveQuantizationStrength);
- this.UpdateOptionsString();
+ this.showX264Panel = value;
+ this.NotifyOfPropertyChange(() => this.ShowX264Panel);
}
}
/// <summary>
- /// Gets or sets AdvancedOptionsString.
- /// </summary>
- public string AdvancedOptionsString
- {
- get
- {
- return this.Task.AdvancedEncoderOptions;
- }
-
- set
- {
- 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();
- }
- }
- }
-
- /// <summary>
- /// Gets or sets Analysis.
- /// </summary>
- public AdvancedChoice Analysis
- {
- get
- {
- return this.analysis;
- }
-
- set
- {
- this.analysis = value;
- this.NotifyOfPropertyChange(() => this.Analysis);
- this.UpdateOptionsString();
- }
- }
-
- /// <summary>
- /// Gets or sets a value indicating whether AutomaticChange.
- /// </summary>
- public bool AutomaticChange { get; set; }
-
- /// <summary>
- /// Gets or sets BFrames.
- /// </summary>
- public AdvancedChoice BFrames
- {
- get
- {
- return this.bFrames;
- }
-
- set
- {
- this.bFrames = value;
- this.NotifyOfPropertyChange(() => this.BFrames);
- this.NotifyOfPropertyChange(() => this.BFramesOptionsVisible);
- this.NotifyOfPropertyChange(() => this.PyramidalBFramesVisible);
- this.UpdateOptionsString();
- }
- }
-
- /// <summary>
- /// Gets a value indicating whether BFramesOptionsVisible.
- /// </summary>
- public bool BFramesOptionsVisible
- {
- get
- {
- return this.BFrames.Value != "0";
- }
- }
-
- /// <summary>
- /// Gets or sets a value indicating whether CabacEntropyCoding.
- /// </summary>
- public bool CabacEntropyCoding
- {
- get
- {
- return this.cabacEntropyCoding;
- }
-
- set
- {
- this.cabacEntropyCoding = value;
- this.NotifyOfPropertyChange(() => this.CabacEntropyCoding);
- this.NotifyOfPropertyChange(() => this.PsychovisualTrellisVisible);
- this.UpdateOptionsString();
- }
- }
-
- /// <summary>
- /// Gets or sets DeblockingStrength.
- /// </summary>
- public AdvancedChoice DeblockingStrength
- {
- get
- {
- return this.deblockingStrength;
- }
-
- set
- {
- this.deblockingStrength = value;
- this.NotifyOfPropertyChange(() => this.DeblockingStrength);
- this.UpdateOptionsString();
- }
- }
-
- /// <summary>
- /// Gets or sets DeblockingThreshold.
- /// </summary>
- public AdvancedChoice DeblockingThreshold
- {
- get
- {
- return this.deblockingThreshold;
- }
-
- set
- {
- this.deblockingThreshold = value;
- this.NotifyOfPropertyChange(() => this.DeblockingThreshold);
- this.UpdateOptionsString();
- }
- }
-
- /// <summary>
- /// Gets or sets DirectPrediction.
- /// </summary>
- public AdvancedChoice DirectPrediction
- {
- get
- {
- return this.directPrediction;
- }
-
- set
- {
- this.directPrediction = value;
- this.NotifyOfPropertyChange(() => this.DirectPrediction);
- this.UpdateOptionsString();
- }
- }
-
- /// <summary>
- /// Gets or sets a value indicating whether EightByEightDct.
- /// </summary>
- public bool EightByEightDct
- {
- get
- {
- return this.eightByEightDct;
- }
-
- set
- {
- this.eightByEightDct = value;
- this.NotifyOfPropertyChange(() => this.EightByEightDct);
- this.UpdateOptionsString();
- }
- }
-
- /// <summary>
- /// Gets or sets MotionEstimationMethod.
- /// </summary>
- public AdvancedChoice MotionEstimationMethod
- {
- get
- {
- return this.motionEstimationMethod;
- }
-
- set
- {
- this.motionEstimationMethod = value;
- this.NotifyOfPropertyChange(() => this.MotionEstimationMethod);
-
- if ((MotionEstimationMethod.Value == "hex" || MotionEstimationMethod.Value == "dia") && (motionEstimationRange > 16))
- {
- this.motionEstimationRange = 16;
- this.NotifyOfPropertyChange(() => this.MotionEstimationRange);
- }
-
- this.UpdateOptionsString();
- }
- }
-
- /// <summary>
- /// Gets or sets MotionEstimationRange.
- /// </summary>
- public int MotionEstimationRange
- {
- get
- {
- return this.motionEstimationRange;
- }
-
- set
- {
- if ((MotionEstimationMethod.Value == "hex" || MotionEstimationMethod.Value == "dia") && (value > 16))
- {
- this.motionEstimationRange = 16;
- }
- else if (value < 4)
- {
- this.motionEstimationRange = 4;
- }
- else
- {
- this.motionEstimationRange = value;
- }
-
- this.NotifyOfPropertyChange(() => this.MotionEstimationRange);
- this.UpdateOptionsString();
- }
- }
-
- /// <summary>
- /// Gets or sets a value indicating whether NoDctDecimate.
- /// </summary>
- public bool NoDctDecimate
- {
- get
- {
- return this.noDctDecimate;
- }
-
- set
- {
- this.noDctDecimate = value;
- this.NotifyOfPropertyChange(() => this.NoDctDecimate);
- this.UpdateOptionsString();
- }
- }
-
- /// <summary>
- /// Gets or sets PsychovisualRateDistortion.
- /// </summary>
- public double PsychovisualRateDistortion
- {
- get
- {
- return this.psychovisualRateDistortion;
- }
-
- set
- {
- this.psychovisualRateDistortion = value;
- this.NotifyOfPropertyChange(() => this.PsychovisualRateDistortion);
- this.UpdateOptionsString();
- }
- }
-
- /// <summary>
- /// Gets or sets PsychovisualTrellis.
- /// </summary>
- public double PsychovisualTrellis
- {
- get
- {
- return this.psychovisualTrellis;
- }
-
- set
- {
- this.psychovisualTrellis = value;
- this.NotifyOfPropertyChange(() => this.PsychovisualTrellis);
- this.UpdateOptionsString();
- }
- }
-
- /// <summary>
- /// Gets a value indicating whether PsychovisualTrellisVisible.
- /// </summary>
- public bool PsychovisualTrellisVisible
- {
- get
- {
- return this.CabacEntropyCoding && this.Trellis.Value != "0";
- }
- }
-
- /// <summary>
- /// Gets a value indicating whether PsychovisualRateDistortionVisible.
- /// </summary>
- public bool PsychovisualRateDistortionVisible
- {
- get
- {
- int value;
- int.TryParse(this.SubpixelMotionEstimation.Value.Trim(), out value);
- return value >= 6;
- }
- }
-
- /// <summary>
- /// Gets or sets PyramidalBFrames.
- /// </summary>
- public AdvancedChoice PyramidalBFrames
- {
- get
- {
- return this.pyramidalBFrames;
- }
-
- set
- {
- this.pyramidalBFrames = value;
- this.NotifyOfPropertyChange(() => this.PyramidalBFrames);
- this.UpdateOptionsString();
- }
- }
-
- /// <summary>
- /// Gets a value indicating whether PyramidalBFramesVisible.
- /// </summary>
- public bool PyramidalBFramesVisible
- {
- get
- {
- return int.Parse(this.BFrames.Value) > 1;
- }
- }
-
- /// <summary>
- /// Gets or sets ReferenceFrames.
- /// </summary>
- public AdvancedChoice ReferenceFrames
- {
- get
- {
- return this.referenceFrames;
- }
-
- set
- {
- this.referenceFrames = value;
- this.NotifyOfPropertyChange(() => this.ReferenceFrames);
- this.UpdateOptionsString();
- }
- }
-
- /// <summary>
- /// Gets or sets SubpixelMotionEstimation.
- /// </summary>
- public AdvancedChoice SubpixelMotionEstimation
- {
- get
- {
- return this.subpixelMotionEstimation;
- }
-
- set
- {
- this.subpixelMotionEstimation = value;
- this.NotifyOfPropertyChange(() => this.SubpixelMotionEstimation);
- this.NotifyOfPropertyChange(() => this.PsychovisualRateDistortionVisible);
- this.UpdateOptionsString();
- }
- }
-
- /// <summary>
- /// Gets or sets Task.
- /// </summary>
- public EncodeTask Task { get; set; }
-
- /// <summary>
- /// Gets or sets Trellis.
- /// </summary>
- public AdvancedChoice Trellis
- {
- get
- {
- return this.trellis;
- }
-
- set
- {
- this.trellis = value;
- this.NotifyOfPropertyChange(() => this.Trellis);
- this.NotifyOfPropertyChange(() => this.PsychovisualTrellisVisible);
- this.UpdateOptionsString();
- }
- }
-
- /// <summary>
- /// Gets or sets a value indicating whether WeightedPFrames.
+ /// Gets or sets a value indicating whether DisplayX264Options.
/// </summary>
- public bool WeightedPFrames
+ public bool? ShowSimplePanel
{
get
{
- return this.weightedPFrames;
+ return this.displayX264Options;
}
-
set
{
- this.weightedPFrames = value;
- this.NotifyOfPropertyChange(() => this.WeightedPFrames);
- this.UpdateOptionsString();
- }
- }
-
- #endregion
-
- #region Public Methods
-
- /// <summary>
- /// The update ui from advanced options.
- /// </summary>
- public void UpdateUIFromAdvancedOptions()
- {
- this.AutomaticChange = true;
-
- // Reset UI to defaults, and re-apply options.
- this.SetAdvancedToDefaults();
-
- if (this.Task.AdvancedEncoderOptions == null)
- {
- this.AutomaticChange = false;
- return;
- }
-
- // Check the updated options string. Update UI for any recognized options.
- string[] newOptionsSegments = this.Task.AdvancedEncoderOptions.Split(':');
- foreach (string newOptionsSegment in newOptionsSegments)
- {
- int equalsIndex = newOptionsSegment.IndexOf('=');
- if (equalsIndex >= 0)
- {
- string optionName = newOptionsSegment.Substring(0, equalsIndex);
- string optionValue = newOptionsSegment.Substring(equalsIndex + 1);
-
- if (optionName != string.Empty && optionValue != string.Empty)
- {
- AdvancedChoice newChoice;
- int parseInt;
- double parseDouble;
- string[] subParts;
-
- switch (optionName)
- {
- case "ref":
- if (int.TryParse(optionValue, out parseInt))
- {
- newChoice =
- AdvancedChoicesHelper.ReferenceFrames.SingleOrDefault(
- choice => choice.Value == parseInt.ToString(CultureInfo.InvariantCulture));
- if (newChoice != null)
- {
- this.ReferenceFrames = newChoice;
- }
- }
-
- break;
- case "bframes":
- if (int.TryParse(optionValue, out parseInt))
- {
- newChoice =
- AdvancedChoicesHelper.BFrames.SingleOrDefault(
- choice => choice.Value == parseInt.ToString(CultureInfo.InvariantCulture));
- if (newChoice != null)
- {
- this.BFrames = newChoice;
- }
- }
-
- break;
- case "b-adapt":
- newChoice =
- AdvancedChoicesHelper.AdaptiveBFrames.SingleOrDefault(
- choice => choice.Value == optionValue);
- if (newChoice != null)
- {
- this.AdaptiveBFrames = newChoice;
- }
-
- break;
- case "direct":
- newChoice =
- AdvancedChoicesHelper.DirectPrediction.SingleOrDefault(
- choice => choice.Value == optionValue);
- if (newChoice != null)
- {
- this.DirectPrediction = newChoice;
- }
-
- break;
- case "weightp":
- if (optionValue == "0")
- {
- this.WeightedPFrames = false;
- }
- else if (optionValue == "1")
- {
- this.WeightedPFrames = true;
- }
-
- break;
- case "b-pyramid":
- newChoice =
- AdvancedChoicesHelper.PyramidalBFrames.SingleOrDefault(
- choice => choice.Value == optionValue);
- if (newChoice != null)
- {
- this.PyramidalBFrames = newChoice;
- }
-
- break;
- case "me":
- newChoice =
- AdvancedChoicesHelper.MotionEstimationMethod.SingleOrDefault(
- choice => choice.Value == optionValue);
- if (newChoice != null)
- {
- this.MotionEstimationMethod = newChoice;
- }
-
- break;
- case "subme":
- case "subq":
- if (int.TryParse(optionValue, out parseInt))
- {
- newChoice =
- AdvancedChoicesHelper.SubpixelMotionEstimation.SingleOrDefault(
- choice => choice.Value == parseInt.ToString(CultureInfo.InvariantCulture));
- if (newChoice != null)
- {
- this.SubpixelMotionEstimation = newChoice;
- }
- }
-
- break;
- case "merange":
- if (int.TryParse(optionValue, out parseInt))
- {
- this.MotionEstimationRange = parseInt;
- }
-
- break;
- case "analyse":
- newChoice =
- AdvancedChoicesHelper.Analysis.SingleOrDefault(
- choice => choice.Value == optionValue);
- if (newChoice != null)
- {
- this.Analysis = newChoice;
- }
-
- break;
- case "8x8dct":
- if (optionValue == "0")
- {
- this.EightByEightDct = false;
- }
- else if (optionValue == "1")
- {
- this.EightByEightDct = true;
- }
-
- break;
- case "cabac":
- if (optionValue == "0")
- {
- this.CabacEntropyCoding = false;
- }
- else if (optionValue == "1")
- {
- this.CabacEntropyCoding = true;
- }
-
- break;
- case "trellis":
- if (int.TryParse(optionValue, out parseInt))
- {
- newChoice =
- AdvancedChoicesHelper.Trellis.SingleOrDefault(
- choice => choice.Value == parseInt.ToString(CultureInfo.InvariantCulture));
- if (newChoice != null)
- {
- this.Trellis = newChoice;
- }
- }
-
- break;
- case "aq-strength":
- if (double.TryParse(optionValue, NumberStyles.Any, CultureInfo.InvariantCulture, out parseDouble) && parseDouble >= 0.0 &&
- parseDouble <= 2.0)
- {
- this.AdaptiveQuantizationStrength = Math.Round(parseDouble, 1);
- }
-
- break;
- case "psy-rd":
- subParts = optionValue.Split(',');
- if (subParts.Length == 2)
- {
- double psyRD, psyTrellis;
- if (double.TryParse(subParts[0], NumberStyles.Any, CultureInfo.InvariantCulture, out psyRD) &&
- double.TryParse(subParts[1], NumberStyles.Any, CultureInfo.InvariantCulture, out psyTrellis))
- {
- if (psyRD >= 0.0 && psyRD <= 2.0 && psyTrellis >= 0.0 && psyTrellis <= 1.0)
- {
- this.PsychovisualRateDistortion = Math.Round(psyRD, 1);
- this.PsychovisualTrellis = Math.Round(psyTrellis, 2);
- }
- }
- }
-
- break;
- case "no-dct-decimate":
- if (optionValue == "0")
- {
- this.NoDctDecimate = false;
- }
- else if (optionValue == "1")
- {
- this.NoDctDecimate = true;
- }
-
- break;
- case "deblock":
- subParts = optionValue.Split(',');
- if (subParts.Length == 2)
- {
- int dbStrength, dbThreshold;
- if (int.TryParse(subParts[0], out dbStrength) &&
- int.TryParse(subParts[1], out dbThreshold))
- {
- newChoice =
- AdvancedChoicesHelper.DeblockingStrength.SingleOrDefault(
- choice => choice.Value == subParts[0]);
- if (newChoice != null)
- {
- this.DeblockingStrength = newChoice;
- }
-
- newChoice =
- AdvancedChoicesHelper.DeblockingThreshold.SingleOrDefault(
- choice => choice.Value == subParts[1]);
- if (newChoice != null)
- {
- this.DeblockingThreshold = newChoice;
- }
- }
- }
-
- break;
- }
- }
- }
+ this.displayX264Options = value;
+ this.NotifyOfPropertyChange(() => this.ShowSimplePanel);
}
-
- this.AutomaticChange = false;
}
#endregion
#region Implemented Interfaces
- #region IAdvancedViewModel
-
/// <summary>
/// The set encoder.
/// </summary>
@@ -950,28 +90,19 @@ namespace HandBrakeWPF.ViewModels
/// </param>
public void SetEncoder(VideoEncoder encoder)
{
- // If we are switching from x264, cache it's settings.
- if (this.DisplayX264Options.HasValue && this.DisplayX264Options.Value )
- {
- this.optionsCache = this.AdvancedOptionsString;
- }
+ this.EncoderOptionsViewModel.SetEncoder(encoder);
+ this.X264ViewModel.SetEncoder(encoder);
- // UI Set for new encoder.
if (encoder == VideoEncoder.X264)
{
- this.AdvancedOptionsString = optionsCache;
- this.DisplayX264Options = true;
- }
- else if (encoder == VideoEncoder.Theora)
- {
- this.AdvancedOptionsString = string.Empty;
- this.DisplayX264Options = null;
+ this.ShowX264Panel = true;
+ this.ShowSimplePanel = false;
}
else
{
- this.AdvancedOptionsString = string.Empty;
- this.DisplayX264Options = false;
- }
+ this.ShowX264Panel = false;
+ this.ShowSimplePanel = true;
+ }
}
/// <summary>
@@ -979,13 +110,10 @@ namespace HandBrakeWPF.ViewModels
/// </summary>
public void Clear()
{
- this.AdvancedOptionsString = string.Empty;
+ this.EncoderOptionsViewModel.Clear();
+ this.X264ViewModel.Clear();
}
- #endregion
-
- #region ITabInterface
-
/// <summary>
/// Setup this tab for the specified preset.
/// </summary>
@@ -997,10 +125,8 @@ namespace HandBrakeWPF.ViewModels
/// </param>
public void SetPreset(Preset preset, EncodeTask task)
{
- this.Task.PropertyChanged -= this.Task_PropertyChanged;
- this.Task = task;
- this.Task.PropertyChanged += this.Task_PropertyChanged;
- this.AdvancedOptionsString = preset.Task.AdvancedEncoderOptions;
+ this.EncoderOptionsViewModel.SetPreset(preset, task);
+ this.X264ViewModel.SetPreset(preset, task);
}
/// <summary>
@@ -1011,9 +137,10 @@ namespace HandBrakeWPF.ViewModels
/// </param>
public void UpdateTask(EncodeTask task)
{
- this.Task = task;
+ this.EncoderOptionsViewModel.UpdateTask(task);
+ this.X264ViewModel.UpdateTask(task);
+
this.SetEncoder(task.VideoEncoder);
- this.AdvancedOptionsString = task.AdvancedEncoderOptions;
}
/// <summary>
@@ -1030,184 +157,8 @@ namespace HandBrakeWPF.ViewModels
/// </param>
public void SetSource(Title title, Preset preset, EncodeTask task)
{
- this.Task = task;
- this.NotifyOfPropertyChange(() => this.AdvancedOptionsString);
- }
-
- #endregion
-
- #endregion
-
- #region Methods
-
- /// <summary>
- /// The set advanced to defaults.
- /// </summary>
- private void SetAdvancedToDefaults()
- {
- this.ReferenceFrames = AdvancedChoicesHelper.ReferenceFrames.SingleOrDefault(choice => choice.IsDefault);
- this.BFrames = AdvancedChoicesHelper.BFrames.SingleOrDefault(choice => choice.IsDefault);
- this.AdaptiveBFrames = AdvancedChoicesHelper.AdaptiveBFrames.SingleOrDefault(choice => choice.IsDefault);
- this.DirectPrediction = AdvancedChoicesHelper.DirectPrediction.SingleOrDefault(choice => choice.IsDefault);
- this.WeightedPFrames = true;
- this.PyramidalBFrames = AdvancedChoicesHelper.PyramidalBFrames.SingleOrDefault(choice => choice.IsDefault);
- this.MotionEstimationMethod =
- AdvancedChoicesHelper.MotionEstimationMethod.SingleOrDefault(choice => choice.IsDefault);
- this.SubpixelMotionEstimation =
- AdvancedChoicesHelper.SubpixelMotionEstimation.SingleOrDefault(choice => choice.IsDefault);
- this.MotionEstimationRange = 16;
- this.Analysis = AdvancedChoicesHelper.Analysis.SingleOrDefault(choice => choice.IsDefault);
- this.EightByEightDct = true;
- this.CabacEntropyCoding = true;
- this.Trellis = AdvancedChoicesHelper.Trellis.SingleOrDefault(choice => choice.IsDefault);
- this.AdaptiveQuantizationStrength = 1.0;
- this.PsychovisualRateDistortion = 1.0;
- this.PsychovisualTrellis = 0.0;
- this.DeblockingStrength =
- AdvancedChoicesHelper.DeblockingStrength.SingleOrDefault(choice => choice.IsDefault);
- this.DeblockingThreshold =
- AdvancedChoicesHelper.DeblockingThreshold.SingleOrDefault(choice => choice.IsDefault);
- this.NoDctDecimate = false;
- }
-
- /// <summary>
- /// Update the x264 options string from a UI change.
- /// </summary>
- private void UpdateOptionsString()
- {
- if (this.AutomaticChange)
- {
- return;
- }
-
- List<string> newOptions = new List<string>();
-
- // First add any parts of the options string that don't correspond to the UI
- if (this.AdvancedOptionsString != null)
- {
- string[] existingSegments = this.AdvancedOptionsString.Split(':');
- foreach (string existingSegment in existingSegments)
- {
- string optionName = existingSegment;
- int equalsIndex = existingSegment.IndexOf('=');
- if (equalsIndex >= 0)
- {
- optionName = existingSegment.Substring(0, existingSegment.IndexOf("=", System.StringComparison.Ordinal));
- }
-
- if (!this.uiOptions.Contains(optionName) && optionName != string.Empty)
- {
- newOptions.Add(existingSegment);
- }
- }
- }
-
- // Now add everything from the UI
- if (!this.ReferenceFrames.IsDefault)
- {
- newOptions.Add("ref=" + this.ReferenceFrames.Value);
- }
-
- if (!this.BFrames.IsDefault)
- {
- newOptions.Add("bframes=" + this.BFrames.Value);
- }
-
- if (this.BFrames.Value != "0")
- {
- if (!this.AdaptiveBFrames.IsDefault)
- {
- newOptions.Add("b-adapt=" + this.AdaptiveBFrames.Value);
- }
-
- if (!this.DirectPrediction.IsDefault)
- {
- newOptions.Add("direct=" + this.DirectPrediction.Value);
- }
-
- if (this.BFrames.Value != "1" && !this.PyramidalBFrames.IsDefault)
- {
- newOptions.Add("b-pyramid=" + this.PyramidalBFrames.Value);
- }
- }
-
- if (!this.WeightedPFrames)
- {
- newOptions.Add("weightp=0");
- }
-
- if (!this.MotionEstimationMethod.IsDefault)
- {
- newOptions.Add("me=" + this.MotionEstimationMethod.Value);
- }
-
- if (!this.SubpixelMotionEstimation.IsDefault)
- {
- newOptions.Add("subme=" + this.SubpixelMotionEstimation.Value);
- }
-
- if (this.MotionEstimationRange != 16)
- {
- newOptions.Add("merange=" + this.MotionEstimationRange);
- }
-
- if (!this.Analysis.IsDefault)
- {
- newOptions.Add("analyse=" + this.Analysis.Value);
- }
-
- if (this.Analysis.Value != "none" && !this.EightByEightDct)
- {
- newOptions.Add("8x8dct=0");
- }
-
- if (!this.CabacEntropyCoding)
- {
- newOptions.Add("cabac=0");
- }
-
- if (!this.Trellis.IsDefault)
- {
- newOptions.Add("trellis=" + this.Trellis.Value);
- }
-
- double psTrellis = 0.0;
- if (this.CabacEntropyCoding && this.Trellis.Value != "0")
- {
- psTrellis = this.PsychovisualTrellis;
- }
-
- if (this.AdaptiveQuantizationStrength != 1.0)
- {
- newOptions.Add(
- "aq-strength=" + this.AdaptiveQuantizationStrength.ToString("F1", CultureInfo.InvariantCulture));
- }
-
- if (this.PsychovisualRateDistortion != 1.0 || psTrellis > 0.0)
- {
- newOptions.Add(
- "psy-rd=" + this.PsychovisualRateDistortion.ToString("F1", CultureInfo.InvariantCulture) + "," +
- psTrellis.ToString("F2", CultureInfo.InvariantCulture));
- }
-
- if (this.NoDctDecimate)
- {
- newOptions.Add("no-dct-decimate=1");
- }
-
- if (!this.DeblockingStrength.IsDefault || !this.DeblockingThreshold.IsDefault)
- {
- newOptions.Add("deblock=" + this.DeblockingStrength.Value + "," + this.DeblockingThreshold.Value);
- }
-
- 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();
- }
+ this.EncoderOptionsViewModel.SetSource(title, preset, task);
+ this.X264ViewModel.SetSource(title, preset, task);
}
#endregion
diff --git a/win/CS/HandBrakeWPF/ViewModels/EncoderOptionsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/EncoderOptionsViewModel.cs
new file mode 100644
index 000000000..e578d9688
--- /dev/null
+++ b/win/CS/HandBrakeWPF/ViewModels/EncoderOptionsViewModel.cs
@@ -0,0 +1,114 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="EncoderOptionsViewModel.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 Simple Encoder options screen
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.ViewModels
+{
+ using HandBrake.ApplicationServices.Model;
+ using HandBrake.ApplicationServices.Parsing;
+ using HandBrake.Interop.Model.Encoding;
+
+ using HandBrakeWPF.ViewModels.Interfaces;
+
+ /// <summary>
+ /// The Simple Encoder options screen
+ /// </summary>
+ public class EncoderOptionsViewModel : ViewModelBase, IEncoderOptionsViewModel, ITabInterface
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="EncoderOptionsViewModel"/> class.
+ /// </summary>
+ public EncoderOptionsViewModel()
+ {
+ this.Task = new EncodeTask();
+ }
+
+ /// <summary>
+ /// Gets or sets the task.
+ /// </summary>
+ public EncodeTask Task { get; set; }
+
+ /// <summary>
+ /// Gets or sets the options string.
+ /// </summary>
+ public string AdvancedOptionsString
+ {
+ get
+ {
+ return this.Task.AdvancedEncoderOptions;
+ }
+ set
+ {
+ this.Task.AdvancedEncoderOptions = value;
+ this.NotifyOfPropertyChange(() => this.AdvancedOptionsString);
+ }
+ }
+
+ /// <summary>
+ /// The set source.
+ /// </summary>
+ /// <param name="selectedTitle">
+ /// The selected title.
+ /// </param>
+ /// <param name="currentPreset">
+ /// The current preset.
+ /// </param>
+ /// <param name="task">
+ /// The task.
+ /// </param>
+ public void SetSource(Title selectedTitle, Preset currentPreset, EncodeTask task)
+ {
+ this.Task = task;
+ this.NotifyOfPropertyChange(() => this.AdvancedOptionsString);
+ }
+
+ /// <summary>
+ /// The set preset.
+ /// </summary>
+ /// <param name="preset">
+ /// The preset.
+ /// </param>
+ /// <param name="task">
+ /// The task.
+ /// </param>
+ public void SetPreset(Preset preset, EncodeTask task)
+ {
+ this.Task = task;
+ this.AdvancedOptionsString = preset.Task.AdvancedEncoderOptions;
+ }
+
+ /// <summary>
+ /// The update task.
+ /// </summary>
+ /// <param name="task">
+ /// The task.
+ /// </param>
+ public void UpdateTask(EncodeTask task)
+ {
+ this.Task = task;
+ this.NotifyOfPropertyChange(() => this.AdvancedOptionsString);
+ }
+
+ /// <summary>
+ /// The set encoder.
+ /// </summary>
+ /// <param name="encoder">
+ /// The encoder.
+ /// </param>
+ public void SetEncoder(VideoEncoder encoder)
+ {
+ }
+
+ /// <summary>
+ /// The clear.
+ /// </summary>
+ public void Clear()
+ {
+ }
+ }
+}
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IEncoderOptionsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IEncoderOptionsViewModel.cs
new file mode 100644
index 000000000..10f1270d4
--- /dev/null
+++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IEncoderOptionsViewModel.cs
@@ -0,0 +1,32 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="IEncoderOptionsViewModel.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 Simple Encoder Options Tab
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.ViewModels.Interfaces
+{
+ using HandBrake.Interop.Model.Encoding;
+
+ /// <summary>
+ /// The Simple Encoder Options Tab
+ /// </summary>
+ public interface IEncoderOptionsViewModel : ITabInterface
+ {
+ /// <summary>
+ /// Set the currently selected encoder.
+ /// </summary>
+ /// <param name="encoder">
+ /// The Video Encoder.
+ /// </param>
+ void SetEncoder(VideoEncoder encoder);
+
+ /// <summary>
+ /// Clear out the settings.
+ /// </summary>
+ void Clear();
+ }
+}
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IX264ViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IX264ViewModel.cs
new file mode 100644
index 000000000..70b72affe
--- /dev/null
+++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IX264ViewModel.cs
@@ -0,0 +1,32 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="IX264ViewModel.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>
+// Defines the IX264ViewModel type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.ViewModels.Interfaces
+{
+ using HandBrake.Interop.Model.Encoding;
+
+ /// <summary>
+ /// The Advanced View Model Interface
+ /// </summary>
+ public interface IX264ViewModel : ITabInterface
+ {
+ /// <summary>
+ /// Set the currently selected encoder.
+ /// </summary>
+ /// <param name="encoder">
+ /// The Video Encoder.
+ /// </param>
+ void SetEncoder(VideoEncoder encoder);
+
+ /// <summary>
+ /// Clear out the settings.
+ /// </summary>
+ void Clear();
+ }
+}
diff --git a/win/CS/HandBrakeWPF/ViewModels/X264ViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/X264ViewModel.cs
new file mode 100644
index 000000000..e981b3e02
--- /dev/null
+++ b/win/CS/HandBrakeWPF/ViewModels/X264ViewModel.cs
@@ -0,0 +1,1155 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="X264ViewModel.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 X264 Advanced View Model
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.ViewModels
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Globalization;
+ using System.Linq;
+
+ using HandBrake.ApplicationServices.Model;
+ using HandBrake.ApplicationServices.Parsing;
+ using HandBrake.Interop.Model.Encoding;
+
+ using HandBrakeWPF.Commands.Interfaces;
+ using HandBrakeWPF.Helpers;
+ using HandBrakeWPF.Model;
+ using HandBrakeWPF.ViewModels.Interfaces;
+
+ /// <summary>
+ /// The Advanced View Model
+ /// </summary>
+ public class X264ViewModel : ViewModelBase, IX264ViewModel
+ {
+ /// <summary>
+ /// The advanced encoder options command.
+ /// </summary>
+ private readonly IAdvancedEncoderOptionsCommand advancedEncoderOptionsCommand;
+
+ #region Constants and Fields
+
+ /// <summary>
+ /// The adaptive b frames.
+ /// </summary>
+ private AdvancedChoice adaptiveBFrames;
+
+ /// <summary>
+ /// The adaptive quantization strength.
+ /// </summary>
+ private double adaptiveQuantizationStrength;
+
+ /// <summary>
+ /// The analysis.
+ /// </summary>
+ private AdvancedChoice analysis;
+
+ /// <summary>
+ /// The b frames.
+ /// </summary>
+ private AdvancedChoice bFrames;
+
+ /// <summary>
+ /// The cabac entropy coding.
+ /// </summary>
+ private bool cabacEntropyCoding;
+
+ /// <summary>
+ /// The deblocking strength.
+ /// </summary>
+ private AdvancedChoice deblockingStrength;
+
+ /// <summary>
+ /// The deblocking threshold.
+ /// </summary>
+ private AdvancedChoice deblockingThreshold;
+
+ /// <summary>
+ /// The direct prediction.
+ /// </summary>
+ private AdvancedChoice directPrediction;
+
+ /// <summary>
+ /// The eight by eight dct.
+ /// </summary>
+ private bool eightByEightDct;
+
+ /// <summary>
+ /// The motion estimation method.
+ /// </summary>
+ private AdvancedChoice motionEstimationMethod;
+
+ /// <summary>
+ /// The motion estimation range.
+ /// </summary>
+ private int motionEstimationRange;
+
+ /// <summary>
+ /// The no dct decimate.
+ /// </summary>
+ private bool noDctDecimate;
+
+ /// <summary>
+ /// The psychovisual rate distortion.
+ /// </summary>
+ private double psychovisualRateDistortion;
+
+ /// <summary>
+ /// The psychovisual trellis.
+ /// </summary>
+ private double psychovisualTrellis;
+
+ /// <summary>
+ /// The pyramidal b frames.
+ /// </summary>
+ private AdvancedChoice pyramidalBFrames;
+
+ /// <summary>
+ /// The reference frames.
+ /// </summary>
+ private AdvancedChoice referenceFrames;
+
+ /// <summary>
+ /// The subpixel motion estimation.
+ /// </summary>
+ private AdvancedChoice subpixelMotionEstimation;
+
+ /// <summary>
+ /// The trellis.
+ /// </summary>
+ private AdvancedChoice trellis;
+
+ /// <summary>
+ /// X264 options that have UI elements that correspond to them.
+ /// </summary>
+ private HashSet<string> uiOptions = new HashSet<string>
+ {
+ "ref",
+ "bframes",
+ "b-adapt",
+ "direct",
+ "weightp",
+ "b-pyramid",
+ "me",
+ "subme",
+ "subq",
+ "merange",
+ "analyse",
+ "8x8dct",
+ "cabac",
+ "trellis",
+ "aq-strength",
+ "psy-rd",
+ "no-dct-decimate",
+ "deblock"
+ };
+
+ /// <summary>
+ /// The weighted p frames.
+ /// </summary>
+ private bool weightedPFrames;
+
+ #endregion
+
+ #region Constructors and Destructors
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="X264ViewModel"/> class.
+ /// </summary>
+ /// <param name="advancedEncoderOptionsCommand">
+ /// The advanced Encoder Options Command.
+ /// </param>
+ public X264ViewModel(IAdvancedEncoderOptionsCommand advancedEncoderOptionsCommand)
+ {
+ this.advancedEncoderOptionsCommand = advancedEncoderOptionsCommand;
+ this.Task = new EncodeTask();
+ this.UpdateUIFromAdvancedOptions();
+ }
+
+ /// <summary>
+ /// The task object property changed.
+ /// </summary>
+ /// <param name="sender">
+ /// The sender.
+ /// </param>
+ /// <param name="e">
+ /// The PropertyChangedEventArgs.
+ /// </param>
+ private void Task_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
+ {
+ if (e.PropertyName == UserSettingConstants.ShowAdvancedTab)
+ {
+ ShowX264AdvancedOptions = this.Task.ShowAdvancedTab;
+ this.NotifyOfPropertyChange(() => ShowX264AdvancedOptions);
+ }
+ }
+
+ #endregion
+
+ #region Properties
+
+ /// <summary>
+ /// Gets or sets a value indicating whether show x 264 advanced options.
+ /// </summary>
+ public bool ShowX264AdvancedOptions { get; set; }
+
+ /// <summary>
+ /// Gets or sets AdaptiveBFrames.
+ /// </summary>
+ public AdvancedChoice AdaptiveBFrames
+ {
+ get
+ {
+ return this.adaptiveBFrames;
+ }
+
+ set
+ {
+ this.adaptiveBFrames = value;
+ this.NotifyOfPropertyChange(() => this.AdaptiveBFrames);
+ this.UpdateOptionsString();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets AdaptiveQuantizationStrength.
+ /// </summary>
+ public double AdaptiveQuantizationStrength
+ {
+ get
+ {
+ return this.adaptiveQuantizationStrength;
+ }
+
+ set
+ {
+ this.adaptiveQuantizationStrength = value;
+ this.NotifyOfPropertyChange(() => this.AdaptiveQuantizationStrength);
+ this.UpdateOptionsString();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets AdvancedOptionsString.
+ /// </summary>
+ public string AdvancedOptionsString
+ {
+ get
+ {
+ return this.Task.AdvancedEncoderOptions;
+ }
+
+ set
+ {
+ 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();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets Analysis.
+ /// </summary>
+ public AdvancedChoice Analysis
+ {
+ get
+ {
+ return this.analysis;
+ }
+
+ set
+ {
+ this.analysis = value;
+ this.NotifyOfPropertyChange(() => this.Analysis);
+ this.UpdateOptionsString();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether AutomaticChange.
+ /// </summary>
+ public bool AutomaticChange { get; set; }
+
+ /// <summary>
+ /// Gets or sets BFrames.
+ /// </summary>
+ public AdvancedChoice BFrames
+ {
+ get
+ {
+ return this.bFrames;
+ }
+
+ set
+ {
+ this.bFrames = value;
+ this.NotifyOfPropertyChange(() => this.BFrames);
+ this.NotifyOfPropertyChange(() => this.BFramesOptionsVisible);
+ this.NotifyOfPropertyChange(() => this.PyramidalBFramesVisible);
+ this.UpdateOptionsString();
+ }
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether BFramesOptionsVisible.
+ /// </summary>
+ public bool BFramesOptionsVisible
+ {
+ get
+ {
+ return this.BFrames.Value != "0";
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether CabacEntropyCoding.
+ /// </summary>
+ public bool CabacEntropyCoding
+ {
+ get
+ {
+ return this.cabacEntropyCoding;
+ }
+
+ set
+ {
+ this.cabacEntropyCoding = value;
+ this.NotifyOfPropertyChange(() => this.CabacEntropyCoding);
+ this.NotifyOfPropertyChange(() => this.PsychovisualTrellisVisible);
+ this.UpdateOptionsString();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets DeblockingStrength.
+ /// </summary>
+ public AdvancedChoice DeblockingStrength
+ {
+ get
+ {
+ return this.deblockingStrength;
+ }
+
+ set
+ {
+ this.deblockingStrength = value;
+ this.NotifyOfPropertyChange(() => this.DeblockingStrength);
+ this.UpdateOptionsString();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets DeblockingThreshold.
+ /// </summary>
+ public AdvancedChoice DeblockingThreshold
+ {
+ get
+ {
+ return this.deblockingThreshold;
+ }
+
+ set
+ {
+ this.deblockingThreshold = value;
+ this.NotifyOfPropertyChange(() => this.DeblockingThreshold);
+ this.UpdateOptionsString();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets DirectPrediction.
+ /// </summary>
+ public AdvancedChoice DirectPrediction
+ {
+ get
+ {
+ return this.directPrediction;
+ }
+
+ set
+ {
+ this.directPrediction = value;
+ this.NotifyOfPropertyChange(() => this.DirectPrediction);
+ this.UpdateOptionsString();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether EightByEightDct.
+ /// </summary>
+ public bool EightByEightDct
+ {
+ get
+ {
+ return this.eightByEightDct;
+ }
+
+ set
+ {
+ this.eightByEightDct = value;
+ this.NotifyOfPropertyChange(() => this.EightByEightDct);
+ this.UpdateOptionsString();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets MotionEstimationMethod.
+ /// </summary>
+ public AdvancedChoice MotionEstimationMethod
+ {
+ get
+ {
+ return this.motionEstimationMethod;
+ }
+
+ set
+ {
+ this.motionEstimationMethod = value;
+ this.NotifyOfPropertyChange(() => this.MotionEstimationMethod);
+
+ if ((MotionEstimationMethod.Value == "hex" || MotionEstimationMethod.Value == "dia") && (motionEstimationRange > 16))
+ {
+ this.motionEstimationRange = 16;
+ this.NotifyOfPropertyChange(() => this.MotionEstimationRange);
+ }
+
+ this.UpdateOptionsString();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets MotionEstimationRange.
+ /// </summary>
+ public int MotionEstimationRange
+ {
+ get
+ {
+ return this.motionEstimationRange;
+ }
+
+ set
+ {
+ if ((MotionEstimationMethod.Value == "hex" || MotionEstimationMethod.Value == "dia") && (value > 16))
+ {
+ this.motionEstimationRange = 16;
+ }
+ else if (value < 4)
+ {
+ this.motionEstimationRange = 4;
+ }
+ else
+ {
+ this.motionEstimationRange = value;
+ }
+
+ this.NotifyOfPropertyChange(() => this.MotionEstimationRange);
+ this.UpdateOptionsString();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether NoDctDecimate.
+ /// </summary>
+ public bool NoDctDecimate
+ {
+ get
+ {
+ return this.noDctDecimate;
+ }
+
+ set
+ {
+ this.noDctDecimate = value;
+ this.NotifyOfPropertyChange(() => this.NoDctDecimate);
+ this.UpdateOptionsString();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets PsychovisualRateDistortion.
+ /// </summary>
+ public double PsychovisualRateDistortion
+ {
+ get
+ {
+ return this.psychovisualRateDistortion;
+ }
+
+ set
+ {
+ this.psychovisualRateDistortion = value;
+ this.NotifyOfPropertyChange(() => this.PsychovisualRateDistortion);
+ this.UpdateOptionsString();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets PsychovisualTrellis.
+ /// </summary>
+ public double PsychovisualTrellis
+ {
+ get
+ {
+ return this.psychovisualTrellis;
+ }
+
+ set
+ {
+ this.psychovisualTrellis = value;
+ this.NotifyOfPropertyChange(() => this.PsychovisualTrellis);
+ this.UpdateOptionsString();
+ }
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether PsychovisualTrellisVisible.
+ /// </summary>
+ public bool PsychovisualTrellisVisible
+ {
+ get
+ {
+ return this.CabacEntropyCoding && this.Trellis.Value != "0";
+ }
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether PsychovisualRateDistortionVisible.
+ /// </summary>
+ public bool PsychovisualRateDistortionVisible
+ {
+ get
+ {
+ int value;
+ int.TryParse(this.SubpixelMotionEstimation.Value.Trim(), out value);
+ return value >= 6;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets PyramidalBFrames.
+ /// </summary>
+ public AdvancedChoice PyramidalBFrames
+ {
+ get
+ {
+ return this.pyramidalBFrames;
+ }
+
+ set
+ {
+ this.pyramidalBFrames = value;
+ this.NotifyOfPropertyChange(() => this.PyramidalBFrames);
+ this.UpdateOptionsString();
+ }
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether PyramidalBFramesVisible.
+ /// </summary>
+ public bool PyramidalBFramesVisible
+ {
+ get
+ {
+ return int.Parse(this.BFrames.Value) > 1;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets ReferenceFrames.
+ /// </summary>
+ public AdvancedChoice ReferenceFrames
+ {
+ get
+ {
+ return this.referenceFrames;
+ }
+
+ set
+ {
+ this.referenceFrames = value;
+ this.NotifyOfPropertyChange(() => this.ReferenceFrames);
+ this.UpdateOptionsString();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets SubpixelMotionEstimation.
+ /// </summary>
+ public AdvancedChoice SubpixelMotionEstimation
+ {
+ get
+ {
+ return this.subpixelMotionEstimation;
+ }
+
+ set
+ {
+ this.subpixelMotionEstimation = value;
+ this.NotifyOfPropertyChange(() => this.SubpixelMotionEstimation);
+ this.NotifyOfPropertyChange(() => this.PsychovisualRateDistortionVisible);
+ this.UpdateOptionsString();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets Task.
+ /// </summary>
+ public EncodeTask Task { get; set; }
+
+ /// <summary>
+ /// Gets or sets Trellis.
+ /// </summary>
+ public AdvancedChoice Trellis
+ {
+ get
+ {
+ return this.trellis;
+ }
+
+ set
+ {
+ this.trellis = value;
+ this.NotifyOfPropertyChange(() => this.Trellis);
+ this.NotifyOfPropertyChange(() => this.PsychovisualTrellisVisible);
+ this.UpdateOptionsString();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether WeightedPFrames.
+ /// </summary>
+ public bool WeightedPFrames
+ {
+ get
+ {
+ return this.weightedPFrames;
+ }
+
+ set
+ {
+ this.weightedPFrames = value;
+ this.NotifyOfPropertyChange(() => this.WeightedPFrames);
+ this.UpdateOptionsString();
+ }
+ }
+
+ #endregion
+
+ #region Public Methods
+
+ /// <summary>
+ /// The update ui from advanced options.
+ /// </summary>
+ public void UpdateUIFromAdvancedOptions()
+ {
+ this.AutomaticChange = true;
+
+ // Reset UI to defaults, and re-apply options.
+ this.SetAdvancedToDefaults();
+
+ if (this.Task.AdvancedEncoderOptions == null)
+ {
+ this.AutomaticChange = false;
+ return;
+ }
+
+ // Check the updated options string. Update UI for any recognized options.
+ string[] newOptionsSegments = this.Task.AdvancedEncoderOptions.Split(':');
+ foreach (string newOptionsSegment in newOptionsSegments)
+ {
+ int equalsIndex = newOptionsSegment.IndexOf('=');
+ if (equalsIndex >= 0)
+ {
+ string optionName = newOptionsSegment.Substring(0, equalsIndex);
+ string optionValue = newOptionsSegment.Substring(equalsIndex + 1);
+
+ if (optionName != string.Empty && optionValue != string.Empty)
+ {
+ AdvancedChoice newChoice;
+ int parseInt;
+ double parseDouble;
+ string[] subParts;
+
+ switch (optionName)
+ {
+ case "ref":
+ if (int.TryParse(optionValue, out parseInt))
+ {
+ newChoice =
+ AdvancedChoicesHelper.ReferenceFrames.SingleOrDefault(
+ choice => choice.Value == parseInt.ToString(CultureInfo.InvariantCulture));
+ if (newChoice != null)
+ {
+ this.ReferenceFrames = newChoice;
+ }
+ }
+
+ break;
+ case "bframes":
+ if (int.TryParse(optionValue, out parseInt))
+ {
+ newChoice =
+ AdvancedChoicesHelper.BFrames.SingleOrDefault(
+ choice => choice.Value == parseInt.ToString(CultureInfo.InvariantCulture));
+ if (newChoice != null)
+ {
+ this.BFrames = newChoice;
+ }
+ }
+
+ break;
+ case "b-adapt":
+ newChoice =
+ AdvancedChoicesHelper.AdaptiveBFrames.SingleOrDefault(
+ choice => choice.Value == optionValue);
+ if (newChoice != null)
+ {
+ this.AdaptiveBFrames = newChoice;
+ }
+
+ break;
+ case "direct":
+ newChoice =
+ AdvancedChoicesHelper.DirectPrediction.SingleOrDefault(
+ choice => choice.Value == optionValue);
+ if (newChoice != null)
+ {
+ this.DirectPrediction = newChoice;
+ }
+
+ break;
+ case "weightp":
+ if (optionValue == "0")
+ {
+ this.WeightedPFrames = false;
+ }
+ else if (optionValue == "1")
+ {
+ this.WeightedPFrames = true;
+ }
+
+ break;
+ case "b-pyramid":
+ newChoice =
+ AdvancedChoicesHelper.PyramidalBFrames.SingleOrDefault(
+ choice => choice.Value == optionValue);
+ if (newChoice != null)
+ {
+ this.PyramidalBFrames = newChoice;
+ }
+
+ break;
+ case "me":
+ newChoice =
+ AdvancedChoicesHelper.MotionEstimationMethod.SingleOrDefault(
+ choice => choice.Value == optionValue);
+ if (newChoice != null)
+ {
+ this.MotionEstimationMethod = newChoice;
+ }
+
+ break;
+ case "subme":
+ case "subq":
+ if (int.TryParse(optionValue, out parseInt))
+ {
+ newChoice =
+ AdvancedChoicesHelper.SubpixelMotionEstimation.SingleOrDefault(
+ choice => choice.Value == parseInt.ToString(CultureInfo.InvariantCulture));
+ if (newChoice != null)
+ {
+ this.SubpixelMotionEstimation = newChoice;
+ }
+ }
+
+ break;
+ case "merange":
+ if (int.TryParse(optionValue, out parseInt))
+ {
+ this.MotionEstimationRange = parseInt;
+ }
+
+ break;
+ case "analyse":
+ newChoice =
+ AdvancedChoicesHelper.Analysis.SingleOrDefault(
+ choice => choice.Value == optionValue);
+ if (newChoice != null)
+ {
+ this.Analysis = newChoice;
+ }
+
+ break;
+ case "8x8dct":
+ if (optionValue == "0")
+ {
+ this.EightByEightDct = false;
+ }
+ else if (optionValue == "1")
+ {
+ this.EightByEightDct = true;
+ }
+
+ break;
+ case "cabac":
+ if (optionValue == "0")
+ {
+ this.CabacEntropyCoding = false;
+ }
+ else if (optionValue == "1")
+ {
+ this.CabacEntropyCoding = true;
+ }
+
+ break;
+ case "trellis":
+ if (int.TryParse(optionValue, out parseInt))
+ {
+ newChoice =
+ AdvancedChoicesHelper.Trellis.SingleOrDefault(
+ choice => choice.Value == parseInt.ToString(CultureInfo.InvariantCulture));
+ if (newChoice != null)
+ {
+ this.Trellis = newChoice;
+ }
+ }
+
+ break;
+ case "aq-strength":
+ if (double.TryParse(optionValue, NumberStyles.Any, CultureInfo.InvariantCulture, out parseDouble) && parseDouble >= 0.0 &&
+ parseDouble <= 2.0)
+ {
+ this.AdaptiveQuantizationStrength = Math.Round(parseDouble, 1);
+ }
+
+ break;
+ case "psy-rd":
+ subParts = optionValue.Split(',');
+ if (subParts.Length == 2)
+ {
+ double psyRD, psyTrellis;
+ if (double.TryParse(subParts[0], NumberStyles.Any, CultureInfo.InvariantCulture, out psyRD) &&
+ double.TryParse(subParts[1], NumberStyles.Any, CultureInfo.InvariantCulture, out psyTrellis))
+ {
+ if (psyRD >= 0.0 && psyRD <= 2.0 && psyTrellis >= 0.0 && psyTrellis <= 1.0)
+ {
+ this.PsychovisualRateDistortion = Math.Round(psyRD, 1);
+ this.PsychovisualTrellis = Math.Round(psyTrellis, 2);
+ }
+ }
+ }
+
+ break;
+ case "no-dct-decimate":
+ if (optionValue == "0")
+ {
+ this.NoDctDecimate = false;
+ }
+ else if (optionValue == "1")
+ {
+ this.NoDctDecimate = true;
+ }
+
+ break;
+ case "deblock":
+ subParts = optionValue.Split(',');
+ if (subParts.Length == 2)
+ {
+ int dbStrength, dbThreshold;
+ if (int.TryParse(subParts[0], out dbStrength) &&
+ int.TryParse(subParts[1], out dbThreshold))
+ {
+ newChoice =
+ AdvancedChoicesHelper.DeblockingStrength.SingleOrDefault(
+ choice => choice.Value == subParts[0]);
+ if (newChoice != null)
+ {
+ this.DeblockingStrength = newChoice;
+ }
+
+ newChoice =
+ AdvancedChoicesHelper.DeblockingThreshold.SingleOrDefault(
+ choice => choice.Value == subParts[1]);
+ if (newChoice != null)
+ {
+ this.DeblockingThreshold = newChoice;
+ }
+ }
+ }
+
+ break;
+ }
+ }
+ }
+ }
+
+ this.AutomaticChange = false;
+ }
+
+ #endregion
+
+ #region Implemented Interfaces
+
+ #region IAdvancedViewModel
+
+ /// <summary>
+ /// The set encoder.
+ /// </summary>
+ /// <param name="encoder">
+ /// The encoder.
+ /// </param>
+ public void SetEncoder(VideoEncoder encoder)
+ {
+ }
+
+ /// <summary>
+ /// The clear.
+ /// </summary>
+ public void Clear()
+ {
+ this.AdvancedOptionsString = string.Empty;
+ }
+
+ #endregion
+
+ #region ITabInterface
+
+ /// <summary>
+ /// Setup this tab for the specified preset.
+ /// </summary>
+ /// <param name="preset">
+ /// The preset.
+ /// </param>
+ /// <param name="task">
+ /// The task.
+ /// </param>
+ public void SetPreset(Preset preset, EncodeTask task)
+ {
+ this.Task.PropertyChanged -= this.Task_PropertyChanged;
+ this.Task = task;
+ this.Task.PropertyChanged += this.Task_PropertyChanged;
+ this.AdvancedOptionsString = preset.Task.AdvancedEncoderOptions;
+ }
+
+ /// <summary>
+ /// Update all the UI controls based on the encode task passed in.
+ /// </summary>
+ /// <param name="task">
+ /// The task.
+ /// </param>
+ public void UpdateTask(EncodeTask task)
+ {
+ this.Task = task;
+ this.SetEncoder(task.VideoEncoder);
+ this.AdvancedOptionsString = task.AdvancedEncoderOptions;
+ }
+
+ /// <summary>
+ /// Setup this window for a new source
+ /// </summary>
+ /// <param name="title">
+ /// The title.
+ /// </param>
+ /// <param name="preset">
+ /// The preset.
+ /// </param>
+ /// <param name="task">
+ /// The task.
+ /// </param>
+ public void SetSource(Title title, Preset preset, EncodeTask task)
+ {
+ this.Task = task;
+ this.NotifyOfPropertyChange(() => this.AdvancedOptionsString);
+ }
+
+ #endregion
+
+ #endregion
+
+ #region Methods
+
+ /// <summary>
+ /// The set advanced to defaults.
+ /// </summary>
+ private void SetAdvancedToDefaults()
+ {
+ this.ReferenceFrames = AdvancedChoicesHelper.ReferenceFrames.SingleOrDefault(choice => choice.IsDefault);
+ this.BFrames = AdvancedChoicesHelper.BFrames.SingleOrDefault(choice => choice.IsDefault);
+ this.AdaptiveBFrames = AdvancedChoicesHelper.AdaptiveBFrames.SingleOrDefault(choice => choice.IsDefault);
+ this.DirectPrediction = AdvancedChoicesHelper.DirectPrediction.SingleOrDefault(choice => choice.IsDefault);
+ this.WeightedPFrames = true;
+ this.PyramidalBFrames = AdvancedChoicesHelper.PyramidalBFrames.SingleOrDefault(choice => choice.IsDefault);
+ this.MotionEstimationMethod =
+ AdvancedChoicesHelper.MotionEstimationMethod.SingleOrDefault(choice => choice.IsDefault);
+ this.SubpixelMotionEstimation =
+ AdvancedChoicesHelper.SubpixelMotionEstimation.SingleOrDefault(choice => choice.IsDefault);
+ this.MotionEstimationRange = 16;
+ this.Analysis = AdvancedChoicesHelper.Analysis.SingleOrDefault(choice => choice.IsDefault);
+ this.EightByEightDct = true;
+ this.CabacEntropyCoding = true;
+ this.Trellis = AdvancedChoicesHelper.Trellis.SingleOrDefault(choice => choice.IsDefault);
+ this.AdaptiveQuantizationStrength = 1.0;
+ this.PsychovisualRateDistortion = 1.0;
+ this.PsychovisualTrellis = 0.0;
+ this.DeblockingStrength =
+ AdvancedChoicesHelper.DeblockingStrength.SingleOrDefault(choice => choice.IsDefault);
+ this.DeblockingThreshold =
+ AdvancedChoicesHelper.DeblockingThreshold.SingleOrDefault(choice => choice.IsDefault);
+ this.NoDctDecimate = false;
+ }
+
+ /// <summary>
+ /// Update the x264 options string from a UI change.
+ /// </summary>
+ private void UpdateOptionsString()
+ {
+ if (this.AutomaticChange)
+ {
+ return;
+ }
+
+ List<string> newOptions = new List<string>();
+
+ // First add any parts of the options string that don't correspond to the UI
+ if (this.AdvancedOptionsString != null)
+ {
+ string[] existingSegments = this.AdvancedOptionsString.Split(':');
+ foreach (string existingSegment in existingSegments)
+ {
+ string optionName = existingSegment;
+ int equalsIndex = existingSegment.IndexOf('=');
+ if (equalsIndex >= 0)
+ {
+ optionName = existingSegment.Substring(0, existingSegment.IndexOf("=", System.StringComparison.Ordinal));
+ }
+
+ if (!this.uiOptions.Contains(optionName) && optionName != string.Empty)
+ {
+ newOptions.Add(existingSegment);
+ }
+ }
+ }
+
+ // Now add everything from the UI
+ if (!this.ReferenceFrames.IsDefault)
+ {
+ newOptions.Add("ref=" + this.ReferenceFrames.Value);
+ }
+
+ if (!this.BFrames.IsDefault)
+ {
+ newOptions.Add("bframes=" + this.BFrames.Value);
+ }
+
+ if (this.BFrames.Value != "0")
+ {
+ if (!this.AdaptiveBFrames.IsDefault)
+ {
+ newOptions.Add("b-adapt=" + this.AdaptiveBFrames.Value);
+ }
+
+ if (!this.DirectPrediction.IsDefault)
+ {
+ newOptions.Add("direct=" + this.DirectPrediction.Value);
+ }
+
+ if (this.BFrames.Value != "1" && !this.PyramidalBFrames.IsDefault)
+ {
+ newOptions.Add("b-pyramid=" + this.PyramidalBFrames.Value);
+ }
+ }
+
+ if (!this.WeightedPFrames)
+ {
+ newOptions.Add("weightp=0");
+ }
+
+ if (!this.MotionEstimationMethod.IsDefault)
+ {
+ newOptions.Add("me=" + this.MotionEstimationMethod.Value);
+ }
+
+ if (!this.SubpixelMotionEstimation.IsDefault)
+ {
+ newOptions.Add("subme=" + this.SubpixelMotionEstimation.Value);
+ }
+
+ if (this.MotionEstimationRange != 16)
+ {
+ newOptions.Add("merange=" + this.MotionEstimationRange);
+ }
+
+ if (!this.Analysis.IsDefault)
+ {
+ newOptions.Add("analyse=" + this.Analysis.Value);
+ }
+
+ if (this.Analysis.Value != "none" && !this.EightByEightDct)
+ {
+ newOptions.Add("8x8dct=0");
+ }
+
+ if (!this.CabacEntropyCoding)
+ {
+ newOptions.Add("cabac=0");
+ }
+
+ if (!this.Trellis.IsDefault)
+ {
+ newOptions.Add("trellis=" + this.Trellis.Value);
+ }
+
+ double psTrellis = 0.0;
+ if (this.CabacEntropyCoding && this.Trellis.Value != "0")
+ {
+ psTrellis = this.PsychovisualTrellis;
+ }
+
+ if (this.AdaptiveQuantizationStrength != 1.0)
+ {
+ newOptions.Add(
+ "aq-strength=" + this.AdaptiveQuantizationStrength.ToString("F1", CultureInfo.InvariantCulture));
+ }
+
+ if (this.PsychovisualRateDistortion != 1.0 || psTrellis > 0.0)
+ {
+ newOptions.Add(
+ "psy-rd=" + this.PsychovisualRateDistortion.ToString("F1", CultureInfo.InvariantCulture) + "," +
+ psTrellis.ToString("F2", CultureInfo.InvariantCulture));
+ }
+
+ if (this.NoDctDecimate)
+ {
+ newOptions.Add("no-dct-decimate=1");
+ }
+
+ if (!this.DeblockingStrength.IsDefault || !this.DeblockingThreshold.IsDefault)
+ {
+ newOptions.Add("deblock=" + this.DeblockingStrength.Value + "," + this.DeblockingThreshold.Value);
+ }
+
+ 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
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrakeWPF/Views/AdvancedView.xaml b/win/CS/HandBrakeWPF/Views/AdvancedView.xaml
index b0b7698d2..99d05b099 100644
--- a/win/CS/HandBrakeWPF/Views/AdvancedView.xaml
+++ b/win/CS/HandBrakeWPF/Views/AdvancedView.xaml
@@ -3,29 +3,12 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Converters="clr-namespace:HandBrakeWPF.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:Helpers="clr-namespace:HandBrakeWPF.Helpers"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:Properties="clr-namespace:HandBrakeWPF.Properties"
- xmlns:controls="clr-namespace:HandBrakeWPF.Controls"
x:Name="advancedView"
mc:Ignorable="d"
>
<UserControl.Resources>
- <Converters:AdvancedVisibilityConverter x:Key="VisibilityConverter" />
<Converters:BooleanToVisibilityConverter x:Key="BooleanVisibilityConverter" />
- <Style x:Key="AdvancedLabel" TargetType="Label">
- <Setter Property="HorizontalAlignment" Value="Right" />
- </Style>
-
- <Style x:Key="LongToolTipHolder" TargetType="FrameworkElement">
- <Setter Property="ToolTipService.ShowDuration" Value="20000" />
- <Setter Property="Margin" Value="0,2,0,2" />
- </Style>
-
- <Style x:Key="LongToolTip" TargetType="TextBlock">
- <Setter Property="Width" Value="400" />
- <Setter Property="TextWrapping" Value="Wrap" />
- </Style>
</UserControl.Resources>
<Grid>
@@ -33,533 +16,14 @@
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
- <RowDefinition Height="*" />
</Grid.RowDefinitions>
- <!-- X264 Query -->
-
- <TextBlock Grid.Row="2" Margin="10,5,10,0"
- VerticalAlignment="Center"
- FontWeight="Bold"
- Text="x264 Encoder Options:"
- Visibility="{Binding ShowX264AdvancedOptions, Converter={StaticResource BooleanVisibilityConverter}, ConverterParameter=false}"
- />
-
- <TextBox Grid.Row="3"
- Margin="10,2,10, 2"
- HorizontalAlignment="Stretch"
- VerticalAlignment="Stretch"
- Style="{StaticResource LongToolTipHolder}"
- ToolTip="{x:Static Properties:Resources.Advanced_EncoderOptions}"
- Text="{Binding AdvancedOptionsString,
- UpdateSourceTrigger=PropertyChanged}"
- TextWrapping="Wrap"
- Visibility="{Binding ShowX264AdvancedOptions, Converter={StaticResource BooleanVisibilityConverter}, ConverterParameter=false}"
- />
-
- <StackPanel Orientation="Vertical">
-
- <!-- Other Encoders -->
- <Grid Visibility="{Binding DisplayX264Options, Converter={StaticResource BooleanVisibilityConverter}, ConverterParameter=true}">
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" />
- <RowDefinition Height="102" />
- </Grid.RowDefinitions>
- <TextBlock Margin="10,5,10,0"
- VerticalAlignment="Center"
- FontWeight="Bold"
- Text="Advanced Query"
- />
- <TextBox Grid.Row="1"
- Margin="10,0,10,5"
- HorizontalAlignment="Stretch"
- VerticalAlignment="Stretch"
- Text="{Binding AdvancedOptionsString, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
- TextWrapping="Wrap"
- />
- </Grid>
-
- <!-- X264 -->
- <TextBlock Text="{x:Static Properties:Resources.Advanced_NotInUse}"
- TextWrapping="Wrap" Width="480" Margin="0, 100, 0, 0" FontSize="12"
- Visibility="{Binding ShowX264AdvancedOptions, Converter={StaticResource BooleanVisibilityConverter}, ConverterParameter=true}" />
-
- <Grid Visibility="{Binding ShowX264AdvancedOptions, Converter={StaticResource BooleanVisibilityConverter}, ConverterParameter=false}">
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" />
- <RowDefinition Height="*" />
- </Grid.RowDefinitions>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="Auto" />
- </Grid.ColumnDefinitions>
-
- <!-- Left Column -->
- <StackPanel Grid.Row="0"
- Grid.Column="0"
- Orientation="Vertical"
- >
- <!-- Encoding -->
- <StackPanel Orientation="Vertical">
- <TextBlock Grid.Row="0"
- Margin="10,5,0,0"
- FontWeight="Bold"
- Text="Encoding: "
- />
- <Grid Margin="0,5,0,0"
- HorizontalAlignment="Left"
- VerticalAlignment="Top"
- >
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- </Grid.RowDefinitions>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="*" MinWidth="100" />
- </Grid.ColumnDefinitions>
-
- <Label Grid.Row="0"
- Grid.Column="0"
- Content="Reference Frames:"
- Style="{StaticResource AdvancedLabel}"
- />
- <ComboBox Grid.Row="0"
- Grid.Column="1"
- Height="22"
- DisplayMemberPath="Label"
- ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.ReferenceFrames}"
- SelectedItem="{Binding ReferenceFrames}"
- Style="{StaticResource LongToolTipHolder}"
- >
- <ComboBox.ToolTip>
- <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_ReferenceFramesToolTip}" />
- </ComboBox.ToolTip>
- </ComboBox>
-
- <Label Grid.Row="1"
- Grid.Column="0"
- Content="Maximum B-Frames:"
- Style="{StaticResource AdvancedLabel}"
- />
- <ComboBox Grid.Row="1"
- Grid.Column="1"
- Height="22"
- DisplayMemberPath="Label"
- ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.BFrames}"
- SelectedItem="{Binding BFrames}"
- Style="{StaticResource LongToolTipHolder}"
- >
- <ComboBox.ToolTip>
- <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_BFramesToolTip}" />
- </ComboBox.ToolTip>
- </ComboBox>
-
-
- <Label Grid.Row="4"
- Grid.Column="0"
- Height="28"
- Content="CABAC:"
- Style="{StaticResource AdvancedLabel}"
- />
- <CheckBox Grid.Row="4"
- Grid.Column="1"
- Height="16"
- IsChecked="{Binding CabacEntropyCoding}"
- Style="{StaticResource LongToolTipHolder}"
- >
- <CheckBox.ToolTip>
- <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_CabacToolTip}" />
- </CheckBox.ToolTip>
- </CheckBox>
-
- <Label Grid.Row="5"
- Grid.Column="0"
- Height="28"
- Content="8x8 Transform:"
- Style="{StaticResource AdvancedLabel}"
- />
- <CheckBox Grid.Row="5"
- Grid.Column="1"
- Height="16"
- IsChecked="{Binding EightByEightDct}"
- Style="{StaticResource LongToolTipHolder}">
- <CheckBox.ToolTip>
- <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_EightByEightDctToolTip}" />
- </CheckBox.ToolTip>
- </CheckBox>
-
- <Label Grid.Row="6"
- Grid.Column="0"
- Content="Weighted P-Frames:"
- Style="{StaticResource AdvancedLabel}"
- />
- <CheckBox Grid.Row="6"
- Grid.Column="1"
- VerticalAlignment="Center"
- IsChecked="{Binding WeightedPFrames}"
- Style="{StaticResource LongToolTipHolder}"
- >
- <CheckBox.ToolTip>
- <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_WeightPToolTip}" />
- </CheckBox.ToolTip>
- </CheckBox>
-
- <Label Grid.Row="7"
- Grid.Column="0"
- Content="Pyramidal B-Frames:"
- Style="{StaticResource AdvancedLabel}"
- Visibility="{Binding PyramidalBFramesVisible,
- Converter={StaticResource VisibilityConverter}}"
- />
- <ComboBox Grid.Row="7"
- Grid.Column="1"
- Height="22"
- MaxWidth="100"
- DisplayMemberPath="Label"
- ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.PyramidalBFrames}"
- SelectedItem="{Binding PyramidalBFrames}"
- Style="{StaticResource LongToolTipHolder}"
- Visibility="{Binding PyramidalBFramesVisible,
- Converter={StaticResource VisibilityConverter}}"
- >
- <ComboBox.ToolTip>
- <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_PyramidalBFramesToolTip}" />
- </ComboBox.ToolTip>
- </ComboBox>
- </Grid>
- </StackPanel>
- </StackPanel>
-
- <!-- Right Column -->
- <Grid Grid.Row="0" Grid.Column="1">
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- <RowDefinition Height="*" />
- </Grid.RowDefinitions>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- </Grid.ColumnDefinitions>
-
- <!-- Analysis -->
- <TextBlock Text="Analysis: " Grid.Row="0" Margin="10,5,0,0" FontWeight="Bold" />
- <Grid Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Top">
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- </Grid.RowDefinitions>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="Auto" MinWidth="100" />
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="Auto" />
- </Grid.ColumnDefinitions>
-
- <Label Content="Adaptive B-Frames:"
- Style="{StaticResource AdvancedLabel}"
- Visibility="{Binding BFramesOptionsVisible,
- Converter={StaticResource VisibilityConverter}}" Height="26" VerticalAlignment="Top" />
- <ComboBox Grid.Row="0"
- Grid.Column="1"
- Width="120"
- Height="22"
- MaxWidth="120"
- DisplayMemberPath="Label"
- ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.AdaptiveBFrames}"
- SelectedItem="{Binding AdaptiveBFrames}"
- Style="{StaticResource LongToolTipHolder}"
- Visibility="{Binding BFramesOptionsVisible,
- Converter={StaticResource VisibilityConverter}}"
- >
- <ComboBox.ToolTip>
- <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_AdaptiveBFramesToolTip}" />
- </ComboBox.ToolTip>
- </ComboBox>
-
- <Label Grid.Row="1"
- Grid.Column="0"
- Content="Adaptive Direct Mode:"
- Style="{StaticResource AdvancedLabel}"
- Visibility="{Binding BFramesOptionsVisible,
- Converter={StaticResource VisibilityConverter}}"
- />
- <ComboBox Grid.Row="1"
- Grid.Column="1"
- Width="120"
- Height="22"
- MaxWidth="120"
- DisplayMemberPath="Label"
- ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.DirectPrediction}"
- SelectedItem="{Binding DirectPrediction}"
- Style="{StaticResource LongToolTipHolder}"
- Visibility="{Binding BFramesOptionsVisible,
- Converter={StaticResource VisibilityConverter}}"
- >
- <ComboBox.ToolTip>
- <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_AdaptiveDirectModeToolTip}" />
- </ComboBox.ToolTip>
- </ComboBox>
-
- <Label Grid.Row="2"
- Grid.Column="0"
- Content="Motion Est Method:"
- Style="{StaticResource AdvancedLabel}"
- />
- <ComboBox Grid.Row="2"
- Grid.Column="1"
- Width="120"
- Height="22"
- MaxWidth="120"
- DisplayMemberPath="Label"
- ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.MotionEstimationMethod}"
- SelectedItem="{Binding MotionEstimationMethod}"
- Style="{StaticResource LongToolTipHolder}"
- >
- <ComboBox.ToolTip>
- <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_MotionEstimationMethodToolTip}" />
- </ComboBox.ToolTip>
- </ComboBox>
-
- <Label Grid.Row="3"
- Grid.Column="0"
- Content="Subpixel Motion Est:"
- Style="{StaticResource AdvancedLabel}"
- />
- <ComboBox Grid.Row="3"
- Grid.Column="1"
- Width="120"
- Height="22"
- MaxWidth="120"
- DisplayMemberPath="Label"
- ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.SubpixelMotionEstimation}"
- SelectedItem="{Binding SubpixelMotionEstimation}"
- Style="{StaticResource LongToolTipHolder}"
- >
- <ComboBox.ToolTip>
- <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_SubpixelMotionEstimationToolTip}" />
- </ComboBox.ToolTip>
- </ComboBox>
-
- <Label Grid.Row="4"
- Grid.Column="0"
- Content="Motion Est Range:"
- Style="{StaticResource AdvancedLabel}" />
- <controls:NumberBox Grid.Row="4"
- Grid.Column="1"
- Width="120"
- Height="22"
- MaxWidth="120"
- Minimum="4" Maximum="64"
- Number="{Binding MotionEstimationRange, Mode=TwoWay}"
- ToolTip="{x:Static Properties:Resources.Advanced_MotionEstimationRangeToolTip}"
- />
-
-
- <!-- Column 2 -->
- <Label Grid.Row="0" Grid.Column="2"
- Height="28"
- HorizontalAlignment="Right"
- VerticalAlignment="Top"
- Content="Partition Type:"
- />
- <ComboBox Grid.Row="0" Grid.Column="3"
- Width="100"
- Height="23"
- MaxWidth="100"
- HorizontalAlignment="Right"
- VerticalAlignment="Top"
- DisplayMemberPath="Label"
- ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.Analysis}"
- SelectedItem="{Binding Analysis}"
- Style="{StaticResource LongToolTipHolder}"
- >
- <ComboBox.ToolTip>
- <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_AnalysisToolTip}" />
- </ComboBox.ToolTip>
- </ComboBox>
-
- <Label Grid.Row="1" Grid.Column="2" Height="28" HorizontalAlignment="Right" VerticalAlignment="Top" Content="Trellis:" />
- <ComboBox Grid.Row="1"
- Grid.Column="3"
- Width="100"
- Height="23"
- MaxWidth="100"
- HorizontalAlignment="Right"
- VerticalAlignment="Top"
- DisplayMemberPath="Label"
- ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.Trellis}"
- SelectedItem="{Binding Trellis}"
- Style="{StaticResource LongToolTipHolder}">
- <ComboBox.ToolTip>
- <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_TrellisToolTip}" />
- </ComboBox.ToolTip>
- </ComboBox>
- </Grid>
-
- <!-- PhysoVisual -->
- <TextBlock Text="Psychovisual: " Grid.Row="2" Margin="10,5,0,0" FontWeight="Bold" />
- <Grid Grid.Row="3"
- Height="90"
- HorizontalAlignment="Left"
- VerticalAlignment="Top"
- >
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- </Grid.RowDefinitions>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="Auto" MinWidth="100" />
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="Auto" />
- </Grid.ColumnDefinitions>
-
- <Label Grid.Row="0" Grid.Column="0"
- Content="Adaptive Quant Strength:"
- Style="{StaticResource AdvancedLabel}"
- />
- <Slider Grid.Row="0" Grid.Column="1"
- IsSnapToTickEnabled="True"
- LargeChange="0.2"
- Maximum="2.0"
- Width="150"
- Minimum="0.0"
- SmallChange="0.1"
- Style="{StaticResource LongToolTipHolder}"
- TickFrequency="0.1"
- TickPlacement="BottomRight"
- Value="{Binding AdaptiveQuantizationStrength}"
- >
- <Slider.ToolTip>
- <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_AdaptiveQuantizationStrengthToolTip}" />
- </Slider.ToolTip>
- </Slider>
-
- <Label Grid.Row="1" Grid.Column="0"
- Content="Rate Distortion:"
- Style="{StaticResource AdvancedLabel}"
- Visibility="{Binding PsychovisualRateDistortionVisible,
- Converter={StaticResource VisibilityConverter}}"
- />
- <Slider Grid.Row="1" Grid.Column="1"
- IsSnapToTickEnabled="True"
- LargeChange="0.2"
- Maximum="2.0"
- Minimum="0.0"
- Width="150"
- SmallChange="0.1"
- Style="{StaticResource LongToolTipHolder}"
- TickFrequency="0.1"
- TickPlacement="BottomRight"
- Visibility="{Binding PsychovisualRateDistortionVisible,
- Converter={StaticResource VisibilityConverter}}"
- Value="{Binding PsychovisualRateDistortion}"
- >
- <Slider.ToolTip>
- <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_PsychovisualRateDistortionToolTip}" />
- </Slider.ToolTip>
- </Slider>
-
- <Label Grid.Row="2" Grid.Column="0"
- Content="Psychovisual Trellis:"
- Style="{StaticResource AdvancedLabel}"
- Visibility="{Binding PsychovisualTrellisVisible,
- Converter={StaticResource VisibilityConverter}}"
- />
- <Slider Grid.Row="2" Grid.Column="1"
- IsSnapToTickEnabled="True"
- LargeChange="0.2"
- Maximum="1.0"
- Minimum="0.0"
- Width="150"
- SmallChange="0.05"
- Style="{StaticResource LongToolTipHolder}"
- TickFrequency="0.05"
- TickPlacement="BottomRight"
- Visibility="{Binding PsychovisualTrellisVisible,
- Converter={StaticResource VisibilityConverter}}"
- Value="{Binding PsychovisualTrellis}"
- >
- <Slider.ToolTip>
- <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_PsychovisualTrellisToolTip}" />
- </Slider.ToolTip>
- </Slider>
-
- <Label Grid.Row="0" Grid.Column="2" Width="110"
- HorizontalAlignment="Left"
- VerticalAlignment="Center"
- HorizontalContentAlignment="Right"
- Content="No DCT-Decimate:"
- />
- <CheckBox Grid.Row="0" Grid.Column="3" HorizontalAlignment="Left"
- VerticalAlignment="Center"
- IsChecked="{Binding NoDctDecimate}"
- Style="{StaticResource LongToolTipHolder}"
- >
- <CheckBox.ToolTip>
- <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_NoDctDecimateToolTip}" />
- </CheckBox.ToolTip>
- </CheckBox>
-
- <Label Grid.Row="1"
- Grid.Column="2"
- Height="28"
- HorizontalAlignment="Right"
- VerticalAlignment="Top"
- Content="Deblocking:"
- />
- <StackPanel Orientation="Vertical" Grid.Row="1" Grid.Column="3" Grid.RowSpan="2">
- <ComboBox
- Width="85"
- Height="23"
- MaxWidth="85"
- HorizontalAlignment="Right"
- VerticalAlignment="Top"
- DisplayMemberPath="Label"
- ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.DeblockingStrength}"
- SelectedItem="{Binding DeblockingStrength}"
- Style="{StaticResource LongToolTipHolder}"
- >
- <ComboBox.ToolTip>
- <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_DeblockingToolTip}" />
- </ComboBox.ToolTip>
- </ComboBox>
- <ComboBox
- Width="85"
- Height="23"
- MaxWidth="85"
- Margin="0,5,0,0"
- HorizontalAlignment="Right"
- VerticalAlignment="Top"
- DisplayMemberPath="Label"
- ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.DeblockingThreshold}"
- SelectedItem="{Binding DeblockingThreshold}"
- Style="{StaticResource LongToolTipHolder}"
- >
- <ComboBox.ToolTip>
- <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_DeblockingToolTip}" />
- </ComboBox.ToolTip>
- </ComboBox>
- </StackPanel>
-
- </Grid>
+ <ContentControl x:Name="X264ViewModel"
+ Visibility="{Binding ShowX264Panel, Converter={StaticResource BooleanVisibilityConverter}}" />
- </Grid>
+ <ContentControl x:Name="EncoderOptionsViewModel"
+ Visibility="{Binding ShowSimplePanel, Converter={StaticResource BooleanVisibilityConverter}}" />
- </Grid>
- </StackPanel>
</Grid>
</UserControl> \ No newline at end of file
diff --git a/win/CS/HandBrakeWPF/Views/EncoderOptionsView.xaml b/win/CS/HandBrakeWPF/Views/EncoderOptionsView.xaml
new file mode 100644
index 000000000..c4e64d6a8
--- /dev/null
+++ b/win/CS/HandBrakeWPF/Views/EncoderOptionsView.xaml
@@ -0,0 +1,28 @@
+<UserControl x:Class="HandBrakeWPF.Views.EncoderOptionsView"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ x:Name="x264View"
+ mc:Ignorable="d"
+ >
+ <Grid>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="100" />
+ </Grid.RowDefinitions>
+
+ <TextBlock Margin="10,5,10,0" Grid.Row="0"
+ VerticalAlignment="Center"
+ FontWeight="Bold"
+ Text="Advanced Query"
+ />
+ <TextBox Grid.Row="1"
+ Margin="10,5,10,5"
+ HorizontalAlignment="Stretch"
+ VerticalAlignment="Stretch"
+ Text="{Binding AdvancedOptionsString, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
+ TextWrapping="Wrap"
+ />
+ </Grid>
+</UserControl> \ No newline at end of file
diff --git a/win/CS/HandBrakeWPF/Views/EncoderOptionsView.xaml.cs b/win/CS/HandBrakeWPF/Views/EncoderOptionsView.xaml.cs
new file mode 100644
index 000000000..003d8274e
--- /dev/null
+++ b/win/CS/HandBrakeWPF/Views/EncoderOptionsView.xaml.cs
@@ -0,0 +1,27 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="EncoderOptionsView.xaml.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>
+// Interaction logic for EncoderOptionsView.xaml
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.Views
+{
+ using System.Windows.Controls;
+
+ /// <summary>
+ /// Interaction logic for AdvancedView.xaml
+ /// </summary>
+ public partial class EncoderOptionsView : UserControl
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="EncoderOptionsView"/> class.
+ /// </summary>
+ public EncoderOptionsView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/win/CS/HandBrakeWPF/Views/OptionsView.xaml b/win/CS/HandBrakeWPF/Views/OptionsView.xaml
index 389a80791..83735e414 100644
--- a/win/CS/HandBrakeWPF/Views/OptionsView.xaml
+++ b/win/CS/HandBrakeWPF/Views/OptionsView.xaml
@@ -88,8 +88,6 @@
<StackPanel Orientation="Vertical" Grid.Column="1" Margin="20,0,0,0">
<CheckBox Content="Check for Updates" IsChecked="{Binding CheckForUpdates}" />
<ComboBox Name="checkForUpdateFrequency" ItemsSource="{Binding CheckForUpdatesFrequencies}" SelectedIndex="{Binding CheckForUpdatesFrequency}" Margin="25,0,0,5" HorizontalAlignment="Left" Width="120"></ComboBox>
-
- <CheckBox Content="Enable Tooltips" Visibility="Collapsed" IsChecked="{Binding EnableGuiTooltips}" />
</StackPanel>
</StackPanel>
@@ -291,7 +289,6 @@
<StackPanel Orientation="Vertical" Grid.Column="1" Margin="20,0,0,0">
<CheckBox Content="Prevent the system from sleeping while encoding" IsChecked="{Binding PreventSleep}" />
<CheckBox Content="Minimize to system tray (Requires Restart)" IsChecked="{Binding MinimiseToTray}" />
- <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}" />
diff --git a/win/CS/HandBrakeWPF/Views/X264View.xaml b/win/CS/HandBrakeWPF/Views/X264View.xaml
new file mode 100644
index 000000000..b1c97e592
--- /dev/null
+++ b/win/CS/HandBrakeWPF/Views/X264View.xaml
@@ -0,0 +1,539 @@
+<UserControl x:Class="HandBrakeWPF.Views.X264View"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:Converters="clr-namespace:HandBrakeWPF.Converters"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:Helpers="clr-namespace:HandBrakeWPF.Helpers"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:Properties="clr-namespace:HandBrakeWPF.Properties"
+ xmlns:controls="clr-namespace:HandBrakeWPF.Controls"
+ x:Name="x264View"
+ mc:Ignorable="d"
+ >
+ <UserControl.Resources>
+ <Converters:AdvancedVisibilityConverter x:Key="VisibilityConverter" />
+ <Converters:BooleanToVisibilityConverter x:Key="BooleanVisibilityConverter" />
+ <Style x:Key="AdvancedLabel" TargetType="Label">
+ <Setter Property="HorizontalAlignment" Value="Right" />
+ </Style>
+
+ <Style x:Key="LongToolTipHolder" TargetType="FrameworkElement">
+ <Setter Property="ToolTipService.ShowDuration" Value="20000" />
+ <Setter Property="Margin" Value="0,2,0,2" />
+ </Style>
+
+ <Style x:Key="LongToolTip" TargetType="TextBlock">
+ <Setter Property="Width" Value="400" />
+ <Setter Property="TextWrapping" Value="Wrap" />
+ </Style>
+
+ </UserControl.Resources>
+ <Grid>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="*" />
+ </Grid.RowDefinitions>
+
+ <!-- X264 Query -->
+
+ <TextBlock Text="{x:Static Properties:Resources.Advanced_NotInUse}" Grid.Row="0"
+ TextWrapping="Wrap" Width="480" Margin="0, 100, 0, 0" FontSize="12"
+ Visibility="{Binding ShowX264AdvancedOptions, Converter={StaticResource BooleanVisibilityConverter}, ConverterParameter=true}" />
+
+ <Grid Grid.Row="1" Visibility="{Binding ShowX264AdvancedOptions, Converter={StaticResource BooleanVisibilityConverter}, ConverterParameter=false}">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="*" />
+ </Grid.RowDefinitions>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="Auto" />
+ </Grid.ColumnDefinitions>
+
+ <!-- Left Column -->
+ <StackPanel Grid.Row="0"
+ Grid.Column="0"
+ Orientation="Vertical"
+ >
+ <!-- Encoding -->
+ <StackPanel Orientation="Vertical">
+ <TextBlock Grid.Row="0"
+ Margin="10,5,0,0"
+ FontWeight="Bold"
+ Text="Encoding: "
+ />
+ <Grid Margin="0,5,0,0"
+ HorizontalAlignment="Left"
+ VerticalAlignment="Top"
+ >
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ </Grid.RowDefinitions>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" MinWidth="100" />
+ </Grid.ColumnDefinitions>
+
+ <Label Grid.Row="0"
+ Grid.Column="0"
+ Content="Reference Frames:"
+ Style="{StaticResource AdvancedLabel}"
+ />
+ <ComboBox Grid.Row="0"
+ Grid.Column="1"
+ Height="22"
+ DisplayMemberPath="Label"
+ ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.ReferenceFrames}"
+ SelectedItem="{Binding ReferenceFrames}"
+ Style="{StaticResource LongToolTipHolder}"
+ >
+ <ComboBox.ToolTip>
+ <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_ReferenceFramesToolTip}" />
+ </ComboBox.ToolTip>
+ </ComboBox>
+
+ <Label Grid.Row="1"
+ Grid.Column="0"
+ Content="Maximum B-Frames:"
+ Style="{StaticResource AdvancedLabel}"
+ />
+ <ComboBox Grid.Row="1"
+ Grid.Column="1"
+ Height="22"
+ DisplayMemberPath="Label"
+ ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.BFrames}"
+ SelectedItem="{Binding BFrames}"
+ Style="{StaticResource LongToolTipHolder}"
+ >
+ <ComboBox.ToolTip>
+ <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_BFramesToolTip}" />
+ </ComboBox.ToolTip>
+ </ComboBox>
+
+
+ <Label Grid.Row="4"
+ Grid.Column="0"
+ Height="28"
+ Content="CABAC:"
+ Style="{StaticResource AdvancedLabel}"
+ />
+ <CheckBox Grid.Row="4"
+ Grid.Column="1"
+ Height="16"
+ IsChecked="{Binding CabacEntropyCoding}"
+ Style="{StaticResource LongToolTipHolder}"
+ >
+ <CheckBox.ToolTip>
+ <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_CabacToolTip}" />
+ </CheckBox.ToolTip>
+ </CheckBox>
+
+ <Label Grid.Row="5"
+ Grid.Column="0"
+ Height="28"
+ Content="8x8 Transform:"
+ Style="{StaticResource AdvancedLabel}"
+ />
+ <CheckBox Grid.Row="5"
+ Grid.Column="1"
+ Height="16"
+ IsChecked="{Binding EightByEightDct}"
+ Style="{StaticResource LongToolTipHolder}">
+ <CheckBox.ToolTip>
+ <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_EightByEightDctToolTip}" />
+ </CheckBox.ToolTip>
+ </CheckBox>
+
+ <Label Grid.Row="6"
+ Grid.Column="0"
+ Content="Weighted P-Frames:"
+ Style="{StaticResource AdvancedLabel}"
+ />
+ <CheckBox Grid.Row="6"
+ Grid.Column="1"
+ VerticalAlignment="Center"
+ IsChecked="{Binding WeightedPFrames}"
+ Style="{StaticResource LongToolTipHolder}"
+ >
+ <CheckBox.ToolTip>
+ <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_WeightPToolTip}" />
+ </CheckBox.ToolTip>
+ </CheckBox>
+
+ <Label Grid.Row="7"
+ Grid.Column="0"
+ Content="Pyramidal B-Frames:"
+ Style="{StaticResource AdvancedLabel}"
+ Visibility="{Binding PyramidalBFramesVisible,
+ Converter={StaticResource VisibilityConverter}}"
+ />
+ <ComboBox Grid.Row="7"
+ Grid.Column="1"
+ Height="22"
+ MaxWidth="100"
+ DisplayMemberPath="Label"
+ ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.PyramidalBFrames}"
+ SelectedItem="{Binding PyramidalBFrames}"
+ Style="{StaticResource LongToolTipHolder}"
+ Visibility="{Binding PyramidalBFramesVisible,
+ Converter={StaticResource VisibilityConverter}}"
+ >
+ <ComboBox.ToolTip>
+ <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_PyramidalBFramesToolTip}" />
+ </ComboBox.ToolTip>
+ </ComboBox>
+ </Grid>
+ </StackPanel>
+ </StackPanel>
+
+ <!-- Right Column -->
+ <Grid Grid.Row="0" Grid.Column="1">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="*" />
+ </Grid.RowDefinitions>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ </Grid.ColumnDefinitions>
+
+ <!-- Analysis -->
+ <TextBlock Text="Analysis: " Grid.Row="0" Margin="10,5,0,0" FontWeight="Bold" />
+ <Grid Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Top">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ </Grid.RowDefinitions>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="Auto" MinWidth="100" />
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="Auto" />
+ </Grid.ColumnDefinitions>
+
+ <Label Content="Adaptive B-Frames:"
+ Style="{StaticResource AdvancedLabel}"
+ Visibility="{Binding BFramesOptionsVisible,
+ Converter={StaticResource VisibilityConverter}}" Height="26" VerticalAlignment="Top" />
+ <ComboBox Grid.Row="0"
+ Grid.Column="1"
+ Width="120"
+ Height="22"
+ MaxWidth="120"
+ DisplayMemberPath="Label"
+ ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.AdaptiveBFrames}"
+ SelectedItem="{Binding AdaptiveBFrames}"
+ Style="{StaticResource LongToolTipHolder}"
+ Visibility="{Binding BFramesOptionsVisible,
+ Converter={StaticResource VisibilityConverter}}"
+ >
+ <ComboBox.ToolTip>
+ <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_AdaptiveBFramesToolTip}" />
+ </ComboBox.ToolTip>
+ </ComboBox>
+
+ <Label Grid.Row="1"
+ Grid.Column="0"
+ Content="Adaptive Direct Mode:"
+ Style="{StaticResource AdvancedLabel}"
+ Visibility="{Binding BFramesOptionsVisible,
+ Converter={StaticResource VisibilityConverter}}"
+ />
+ <ComboBox Grid.Row="1"
+ Grid.Column="1"
+ Width="120"
+ Height="22"
+ MaxWidth="120"
+ DisplayMemberPath="Label"
+ ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.DirectPrediction}"
+ SelectedItem="{Binding DirectPrediction}"
+ Style="{StaticResource LongToolTipHolder}"
+ Visibility="{Binding BFramesOptionsVisible,
+ Converter={StaticResource VisibilityConverter}}"
+ >
+ <ComboBox.ToolTip>
+ <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_AdaptiveDirectModeToolTip}" />
+ </ComboBox.ToolTip>
+ </ComboBox>
+
+ <Label Grid.Row="2"
+ Grid.Column="0"
+ Content="Motion Est Method:"
+ Style="{StaticResource AdvancedLabel}"
+ />
+ <ComboBox Grid.Row="2"
+ Grid.Column="1"
+ Width="120"
+ Height="22"
+ MaxWidth="120"
+ DisplayMemberPath="Label"
+ ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.MotionEstimationMethod}"
+ SelectedItem="{Binding MotionEstimationMethod}"
+ Style="{StaticResource LongToolTipHolder}"
+ >
+ <ComboBox.ToolTip>
+ <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_MotionEstimationMethodToolTip}" />
+ </ComboBox.ToolTip>
+ </ComboBox>
+
+ <Label Grid.Row="3"
+ Grid.Column="0"
+ Content="Subpixel Motion Est:"
+ Style="{StaticResource AdvancedLabel}"
+ />
+ <ComboBox Grid.Row="3"
+ Grid.Column="1"
+ Width="120"
+ Height="22"
+ MaxWidth="120"
+ DisplayMemberPath="Label"
+ ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.SubpixelMotionEstimation}"
+ SelectedItem="{Binding SubpixelMotionEstimation}"
+ Style="{StaticResource LongToolTipHolder}"
+ >
+ <ComboBox.ToolTip>
+ <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_SubpixelMotionEstimationToolTip}" />
+ </ComboBox.ToolTip>
+ </ComboBox>
+
+ <Label Grid.Row="4"
+ Grid.Column="0"
+ Content="Motion Est Range:"
+ Style="{StaticResource AdvancedLabel}" />
+ <controls:NumberBox Grid.Row="4"
+ Grid.Column="1"
+ Width="120"
+ Height="22"
+ MaxWidth="120"
+ Minimum="4" Maximum="64"
+ Number="{Binding MotionEstimationRange, Mode=TwoWay}"
+ ToolTip="{x:Static Properties:Resources.Advanced_MotionEstimationRangeToolTip}"
+ />
+
+
+ <!-- Column 2 -->
+ <Label Grid.Row="0" Grid.Column="2"
+ Height="28"
+ HorizontalAlignment="Right"
+ VerticalAlignment="Top"
+ Content="Partition Type:"
+ />
+ <ComboBox Grid.Row="0" Grid.Column="3"
+ Width="100"
+ Height="23"
+ MaxWidth="100"
+ HorizontalAlignment="Right"
+ VerticalAlignment="Top"
+ DisplayMemberPath="Label"
+ ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.Analysis}"
+ SelectedItem="{Binding Analysis}"
+ Style="{StaticResource LongToolTipHolder}"
+ >
+ <ComboBox.ToolTip>
+ <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_AnalysisToolTip}" />
+ </ComboBox.ToolTip>
+ </ComboBox>
+
+ <Label Grid.Row="1" Grid.Column="2" Height="28" HorizontalAlignment="Right" VerticalAlignment="Top" Content="Trellis:" />
+ <ComboBox Grid.Row="1"
+ Grid.Column="3"
+ Width="100"
+ Height="23"
+ MaxWidth="100"
+ HorizontalAlignment="Right"
+ VerticalAlignment="Top"
+ DisplayMemberPath="Label"
+ ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.Trellis}"
+ SelectedItem="{Binding Trellis}"
+ Style="{StaticResource LongToolTipHolder}">
+ <ComboBox.ToolTip>
+ <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_TrellisToolTip}" />
+ </ComboBox.ToolTip>
+ </ComboBox>
+ </Grid>
+
+ <!-- PhysoVisual -->
+ <TextBlock Text="Psychovisual: " Grid.Row="2" Margin="10,5,0,0" FontWeight="Bold" />
+ <Grid Grid.Row="3"
+ Height="90"
+ HorizontalAlignment="Left"
+ VerticalAlignment="Top"
+ >
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ </Grid.RowDefinitions>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="Auto" MinWidth="100" />
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="Auto" />
+ </Grid.ColumnDefinitions>
+
+ <Label Grid.Row="0" Grid.Column="0"
+ Content="Adaptive Quant Strength:"
+ Style="{StaticResource AdvancedLabel}"
+ />
+ <Slider Grid.Row="0" Grid.Column="1"
+ IsSnapToTickEnabled="True"
+ LargeChange="0.2"
+ Maximum="2.0"
+ Width="150"
+ Minimum="0.0"
+ SmallChange="0.1"
+ Style="{StaticResource LongToolTipHolder}"
+ TickFrequency="0.1"
+ TickPlacement="BottomRight"
+ Value="{Binding AdaptiveQuantizationStrength}"
+ >
+ <Slider.ToolTip>
+ <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_AdaptiveQuantizationStrengthToolTip}" />
+ </Slider.ToolTip>
+ </Slider>
+
+ <Label Grid.Row="1" Grid.Column="0"
+ Content="Rate Distortion:"
+ Style="{StaticResource AdvancedLabel}"
+ Visibility="{Binding PsychovisualRateDistortionVisible,
+ Converter={StaticResource VisibilityConverter}}"
+ />
+ <Slider Grid.Row="1" Grid.Column="1"
+ IsSnapToTickEnabled="True"
+ LargeChange="0.2"
+ Maximum="2.0"
+ Minimum="0.0"
+ Width="150"
+ SmallChange="0.1"
+ Style="{StaticResource LongToolTipHolder}"
+ TickFrequency="0.1"
+ TickPlacement="BottomRight"
+ Visibility="{Binding PsychovisualRateDistortionVisible,
+ Converter={StaticResource VisibilityConverter}}"
+ Value="{Binding PsychovisualRateDistortion}"
+ >
+ <Slider.ToolTip>
+ <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_PsychovisualRateDistortionToolTip}" />
+ </Slider.ToolTip>
+ </Slider>
+
+ <Label Grid.Row="2" Grid.Column="0"
+ Content="Psychovisual Trellis:"
+ Style="{StaticResource AdvancedLabel}"
+ Visibility="{Binding PsychovisualTrellisVisible,
+ Converter={StaticResource VisibilityConverter}}"
+ />
+ <Slider Grid.Row="2" Grid.Column="1"
+ IsSnapToTickEnabled="True"
+ LargeChange="0.2"
+ Maximum="1.0"
+ Minimum="0.0"
+ Width="150"
+ SmallChange="0.05"
+ Style="{StaticResource LongToolTipHolder}"
+ TickFrequency="0.05"
+ TickPlacement="BottomRight"
+ Visibility="{Binding PsychovisualTrellisVisible,
+ Converter={StaticResource VisibilityConverter}}"
+ Value="{Binding PsychovisualTrellis}"
+ >
+ <Slider.ToolTip>
+ <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_PsychovisualTrellisToolTip}" />
+ </Slider.ToolTip>
+ </Slider>
+
+ <Label Grid.Row="0" Grid.Column="2" Width="110"
+ HorizontalAlignment="Left"
+ VerticalAlignment="Center"
+ HorizontalContentAlignment="Right"
+ Content="No DCT-Decimate:"
+ />
+ <CheckBox Grid.Row="0" Grid.Column="3" HorizontalAlignment="Left"
+ VerticalAlignment="Center"
+ IsChecked="{Binding NoDctDecimate}"
+ Style="{StaticResource LongToolTipHolder}"
+ >
+ <CheckBox.ToolTip>
+ <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_NoDctDecimateToolTip}" />
+ </CheckBox.ToolTip>
+ </CheckBox>
+
+ <Label Grid.Row="1"
+ Grid.Column="2"
+ Height="28"
+ HorizontalAlignment="Right"
+ VerticalAlignment="Top"
+ Content="Deblocking:"
+ />
+ <StackPanel Orientation="Vertical" Grid.Row="1" Grid.Column="3" Grid.RowSpan="2">
+ <ComboBox
+ Width="85"
+ Height="23"
+ MaxWidth="85"
+ HorizontalAlignment="Right"
+ VerticalAlignment="Top"
+ DisplayMemberPath="Label"
+ ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.DeblockingStrength}"
+ SelectedItem="{Binding DeblockingStrength}"
+ Style="{StaticResource LongToolTipHolder}"
+ >
+ <ComboBox.ToolTip>
+ <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_DeblockingToolTip}" />
+ </ComboBox.ToolTip>
+ </ComboBox>
+ <ComboBox
+ Width="85"
+ Height="23"
+ MaxWidth="85"
+ Margin="0,5,0,0"
+ HorizontalAlignment="Right"
+ VerticalAlignment="Top"
+ DisplayMemberPath="Label"
+ ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.DeblockingThreshold}"
+ SelectedItem="{Binding DeblockingThreshold}"
+ Style="{StaticResource LongToolTipHolder}"
+ >
+ <ComboBox.ToolTip>
+ <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_DeblockingToolTip}" />
+ </ComboBox.ToolTip>
+ </ComboBox>
+ </StackPanel>
+
+ </Grid>
+
+ </Grid>
+
+ </Grid>
+
+ <TextBlock Grid.Row="2" Margin="10,5,10,0"
+ VerticalAlignment="Center"
+ FontWeight="Bold"
+ Text="x264 Encoder Options:"
+ Visibility="{Binding ShowX264AdvancedOptions, Converter={StaticResource BooleanVisibilityConverter}, ConverterParameter=false}" />
+
+ <TextBox Grid.Row="3"
+ Margin="10,2,10, 2"
+ MinHeight="50"
+ HorizontalAlignment="Stretch"
+ VerticalAlignment="Stretch"
+ Style="{StaticResource LongToolTipHolder}"
+ ToolTip="{x:Static Properties:Resources.Advanced_EncoderOptions}"
+ Text="{Binding AdvancedOptionsString, UpdateSourceTrigger=PropertyChanged}"
+ TextWrapping="Wrap"
+ Visibility="{Binding ShowX264AdvancedOptions, Converter={StaticResource BooleanVisibilityConverter}, ConverterParameter=false}"
+ />
+ </Grid>
+</UserControl> \ No newline at end of file
diff --git a/win/CS/HandBrakeWPF/Views/X264View.xaml.cs b/win/CS/HandBrakeWPF/Views/X264View.xaml.cs
new file mode 100644
index 000000000..7c7f9bea3
--- /dev/null
+++ b/win/CS/HandBrakeWPF/Views/X264View.xaml.cs
@@ -0,0 +1,27 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="AdvancedView.xaml.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>
+// Interaction logic for AdvancedView.xaml
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.Views
+{
+ using System.Windows.Controls;
+
+ /// <summary>
+ /// Interaction logic for AdvancedView.xaml
+ /// </summary>
+ public partial class X264View : UserControl
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="AdvancedView"/> class.
+ /// </summary>
+ public X264View()
+ {
+ InitializeComponent();
+ }
+ }
+}