diff options
author | sr55 <[email protected]> | 2015-01-22 16:32:22 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2015-01-22 16:32:22 +0000 |
commit | acf831a1c78044a01e470102385334d183d1d5b1 (patch) | |
tree | f508c79182ff84f33617dcf826110bd21312adeb /win/CS/HandBrake.ApplicationServices | |
parent | 1ccc7a6a3caedda77d6e62972129727fb1598f35 (diff) |
WinGui: Initial re-factoring of the Video Tab. Replaces encoder specific preset/tune/profile/level options with generic versions. This will break all existing user presets so the version number for the presets has been bumped. This should trigger the old presets to be archived.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6789 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrake.ApplicationServices')
14 files changed, 771 insertions, 429 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
|