diff options
Diffstat (limited to 'win')
35 files changed, 1152 insertions, 1436 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj index 9253d7ab3..30740ab36 100644 --- a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj +++ b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj @@ -108,6 +108,10 @@ <Compile Include="EventArgs\QueueProgressEventArgs.cs" />
<Compile Include="Isolation\BackgroundServiceConnector.cs" />
<Compile Include="Isolation\IsolatedEncodeService.cs" />
+ <Compile Include="Services\Encode\Factories\VideoProfileFactory.cs" />
+ <Compile Include="Services\Encode\Factories\VideoPresetFactory.cs" />
+ <Compile Include="Services\Encode\Factories\VideoLevelFactory.cs" />
+ <Compile Include="Services\Encode\Factories\VideoTuneFactory.cs" />
<Compile Include="Services\Encode\Model\Models\DenoisePreset.cs" />
<Compile Include="Services\Encode\Model\Models\DenoiseTune.cs" />
<Compile Include="Model\HBConfiguration.cs" />
@@ -115,6 +119,10 @@ <Compile Include="Services\Encode\EventArgs\EncodeCompletedEventArgs.cs" />
<Compile Include="Services\Encode\EventArgs\EncodeProgressEventArgs.cs" />
<Compile Include="Services\Encode\Interfaces\IEncodeServiceWrapper.cs" />
+ <Compile Include="Services\Encode\Model\Models\Video\VideoLevel.cs" />
+ <Compile Include="Services\Encode\Model\Models\Video\VideoPreset.cs" />
+ <Compile Include="Services\Encode\Model\Models\Video\VideoProfile.cs" />
+ <Compile Include="Services\Encode\Model\Models\Video\VideoTune.cs" />
<Compile Include="Services\Interfaces\IHbServiceCallback.cs" />
<Compile Include="Services\Interfaces\IServerService.cs" />
<Compile Include="Services\Scan\EventArgs\ScanCompletedEventArgs.cs" />
@@ -184,9 +192,7 @@ <Name>HandBrakeInterop</Name>
</ProjectReference>
</ItemGroup>
- <ItemGroup>
- <Folder Include="Services\Encode\Factories\" />
- </ItemGroup>
+ <ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(ProgramFiles)\MSBuild\StyleCop\v4.*\StyleCop.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode/Factories/VideoLevelFactory.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode/Factories/VideoLevelFactory.cs new file mode 100644 index 000000000..375b7be95 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Services/Encode/Factories/VideoLevelFactory.cs @@ -0,0 +1,38 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="VideoLevelFactory.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 video level factory.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.ApplicationServices.Services.Encode.Factories
+{
+ /// <summary>
+ /// The video tune factory.
+ /// </summary>
+ public class VideoLevelFactory
+ {
+ /// <summary>
+ /// The get display name for a given short name.
+ /// LibHB doesn't currently support this.
+ /// </summary>
+ /// <param name="shortName">
+ /// The short name.
+ /// </param>
+ /// <returns>
+ /// The <see cref="string"/>.
+ /// </returns>
+ public static string GetDisplayName(string shortName)
+ {
+ switch (shortName)
+ {
+ case "auto":
+ return "Auto";
+ }
+
+ return shortName;
+ }
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode/Factories/VideoPresetFactory.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode/Factories/VideoPresetFactory.cs new file mode 100644 index 000000000..4239b4c80 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Services/Encode/Factories/VideoPresetFactory.cs @@ -0,0 +1,63 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="VideoPresetFactory.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 video preset factory.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.ApplicationServices.Services.Encode.Factories
+{
+ /// <summary>
+ /// The video tune factory.
+ /// </summary>
+ public class VideoPresetFactory
+ {
+ /// <summary>
+ /// The get display name for a given short name.
+ /// LibHB doesn't currently support this.
+ /// </summary>
+ /// <param name="shortName">
+ /// The short name.
+ /// </param>
+ /// <returns>
+ /// The <see cref="string"/>.
+ /// </returns>
+ public static string GetDisplayName(string shortName)
+ {
+ switch (shortName)
+ {
+ case "ultrafast":
+ return "Ultrafast";
+ case "superfast":
+ return "Superfast";
+ case "veryfast":
+ return "Veryfast";
+ case "faster":
+ return "Faster";
+ case "fast":
+ return "Fast";
+ case "medium":
+ return "Medium";
+ case "slow":
+ return "Slow";
+ case "slower":
+ return "Slower";
+ case "veryslow":
+ return "VerySlow";
+ case "placebo":
+ return "Placebo";
+
+ case "balanced":
+ return "Balanced";
+ case "speed":
+ return "Speed";
+ case "quality":
+ return "Quality";
+ }
+
+ return shortName;
+ }
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode/Factories/VideoProfileFactory.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode/Factories/VideoProfileFactory.cs new file mode 100644 index 000000000..f4a48f5a1 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Services/Encode/Factories/VideoProfileFactory.cs @@ -0,0 +1,44 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="VideoProfileFactory.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 video profile factory.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.ApplicationServices.Services.Encode.Factories
+{
+ /// <summary>
+ /// The video profile factory.
+ /// </summary>
+ public class VideoProfileFactory
+ {
+ /// <summary>
+ /// The get display name for a given short name.
+ /// LibHB doesn't currently support this.
+ /// </summary>
+ /// <param name="shortName">
+ /// The short name.
+ /// </param>
+ /// <returns>
+ /// The <see cref="string"/>.
+ /// </returns>
+ public static string GetDisplayName(string shortName)
+ {
+ switch (shortName)
+ {
+ case "auto":
+ return "Auto";
+ case "main":
+ return "Main";
+ case "high":
+ return "High";
+ case "baseline":
+ return "Baseline";
+ }
+
+ return shortName;
+ }
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode/Factories/VideoTuneFactory.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode/Factories/VideoTuneFactory.cs new file mode 100644 index 000000000..b5aef7777 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Services/Encode/Factories/VideoTuneFactory.cs @@ -0,0 +1,54 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="VideoTuneFactory.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 video tune factory.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.ApplicationServices.Services.Encode.Factories
+{
+ /// <summary>
+ /// The video tune factory.
+ /// </summary>
+ public class VideoTuneFactory
+ {
+ /// <summary>
+ /// The get display name for a given short name.
+ /// LibHB doesn't currently support this.
+ /// </summary>
+ /// <param name="shortName">
+ /// The short name.
+ /// </param>
+ /// <returns>
+ /// The <see cref="string"/>.
+ /// </returns>
+ public static string GetDisplayName(string shortName)
+ {
+ switch (shortName)
+ {
+ case "auto":
+ return "Auto";
+ case "film":
+ return "Film";
+ case "animation":
+ return "Animation";
+ case "grain":
+ return "Grain";
+ case "stillimage":
+ return "Still Image";
+ case "psnr":
+ return "PSNR";
+ case "ssim":
+ return "SSIM";
+ case "fastdecode":
+ return "Fast Decode";
+ case "zerolatency":
+ return "Zero Latency";
+ }
+
+ return shortName;
+ }
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/EncodeTask.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/EncodeTask.cs index 86735482a..42210363a 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/EncodeTask.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/EncodeTask.cs @@ -10,18 +10,15 @@ namespace HandBrake.ApplicationServices.Services.Encode.Model
{
using System;
+ using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
-
using Caliburn.Micro;
using HandBrake.ApplicationServices.Services.Encode.Model.Models;
+ using HandBrake.ApplicationServices.Services.Encode.Model.Models.Video;
using HandBrake.Interop.Model;
using HandBrake.Interop.Model.Encoding;
- using HandBrake.Interop.Model.Encoding.x264;
- using HandBrake.Interop.Model.Encoding.x265;
-
- using OutputFormat = HandBrake.ApplicationServices.Services.Encode.Model.Models.OutputFormat;
/// <summary>
/// An Encode Task
@@ -35,11 +32,6 @@ namespace HandBrake.ApplicationServices.Services.Encode.Model /// </summary>
private bool showAdvancedTab;
- /// <summary>
- /// The advanced encoder options.
- /// </summary>
- private string advancedEncoderOptions;
-
#endregion
/// <summary>
@@ -52,15 +44,9 @@ namespace HandBrake.ApplicationServices.Services.Encode.Model this.SubtitleTracks = new ObservableCollection<SubtitleTrack>();
this.ChapterNames = new ObservableCollection<ChapterMarker>();
this.AllowedPassthruOptions = new AllowedPassthru();
- this.X264Preset = x264Preset.Medium;
- this.QsvPreset = QsvPreset.Quality;
- this.H264Profile = x264Profile.Auto;
- this.X264Tune = x264Tune.None;
this.Modulus = 16;
- this.H265Profile = x265Profile.None;
- this.X265Preset = x265Preset.VeryFast;
- this.X265Tune = x265Tune.None;
+ this.VideoTunes = new List<VideoTune>();
}
/// <summary>
@@ -138,19 +124,14 @@ namespace HandBrake.ApplicationServices.Services.Encode.Model this.VideoEncoder = task.VideoEncoder;
this.VideoEncodeRateType = task.VideoEncodeRateType;
this.Width = task.Width;
- this.X264Preset = task.X264Preset;
- this.QsvPreset = task.QsvPreset;
- this.H264Profile = task.H264Profile;
- this.X264Tune = task.X264Tune;
- this.H264Level = task.H264Level;
- this.FastDecode = task.FastDecode;
+
+ this.VideoLevel = task.VideoLevel;
+ this.VideoProfile = task.VideoProfile;
+ this.VideoPreset = task.VideoPreset;
+ this.VideoTunes = task.VideoTunes;
this.ExtraAdvancedArguments = task.ExtraAdvancedArguments;
this.ShowAdvancedTab = task.ShowAdvancedTab;
-
- this.X265Preset = task.X265Preset;
- this.X265Tune = task.X265Tune;
- this.H265Profile = task.H265Profile;
}
#region Source
@@ -435,68 +416,33 @@ namespace HandBrake.ApplicationServices.Services.Encode.Model /// <summary>
/// Gets or sets AdvancedEncoderOptions.
/// </summary>
- public string AdvancedEncoderOptions
- {
- get
- {
- return this.advancedEncoderOptions;
- }
- set
- {
- this.advancedEncoderOptions = value;
- }
- }
-
- /// <summary>
- /// Gets or sets x264Preset.
- /// </summary>
- public x264Preset X264Preset { get; set; }
-
- /// <summary>
- /// Gets or sets the qsv preset.
- /// </summary>
- public QsvPreset QsvPreset { get; set; }
+ public string AdvancedEncoderOptions { get; set; }
/// <summary>
- /// Gets or sets x264Profile.
+ /// Gets or sets the video profile.
/// </summary>
- public x264Profile H264Profile { get; set; }
+ public VideoProfile VideoProfile { get; set; }
/// <summary>
- /// Gets or sets the x 264 level.
+ /// Gets or sets the video level.
/// </summary>
- public string H264Level { get; set; }
+ public VideoLevel VideoLevel { get; set; }
/// <summary>
- /// Gets or sets X264Tune.
+ /// Gets or sets the video preset.
/// </summary>
- public x264Tune X264Tune { get; set; }
+ public VideoPreset VideoPreset { get; set; }
/// <summary>
- /// Gets or sets a value indicating whether fast decode.
+ /// Gets or sets the video tunes.
/// </summary>
- public bool FastDecode { get; set; }
+ public List<VideoTune> VideoTunes { get; set; }
/// <summary>
/// Gets or sets Extra Advanced Arguments for the Video Tab.
/// </summary>
public string ExtraAdvancedArguments { get; set; }
- /// <summary>
- /// Gets or sets x265Preset.
- /// </summary>
- public x265Preset X265Preset { get; set; }
-
- /// <summary>
- /// Gets or sets x265Profile.
- /// </summary>
- public x265Profile H265Profile { get; set; }
-
- /// <summary>
- /// Gets or sets X265Tune.
- /// </summary>
- public x265Tune X265Tune { get; set; }
-
#endregion
#region Preview
@@ -555,7 +501,7 @@ namespace HandBrake.ApplicationServices.Services.Encode.Model }
set
{
- if (!object.Equals(value, this.showAdvancedTab))
+ if (!Equals(value, this.showAdvancedTab))
{
this.showAdvancedTab = value;
this.NotifyOfPropertyChange(() => this.ShowAdvancedTab);
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/Video/VideoLevel.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/Video/VideoLevel.cs new file mode 100644 index 000000000..f2a402c08 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/Video/VideoLevel.cs @@ -0,0 +1,118 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="VideoLevel.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 video level.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.ApplicationServices.Services.Encode.Model.Models.Video
+{
+ using HandBrake.ApplicationServices.Services.Encode.Factories;
+
+ /// <summary>
+ /// The video level.
+ /// </summary>
+ public class VideoLevel
+ {
+ /// <summary>
+ /// An internal representation of the Auto Selection.
+ /// </summary>
+ public static VideoLevel Auto = new VideoLevel("Auto", "auto");
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="VideoLevel"/> class.
+ /// </summary>
+ public VideoLevel()
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="VideoLevel"/> class.
+ /// </summary>
+ /// <param name="displayName">
+ /// The display name.
+ /// </param>
+ /// <param name="shortName">
+ /// The short name.
+ /// </param>
+ public VideoLevel(string displayName, string shortName)
+ {
+ this.DisplayName = VideoLevelFactory.GetDisplayName(displayName);
+ this.ShortName = shortName;
+ }
+
+ /// <summary>
+ /// Gets or sets the display name.
+ /// </summary>
+ public string DisplayName { get; set; }
+
+ /// <summary>
+ /// Gets or sets the short name.
+ /// </summary>
+ public string ShortName { get; set; }
+
+ /// <summary>
+ /// The clone.
+ /// </summary>
+ /// <returns>
+ /// The <see cref="VideoProfile"/>.
+ /// </returns>
+ public VideoLevel Clone()
+ {
+ return new VideoLevel(this.DisplayName, this.ShortName);
+ }
+
+ /// <summary>
+ /// The equals.
+ /// </summary>
+ /// <param name="other">
+ /// The other.
+ /// </param>
+ /// <returns>
+ /// The <see cref="bool"/>.
+ /// </returns>
+ protected bool Equals(VideoLevel other)
+ {
+ return string.Equals(this.ShortName, other.ShortName);
+ }
+
+ /// <summary>
+ /// The equals.
+ /// </summary>
+ /// <param name="obj">
+ /// The obj.
+ /// </param>
+ /// <returns>
+ /// The <see cref="bool"/>.
+ /// </returns>
+ public override bool Equals(object obj)
+ {
+ if (ReferenceEquals(null, obj))
+ {
+ return false;
+ }
+ if (ReferenceEquals(this, obj))
+ {
+ return true;
+ }
+ if (obj.GetType() != this.GetType())
+ {
+ return false;
+ }
+ return Equals((VideoLevel)obj);
+ }
+
+ /// <summary>
+ /// The get hash code.
+ /// </summary>
+ /// <returns>
+ /// The <see cref="int"/>.
+ /// </returns>
+ public override int GetHashCode()
+ {
+ return (this.ShortName != null ? this.ShortName.GetHashCode() : 0);
+ }
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/Video/VideoPreset.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/Video/VideoPreset.cs new file mode 100644 index 000000000..11dc04125 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/Video/VideoPreset.cs @@ -0,0 +1,116 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="VideoPreset.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 video preset.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.ApplicationServices.Services.Encode.Model.Models.Video
+{
+ using HandBrake.ApplicationServices.Services.Encode.Factories;
+
+ /// <summary>
+ /// The video preset.
+ /// </summary>
+ public class VideoPreset
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="VideoPreset"/> class.
+ /// </summary>
+ public VideoPreset()
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="VideoPreset"/> class.
+ /// </summary>
+ /// <param name="displayName">
+ /// The display name.
+ /// </param>
+ /// <param name="shortName">
+ /// The short name.
+ /// </param>
+ public VideoPreset(string displayName, string shortName)
+ {
+ this.DisplayName = VideoPresetFactory.GetDisplayName(displayName);
+ this.ShortName = shortName;
+ }
+
+ /// <summary>
+ /// Gets or sets the display name.
+ /// </summary>
+ public string DisplayName { get; set; }
+
+ /// <summary>
+ /// Gets or sets the short name.
+ /// </summary>
+ public string ShortName { get; set; }
+
+ /// <summary>
+ /// The clone.
+ /// </summary>
+ /// <returns>
+ /// The <see cref="VideoProfile"/>.
+ /// </returns>
+ public VideoPreset Clone()
+ {
+ return new VideoPreset(this.DisplayName, this.ShortName);
+ }
+
+ /// <summary>
+ /// The equals.
+ /// </summary>
+ /// <param name="other">
+ /// The other.
+ /// </param>
+ /// <returns>
+ /// The <see cref="bool"/>.
+ /// </returns>
+ protected bool Equals(VideoPreset other)
+ {
+ return string.Equals(this.ShortName, other.ShortName);
+ }
+
+ /// <summary>
+ /// The equals.
+ /// </summary>
+ /// <param name="obj">
+ /// The obj.
+ /// </param>
+ /// <returns>
+ /// The <see cref="bool"/>.
+ /// </returns>
+ public override bool Equals(object obj)
+ {
+ if (ReferenceEquals(null, obj))
+ {
+ return false;
+ }
+
+ if (ReferenceEquals(this, obj))
+ {
+ return true;
+ }
+
+ if (obj.GetType() != this.GetType())
+ {
+ return false;
+ }
+
+ return this.Equals((VideoPreset)obj);
+ }
+
+ /// <summary>
+ /// The get hash code.
+ /// </summary>
+ /// <returns>
+ /// The <see cref="int"/>.
+ /// </returns>
+ public override int GetHashCode()
+ {
+ return (this.ShortName != null ? this.ShortName.GetHashCode() : 0);
+ }
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/Video/VideoProfile.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/Video/VideoProfile.cs new file mode 100644 index 000000000..8c528df2f --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/Video/VideoProfile.cs @@ -0,0 +1,121 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="VideoProfile.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 video profile.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.ApplicationServices.Services.Encode.Model.Models.Video
+{
+ using HandBrake.ApplicationServices.Services.Encode.Factories;
+
+ /// <summary>
+ /// The video profile.
+ /// </summary>
+ public class VideoProfile
+ {
+ /// <summary>
+ /// An internal representation of the Auto Selection.
+ /// </summary>
+ public static VideoProfile Auto = new VideoProfile("Auto", "auto");
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="VideoProfile"/> class.
+ /// </summary>
+ public VideoProfile()
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="VideoProfile"/> class.
+ /// </summary>
+ /// <param name="displayName">
+ /// The display name.
+ /// </param>
+ /// <param name="shortName">
+ /// The short name.
+ /// </param>
+ public VideoProfile(string displayName, string shortName)
+ {
+ this.DisplayName = VideoProfileFactory.GetDisplayName(displayName);
+ this.ShortName = shortName;
+ }
+
+ /// <summary>
+ /// Gets or sets the display name.
+ /// </summary>
+ public string DisplayName { get; set; }
+
+ /// <summary>
+ /// Gets or sets the short name.
+ /// </summary>
+ public string ShortName { get; set; }
+
+ /// <summary>
+ /// The clone.
+ /// </summary>
+ /// <returns>
+ /// The <see cref="VideoProfile"/>.
+ /// </returns>
+ public VideoProfile Clone()
+ {
+ return new VideoProfile(this.DisplayName, this.ShortName);
+ }
+
+ /// <summary>
+ /// The equals.
+ /// </summary>
+ /// <param name="other">
+ /// The other.
+ /// </param>
+ /// <returns>
+ /// The <see cref="bool"/>.
+ /// </returns>
+ protected bool Equals(VideoProfile other)
+ {
+ return string.Equals(this.DisplayName, other.DisplayName) && string.Equals(this.ShortName, other.ShortName);
+ }
+
+ /// <summary>
+ /// The equals.
+ /// </summary>
+ /// <param name="obj">
+ /// The obj.
+ /// </param>
+ /// <returns>
+ /// The <see cref="bool"/>.
+ /// </returns>
+ public override bool Equals(object obj)
+ {
+ if (ReferenceEquals(null, obj))
+ {
+ return false;
+ }
+ if (ReferenceEquals(this, obj))
+ {
+ return true;
+ }
+ if (obj.GetType() != this.GetType())
+ {
+ return false;
+ }
+ return Equals((VideoProfile)obj);
+ }
+
+ /// <summary>
+ /// The get hash code.
+ /// </summary>
+ /// <returns>
+ /// The <see cref="int"/>.
+ /// </returns>
+ public override int GetHashCode()
+ {
+ unchecked
+ {
+ return ((this.DisplayName != null ? this.DisplayName.GetHashCode() : 0) * 397) ^ (this.ShortName != null ? this.ShortName.GetHashCode() : 0);
+ }
+ }
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/Video/VideoTune.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/Video/VideoTune.cs new file mode 100644 index 000000000..b74993307 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/Video/VideoTune.cs @@ -0,0 +1,137 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="VideoTune.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 video tune.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.ApplicationServices.Services.Encode.Model.Models.Video
+{
+ using HandBrake.ApplicationServices.Services.Encode.Factories;
+
+ /// <summary>
+ /// The video tune.
+ /// </summary>
+ public class VideoTune
+ {
+ /// <summary>
+ /// Static object to represent "None"
+ /// </summary>
+ public static VideoTune None = new VideoTune("None", "none");
+
+ /// <summary>
+ /// Static object to represent "None"
+ /// </summary>
+ public static VideoTune FastDecode = new VideoTune("Fast Decode", "fastdecode");
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="VideoTune"/> class.
+ /// </summary>
+ public VideoTune()
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="VideoTune"/> class.
+ /// </summary>
+ /// <param name="displayName">
+ /// The display name.
+ /// </param>
+ /// <param name="shortName">
+ /// The short name.
+ /// </param>
+ public VideoTune(string displayName, string shortName)
+ {
+ this.DisplayName = VideoTuneFactory.GetDisplayName(displayName);
+ this.ShortName = shortName;
+ }
+
+ /// <summary>
+ /// Gets or sets the display name.
+ /// </summary>
+ public string DisplayName { get; set; }
+
+ /// <summary>
+ /// Gets or sets the short name.
+ /// </summary>
+ public string ShortName { get; set; }
+
+ /// <summary>
+ /// The clone.
+ /// </summary>
+ /// <returns>
+ /// The <see cref="VideoProfile"/>.
+ /// </returns>
+ public VideoTune Clone()
+ {
+ return new VideoTune(this.DisplayName, this.ShortName);
+ }
+
+ /// <summary>
+ /// The equals.
+ /// </summary>
+ /// <param name="other">
+ /// The other.
+ /// </param>
+ /// <returns>
+ /// The <see cref="bool"/>.
+ /// </returns>
+ protected bool Equals(VideoProfile other)
+ {
+ return string.Equals(this.DisplayName, other.DisplayName) && string.Equals(this.ShortName, other.ShortName);
+ }
+
+ /// <summary>
+ /// The equals.
+ /// </summary>
+ /// <param name="other">
+ /// The other.
+ /// </param>
+ /// <returns>
+ /// The <see cref="bool"/>.
+ /// </returns>
+ protected bool Equals(VideoTune other)
+ {
+ return string.Equals(this.ShortName, other.ShortName);
+ }
+
+ /// <summary>
+ /// The equals.
+ /// </summary>
+ /// <param name="obj">
+ /// The obj.
+ /// </param>
+ /// <returns>
+ /// The <see cref="bool"/>.
+ /// </returns>
+ public override bool Equals(object obj)
+ {
+ if (ReferenceEquals(null, obj))
+ {
+ return false;
+ }
+ if (ReferenceEquals(this, obj))
+ {
+ return true;
+ }
+ if (obj.GetType() != this.GetType())
+ {
+ return false;
+ }
+ return Equals((VideoTune)obj);
+ }
+
+ /// <summary>
+ /// The get hash code.
+ /// </summary>
+ /// <returns>
+ /// The <see cref="int"/>.
+ /// </returns>
+ public override int GetHashCode()
+ {
+ return (this.ShortName != null ? this.ShortName.GetHashCode() : 0);
+ }
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/Converters.cs b/win/CS/HandBrake.ApplicationServices/Utilities/Converters.cs index d3fd4b6e5..3bb040052 100644 --- a/win/CS/HandBrake.ApplicationServices/Utilities/Converters.cs +++ b/win/CS/HandBrake.ApplicationServices/Utilities/Converters.cs @@ -14,8 +14,6 @@ namespace HandBrake.ApplicationServices.Utilities using HandBrake.ApplicationServices.Services.Encode.Model.Models;
using HandBrake.Interop.Model.Encoding;
- using HandBrake.Interop.Model.Encoding.x264;
- using HandBrake.Interop.Model.Encoding.x265;
/// <summary>
/// A class to convert various things to native C# objects
@@ -342,192 +340,6 @@ namespace HandBrake.ApplicationServices.Utilities #endregion
- #region x264
-
- /// <summary>
- /// Get the x264Preset from a cli parameter
- /// </summary>
- /// <param name="preset">
- /// The preset.
- /// </param>
- /// <returns>
- /// The x264Preset enum value
- /// </returns>
- public static x264Preset Getx264PresetFromCli(string preset)
- {
- switch (preset)
- {
- case "ultrafast":
- return x264Preset.Ultrafast;
- case "superfast":
- return x264Preset.Superfast;
- case "veryfast":
- return x264Preset.VeryFast;
- case "faster":
- return x264Preset.Faster;
- case "fast":
- return x264Preset.Fast;
- case "medium":
- return x264Preset.Medium;
- case "slow":
- return x264Preset.Slow;
- case "slower":
- return x264Preset.Slower;
- case "veryslow":
- return x264Preset.VerySlow;
- case "placebo":
- return x264Preset.Placebo;
- default:
- return x264Preset.Faster;
- }
- }
-
- /// <summary>
- /// Get the x264 Profile from the cli
- /// </summary>
- /// <param name="profile">
- /// The preset.
- /// </param>
- /// <returns>
- /// The x264Profile enum value
- /// </returns>
- public static x264Profile Getx264ProfileFromCli(string profile)
- {
- switch (profile)
- {
- case "baseline":
- return x264Profile.Baseline;
- case "main":
- return x264Profile.Main;
- case "high":
- return x264Profile.High;
- default:
- return x264Profile.Main;
- }
- }
-
- /// <summary>
- /// Get x264Tune enum from a cli string
- /// </summary>
- /// <param name="tune">
- /// The tune.
- /// </param>
- /// <returns>
- /// The x264Tune enum value
- /// </returns>
- public static x264Tune Getx264TuneFromCli(string tune)
- {
- switch (tune)
- {
- case "film":
- return x264Tune.Film;
- case "animation":
- return x264Tune.Animation;
- case "grain":
- return x264Tune.Grain;
- case "stillimage":
- return x264Tune.Stillimage;
- case "psnr":
- return x264Tune.Psnr;
- case "ssim":
- return x264Tune.Ssim;
- case "fastdecode":
- return x264Tune.Fastdecode;
- default:
- return x264Tune.Film;
- }
- }
-
- #endregion
-
- #region x265
-
- /// <summary>
- /// Get the x265Preset from a cli parameter
- /// </summary>
- /// <param name="preset">
- /// The preset.
- /// </param>
- /// <returns>
- /// The x265Preset enum value
- /// </returns>
- public static x265Preset Getx265PresetFromCli(string preset)
- {
- switch (preset)
- {
- case "ultrafast":
- return x265Preset.Ultrafast;
- case "superfast":
- return x265Preset.Superfast;
- case "veryfast":
- return x265Preset.VeryFast;
- case "faster":
- return x265Preset.Faster;
- case "fast":
- return x265Preset.Fast;
- case "medium":
- return x265Preset.Medium;
- case "slow":
- return x265Preset.Slow;
- case "slower":
- return x265Preset.Slower;
- case "veryslow":
- return x265Preset.VerySlow;
- case "placebo":
- return x265Preset.Placebo;
- default:
- return x265Preset.Faster;
- }
- }
-
- /// <summary>
- /// Get the x265 Profile from the cli
- /// </summary>
- /// <param name="profile">
- /// The preset.
- /// </param>
- /// <returns>
- /// The x265Profile enum value
- /// </returns>
- public static x265Profile Getx265ProfileFromCli(string profile)
- {
- switch (profile)
- {
- case "mainstillpicture":
- return x265Profile.Mainstillpicture;
- case "main":
- return x265Profile.Main;
- case "main10":
- return x265Profile.Main10;
- default:
- return x265Profile.Main;
- }
- }
-
- /// <summary>
- /// Get x265Tune enum from a cli string
- /// </summary>
- /// <param name="tune">
- /// The tune.
- /// </param>
- /// <returns>
- /// The x265Tune enum value
- /// </returns>
- public static x265Tune Getx265TuneFromCli(string tune)
- {
- switch (tune)
- {
- case "psnr":
- return x265Tune.psnr;
- case "ssim":
- return x265Tune.ssim;
- default:
- return x265Tune.psnr;
- }
- }
-
- #endregion
-
#region File Format
/// <summary>
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/InteropModelCreator.cs b/win/CS/HandBrake.ApplicationServices/Utilities/InteropModelCreator.cs index 0f2fa8688..8cd9588b8 100644 --- a/win/CS/HandBrake.ApplicationServices/Utilities/InteropModelCreator.cs +++ b/win/CS/HandBrake.ApplicationServices/Utilities/InteropModelCreator.cs @@ -18,8 +18,6 @@ namespace HandBrake.ApplicationServices.Utilities using HandBrake.ApplicationServices.Services.Encode.Model.Models;
using HandBrake.Interop.Model;
using HandBrake.Interop.Model.Encoding;
- using HandBrake.Interop.Model.Encoding.x264;
- using HandBrake.Interop.Model.Encoding.x265;
/// <summary>
/// A Utility Class to Convert a
@@ -189,44 +187,20 @@ namespace HandBrake.ApplicationServices.Utilities job.TwoPass = work.TwoPass;
job.TurboFirstPass = work.TurboFirstPass;
- if (work.VideoEncoder == VideoEncoder.X264)
+ if (work.VideoEncoder == VideoEncoder.X264 || work.VideoEncoder == VideoEncoder.X265 || work.VideoEncoder == VideoEncoder.QuickSync)
{
- job.VideoPreset = work.X264Preset.ToString().ToLower().Replace(" ", string.Empty);
- job.VideoTunes = new List<string>();
+ job.VideoPreset = work.VideoPreset.ShortName;
+ job.VideoProfile = work.VideoProfile.ShortName;
+ job.VideoLevel = work.VideoLevel.ShortName;
- if (work.X264Tune != x264Tune.None)
+ if (work.VideoEncoder != VideoEncoder.QuickSync)
{
- job.VideoTunes.Add(work.X264Tune.ToString().ToLower().Replace(" ", string.Empty));
- }
-
- if (work.FastDecode)
- {
- job.VideoTunes.Add("fastdecode");
- }
-
- job.VideoProfile = work.H264Profile.ToString().ToLower().Replace(" ", string.Empty); // TODO change these away from strings.
- job.VideoLevel = work.H264Level;
- }
- else if (work.VideoEncoder == VideoEncoder.X265)
- {
- job.VideoPreset = work.X265Preset.ToString().ToLower().Replace(" ", string.Empty);
-
- if (work.H265Profile != x265Profile.None)
- {
- job.VideoProfile = work.H265Profile.ToString().ToLower().Replace(" ", string.Empty);
- }
-
- job.VideoTunes = new List<string>();
- if (work.X265Tune != x265Tune.None)
- {
- job.VideoTunes.Add(work.X265Tune.ToString().ToLower().Replace(" ", string.Empty));
- }
- }
- else if (work.VideoEncoder == VideoEncoder.QuickSync)
- {
- job.VideoPreset = work.QsvPreset.ToString().ToLower().Replace(" ", string.Empty);
- job.VideoProfile = work.H264Profile.ToString().ToLower().Replace(" ", string.Empty);
- job.VideoLevel = work.H264Level;
+ job.VideoTunes = new List<string>();
+ foreach (var item in work.VideoTunes)
+ {
+ job.VideoTunes.Add(item.ShortName);
+ }
+ }
}
// Chapter Markers
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs b/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs index 4c0eddac1..47c29db0a 100644 --- a/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs +++ b/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs @@ -14,13 +14,12 @@ namespace HandBrake.ApplicationServices.Utilities using System.Collections.ObjectModel;
using System.Globalization;
using System.IO;
+ using System.Linq;
using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Services.Encode.Model;
using HandBrake.ApplicationServices.Services.Encode.Model.Models;
using HandBrake.Interop.Model.Encoding;
- using HandBrake.Interop.Model.Encoding.x264;
- using HandBrake.Interop.Model.Encoding.x265;
/// <summary>
/// Generate a CLI Query for HandBrakeCLI
@@ -942,64 +941,21 @@ namespace HandBrake.ApplicationServices.Utilities {
string query = string.Empty;
- // X264 Only
- if (task.VideoEncoder == VideoEncoder.X264)
+ if (task.VideoEncoder == VideoEncoder.X264 || task.VideoEncoder == VideoEncoder.X265 || task.VideoEncoder == VideoEncoder.QuickSync)
{
if (!task.ShowAdvancedTab)
{
- if (task.X264Preset != x264Preset.Medium)
- {
- query += string.Format(
- " --encoder-preset={0} ", task.X264Preset.ToString().ToLower().Replace(" ", string.Empty));
- }
+ query += string.Format(" --encoder-preset={0} ", task.VideoPreset.ShortName);
- if (task.X264Tune != x264Tune.None)
+ string tuneQuery = task.VideoTunes.Aggregate(string.Empty, (current, tune) => string.IsNullOrEmpty(current) ? tune.ShortName : string.Format(",{0}", tune.ShortName));
+ if (!string.IsNullOrEmpty(tuneQuery))
{
- string tune = string.Empty;
-
- if (task.FastDecode)
- {
- tune = "fastdecode";
- }
-
- string tuneDropdown = task.X264Tune.ToString().ToLower().Replace(" ", string.Empty);
- if (task.X264Tune != x264Tune.None && !string.IsNullOrEmpty(tuneDropdown))
- {
- tune = string.IsNullOrEmpty(tune) ? tuneDropdown : string.Format(",{0}", tuneDropdown);
- }
-
- query += string.Format(" --encoder-tune=\"{0}\" ", tune);
+ query += string.Format(" --encoder-tune=\"{0}\" ", tuneQuery);
}
- if (!string.IsNullOrEmpty(task.ExtraAdvancedArguments))
- {
- query += string.Format(" -x {0}", task.ExtraAdvancedArguments);
- }
- }
- }
+ query += string.Format(" --encoder-profile={0} ", task.VideoProfile.ShortName);
- // X265 Only
- if (task.VideoEncoder == VideoEncoder.X265)
- {
- if (!task.ShowAdvancedTab)
- {
- if (task.X265Preset != x265Preset.Medium)
- {
- query += string.Format(
- " --encoder-preset={0} ", task.X265Preset.ToString().ToLower().Replace(" ", string.Empty));
- }
-
- if (task.X265Tune != x265Tune.None)
- {
- query += string.Format(
- " --encoder-tune=\"{0}\" ", task.X265Tune.ToString().ToLower().Replace(" ", string.Empty));
- }
-
- if (task.H265Profile != x265Profile.None)
- {
- query += string.Format(
- " --encoder-profile={0} ", task.H265Profile.ToString().ToLower().Replace(" ", string.Empty));
- }
+ query += string.Format(" --encoder-level=\"{0}\" ", task.VideoLevel.ShortName);
if (!string.IsNullOrEmpty(task.ExtraAdvancedArguments))
{
@@ -1007,37 +963,18 @@ namespace HandBrake.ApplicationServices.Utilities }
}
}
-
- // QSV Only
- if (task.VideoEncoder == VideoEncoder.QuickSync)
+ else if (!task.ShowAdvancedTab && !string.IsNullOrEmpty(task.ExtraAdvancedArguments))
{
- query += string.Format(" --encoder-preset={0}", task.QsvPreset.ToString().ToLower());
+ query += string.Format(" -x {0}", task.ExtraAdvancedArguments);
}
+
// options that apply to all encoders
- if (!string.IsNullOrEmpty(task.AdvancedEncoderOptions))
+ if (task.ShowAdvancedTab && !string.IsNullOrEmpty(task.AdvancedEncoderOptions))
{
query += string.Format(" -x {0}", task.AdvancedEncoderOptions);
}
- // Options that apply to both x264 and QuickSync
- if (task.VideoEncoder == VideoEncoder.QuickSync || task.VideoEncoder == VideoEncoder.X264)
- {
- // when using x264 with the advanced panel, the H.264 profile/level widgets are disabled
- if (!(task.VideoEncoder == VideoEncoder.X264 && task.ShowAdvancedTab))
- {
- if (task.H264Level != "Auto")
- {
- query += string.Format(" --encoder-level=\"{0}\" ", task.H264Level);
- }
- if (task.H264Profile != x264Profile.Auto)
- {
- query += string.Format(
- " --encoder-profile={0} ", task.H264Profile.ToString().ToLower().Replace(" ", string.Empty));
- }
- }
- }
-
return query;
}
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/QueryParserUtility.cs b/win/CS/HandBrake.ApplicationServices/Utilities/QueryParserUtility.cs index c8c79116f..4955cc3ef 100644 --- a/win/CS/HandBrake.ApplicationServices/Utilities/QueryParserUtility.cs +++ b/win/CS/HandBrake.ApplicationServices/Utilities/QueryParserUtility.cs @@ -18,6 +18,7 @@ namespace HandBrake.ApplicationServices.Utilities using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Services.Encode.Model;
using HandBrake.ApplicationServices.Services.Encode.Model.Models;
+ using HandBrake.ApplicationServices.Services.Encode.Model.Models.Video;
using HandBrake.Interop.Model;
using HandBrake.Interop.Model.Encoding;
@@ -111,15 +112,11 @@ namespace HandBrake.ApplicationServices.Utilities // Advanced Tab
Match advanced = Regex.Match(input, @"-x ([.,/a-zA-Z0-9=:-]*)");
- Match x264Preset = Regex.Match(input, @"--x264-preset([=a-zA-Z0-9\s ]*)");
- Match x264Tune = Regex.Match(input, @"--x264-tune([=,a-zA-Z0-9\s ]*)");
- Match h264Profile = Regex.Match(input, @"--h264-profile([=a-zA-Z0-9\s ]*)");
- Match x264Profile = Regex.Match(input, @"--x264-profile([=a-zA-Z0-9\s ]*)");
- Match h264Level = Regex.Match(input, @"--h264-level([=a-zA-Z0-9.\s ]*)");
-
- Match x265Profile = Regex.Match(input, @"--x265-profile([=a-zA-Z0-9\s ]*)");
- Match x265Tune = Regex.Match(input, @"--x265-tune([=,a-zA-Z0-9\s ]*)");
- Match x265Preset = Regex.Match(input, @"--x265-preset([=a-zA-Z0-9\s ]*)");
+ Match videoLevel = Regex.Match(input, @"--encoder-level([=a-zA-Z0-9.\s ]*)");
+ Match videoProfile = Regex.Match(input, @"--encoder-profile([=a-zA-Z0-9\s ]*)");
+ Match videoTune = Regex.Match(input, @"--encoder-tune([=,a-zA-Z0-9\s ]*)");
+ Match videoPreset = Regex.Match(input, @"--encoder-preset([=a-zA-Z0-9\s ]*)");
+
#endregion
#region Set Varibles
@@ -492,60 +489,39 @@ namespace HandBrake.ApplicationServices.Utilities if (advanced.Success)
parsed.AdvancedEncoderOptions = advanced.ToString().Replace("-x ", string.Empty);
- if (x264Preset.Success)
- parsed.X264Preset =
- Converters.Getx264PresetFromCli(x264Preset.ToString().Replace("--x264-preset", string.Empty).Replace("=", string.Empty).Trim());
-
- if (h264Profile.Success)
- parsed.H264Profile =
- Converters.Getx264ProfileFromCli(h264Profile.ToString().Replace("--h264-profile", string.Empty).Replace("=", string.Empty).Trim());
-
- if (x264Profile.Success)
- parsed.H264Profile =
- Converters.Getx264ProfileFromCli(x264Profile.ToString().Replace("--x264-profile", string.Empty).Replace("=", string.Empty).Trim());
-
- if (h264Level.Success)
- parsed.H264Level =
- h264Level.ToString().Replace("--h264-level", string.Empty).Replace("=", string.Empty).Trim();
-
- if (x264Tune.Success)
+ if (videoPreset.Success)
{
- string tuneOptions =
- x264Tune.ToString().Replace("--x264-tune", string.Empty).Replace("=", string.Empty).Trim();
-
- parsed.FastDecode = tuneOptions.Contains("fastdecode");
-
- // Remove these options. They are not in the dropdown.
- tuneOptions = tuneOptions.Replace("fastdecode", string.Empty).Replace(
- ",", string.Empty);
-
- parsed.X264Tune = Converters.Getx264TuneFromCli(tuneOptions);
+ string preset = videoPreset.ToString().Replace("--encoder-preset", string.Empty).Replace("=", string.Empty).Trim();
+ parsed.VideoPreset = new VideoPreset(preset, preset);
}
- if (x265Preset.Success)
- parsed.X265Preset =
- Converters.Getx265PresetFromCli(x265Preset.ToString().Replace("--x265-preset", string.Empty).Replace("=", string.Empty).Trim());
-
- if (h264Profile.Success)
- parsed.H265Profile =
- Converters.Getx265ProfileFromCli(h264Profile.ToString().Replace("--h265-profile", string.Empty).Replace("=", string.Empty).Trim());
+ if (videoProfile.Success)
+ {
+ string profile = videoProfile.ToString().Replace("--encoder-profile", string.Empty).Replace("=", string.Empty).Trim();
+ parsed.VideoProfile = new VideoProfile(profile, profile);
+ }
- if (x265Profile.Success)
- parsed.H265Profile =
- Converters.Getx265ProfileFromCli(x265Profile.ToString().Replace("--x265-profile", string.Empty).Replace("=", string.Empty).Trim());
+ if (videoLevel.Success)
+ {
+ string level = videoLevel.ToString().Replace("--encoder-level", string.Empty).Replace("=", string.Empty).Trim();
+ parsed.VideoLevel = new VideoLevel(level, level);
+ }
- if (x265Tune.Success)
+ if (videoTune.Success)
{
- string tuneOptions =
- x265Tune.ToString().Replace("--x265-tune", string.Empty).Replace("=", string.Empty).Trim();
+ string tuneOptions = videoTune.ToString().Replace("--encoder-tune", string.Empty).Replace("=", string.Empty).Trim();
- parsed.FastDecode = tuneOptions.Contains("fastdecode");
+ if (tuneOptions.Contains("fastdecode"))
+ {
+ parsed.VideoTunes.Add(new VideoTune("fastdecode", "fastdecode"));
+ }
// Remove these options. They are not in the dropdown.
- tuneOptions = tuneOptions.Replace("fastdecode", string.Empty).Replace(
- ",", string.Empty);
-
- parsed.X265Tune = Converters.Getx265TuneFromCli(tuneOptions);
+ tuneOptions = tuneOptions.Replace("fastdecode", string.Empty).Replace(",", string.Empty);
+ if (!string.IsNullOrEmpty(tuneOptions.Trim()))
+ {
+ parsed.VideoTunes.Add(new VideoTune(tuneOptions, tuneOptions));
+ }
}
#endregion
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj index 68ba627cb..133620409 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj @@ -217,9 +217,6 @@ <Compile Include="Json\State\WorkDone.cs" />
<Compile Include="Json\State\Working.cs" />
<Compile Include="Model\Encoding\PictureRotation.cs" />
- <Compile Include="Model\Encoding\x265\x265Preset.cs" />
- <Compile Include="Model\Encoding\x265\x265Profile.cs" />
- <Compile Include="Model\Encoding\x265\x265Tune.cs" />
<Compile Include="Model\Language.cs" />
<Compile Include="HandBrakeLanguagesHelper.cs" />
<Compile Include="EventArgs\MessageLoggedEventArgs.cs" />
@@ -242,13 +239,9 @@ <Compile Include="Model\Encoding\Mixdown.cs" />
<Compile Include="Model\Encoding\OutputExtension.cs" />
<Compile Include="Model\Encoding\Container.cs" />
- <Compile Include="Model\Encoding\QsvPreset.cs" />
<Compile Include="Model\Encoding\ScaleMethod.cs" />
<Compile Include="Model\Encoding\VideoEncoder.cs" />
<Compile Include="Model\Encoding\VideoEncodeRateType.cs" />
- <Compile Include="Model\Encoding\x264\x264Preset.cs" />
- <Compile Include="Model\Encoding\x264\x264Profile.cs" />
- <Compile Include="Model\Encoding\x264\x264Tune.cs" />
<Compile Include="Model\BitrateLimits.cs" />
<Compile Include="Model\RangeLimits.cs" />
<Compile Include="Model\Size.cs" />
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/QsvPreset.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/QsvPreset.cs deleted file mode 100644 index 08147a5d3..000000000 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/QsvPreset.cs +++ /dev/null @@ -1,28 +0,0 @@ -// --------------------------------------------------------------------------------------------------------------------
-// <copyright file="QsvPreset.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 qsv preset.
-// </summary>
-// --------------------------------------------------------------------------------------------------------------------
-
-namespace HandBrake.Interop.Model.Encoding
-{
- using System.ComponentModel.DataAnnotations;
-
- /// <summary>
- /// The qsv preset.
- /// </summary>
- public enum QsvPreset
- {
- [Display(Name = "Best Speed")]
- Speed,
-
- [Display(Name = "Balanced")]
- Balanced,
-
- [Display(Name = "Best Quality")]
- Quality,
- }
-}
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/VideoEncoder.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/VideoEncoder.cs index 36c228d77..e961cace2 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/VideoEncoder.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/VideoEncoder.cs @@ -23,6 +23,7 @@ namespace HandBrake.Interop.Model.Encoding X264 = 0,
[Display(Name = "H.264 (Intel QSV)")]
+ [ShortName("qsv_h264")]
QuickSync,
[Display(Name = "MPEG-4")]
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/x264/x264Preset.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/x264/x264Preset.cs deleted file mode 100644 index f68c293e5..000000000 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/x264/x264Preset.cs +++ /dev/null @@ -1,49 +0,0 @@ -// --------------------------------------------------------------------------------------------------------------------
-// <copyright file="x264Preset.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 x264Preset type.
-// </summary>
-// --------------------------------------------------------------------------------------------------------------------
-
-namespace HandBrake.Interop.Model.Encoding.x264
-{
- using System.ComponentModel.DataAnnotations;
-
- /// <summary>
- /// The X264 Preset
- /// </summary>
- public enum x264Preset
- {
- [Display(Name = "Ultrafast")]
- Ultrafast,
-
- [Display(Name = "Super Fast")]
- Superfast,
-
- [Display(Name = "Very Fast")]
- VeryFast,
-
- [Display(Name = "Faster")]
- Faster,
-
- [Display(Name = "Fast")]
- Fast,
-
- [Display(Name = "Medium")]
- Medium,
-
- [Display(Name = "Slow")]
- Slow,
-
- [Display(Name = "Slower")]
- Slower,
-
- [Display(Name = "Very Slow")]
- VerySlow,
-
- [Display(Name = "Placebo")]
- Placebo,
- }
-}
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/x264/x264Profile.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/x264/x264Profile.cs deleted file mode 100644 index d1c1facb7..000000000 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/x264/x264Profile.cs +++ /dev/null @@ -1,31 +0,0 @@ -// --------------------------------------------------------------------------------------------------------------------
-// <copyright file="x264Profile.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 Profile
-// </summary>
-// --------------------------------------------------------------------------------------------------------------------
-
-namespace HandBrake.Interop.Model.Encoding.x264
-{
- using System.ComponentModel.DataAnnotations;
-
- /// <summary>
- /// The X264 Profile
- /// </summary>
- public enum x264Profile
- {
- [Display(Name = "Auto")]
- Auto = 0,
-
- [Display(Name = "Baseline")]
- Baseline,
-
- [Display(Name = "Main")]
- Main,
-
- [Display(Name = "High")]
- High
- }
-}
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/x264/x264Tune.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/x264/x264Tune.cs deleted file mode 100644 index 1ae23c437..000000000 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/x264/x264Tune.cs +++ /dev/null @@ -1,43 +0,0 @@ -// --------------------------------------------------------------------------------------------------------------------
-// <copyright file="x264Tune.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 x264Tune type.
-// </summary>
-// --------------------------------------------------------------------------------------------------------------------
-
-namespace HandBrake.Interop.Model.Encoding.x264
-{
- using System.ComponentModel.DataAnnotations;
-
- /// <summary>
- /// The X264 Tune MOdel
- /// </summary>
- public enum x264Tune
- {
- [Display(Name = "None")]
- None = 0,
-
- [Display(Name = "Film")]
- Film,
-
- [Display(Name = "Animation")]
- Animation,
-
- [Display(Name = "Grain")]
- Grain,
-
- [Display(Name = "Still Image")]
- Stillimage,
-
- [Display(Name = "PSNR")]
- Psnr,
-
- [Display(Name = "SSIM")]
- Ssim,
-
- [Display(Name = "Fast Decode")]
- Fastdecode,
- }
-}
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/x265/x265Preset.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/x265/x265Preset.cs deleted file mode 100644 index f8ec669d5..000000000 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/x265/x265Preset.cs +++ /dev/null @@ -1,49 +0,0 @@ -// --------------------------------------------------------------------------------------------------------------------
-// <copyright file="x265Preset.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 x265Preset type.
-// </summary>
-// --------------------------------------------------------------------------------------------------------------------
-
-namespace HandBrake.Interop.Model.Encoding.x265
-{
- using System.ComponentModel.DataAnnotations;
-
- /// <summary>
- /// The X265 Preset
- /// </summary>
- public enum x265Preset
- {
- [Display(Name = "Ultrafast")]
- Ultrafast,
-
- [Display(Name = "Super Fast")]
- Superfast,
-
- [Display(Name = "Very Fast")]
- VeryFast,
-
- [Display(Name = "Faster")]
- Faster,
-
- [Display(Name = "Fast")]
- Fast,
-
- [Display(Name = "Medium")]
- Medium,
-
- [Display(Name = "Slow")]
- Slow,
-
- [Display(Name = "Slower")]
- Slower,
-
- [Display(Name = "Very Slow")]
- VerySlow,
-
- [Display(Name = "Placebo")]
- Placebo,
- }
-}
\ No newline at end of file diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/x265/x265Profile.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/x265/x265Profile.cs deleted file mode 100644 index 8d3aab3da..000000000 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/x265/x265Profile.cs +++ /dev/null @@ -1,31 +0,0 @@ -// --------------------------------------------------------------------------------------------------------------------
-// <copyright file="x265Profile.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 X265 Profile
-// </summary>
-// --------------------------------------------------------------------------------------------------------------------
-
-namespace HandBrake.Interop.Model.Encoding.x265
-{
- using System.ComponentModel.DataAnnotations;
-
- /// <summary>
- /// The X265 Profile
- /// </summary>
- public enum x265Profile
- {
- [Display(Name = "Auto")]
- None = 0,
-
- [Display(Name = "Main")]
- Main,
-
- [Display(Name = "Main10")]
- Main10,
-
- [Display(Name = "Mainstillpicture")]
- Mainstillpicture,
- }
-}
\ No newline at end of file diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/x265/x265Tune.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/x265/x265Tune.cs deleted file mode 100644 index edbcbff95..000000000 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/x265/x265Tune.cs +++ /dev/null @@ -1,35 +0,0 @@ -// --------------------------------------------------------------------------------------------------------------------
-// <copyright file="x265Tune.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 x265Tune type.
-// </summary>
-// --------------------------------------------------------------------------------------------------------------------
-
-namespace HandBrake.Interop.Model.Encoding.x265
-{
- using System.ComponentModel.DataAnnotations;
-
- /// <summary>
- /// The X265 Tune MOdel
- /// </summary>
- public enum x265Tune
- {
- [Display(Name = "None")]
- None = 0,
-
- [Display(Name = "PSNR")]
- psnr,
-
- [Display(Name = "SSIM")]
- ssim,
-
- [Display(Name = "Zero Latency")]
- zerolatency,
-
- [Display(Name = "Fast Decode")]
- fastdecode,
-
- }
-}
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs b/win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs index b488470e2..a0f2c78ed 100644 --- a/win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs +++ b/win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs @@ -18,7 +18,6 @@ namespace HandBrakeWPF.Converters using HandBrake.ApplicationServices.Services.Encode.Model.Models;
using HandBrake.ApplicationServices.Utilities;
using HandBrake.Interop.Model.Encoding;
- using HandBrake.Interop.Model.Encoding.x264;
using PresetPictureSettingsMode = HandBrakeWPF.Model.Picture.PresetPictureSettingsMode;
@@ -47,19 +46,12 @@ namespace HandBrakeWPF.Converters /// </returns>
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
- // Lists
- if (value is IEnumerable<x264Preset>)
- {
- return EnumHelper<x264Preset>.GetEnumDisplayValues(typeof(x264Preset));
- }
- if (value is IEnumerable<x264Profile>)
+ if (value == null)
{
- return EnumHelper<x264Profile>.GetEnumDisplayValues(typeof(x264Profile));
- }
- if (value is IEnumerable<x264Tune>)
- {
- return EnumHelper<x264Tune>.GetEnumDisplayValues(typeof(x264Tune));
+ return null;
}
+
+ // Lists
if (value is IEnumerable<VideoEncoder>)
{
return EnumHelper<VideoEncoder>.GetEnumDisplayValues(typeof(VideoEncoder));
@@ -68,10 +60,6 @@ namespace HandBrakeWPF.Converters {
return EnumHelper<Mixdown>.GetEnumDisplayValues(typeof(Mixdown));
}
- if (targetType == typeof(QsvPreset) || value.GetType() == typeof(QsvPreset))
- {
- return EnumHelper<QsvPreset>.GetDisplay((QsvPreset)value);
- }
if (value is IEnumerable<PresetPictureSettingsMode>)
{
return EnumHelper<PresetPictureSettingsMode>.GetEnumDisplayValues(typeof(PresetPictureSettingsMode));
@@ -102,18 +90,6 @@ namespace HandBrakeWPF.Converters }
// Single Items
- if (targetType == typeof(x264Preset) || value.GetType() == typeof(x264Preset))
- {
- return EnumHelper<x264Preset>.GetDisplay((x264Preset)value);
- }
- if (targetType == typeof(x264Profile) || value.GetType() == typeof(x264Profile))
- {
- return EnumHelper<x264Profile>.GetDisplay((x264Profile)value);
- }
- if (targetType == typeof(x264Tune) || value.GetType() == typeof(x264Tune))
- {
- return EnumHelper<x264Tune>.GetDisplay((x264Tune)value);
- }
if (targetType == typeof(VideoEncoder) || value.GetType() == typeof(VideoEncoder))
{
return EnumHelper<VideoEncoder>.GetDisplay((VideoEncoder)value);
@@ -184,18 +160,6 @@ namespace HandBrakeWPF.Converters /// </exception>
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
- if (targetType == typeof(x264Preset) || value.GetType() == typeof(x264Preset))
- {
- return EnumHelper<x264Preset>.GetValue(value.ToString());
- }
- if (targetType == typeof(x264Profile) || value.GetType() == typeof(x264Profile))
- {
- return EnumHelper<x264Profile>.GetValue(value.ToString());
- }
- if (targetType == typeof(x264Tune) || value.GetType() == typeof(x264Tune))
- {
- return EnumHelper<x264Tune>.GetValue(value.ToString());
- }
if (targetType == typeof(VideoEncoder) || value.GetType() == typeof(VideoEncoder))
{
return EnumHelper<VideoEncoder>.GetValue(value.ToString());
@@ -204,10 +168,6 @@ namespace HandBrakeWPF.Converters {
return EnumHelper<Mixdown>.GetValue(value.ToString());
}
- if (targetType == typeof(QsvPreset) || value.GetType() == typeof(QsvPreset))
- {
- return EnumHelper<QsvPreset>.GetValue(value.ToString());
- }
if (targetType == typeof(PresetPictureSettingsMode) || value.GetType() == typeof(PresetPictureSettingsMode))
{
return EnumHelper<PresetPictureSettingsMode>.GetValue(value.ToString());
diff --git a/win/CS/HandBrakeWPF/Converters/Video/EncoderOptionsTooltipConverter.cs b/win/CS/HandBrakeWPF/Converters/Video/EncoderOptionsTooltipConverter.cs index 18b246510..a67fc9ad8 100644 --- a/win/CS/HandBrakeWPF/Converters/Video/EncoderOptionsTooltipConverter.cs +++ b/win/CS/HandBrakeWPF/Converters/Video/EncoderOptionsTooltipConverter.cs @@ -13,11 +13,8 @@ namespace HandBrakeWPF.Converters.Video using System.Globalization;
using System.Windows.Data;
- using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Services.Encode.Model;
- using HandBrake.ApplicationServices.Utilities;
using HandBrake.Interop.Model.Encoding;
- using HandBrake.Interop.Model.Encoding.x264;
/// <summary>
/// The x 264 queue tooltip converter.
@@ -41,13 +38,13 @@ namespace HandBrakeWPF.Converters.Video return task.AdvancedEncoderOptions;
}
- return string.Format("Preset: {0}{5}Tune: {1}{5}Profile: {2}{5}Level: {3}{5}Extra Arguments: {4}{5}",
- EnumHelper<x264Preset>.GetDisplay(task.X264Preset),
- EnumHelper<x264Tune>.GetDisplay(task.X264Tune),
- task.H264Profile,
- task.H264Level,
- string.IsNullOrEmpty(task.ExtraAdvancedArguments) ? "None" : task.ExtraAdvancedArguments,
- Environment.NewLine);
+ //return string.Format("Preset: {0}{5}Tune: {1}{5}Profile: {2}{5}Level: {3}{5}Extra Arguments: {4}{5}",
+ // EnumHelper<x264Preset>.GetDisplay(task.X264Preset),
+ // EnumHelper<x264Tune>.GetDisplay(task.X264Tune),
+ // task.H264Profile,
+ // task.H264Level,
+ // string.IsNullOrEmpty(task.ExtraAdvancedArguments) ? "None" : task.ExtraAdvancedArguments,
+ // Environment.NewLine);
}
return task != null ? task.AdvancedEncoderOptions.Trim() : string.Empty;
diff --git a/win/CS/HandBrakeWPF/Presets.dat b/win/CS/HandBrakeWPF/Presets.dat index 45ceaacca..0edf6b02f 100644 --- a/win/CS/HandBrakeWPF/Presets.dat +++ b/win/CS/HandBrakeWPF/Presets.dat @@ -1,31 +1,31 @@ < Devices
- + Universal: -e x264 -q 20.0 -r 30 --pfr -a 1,1 -E ffaac,copy:ac3 -B 160,160 -6 dpl2,none -R Auto,Auto -D 0.0,0.0 --audio-copy-mask aac,ac3,dtshd,dts,mp3 --audio-fallback ffac3 -f mp4 -X 720 -Y 576 --loose-anamorphic --modulus 2 -m --x264-preset fast --h264-profile baseline --h264-level 3.0
+ + Universal: -e x264 -q 20.0 -r 30 --pfr -a 1,1 -E ffaac,copy:ac3 -B 160,160 -6 dpl2,none -R Auto,Auto -D 0.0,0.0 --audio-copy-mask aac,ac3,dtshd,dts,mp3 --audio-fallback ffac3 -f mp4 -X 720 -Y 576 --loose-anamorphic --modulus 2 -m --encoder-preset fast --encoder-profile baseline --encoder-level 3.0
- + iPod: -e x264 -q 22.0 -r 30 --pfr -a 1 -E ffaac -B 160 -6 dpl2 -R Auto -D 0.0 --audio-copy-mask aac,ac3,dtshd,dts,mp3 --audio-fallback ffac3 -f mp4 -I -X 320 -Y 240 --modulus 2 -m --x264-preset medium --h264-profile baseline --h264-level 1.3
+ + iPod: -e x264 -q 22.0 -r 30 --pfr -a 1 -E ffaac -B 160 -6 dpl2 -R Auto -D 0.0 --audio-copy-mask aac,ac3,dtshd,dts,mp3 --audio-fallback ffac3 -f mp4 -I -X 320 -Y 240 --modulus 2 -m --encoder-preset medium --encoder-profile baseline --encoder-level 1.3
- + iPhone & iPod touch: -e x264 -q 22.0 -r 30 --pfr -a 1 -E ffaac -B 160 -6 dpl2 -R Auto -D 0.0 --audio-copy-mask aac,ac3,dtshd,dts,mp3 --audio-fallback ffac3 -f mp4 -4 -X 960 -Y 640 --loose-anamorphic --modulus 2 -m --x264-preset medium --h264-profile high --h264-level 3.1
+ + iPhone & iPod touch: -e x264 -q 22.0 -r 30 --pfr -a 1 -E ffaac -B 160 -6 dpl2 -R Auto -D 0.0 --audio-copy-mask aac,ac3,dtshd,dts,mp3 --audio-fallback ffac3 -f mp4 -4 -X 960 -Y 640 --loose-anamorphic --modulus 2 -m --encoder-preset medium --encoder-profile high --encoder-level 3.1
- + iPad: -e x264 -q 20.0 -r 30 --pfr -a 1 -E ffaac -B 160 -6 dpl2 -R Auto -D 0.0 --audio-copy-mask aac,ac3,dtshd,dts,mp3 --audio-fallback ffac3 -f mp4 -4 -X 1280 -Y 720 --loose-anamorphic --modulus 2 -m --x264-preset medium --h264-profile high --h264-level 3.1
+ + iPad: -e x264 -q 20.0 -r 30 --pfr -a 1 -E ffaac -B 160 -6 dpl2 -R Auto -D 0.0 --audio-copy-mask aac,ac3,dtshd,dts,mp3 --audio-fallback ffac3 -f mp4 -4 -X 1280 -Y 720 --loose-anamorphic --modulus 2 -m --encoder-preset medium --encoder-profile high --encoder-level 3.1
- + AppleTV: -e x264 -q 20.0 -r 30 --pfr -a 1,1 -E ffaac,copy:ac3 -B 160,160 -6 dpl2,none -R Auto,Auto -D 0.0,0.0 --audio-copy-mask aac,ac3,dtshd,dts,mp3 --audio-fallback ffac3 -f mp4 -4 -X 960 -Y 720 --loose-anamorphic --modulus 2 -m --x264-preset medium --h264-profile high --h264-level 3.1 -x qpmin=4:cabac=0:ref=2:b-pyramid=none:weightb=0:weightp=0:vbv-maxrate=9500:vbv-bufsize=9500
+ + AppleTV: -e x264 -q 20.0 -r 30 --pfr -a 1,1 -E ffaac,copy:ac3 -B 160,160 -6 dpl2,none -R Auto,Auto -D 0.0,0.0 --audio-copy-mask aac,ac3,dtshd,dts,mp3 --audio-fallback ffac3 -f mp4 -4 -X 960 -Y 720 --loose-anamorphic --modulus 2 -m --encoder-preset medium --encoder-profile high --encoder-level 3.1 -x qpmin=4:cabac=0:ref=2:b-pyramid=none:weightb=0:weightp=0:vbv-maxrate=9500:vbv-bufsize=9500
- + AppleTV 2: -e x264 -q 20.0 -r 30 --pfr -a 1,1 -E ffaac,copy:ac3 -B 160,160 -6 dpl2,none -R Auto,Auto -D 0.0,0.0 --audio-copy-mask aac,ac3,dtshd,dts,mp3 --audio-fallback ffac3 -f mp4 -4 -X 1280 -Y 720 --loose-anamorphic --modulus 2 -m --x264-preset medium --h264-profile high --h264-level 3.1
+ + AppleTV 2: -e x264 -q 20.0 -r 30 --pfr -a 1,1 -E ffaac,copy:ac3 -B 160,160 -6 dpl2,none -R Auto,Auto -D 0.0,0.0 --audio-copy-mask aac,ac3,dtshd,dts,mp3 --audio-fallback ffac3 -f mp4 -4 -X 1280 -Y 720 --loose-anamorphic --modulus 2 -m --encoder-preset medium --encoder-profile high --encoder-level 3.1
- + AppleTV 3: -e x264 -q 20.0 -r 30 --pfr -a 1,1 -E ffaac,copy:ac3 -B 160,160 -6 dpl2,none -R Auto,Auto -D 0.0,0.0 --audio-copy-mask aac,ac3,dtshd,dts,mp3 --audio-fallback ffac3 -f mp4 -4 -X 1920 -Y 1080 --decomb=fast --loose-anamorphic --modulus 2 -m --x264-preset medium --h264-profile high --h264-level 4.0
+ + AppleTV 3: -e x264 -q 20.0 -r 30 --pfr -a 1,1 -E ffaac,copy:ac3 -B 160,160 -6 dpl2,none -R Auto,Auto -D 0.0,0.0 --audio-copy-mask aac,ac3,dtshd,dts,mp3 --audio-fallback ffac3 -f mp4 -4 -X 1920 -Y 1080 --decomb=fast --loose-anamorphic --modulus 2 -m --encoder-preset medium --encoder-profile high --encoder-level 4.0
- + Android: -e x264 -q 22.0 -r 30 --pfr -a 1 -E ffaac -B 128 -6 dpl2 -R Auto -D 0.0 --audio-copy-mask aac,ac3,dtshd,dts,mp3 --audio-fallback ffac3 -f mp4 -X 720 -Y 576 --loose-anamorphic --modulus 2 --x264-preset medium --h264-profile main --h264-level 3.0
+ + Android: -e x264 -q 22.0 -r 30 --pfr -a 1 -E ffaac -B 128 -6 dpl2 -R Auto -D 0.0 --audio-copy-mask aac,ac3,dtshd,dts,mp3 --audio-fallback ffac3 -f mp4 -X 720 -Y 576 --loose-anamorphic --modulus 2 --encoder-preset medium --encoder-profile main --encoder-level 3.0
- + Android Tablet: -e x264 -q 22.0 -r 30 --pfr -a 1 -E ffaac -B 128 -6 dpl2 -R Auto -D 0.0 --audio-copy-mask aac,ac3,dtshd,dts,mp3 --audio-fallback ffac3 -f mp4 -X 1280 -Y 720 --loose-anamorphic --modulus 2 --x264-preset medium --h264-profile main --h264-level 3.1
+ + Android Tablet: -e x264 -q 22.0 -r 30 --pfr -a 1 -E ffaac -B 128 -6 dpl2 -R Auto -D 0.0 --audio-copy-mask aac,ac3,dtshd,dts,mp3 --audio-fallback ffac3 -f mp4 -X 1280 -Y 720 --loose-anamorphic --modulus 2 --encoder-preset medium --encoder-profile main --encoder-level 3.1
- + Windows Phone 8: -e x264 -q 22.0 -r 30 --pfr -a 1 -E ffaac -B 128 -6 dpl2 -R Auto -D 0.0 --audio-copy-mask aac,ac3,dtshd,dts,mp3 --audio-fallback ffac3 -f mp4 -X 1280 -Y 720 --modulus 2 --x264-preset medium --h264-profile main --h264-level 3.1
+ + Windows Phone 8: -e x264 -q 22.0 -r 30 --pfr -a 1 -E ffaac -B 128 -6 dpl2 -R Auto -D 0.0 --audio-copy-mask aac,ac3,dtshd,dts,mp3 --audio-fallback ffac3 -f mp4 -X 1280 -Y 720 --modulus 2 --encoder-preset medium --encoder-profile main --encoder-level 3.1
>
< Regular
- + Normal: -e x264 -q 20.0 -a 1 -E ffaac -B 160 -6 dpl2 -R Auto -D 0.0 --audio-copy-mask aac,ac3,dtshd,dts,mp3 --audio-fallback ffac3 -f mp4 --loose-anamorphic --modulus 2 -m --x264-preset veryfast --h264-profile main --h264-level 4.0
+ + Normal: -e x264 -q 20.0 -a 1 -E ffaac -B 160 -6 dpl2 -R Auto -D 0.0 --audio-copy-mask aac,ac3,dtshd,dts,mp3 --audio-fallback ffac3 -f mp4 --loose-anamorphic --modulus 2 -m --encoder-preset veryfast --encoder-profile main --encoder-level 4.0
- + High Profile: -e x264 -q 20.0 -a 1,1 -E ffaac,copy:ac3 -B 160,160 -6 dpl2,none -R Auto,Auto -D 0.0,0.0 --audio-copy-mask aac,ac3,dtshd,dts,mp3 --audio-fallback ffac3 -f mp4 -4 --decomb --loose-anamorphic --modulus 2 -m --x264-preset medium --h264-profile high --h264-level 4.1
+ + High Profile: -e x264 -q 20.0 -a 1,1 -E ffaac,copy:ac3 -B 160,160 -6 dpl2,none -R Auto,Auto -D 0.0,0.0 --audio-copy-mask aac,ac3,dtshd,dts,mp3 --audio-fallback ffac3 -f mp4 -4 --decomb --loose-anamorphic --modulus 2 -m --encoder-preset medium --encoder-profile high --encoder-level 4.1
->
+>
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/Services/Presets/Factories/PlistFactory.cs b/win/CS/HandBrakeWPF/Services/Presets/Factories/PlistFactory.cs index 5cd4db148..5892978cd 100644 --- a/win/CS/HandBrakeWPF/Services/Presets/Factories/PlistFactory.cs +++ b/win/CS/HandBrakeWPF/Services/Presets/Factories/PlistFactory.cs @@ -1,5 +1,5 @@ // --------------------------------------------------------------------------------------------------------------------
-// <copyright file="PlistUtility.cs" company="HandBrake Project (http://handbrake.fr)">
+// <copyright file="PlistFactory.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>
@@ -9,10 +9,10 @@ namespace HandBrakeWPF.Services.Presets.Factories
{
+ using System.Linq;
using System.Text;
using System.Xml;
- using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Services.Encode.Model;
using HandBrake.ApplicationServices.Services.Encode.Model.Models;
using HandBrake.ApplicationServices.Utilities;
@@ -23,7 +23,7 @@ namespace HandBrakeWPF.Services.Presets.Factories /// <summary>
/// Plist Preset Converter
/// </summary>
- public class PlistUtility
+ public class PlistFactory
{
#region Export
@@ -199,21 +199,19 @@ namespace HandBrakeWPF.Services.Presets.Factories AddEncodeElement(xmlWriter, "VideoFramerateMode", "string", parsed.FramerateMode.ToString().ToLower());
AddBooleanElement(xmlWriter, "VideoGrayScale", parsed.Grayscale);
AddEncodeElement(xmlWriter, "VideoQualitySlider", "real", parsed.Quality.ToString());
- AddEncodeElement(xmlWriter, "h264Level", "string", parsed.H264Level);
- AddEncodeElement(xmlWriter, "x264OptionExtra", "string", parsed.AdvancedEncoderOptions);
- AddEncodeElement(xmlWriter, "x264Preset", "string", parsed.X264Preset.ToString().ToLower());
- AddEncodeElement(xmlWriter, "h264Profile", "string", parsed.H264Profile.ToString().ToLower());
- string tune = parsed.X264Tune.ToString().ToLower();
- if (parsed.FastDecode)
- {
- tune = tune == "none" ? "fastdecode" : tune + ",fastdecode";
- }
- AddEncodeElement(xmlWriter, "x264Tune", "string", tune);
+
+ if (parsed.VideoPreset != null)
+ AddEncodeElement(xmlWriter, "VideoPreset", "string", parsed.VideoPreset.ShortName);
+ if (parsed.VideoLevel != null)
+ AddEncodeElement(xmlWriter, "VideoLevel", "string", parsed.VideoLevel.ShortName);
+ if (parsed.VideoProfile != null)
+ AddEncodeElement(xmlWriter, "VideoProfile", "string", parsed.VideoProfile.ShortName);
+ if (parsed.VideoTunes != null)
+ AddEncodeElement(xmlWriter, "VideoTune", "string", parsed.VideoTunes.Aggregate(string.Empty, (current, item) => string.IsNullOrEmpty(current) ? item.ShortName : "," + item.ShortName));
+
+ AddEncodeElement(xmlWriter, "VideoOptionExtra", "string", parsed.ExtraAdvancedArguments);
AddEncodeElement(xmlWriter, "x264UseAdvancedOptions", "integer", parsed.ShowAdvancedTab ? "1" : "0");
- AddEncodeElement(xmlWriter, "h265Profile", "string", parsed.H265Profile.ToString().ToLower());
- AddEncodeElement(xmlWriter, "x265Preset", "string", parsed.X265Preset.ToString().ToLower());
- AddEncodeElement(xmlWriter, "x265Tune", "string", parsed.X265Tune.ToString().ToLower());
int videoQualityType = 0;
if (parsed.VideoBitrate != null) videoQualityType = 1;
diff --git a/win/CS/HandBrakeWPF/Services/Presets/Factories/PlistPresetFactory.cs b/win/CS/HandBrakeWPF/Services/Presets/Factories/PlistPresetFactory.cs index 7a6e336e8..a98e63e6d 100644 --- a/win/CS/HandBrakeWPF/Services/Presets/Factories/PlistPresetFactory.cs +++ b/win/CS/HandBrakeWPF/Services/Presets/Factories/PlistPresetFactory.cs @@ -15,13 +15,11 @@ namespace HandBrakeWPF.Services.Presets.Factories using System.Globalization;
using System.Linq;
- using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Services.Encode.Model;
using HandBrake.ApplicationServices.Services.Encode.Model.Models;
+ using HandBrake.ApplicationServices.Services.Encode.Model.Models.Video;
using HandBrake.ApplicationServices.Utilities;
using HandBrake.Interop.Model.Encoding;
- using HandBrake.Interop.Model.Encoding.x264;
- using HandBrake.Interop.Model.Encoding.x265;
using HandBrakeWPF.Model.Audio;
using HandBrakeWPF.Model.Subtitles;
@@ -249,38 +247,25 @@ namespace HandBrakeWPF.Services.Presets.Factories case "VideoTwoPass":
preset.Task.TwoPass = kvp.Value == 1;
break;
- case "x264OptionExtra":
- preset.Task.AdvancedEncoderOptions = kvp.Value;
+
+ case "VideoOptionExtra":
+ preset.Task.ExtraAdvancedArguments = kvp.Value;
break;
- case "x264Preset":
- preset.Task.X264Preset = EnumHelper<x264Preset>.GetValue(kvp.Value, true);
+ case "VideoLevel":
+ preset.Task.VideoLevel = new VideoLevel(kvp.Value, kvp.Value);
break;
- case "h264Profile":
- preset.Task.H264Profile = EnumHelper<x264Profile>.GetValue(kvp.Value, true);
+ case "VideoProfile":
+ preset.Task.VideoProfile = new VideoProfile(kvp.Value, kvp.Value);
break;
- case "x264Tune":
- string value = kvp.Value;
- if (value.Contains("fastdecode"))
+ case "VideoPreset":
+ preset.Task.VideoPreset = new VideoPreset(kvp.Value, kvp.Value);
+ break;
+ case "VideoTune":
+ string[] split = kvp.Value.ToString().Split(',');
+ foreach (var item in split)
{
- preset.Task.FastDecode = true;
- value = value.Replace("fastdecode", string.Empty).Replace(",", string.Empty);
+ preset.Task.VideoTunes.Add(new VideoTune(item, item));
}
- preset.Task.X264Tune = EnumHelper<x264Tune>.GetValue(value, true);
- break;
- case "h264Level":
- preset.Task.H264Level = kvp.Value;
- break;
- case "QsvPreset":
- preset.Task.QsvPreset = EnumHelper<QsvPreset>.GetValue(kvp.Value, true);
- break;
- case "h265Profile":
- preset.Task.H265Profile = EnumHelper<x265Profile>.GetValue(kvp.Value, true);
- break;
- case "x265Tune":
- preset.Task.X265Tune = EnumHelper<x265Tune>.GetValue(kvp.Value, true);
- break;
- case "x265Preset":
- preset.Task.X265Preset = EnumHelper<x265Preset>.GetValue(kvp.Value, true);
break;
// Chapter Markers Tab
@@ -288,21 +273,13 @@ namespace HandBrakeWPF.Services.Presets.Factories preset.Task.IncludeChapterMarkers = kvp.Value == true;
break;
- // Advanced x264 tab
+ // Advanced tab
case "x264Option":
- if (preset.Task.VideoEncoder == VideoEncoder.X264) // TODO Temp fix until a better solution is found.
- {
- preset.Task.AdvancedEncoderOptions = kvp.Value;
- }
- break;
-
case "lavcOption":
- if (preset.Task.VideoEncoder != VideoEncoder.X264) // TODO Temp fix until a better solution is found.
- {
- preset.Task.AdvancedEncoderOptions = kvp.Value;
- }
+ preset.Task.AdvancedEncoderOptions = kvp.Value;
break;
+
// Preset Information
case "PresetBuildNumber":
preset.Version = kvp.Value;
diff --git a/win/CS/HandBrakeWPF/Services/Presets/Model/Preset.cs b/win/CS/HandBrakeWPF/Services/Presets/Model/Preset.cs index e1b3d0e4d..1ea596ef7 100644 --- a/win/CS/HandBrakeWPF/Services/Presets/Model/Preset.cs +++ b/win/CS/HandBrakeWPF/Services/Presets/Model/Preset.cs @@ -11,7 +11,6 @@ namespace HandBrakeWPF.Services.Presets.Model {
using Caliburn.Micro;
- using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Services.Encode.Model;
using HandBrakeWPF.Model.Audio;
diff --git a/win/CS/HandBrakeWPF/Services/Presets/Model/PresetContainer.cs b/win/CS/HandBrakeWPF/Services/Presets/Model/PresetContainer.cs index be7e4afdc..f84f88b67 100644 --- a/win/CS/HandBrakeWPF/Services/Presets/Model/PresetContainer.cs +++ b/win/CS/HandBrakeWPF/Services/Presets/Model/PresetContainer.cs @@ -9,8 +9,20 @@ namespace HandBrakeWPF.Services.Presets.Model
{
+ /// <summary>
+ /// The preset container.
+ /// </summary>
public class PresetContainer
{
+ /// <summary>
+ /// Initializes a new instance of the <see cref="PresetContainer"/> class.
+ /// </summary>
+ /// <param name="version">
+ /// The version.
+ /// </param>
+ /// <param name="presets">
+ /// The presets.
+ /// </param>
public PresetContainer(int version, string presets)
{
Version = version;
diff --git a/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs b/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs index be8357f68..cb9e161b2 100644 --- a/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs +++ b/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs @@ -18,7 +18,6 @@ namespace HandBrakeWPF.Services.Presets using System.Text;
using System.Text.RegularExpressions;
using System.Windows;
- using System.Windows.Forms;
using System.Xml.Serialization;
using HandBrake.ApplicationServices.Exceptions;
@@ -38,7 +37,7 @@ namespace HandBrakeWPF.Services.Presets {
#region Private Variables
- private static readonly int CurrentPresetVersion = 1;
+ private static readonly int CurrentPresetVersion = 2;
/// <summary>
/// XML Serializer
@@ -310,12 +309,12 @@ namespace HandBrakeWPF.Services.Presets Preset newPreset = new Preset
{
- Category = category,
- Name = presetName[0].Replace("+", string.Empty).Trim(),
- Version = VersionHelper.GetVersion(),
+ Category = category,
+ Name = presetName[0].Replace("+", string.Empty).Trim(),
+ Version = VersionHelper.GetVersion(),
Description = string.Empty, // Maybe one day we will populate this.
- IsBuildIn = true,
- UsePictureFilters = true,
+ IsBuildIn = true,
+ UsePictureFilters = true,
Task = QueryParserUtility.Parse(presetName[2])
};
@@ -374,8 +373,12 @@ namespace HandBrakeWPF.Services.Presets /// <summary>
/// Check if the preset "name" exists in either Presets or UserPresets lists.
/// </summary>
- /// <param name="name">Name of the preset</param>
- /// <returns>True if found</returns>
+ /// <param name="name">
+ /// Name of the preset
+ /// </param>
+ /// <returns>
+ /// True if found
+ /// </returns>
public bool CheckIfPresetExists(string name)
{
return name == string.Empty || this.presets.Any(item => item.Name == name);
@@ -453,6 +456,7 @@ namespace HandBrakeWPF.Services.Presets foreach (Preset preset in list)
{
preset.IsBuildIn = true;
+
// Older versions did not have this flag so explicitly make sure it is set.
this.presets.Add(preset);
}
@@ -519,9 +523,9 @@ namespace HandBrakeWPF.Services.Presets string fileName = RecoverFromCorruptedPresetFile(this.userPresetFile);
this.errorService.ShowMessageBox(
"HandBrake is unable to load your user presets because they are from an older version of HandBrake. Your old presets file has been renamed so that it doesn't get loaded on next launch."
- + Environment.NewLine + Environment.NewLine + "Archived File: " + fileName,
- "Unable to load user presets.",
- MessageBoxButton.OK,
+ + Environment.NewLine + Environment.NewLine + "Archived File: " + fileName,
+ "Unable to load user presets.",
+ MessageBoxButton.OK,
MessageBoxImage.Exclamation);
return;
}
diff --git a/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs b/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs index b2605e790..8ece8c41a 100644 --- a/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs +++ b/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs @@ -21,9 +21,7 @@ namespace HandBrakeWPF.Startup using Castle.Windsor;
using HandBrake.ApplicationServices;
- using HandBrake.ApplicationServices.Services;
using HandBrake.ApplicationServices.Services.Encode.Interfaces;
- using HandBrake.ApplicationServices.Services.Interfaces;
using HandBrake.ApplicationServices.Services.Scan;
using HandBrake.ApplicationServices.Services.Scan.Interfaces;
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index 523f07312..48bf428f9 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -1746,7 +1746,7 @@ namespace HandBrakeWPF.ViewModels if (!string.IsNullOrEmpty(filename))
{
- PlistUtility.Export(
+ PlistFactory.Export(
savefiledialog.FileName,
this.selectedPreset,
HandBrakeUtils.Build.ToString(CultureInfo.InvariantCulture));
diff --git a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs index 7060530ef..9fe599fc2 100644 --- a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs @@ -14,19 +14,17 @@ namespace HandBrakeWPF.ViewModels using System.ComponentModel;
using System.Globalization;
using System.Linq;
- using System.Windows;
using Caliburn.Micro;
- using HandBrake.ApplicationServices.Model;
+ using HandBrake.ApplicationServices.EventArgs;
using HandBrake.ApplicationServices.Services.Encode.Model;
using HandBrake.ApplicationServices.Services.Encode.Model.Models;
+ using HandBrake.ApplicationServices.Services.Encode.Model.Models.Video;
using HandBrake.ApplicationServices.Services.Scan.Model;
using HandBrake.ApplicationServices.Utilities;
using HandBrake.Interop;
using HandBrake.Interop.Model.Encoding;
- using HandBrake.Interop.Model.Encoding.x264;
- using HandBrake.Interop.Model.Encoding.x265;
using HandBrakeWPF.Commands.Interfaces;
using HandBrakeWPF.Properties;
@@ -34,112 +32,37 @@ namespace HandBrakeWPF.ViewModels using HandBrakeWPF.Services.Presets.Model;
using HandBrakeWPF.ViewModels.Interfaces;
+ using Clipboard = System.Windows.Clipboard;
+
/// <summary>
/// The Video View Model
/// </summary>
public class VideoViewModel : ViewModelBase, IVideoViewModel
{
/*
- * TODO
- * 1. Refactor the Video Encoder Preset/Tune/Level options to be generic instead of encoder specific.
- * 2. Model the UI Interactions in a better way.
- */
+ * Hard Code "None" in the Models for Tune.
+ * Test Everything */
#region Constants and Fields
- /// <summary>
- /// Same as source constant.
- /// </summary>
- private const string SameAsSource = "Same as source";
-
- /// <summary>
- /// The possible h264 levels.
- /// </summary>
- private static readonly List<string> Levels = new List<string> { "Auto", "1.0", "1b", "1.1", "1.2", "1.3", "2.0", "2.1", "2.2", "3.0", "3.1", "3.2", "4.0", "4.1", "4.2", "5.0", "5.1", "5.2" };
- /// <summary>
- /// Backing field for the user setting service.
- /// </summary>
+ private const string SameAsSource = "Same as source";
private readonly IUserSettingService userSettingService;
-
- /// <summary>
- /// The advanced encoder options command
- /// </summary>
private readonly IAdvancedEncoderOptionsCommand advancedEncoderOptionsCommand;
- /// <summary>
- /// Backing field used to display / hide the x264 options
- /// </summary>
- private bool displayX264Options;
-
- /// <summary>
- /// Backing field used to display / hide the x265 options
- /// </summary>
- private bool displayX265Options;
-
- /// <summary>
- /// The display qsv options.
- /// </summary>
- private bool displayQSVOptions;
-
- /// <summary>
- /// Backing field used to display / hide the h264 options
- /// </summary>
- private bool displayEncoderOptions;
-
- /// <summary>
- /// The quality max.
- /// </summary>
+ private bool displayOptimiseOptions;
private int qualityMax;
-
- /// <summary>
- /// The quality min.
- /// </summary>
private int qualityMin;
-
- /// <summary>
- /// The show peak framerate.
- /// </summary>
private bool showPeakFramerate;
-
- /// <summary>
- /// The show peak framerate.
- /// </summary>
private int rf;
-
- /// <summary>
- /// The x264 preset value.
- /// </summary>
- private int x264PresetValue;
-
- /// <summary>
- /// The qsv preset value.
- /// </summary>
- private int qsvPresetValue;
-
- /// <summary>
- /// The can clear tracker.
- /// </summary>
private bool canClear;
-
- /// <summary>
- /// The use advanced tab.
- /// </summary>
private bool useAdvancedTab;
-
- /// <summary>
- /// The display framerate controls.
- /// </summary>
- private bool displayNonQSVControls;
-
- /// <summary>
- /// The x265 preset value.
- /// </summary>
- private int x265PresetValue;
-
- /// <summary>
- /// The display turbo first pass.
- /// </summary>
private bool displayTurboFirstPass;
+ private int videoPresetMaxValue;
+ private int? videoPresetValue;
+ private bool displayNonQsvControls;
+ private VideoTune videoTune;
+ private bool fastDecode;
+ private bool displayTuneControls;
#endregion
@@ -164,15 +87,10 @@ namespace HandBrakeWPF.ViewModels this.IsConstantQuantity = true;
this.VideoEncoders = EnumHelper<VideoEncoder>.GetEnumList();
- X264Presets = new BindingList<x264Preset>(EnumHelper<x264Preset>.GetEnumList().ToList());
- QsvPresets = new BindingList<QsvPreset>(EnumHelper<QsvPreset>.GetEnumList().ToList());
- H264Profiles = EnumHelper<x264Profile>.GetEnumList();
- X264Tunes = EnumHelper<x264Tune>.GetEnumList().Where(t => t != x264Tune.Fastdecode);
- this.H264Levels = Levels;
-
- X265Presets = new BindingList<x265Preset>(EnumHelper<x265Preset>.GetEnumList().ToList());
- H265Profiles = EnumHelper<x265Profile>.GetEnumList();
- X265Tunes = EnumHelper<x265Tune>.GetEnumList();
+ this.VideoProfiles = new BindingList<VideoProfile>();
+ this.VideoTunes = new BindingList<VideoTune>();
+ this.VideoPresets = new BindingList<VideoPreset>();
+ this.VideoLevels = new BindingList<VideoLevel>();
this.userSettingService.SettingChanged += this.UserSettingServiceSettingChanged;
}
@@ -219,7 +137,7 @@ namespace HandBrakeWPF.ViewModels }
set
{
- if (!object.Equals(value, this.useAdvancedTab))
+ if (!Equals(value, this.useAdvancedTab))
{
// Set the Advanced Tab up with the current settings, if we can.
if (value)
@@ -560,38 +478,7 @@ namespace HandBrakeWPF.ViewModels {
this.Task.VideoEncoder = value;
this.NotifyOfPropertyChange(() => this.SelectedVideoEncoder);
-
- // Tell the Advanced Panel off the change
- IAdvancedViewModel advancedViewModel = IoC.Get<IAdvancedViewModel>();
- advancedViewModel.SetEncoder(this.Task.VideoEncoder);
-
- // Update the Quality Slider. Make sure the bounds are up to date with the users settings.
- this.SetQualitySliderBounds();
-
- // Hide the x264 controls when not needed.
- this.DisplayX264Options = value == VideoEncoder.X264;
-
- // Hide the x265 controls when not needed.
- this.DisplayX265Options = value == VideoEncoder.X265;
-
- this.DisplayQSVOptions = value == VideoEncoder.QuickSync;
- this.DisplayH264Options = value == VideoEncoder.X264 || value == VideoEncoder.QuickSync;
- this.UseAdvancedTab = value != VideoEncoder.QuickSync && this.UseAdvancedTab;
- this.DisplayNonQSVControls = value != VideoEncoder.QuickSync;
- this.DisplayTurboFirstPass = value == VideoEncoder.X264;
-
- this.NotifyOfPropertyChange(() => this.Rfqp);
- this.NotifyOfPropertyChange(() => this.ShowAdvancedTab);
-
- this.NotifyOfPropertyChange(() => this.HighQualityLabel);
- if (value == VideoEncoder.QuickSync)
- {
- this.IsConstantFramerate = true;
- this.TwoPass = false;
- this.TurboFirstPass = false;
- this.Task.Framerate = null;
- this.NotifyOfPropertyChange(() => SelectedFramerate);
- }
+ HandleEncoderChange(this.Task.VideoEncoder);
}
}
@@ -627,7 +514,7 @@ namespace HandBrakeWPF.ViewModels }
set
{
- if (!object.Equals(this.Task.ExtraAdvancedArguments, value))
+ if (!Equals(this.Task.ExtraAdvancedArguments, value))
{
this.Task.ExtraAdvancedArguments = value;
this.NotifyOfPropertyChange(() => this.ExtraArguments);
@@ -639,276 +526,245 @@ namespace HandBrakeWPF.ViewModels /// <summary>
/// Gets or sets a value indicating whether to display H264
/// </summary>
- public bool DisplayH264Options
+ public bool DisplayOptimiseOptions
{
get
{
- return this.displayEncoderOptions;
+ return this.displayOptimiseOptions;
}
set
{
- this.displayEncoderOptions = value;
- this.NotifyOfPropertyChange(() => this.DisplayH264Options);
- }
- }
-
- /// <summary>
- /// Gets or sets a value indicating whether display x 264 options.
- /// </summary>
- public bool DisplayX264Options
- {
- get
- {
- return this.displayX264Options;
- }
- set
- {
- this.displayX264Options = value;
- this.NotifyOfPropertyChange(() => this.DisplayX264Options);
- this.NotifyOfPropertyChange(() => FullOptionsTooltip);
- }
- }
-
- /// <summary>
- /// Gets or sets a value indicating whether display x 264 options.
- /// </summary>
- public bool DisplayX265Options
- {
- get
- {
- return this.displayX265Options;
- }
- set
- {
- this.displayX265Options = value;
- this.NotifyOfPropertyChange(() => this.DisplayX265Options);
+ this.displayOptimiseOptions = value;
+ this.NotifyOfPropertyChange(() => this.DisplayOptimiseOptions);
this.NotifyOfPropertyChange(() => FullOptionsTooltip);
}
}
/// <summary>
- /// Gets or sets a value indicating whether to display qsv options.
- /// </summary>
- public bool DisplayQSVOptions
- {
- get
- {
- return this.displayQSVOptions;
- }
- set
- {
- this.displayQSVOptions = value;
- this.NotifyOfPropertyChange(() => this.DisplayQSVOptions);
- }
- }
-
- /// <summary>
- /// Gets or sets a value indicating whether display framerate controls.
+ /// Gets or sets a value indicating whether display non qsv controls.
/// </summary>
public bool DisplayNonQSVControls
+
{
get
{
- return this.displayNonQSVControls;
+ return this.displayNonQsvControls;
}
-
set
{
- this.displayNonQSVControls = value;
+ if (value.Equals(this.displayNonQsvControls))
+ {
+ return;
+ }
+ this.displayNonQsvControls = value;
this.NotifyOfPropertyChange(() => this.DisplayNonQSVControls);
}
}
/// <summary>
- /// Gets or sets the x 264 preset value.
+ /// Gets or sets a value indicating whether display tune controls.
/// </summary>
- public int X264PresetValue
+ public bool DisplayTuneControls
{
get
{
- return this.x264PresetValue;
+ return this.displayTuneControls;
}
set
{
- if (!object.Equals(this.X264PresetValue, value))
+ if (value.Equals(this.displayTuneControls))
{
- this.x264PresetValue = value;
- this.X264Preset = this.X264Presets[value];
- this.NotifyOfPropertyChange(() => this.x264PresetValue);
- this.NotifyOfPropertyChange(() => FullOptionsTooltip);
+ return;
}
+ this.displayTuneControls = value;
+ this.NotifyOfPropertyChange(() => this.DisplayTuneControls);
}
}
/// <summary>
- /// Gets or sets X264Preset.
+ /// Gets or sets a value indicating whether fast decode.
/// </summary>
- public x264Preset X264Preset
+ public bool FastDecode
{
get
{
- return this.Task.X264Preset;
+ return this.fastDecode;
}
set
{
- if (!object.Equals(this.X264Preset, value))
+ if (value.Equals(this.fastDecode))
{
- this.Task.X264Preset = value;
- this.NotifyOfPropertyChange(() => this.X264Preset);
- ResetAdvancedTab();
- this.NotifyOfPropertyChange(() => FullOptionsTooltip);
+ return;
+ }
+ this.fastDecode = value;
+ this.NotifyOfPropertyChange(() => this.FastDecode);
+ this.NotifyOfPropertyChange(() => FullOptionsTooltip);
+ ResetAdvancedTab();
+
+ // Update the encode task
+ if (value && !this.Task.VideoTunes.Contains(VideoTune.FastDecode))
+ {
+ this.Task.VideoTunes.Add(VideoTune.FastDecode);
}
+ else
+ {
+ this.Task.VideoTunes.Remove(VideoTune.FastDecode);
+ }
}
}
/// <summary>
- /// Gets or sets X264Preset.
+ /// Gets or sets the video preset.
/// </summary>
- public QsvPreset QsvPreset
+ public VideoPreset VideoPreset
{
get
{
- return this.Task.QsvPreset;
+ return this.Task.VideoPreset;
}
set
{
- if (!object.Equals(this.QsvPreset, value))
- {
- this.Task.QsvPreset = value;
- this.NotifyOfPropertyChange(() => this.QsvPreset);
- }
+ this.Task.VideoPreset = value;
+ this.NotifyOfPropertyChange(() => this.VideoPreset);
+ this.NotifyOfPropertyChange(() => FullOptionsTooltip);
+ ResetAdvancedTab();
}
}
/// <summary>
- /// Gets or sets the x 264 preset value.
+ /// Gets or sets the video preset value.
/// </summary>
- public int QsvPresetValue
+ public int? VideoPresetValue
{
get
{
- return this.qsvPresetValue;
+ return this.videoPresetValue;
}
set
{
- if (!object.Equals(this.QsvPresetValue, value))
+ this.videoPresetValue = value;
+
+ HBVideoEncoder encoder = HandBrakeEncoderHelpers.VideoEncoders.FirstOrDefault(s => s.ShortName == EnumHelper<VideoEncoder>.GetShortName(this.SelectedVideoEncoder));
+ if (encoder != null && value.HasValue)
{
- this.qsvPresetValue = value;
- this.QsvPreset = this.QsvPresets[value];
- this.NotifyOfPropertyChange(() => this.QsvPresetValue);
+ string preset = encoder.Presets[value.Value];
+ this.VideoPreset = new VideoPreset(preset, preset);
}
+
+ this.NotifyOfPropertyChange(() => this.VideoPresetValue);
}
}
/// <summary>
- /// Gets or sets H264Profile.
+ /// Gets or sets the video preset max value.
/// </summary>
- public x264Profile H264Profile
+ public int VideoPresetMaxValue
{
get
{
- return this.Task.H264Profile;
+ return this.videoPresetMaxValue;
}
set
{
- if (!object.Equals(this.H264Profile, value))
+ if (value == this.videoPresetMaxValue)
{
- this.Task.H264Profile = value;
- this.NotifyOfPropertyChange(() => this.H264Profile);
- ResetAdvancedTab();
- this.NotifyOfPropertyChange(() => FullOptionsTooltip);
+ return;
}
+ this.videoPresetMaxValue = value;
+ this.NotifyOfPropertyChange(() => this.VideoPresetMaxValue);
}
}
/// <summary>
- /// Gets or sets H264Profile.
+ /// Gets or sets the video tune.
/// </summary>
- public string H264Level
+ public VideoTune VideoTune
{
get
{
- return this.Task.H264Level;
+ return this.videoTune;
}
set
{
- if (!object.Equals(this.H264Level, value))
+ if (Equals(value, this.videoTune))
{
- this.Task.H264Level = value;
- this.NotifyOfPropertyChange(() => this.H264Level);
- ResetAdvancedTab();
- this.NotifyOfPropertyChange(() => FullOptionsTooltip);
+ return;
+ }
+ this.videoTune = value;
+ this.NotifyOfPropertyChange(() => this.VideoTune);
+ this.NotifyOfPropertyChange(() => FullOptionsTooltip);
+ ResetAdvancedTab();
+
+ // Update the encode task.
+ this.Task.VideoTunes.Clear();
+ if (value != null && !Equals(value, VideoTune.None))
+ {
+ this.Task.VideoTunes.Add(value);
+ }
+
+ if (this.FastDecode)
+ {
+ this.Task.VideoTunes.Add(VideoTune.FastDecode);
}
}
}
/// <summary>
- /// Gets or sets X264Tune.
+ /// Gets or sets the video profile.
/// </summary>
- public x264Tune X264Tune
+ public VideoProfile VideoProfile
{
get
{
- return this.Task.X264Tune;
+ return this.Task.VideoProfile;
}
set
{
- if (!object.Equals(this.X264Tune, value))
- {
- this.Task.X264Tune = value;
- this.NotifyOfPropertyChange(() => this.X264Tune);
- ResetAdvancedTab();
- this.NotifyOfPropertyChange(() => FullOptionsTooltip);
- }
+ this.Task.VideoProfile = value;
+ this.NotifyOfPropertyChange(() => this.VideoProfile);
+ this.NotifyOfPropertyChange(() => FullOptionsTooltip);
+ ResetAdvancedTab();
}
}
/// <summary>
- /// Gets or sets a value indicating whether fast decode.
+ /// Gets or sets the video level.
/// </summary>
- public bool FastDecode
+ public VideoLevel VideoLevel
{
get
{
- return this.Task.FastDecode;
+ return this.Task.VideoLevel;
}
set
{
- if (!object.Equals(this.FastDecode, value))
- {
- this.Task.FastDecode = value;
- this.NotifyOfPropertyChange(() => this.FastDecode);
- ResetAdvancedTab();
- this.NotifyOfPropertyChange(() => FullOptionsTooltip);
- }
+ this.Task.VideoLevel = value;
+ this.NotifyOfPropertyChange(() => this.VideoLevel);
+ this.NotifyOfPropertyChange(() => FullOptionsTooltip);
+ ResetAdvancedTab();
}
}
/// <summary>
- /// Gets or sets X264Presets.
+ /// Gets or sets the video presets.
/// </summary>
- public BindingList<x264Preset> X264Presets { get; set; }
+ public BindingList<VideoPreset> VideoPresets { get; set; }
/// <summary>
- /// Gets or sets QsvPreset.
+ /// Gets or sets the video tunes.
/// </summary>
- public BindingList<QsvPreset> QsvPresets { get; set; }
+ public BindingList<VideoTune> VideoTunes { get; set; }
/// <summary>
- /// Gets or sets X264Profiles.
+ /// Gets or sets the video profiles.
/// </summary>
- public IEnumerable<x264Profile> H264Profiles { get; set; }
+ public BindingList<VideoProfile> VideoProfiles { get; set; }
/// <summary>
- /// Gets or sets X264Tunes.
+ /// Gets or sets the video levels.
/// </summary>
- public IEnumerable<x264Tune> X264Tunes { get; set; }
-
- /// <summary>
- /// Gets or sets the x 264 levels.
- /// </summary>
- public IEnumerable<string> H264Levels { get; set; }
+ public BindingList<VideoLevel> VideoLevels { get; set; }
/// <summary>
/// Gets the full options tooltip.
@@ -922,117 +778,6 @@ namespace HandBrakeWPF.ViewModels }
/// <summary>
- /// Gets the qsv slider max.
- /// </summary>
- public int QsvSliderMax
- {
- get
- {
- return SystemInfo.IsHswOrNewer ? 2 : 1;
- }
- }
-
- /// <summary>
- /// Gets or sets the x 265 preset value.
- /// </summary>
- public int X265PresetValue
- {
- get
- {
- return this.x265PresetValue;
- }
- set
- {
- if (!object.Equals(this.X265PresetValue, value))
- {
- this.x265PresetValue = value;
- this.X265Preset = this.X265Presets[value];
- this.NotifyOfPropertyChange(() => this.x265PresetValue);
- this.NotifyOfPropertyChange(() => FullOptionsTooltip);
- }
- }
- }
-
- /// <summary>
- /// Gets or sets X265Preset.
- /// </summary>
- public x265Preset X265Preset
- {
- get
- {
- return this.Task.X265Preset;
- }
- set
- {
- if (!object.Equals(this.X265Preset, value))
- {
- this.Task.X265Preset = value;
- this.NotifyOfPropertyChange(() => this.X265Preset);
- ResetAdvancedTab();
- this.NotifyOfPropertyChange(() => FullOptionsTooltip);
- }
- }
- }
-
- /// <summary>
- /// Gets or sets H265Profile.
- /// </summary>
- public x265Profile H265Profile
- {
- get
- {
- return this.Task.H265Profile;
- }
-
- set
- {
- if (!object.Equals(this.H265Profile, value))
- {
- this.Task.H265Profile = value;
- this.NotifyOfPropertyChange(() => this.H265Profile);
- ResetAdvancedTab();
- this.NotifyOfPropertyChange(() => FullOptionsTooltip);
- }
- }
- }
-
- /// <summary>
- /// Gets or sets X265Tune.
- /// </summary>
- public x265Tune X265Tune
- {
- get
- {
- return this.Task.X265Tune;
- }
- set
- {
- if (!object.Equals(this.X265Tune, value))
- {
- this.Task.X265Tune = value;
- this.NotifyOfPropertyChange(() => this.X265Tune);
- ResetAdvancedTab();
- this.NotifyOfPropertyChange(() => FullOptionsTooltip);
- }
- }
- }
-
- /// <summary>
- /// Gets or sets X265Presets.
- /// </summary>
- public BindingList<x265Preset> X265Presets { get; set; }
-
- /// <summary>
- /// Gets or sets X265Profiles.
- /// </summary>
- public IEnumerable<x265Profile> H265Profiles { get; set; }
-
- /// <summary>
- /// Gets or sets X265Tunes.
- /// </summary>
- public IEnumerable<x265Tune> X265Tunes { get; set; }
-
- /// <summary>
/// Gets or sets a value indicating whether display turbo first pass.
/// </summary>
public bool DisplayTurboFirstPass
@@ -1123,60 +868,22 @@ namespace HandBrakeWPF.ViewModels if (preset.Task != null)
{
- this.SetEncoder(preset.Task.VideoEncoder);
-
- // applies to both x264 and QSV
- if (preset.Task.VideoEncoder == VideoEncoder.X264 ||
- preset.Task.VideoEncoder == VideoEncoder.QuickSync)
- {
- this.H264Profile = preset.Task.H264Profile;
- this.H264Level = preset.Task.H264Level;
- }
- else
- {
- this.H264Profile = x264Profile.Auto;
- this.H264Level = "Auto";
- }
-
- // x264 Only
- if (preset.Task.VideoEncoder == VideoEncoder.X264)
- {
- this.X264PresetValue = (int)preset.Task.X264Preset;
- this.X264Tune = preset.Task.X264Tune;
- this.FastDecode = preset.Task.FastDecode;
- }
- else
- {
- this.X264PresetValue = (int)x264Preset.Medium;
- this.X264Tune = x264Tune.None;
- this.FastDecode = false;
- }
+ this.HandleEncoderChange(preset.Task.VideoEncoder);
- // x265 Only
- if (preset.Task.VideoEncoder == VideoEncoder.X265)
+ HBVideoEncoder encoder = HandBrakeEncoderHelpers.VideoEncoders.FirstOrDefault(s => s.ShortName == EnumHelper<VideoEncoder>.GetShortName(preset.Task.VideoEncoder));
+ if (encoder != null)
{
- this.X265PresetValue = (int)preset.Task.X265Preset;
- this.X265Tune = preset.Task.X265Tune;
- this.H265Profile = preset.Task.H265Profile;
- }
- else
- {
- this.X265PresetValue = (int)x265Preset.VeryFast;
- this.X265Tune = x265Tune.None;
- this.H265Profile = x265Profile.None;
+ if (preset.Task.VideoEncoder == VideoEncoder.X264 || preset.Task.VideoEncoder == VideoEncoder.X265 || preset.Task.VideoEncoder == VideoEncoder.QuickSync)
+ {
+ this.VideoLevel = preset.Task.VideoLevel != null ? preset.Task.VideoLevel.Clone() : this.VideoLevels.FirstOrDefault();
+ this.VideoProfile = preset.Task.VideoProfile != null ? preset.Task.VideoProfile.Clone() : this.VideoProfiles.FirstOrDefault();
+ this.VideoPresetValue = preset.Task.VideoPreset != null ? this.VideoPresets.IndexOf(preset.Task.VideoPreset) : 0;
+ this.FastDecode = preset.Task.VideoTunes != null && preset.Task.VideoTunes.Contains(VideoTune.FastDecode);
+ this.VideoTune = preset.Task.VideoTunes != null ? preset.Task.VideoTunes.FirstOrDefault(t => !Equals(t, VideoTune.FastDecode)) : this.VideoTunes.FirstOrDefault();
+ }
}
- // QSV Only
- if (preset.Task.VideoEncoder == VideoEncoder.QuickSync)
- {
- this.QsvPresetValue = (int)preset.Task.QsvPreset;
- }
- else
- {
- this.QsvPresetValue = SystemInfo.IsHswOrNewer
- ? (int)QsvPreset.Quality
- : (int)QsvPreset.Balanced;
- }
+ // TODO Hide Controls.
this.ExtraArguments = preset.Task.ExtraAdvancedArguments;
this.UseAdvancedTab = !string.IsNullOrEmpty(preset.Task.AdvancedEncoderOptions) && this.ShowAdvancedTab;
@@ -1210,37 +917,12 @@ namespace HandBrakeWPF.ViewModels this.NotifyOfPropertyChange(() => this.Task.TwoPass);
this.NotifyOfPropertyChange(() => this.Task.TurboFirstPass);
- this.NotifyOfPropertyChange(() => this.X264Tune);
- this.NotifyOfPropertyChange(() => this.X264Preset);
- this.NotifyOfPropertyChange(() => this.H264Level);
- this.NotifyOfPropertyChange(() => this.H264Profile);
+ this.NotifyOfPropertyChange(() => this.VideoTune);
+ this.NotifyOfPropertyChange(() => this.VideoProfile);
+ this.NotifyOfPropertyChange(() => this.VideoProfile);
+ this.NotifyOfPropertyChange(() => this.VideoLevel);
this.NotifyOfPropertyChange(() => this.FastDecode);
this.NotifyOfPropertyChange(() => this.ExtraArguments);
- this.NotifyOfPropertyChange(() => this.QsvPreset);
-
- this.NotifyOfPropertyChange(() => this.H265Profile);
- this.NotifyOfPropertyChange(() => this.X265Preset);
- this.NotifyOfPropertyChange(() => this.X265Tune);
- }
-
- /// <summary>
- /// Set the currently selected encoder.
- /// </summary>
- /// <param name="encoder">
- /// The Video Encoder.
- /// </param>
- public void SetEncoder(VideoEncoder encoder)
- {
- this.DisplayH264Options = encoder == VideoEncoder.X264 || encoder == VideoEncoder.QuickSync;
- this.DisplayX264Options = encoder == VideoEncoder.X264;
- this.DisplayQSVOptions = encoder == VideoEncoder.QuickSync;
- this.DisplayX265Options = encoder == VideoEncoder.X265;
- this.DisplayTurboFirstPass = encoder == VideoEncoder.X264;
-
- if (encoder == VideoEncoder.QuickSync)
- {
- this.UseAdvancedTab = false;
- }
}
/// <summary>
@@ -1262,17 +944,15 @@ namespace HandBrakeWPF.ViewModels public void ClearAdvancedSettings()
{
this.canClear = false;
- this.X264PresetValue = 5;
- this.X264Tune = x264Tune.None;
- this.H264Profile = x264Profile.Auto;
this.FastDecode = false;
- this.H264Level = "Auto";
+ this.VideoTune = null;
+ this.VideoProfile = new VideoProfile("auto", "auto");
+ this.VideoPreset = null;
+ this.VideoPresetValue = 1;
+ this.VideoLevel = new VideoLevel("auto", "auto");
+
this.ExtraArguments = string.Empty;
this.canClear = true;
-
- this.H265Profile = x265Profile.None;
- this.x265PresetValue = 1;
- this.X265Tune = x265Tune.None;
}
/// <summary>
@@ -1340,13 +1020,13 @@ namespace HandBrakeWPF.ViewModels return string.Empty; // Feature is disabled.
}
- string preset = EnumHelper<x264Preset>.GetDisplay(this.X264Preset).ToLower().Replace(" ", string.Empty);
- string profile = EnumHelper<x264Profile>.GetDisplay(this.H264Profile).ToLower();
+ string preset = this.VideoPreset != null ? this.VideoPreset.ShortName : string.Empty;
+ string profile = this.VideoProfile != null ? this.VideoProfile.ShortName : string.Empty;
List<string> tunes = new List<string>();
- if (X264Tune != x264Tune.None)
+ if (this.VideoTune != null && this.VideoTune.ShortName != "none")
{
- tunes.Add(this.X264Tune.ToString().ToLower().Replace(" ", string.Empty)); // TODO tidy this sillyness up.
+ tunes.Add(this.VideoTune.ShortName);
}
if (this.FastDecode)
{
@@ -1370,12 +1050,12 @@ namespace HandBrakeWPF.ViewModels try
{
return HandBrakeUtils.CreateX264OptionsString(
- preset,
- tunes,
- this.ExtraArguments,
- profile,
- this.H264Level,
- width,
+ preset,
+ tunes,
+ this.ExtraArguments,
+ profile,
+ this.VideoLevel != null ? this.VideoLevel.ShortName : string.Empty,
+ width,
height);
}
catch (Exception)
@@ -1393,7 +1073,7 @@ namespace HandBrakeWPF.ViewModels /// <param name="e">
/// The e.
/// </param>
- private void UserSettingServiceSettingChanged(object sender, HandBrake.ApplicationServices.EventArgs.SettingChangedEventArgs e)
+ private void UserSettingServiceSettingChanged(object sender, SettingChangedEventArgs e)
{
if (e.Key == UserSettingConstants.ShowAdvancedTab)
{
@@ -1458,5 +1138,124 @@ namespace HandBrakeWPF.ViewModels break;
}
}
+
+ /// <summary>
+ /// The handle encoder change.
+ /// </summary>
+ /// <param name="selectedEncoder">
+ /// The selected encoder.
+ /// </param>
+ private void HandleEncoderChange(VideoEncoder selectedEncoder)
+ {
+ HBVideoEncoder encoder = HandBrakeEncoderHelpers.VideoEncoders.FirstOrDefault(s => s.ShortName == EnumHelper<VideoEncoder>.GetShortName(selectedEncoder));
+ if (encoder != null)
+ {
+ // Setup Profile
+ this.VideoProfiles.Clear();
+ if (encoder.Profiles != null)
+ {
+ foreach (var item in encoder.Profiles)
+ {
+ this.VideoProfiles.Add(new VideoProfile(item, item));
+ }
+ this.VideoProfile = this.VideoProfiles.FirstOrDefault();
+ }
+ else
+ {
+ this.VideoProfile = null;
+ }
+
+ // Setup Tune
+ this.VideoTunes.Clear();
+ if (encoder.Tunes != null)
+ {
+ this.VideoTunes.Add(VideoTune.None);
+ foreach (var item in encoder.Tunes)
+ {
+ if (item != VideoTune.FastDecode.ShortName)
+ {
+ this.VideoTunes.Add(new VideoTune(item, item));
+ }
+ }
+ this.FastDecode = false;
+ this.VideoTune = VideoTune.None;
+ }
+ else
+ {
+ this.FastDecode = false;
+ this.VideoTune = VideoTune.None;
+ }
+
+ // Setup Levels
+ this.VideoLevels.Clear();
+ if (encoder.Levels != null)
+ {
+ foreach (var item in encoder.Levels)
+ {
+ this.VideoLevels.Add(new VideoLevel(item, item));
+ }
+
+ this.VideoLevel = this.VideoLevels.FirstOrDefault();
+ }
+ else
+ {
+ this.VideoLevel = VideoLevel.Auto;
+ }
+
+
+ // Setup Presets.
+ this.VideoPresets.Clear();
+ if (encoder.Presets != null)
+ {
+ foreach (var item in encoder.Presets)
+ {
+ this.VideoPresets.Add(new VideoPreset(item, item));
+ }
+
+ this.VideoPresetMaxValue = encoder.Presets.Count - 1;
+ int middlePreset = (int)Math.Round((decimal)(this.VideoPresetMaxValue / 2), 0);
+ this.VideoPreset = new VideoPreset(encoder.Presets[middlePreset], encoder.Presets[middlePreset]);
+ }
+ else
+ {
+ this.VideoPreset = null;
+ }
+ }
+
+ // Tell the Advanced Panel off the change
+ IAdvancedViewModel advancedViewModel = IoC.Get<IAdvancedViewModel>();
+ advancedViewModel.SetEncoder(this.Task.VideoEncoder);
+
+ // Update the Quality Slider. Make sure the bounds are up to date with the users settings.
+ this.SetQualitySliderBounds();
+
+ if (this.SelectedVideoEncoder == VideoEncoder.X264 || this.SelectedVideoEncoder == VideoEncoder.X265 || this.SelectedVideoEncoder == VideoEncoder.QuickSync)
+ {
+ this.DisplayOptimiseOptions = true;
+ }
+
+ this.DisplayNonQSVControls = this.SelectedVideoEncoder != VideoEncoder.QuickSync;
+
+ // Update control display
+ this.UseAdvancedTab = selectedEncoder != VideoEncoder.QuickSync && this.UseAdvancedTab;
+ this.DisplayTurboFirstPass = selectedEncoder == VideoEncoder.X264;
+ this.DisplayTuneControls = SelectedVideoEncoder == VideoEncoder.X264;
+
+ // Refresh Display
+ this.NotifyOfPropertyChange(() => this.Rfqp);
+ this.NotifyOfPropertyChange(() => this.ShowAdvancedTab);
+ this.NotifyOfPropertyChange(() => this.HighQualityLabel);
+
+ // Handle some quicksync specific options.
+ if (selectedEncoder == VideoEncoder.QuickSync)
+ {
+ this.IsConstantFramerate = true;
+ this.TwoPass = false;
+ this.TurboFirstPass = false;
+ this.Task.Framerate = null;
+ this.NotifyOfPropertyChange(() => SelectedFramerate);
+ this.UseAdvancedTab = false;
+ }
+ }
}
}
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/Views/VideoView.xaml b/win/CS/HandBrakeWPF/Views/VideoView.xaml index 8e235ec5f..0de805316 100644 --- a/win/CS/HandBrakeWPF/Views/VideoView.xaml +++ b/win/CS/HandBrakeWPF/Views/VideoView.xaml @@ -151,60 +151,40 @@ <!-- Row 1 -->
- <TextBlock Text="x264 Preset:" Grid.Row="1" Grid.Column="0" VerticalAlignment="Center"
- Visibility="{Binding DisplayX264Options, Converter={StaticResource boolToVisConverter}}" />
- <StackPanel Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3" Orientation="Horizontal"
- Visibility="{Binding DisplayX264Options, Converter={StaticResource boolToVisConverter}}" >
- <Slider Minimum="0" Maximum="9" Width="150" Value="{Binding X264PresetValue, Mode=Default, UpdateSourceTrigger=PropertyChanged}"
+ <TextBlock Text="Encoder Preset:" Grid.Row="1" Grid.Column="0" VerticalAlignment="Center" />
+ <StackPanel Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3" Orientation="Horizontal" >
+ <Slider Minimum="0" Maximum="{Binding VideoPresetMaxValue}" Width="150" Value="{Binding VideoPresetValue, Mode=Default, UpdateSourceTrigger=PropertyChanged}"
IsSnapToTickEnabled="True" TickFrequency="1" TickPlacement="BottomRight" ToolTip="{x:Static Properties:Resources.Video_EncoderPreset}"
Style="{StaticResource LongToolTipHolder}" />
- <TextBlock Text="{Binding X264Preset, Converter={StaticResource enumComboConverter}}" Margin="5,0,0,0" />
+ <TextBlock Text="{Binding VideoPreset.DisplayName}" Margin="5,0,0,0" />
</StackPanel>
- <TextBlock Text="x264 Tune:" Grid.Row="2" Grid.Column="0" VerticalAlignment="Center" Margin="0,10,0,0"
- Visibility="{Binding DisplayX264Options, Converter={StaticResource boolToVisConverter}}" />
+ <TextBlock Text="Encoder Tune:" Grid.Row="2" Grid.Column="0" VerticalAlignment="Center" Margin="0,10,0,0"
+ Visibility="{Binding DisplayTuneControls, Converter={StaticResource boolToVisConverter}}"/>
<ComboBox Width="100" Grid.Row="2" Grid.Column="1" Margin="5,10,5,0" Height="22"
- ItemsSource="{Binding X264Tunes, Converter={StaticResource enumComboConverter}}"
- SelectedItem="{Binding X264Tune, Converter={StaticResource enumComboConverter}}"
- Visibility="{Binding DisplayX264Options, Converter={StaticResource boolToVisConverter}}"
- ToolTip="{x:Static Properties:Resources.Video_EncoderTune}"
+ ItemsSource="{Binding VideoTunes}" DisplayMemberPath="DisplayName" SelectedItem="{Binding VideoTune}"
+ ToolTip="{x:Static Properties:Resources.Video_EncoderTune}" Visibility="{Binding DisplayTuneControls, Converter={StaticResource boolToVisConverter}}"
Style="{StaticResource LongToolTipHolder}" />
<CheckBox IsChecked="{Binding FastDecode}" Content="Fast Decode" Grid.Row="2" Grid.Column="2" Margin="10,10,10,0" VerticalAlignment="Center"
- Visibility="{Binding DisplayX264Options, Converter={StaticResource boolToVisConverter}}"
- ToolTip="{x:Static Properties:Resources.Video_x264FastDecode}"/>
-
- <TextBlock Text="QSV Preset:" Grid.Row="1" Grid.Column="0" VerticalAlignment="Center"
- Visibility="{Binding DisplayQSVOptions, Converter={StaticResource boolToVisConverter}}" />
- <StackPanel Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3" Orientation="Horizontal"
- Visibility="{Binding DisplayQSVOptions, Converter={StaticResource boolToVisConverter}}" >
- <Slider Minimum="0" Maximum="{Binding QsvSliderMax}" Width="150" Value="{Binding QsvPresetValue, Mode=Default, UpdateSourceTrigger=PropertyChanged}"
- IsSnapToTickEnabled="True" TickFrequency="1" TickPlacement="BottomRight" />
- <TextBlock Text="{Binding QsvPreset, Converter={StaticResource enumComboConverter}}" Margin="5,0,0,0" />
- </StackPanel>
-
+ ToolTip="{x:Static Properties:Resources.Video_x264FastDecode}" Visibility="{Binding DisplayTuneControls, Converter={StaticResource boolToVisConverter}}"/>
+
<!-- Row 2-->
<TextBlock Text="H.264 Profile:" Grid.Row="3" Grid.Column="0" Margin="0,10,0,0" VerticalAlignment="Center" />
<ComboBox Width="100" Grid.Row="3" Grid.Column="1" Margin="5,10,5,0" Height="22" VerticalAlignment="Center"
- ItemsSource="{Binding H264Profiles, Converter={StaticResource enumComboConverter}}"
- SelectedItem="{Binding H264Profile, Converter={StaticResource enumComboConverter}}"
- Style="{StaticResource LongToolTipHolder}"
- ToolTip="{x:Static Properties:Resources.Video_EncoderProfile}" />
+ ItemsSource="{Binding VideoProfiles}" DisplayMemberPath="DisplayName" SelectedItem="{Binding VideoProfile}"
+ Style="{StaticResource LongToolTipHolder}" ToolTip="{x:Static Properties:Resources.Video_EncoderProfile}" />
<TextBlock Text="H.264 Level:" Grid.Row="3" Grid.Column="2" Margin="10,10,0,0" VerticalAlignment="Center" />
<ComboBox Width="100" Grid.Row="3" Grid.Column="3" Margin="5,10,5,0" Height="22" VerticalAlignment="Center"
- ItemsSource="{Binding H264Levels}"
- SelectedItem="{Binding H264Level}"
- Style="{StaticResource LongToolTipHolder}"
- ToolTip="{x:Static Properties:Resources.Video_EncoderLevel}"/>
+ ItemsSource="{Binding VideoLevels}" DisplayMemberPath="DisplayName" SelectedItem="{Binding VideoLevel}"
+ Style="{StaticResource LongToolTipHolder}" ToolTip="{x:Static Properties:Resources.Video_EncoderLevel}"/>
<!-- Row 3 -->
- <TextBlock Text="Extra Options:" Grid.Row="4" Grid.Column="0" Margin="0,10,0,0" VerticalAlignment="Center" HorizontalAlignment="Left"
- Visibility="{Binding DisplayX264Options, Converter={StaticResource boolToVisConverter}}" />
+ <TextBlock Text="Extra Options:" Grid.Row="4" Grid.Column="0" Margin="0,10,0,0" VerticalAlignment="Center" HorizontalAlignment="Left" />
<TextBox Text="{Binding ExtraArguments, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
Height="30" MaxLines="2" Grid.Row="4" Grid.Column="1" Grid.ColumnSpan="3" Margin="5,10,0,0" VerticalAlignment="Center"
- ToolTip="{Binding FullOptionsTooltip}" Style="{StaticResource LongToolTipHolder}"
- Visibility="{Binding DisplayX264Options, Converter={StaticResource boolToVisConverter}}" >
+ ToolTip="{Binding FullOptionsTooltip}" Style="{StaticResource LongToolTipHolder}" >
<TextBox.ContextMenu>
<ContextMenu>
<MenuItem Header="Copy Full Query" cal:Message.Attach="[Event Click] = [Action CopyQuery]" />
@@ -217,84 +197,6 @@ </Grid>
- <!-- H265 settings -->
-
- <Grid Grid.Row="1" Grid.ColumnSpan="2" Margin="0,10,0,0" Visibility="{Binding DisplayX265Options, Converter={StaticResource boolToVisConverter}}">
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- <RowDefinition Height="*" />
- </Grid.RowDefinitions>
-
- <TextBlock Text="Optimise Video:" Margin="0,0,0,8" Grid.Row="0" Grid.ColumnSpan="2" FontWeight="Bold" VerticalAlignment="Center" />
-
- <CheckBox Content="Use Advanced Tab instead" Grid.Row="1" IsChecked="{Binding UseAdvancedTab}"
- Visibility="{Binding DisplayX265Options, Converter={StaticResource boolToVisConverter}, ConverterParameter=false}" />
-
- <Grid Grid.Row="2" Margin="0,5,0,0" IsEnabled="{Binding UseAdvancedTab, Converter={StaticResource inverseConverter}}">
-
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- <RowDefinition Height="*" />
- </Grid.RowDefinitions>
-
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="Auto" />
- </Grid.ColumnDefinitions>
-
-
- <!-- Row 1 -->
-
- <TextBlock Text="x265 Preset:" Grid.Row="1" Grid.Column="0" VerticalAlignment="Center"
- Visibility="{Binding DisplayX265Options, Converter={StaticResource boolToVisConverter}}" />
- <StackPanel Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3" Orientation="Horizontal"
- Visibility="{Binding DisplayX265Options, Converter={StaticResource boolToVisConverter}}" >
- <Slider Minimum="0" Maximum="9" Width="150" Value="{Binding X265PresetValue, Mode=Default, UpdateSourceTrigger=PropertyChanged}"
- IsSnapToTickEnabled="True" TickFrequency="1" TickPlacement="BottomRight" ToolTip="{x:Static Properties:Resources.Video_EncoderPreset}"
- Style="{StaticResource LongToolTipHolder}" />
- <TextBlock Text="{Binding X265Preset}" Margin="5,0,0,0" />
- </StackPanel>
-
- <TextBlock Text="x265 Tune:" Grid.Row="2" Grid.Column="0" VerticalAlignment="Center" Margin="0,10,0,0"
- Visibility="{Binding DisplayX265Options, Converter={StaticResource boolToVisConverter}}" />
- <ComboBox Width="100" Grid.Row="2" Grid.Column="1" Margin="5,10,5,0" Height="22"
- ItemsSource="{Binding X265Tunes}"
- SelectedItem="{Binding X265Tune}"
- Visibility="{Binding DisplayX265Options, Converter={StaticResource boolToVisConverter}}"
- ToolTip="{x:Static Properties:Resources.Video_EncoderTune}"
- Style="{StaticResource LongToolTipHolder}" />
-
- <TextBlock Text="H.265 Profile:" Grid.Row="2" Grid.Column="2" Margin="10,10,0,0" VerticalAlignment="Center"
- Visibility="{Binding DisplayX265Options, Converter={StaticResource boolToVisConverter}}" />
- <ComboBox Width="100" Grid.Row="2" Grid.Column="3" Margin="5,10,5,0" Height="22" VerticalAlignment="Center"
- Visibility="{Binding DisplayX265Options, Converter={StaticResource boolToVisConverter}}"
- ItemsSource="{Binding H265Profiles}"
- SelectedItem="{Binding H265Profile}"
- Style="{StaticResource LongToolTipHolder}"
- ToolTip="{x:Static Properties:Resources.Video_EncoderProfile}" />
-
- <!-- Row 3 -->
- <TextBlock Text="Extra Options:" Grid.Row="4" Grid.Column="0" Margin="0,10,0,0" VerticalAlignment="Center" HorizontalAlignment="Left"
- Visibility="{Binding DisplayX265Options, Converter={StaticResource boolToVisConverter}}" />
- <TextBox Text="{Binding ExtraArguments, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
- Height="30" MaxLines="2" Grid.Row="4" Grid.Column="1" Grid.ColumnSpan="3" Margin="5,10,0,0" VerticalAlignment="Center"
- ToolTip="{Binding FullOptionsTooltip}" Style="{StaticResource LongToolTipHolder}"
- Visibility="{Binding DisplayX265Options, Converter={StaticResource boolToVisConverter}}" >
- <TextBox.ContextMenu>
- <ContextMenu>
- <MenuItem Header="Copy Full Query" cal:Message.Attach="[Event Click] = [Action CopyQuery]" />
- </ContextMenu>
- </TextBox.ContextMenu>
- </TextBox>
- </Grid>
- </Grid>
</Grid>
</Grid>
|