]> granicus.if.org Git - handbrake/commitdiff
WinGui: Initial re-factoring of the Video Tab. Replaces encoder specific preset/tune...
authorsr55 <sr55.hb@outlook.com>
Thu, 22 Jan 2015 16:32:22 +0000 (16:32 +0000)
committersr55 <sr55.hb@outlook.com>
Thu, 22 Jan 2015 16:32:22 +0000 (16:32 +0000)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6789 b64f7644-9d1e-0410-96f1-a4d463321fa5

35 files changed:
win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj
win/CS/HandBrake.ApplicationServices/Services/Encode/Factories/VideoLevelFactory.cs [new file with mode: 0644]
win/CS/HandBrake.ApplicationServices/Services/Encode/Factories/VideoPresetFactory.cs [new file with mode: 0644]
win/CS/HandBrake.ApplicationServices/Services/Encode/Factories/VideoProfileFactory.cs [new file with mode: 0644]
win/CS/HandBrake.ApplicationServices/Services/Encode/Factories/VideoTuneFactory.cs [new file with mode: 0644]
win/CS/HandBrake.ApplicationServices/Services/Encode/Model/EncodeTask.cs
win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/Video/VideoLevel.cs [new file with mode: 0644]
win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/Video/VideoPreset.cs [new file with mode: 0644]
win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/Video/VideoProfile.cs [new file with mode: 0644]
win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/Video/VideoTune.cs [new file with mode: 0644]
win/CS/HandBrake.ApplicationServices/Utilities/Converters.cs
win/CS/HandBrake.ApplicationServices/Utilities/InteropModelCreator.cs
win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs
win/CS/HandBrake.ApplicationServices/Utilities/QueryParserUtility.cs
win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj
win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/QsvPreset.cs [deleted file]
win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/VideoEncoder.cs
win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/x264/x264Preset.cs [deleted file]
win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/x264/x264Profile.cs [deleted file]
win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/x264/x264Tune.cs [deleted file]
win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/x265/x265Preset.cs [deleted file]
win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/x265/x265Profile.cs [deleted file]
win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/x265/x265Tune.cs [deleted file]
win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs
win/CS/HandBrakeWPF/Converters/Video/EncoderOptionsTooltipConverter.cs
win/CS/HandBrakeWPF/Presets.dat
win/CS/HandBrakeWPF/Services/Presets/Factories/PlistFactory.cs
win/CS/HandBrakeWPF/Services/Presets/Factories/PlistPresetFactory.cs
win/CS/HandBrakeWPF/Services/Presets/Model/Preset.cs
win/CS/HandBrakeWPF/Services/Presets/Model/PresetContainer.cs
win/CS/HandBrakeWPF/Services/Presets/PresetService.cs
win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs
win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs
win/CS/HandBrakeWPF/Views/VideoView.xaml

index 9253d7ab3eb94d5ba8ccb6cbe0ad73a09d2beb06..30740ab36dd12007d01da3088ffc9c8d815cf976 100644 (file)
     <Compile Include="EventArgs\QueueProgressEventArgs.cs" />\r
     <Compile Include="Isolation\BackgroundServiceConnector.cs" />\r
     <Compile Include="Isolation\IsolatedEncodeService.cs" />\r
+    <Compile Include="Services\Encode\Factories\VideoProfileFactory.cs" />\r
+    <Compile Include="Services\Encode\Factories\VideoPresetFactory.cs" />\r
+    <Compile Include="Services\Encode\Factories\VideoLevelFactory.cs" />\r
+    <Compile Include="Services\Encode\Factories\VideoTuneFactory.cs" />\r
     <Compile Include="Services\Encode\Model\Models\DenoisePreset.cs" />\r
     <Compile Include="Services\Encode\Model\Models\DenoiseTune.cs" />\r
     <Compile Include="Model\HBConfiguration.cs" />\r
     <Compile Include="Services\Encode\EventArgs\EncodeCompletedEventArgs.cs" />\r
     <Compile Include="Services\Encode\EventArgs\EncodeProgressEventArgs.cs" />\r
     <Compile Include="Services\Encode\Interfaces\IEncodeServiceWrapper.cs" />\r
+    <Compile Include="Services\Encode\Model\Models\Video\VideoLevel.cs" />\r
+    <Compile Include="Services\Encode\Model\Models\Video\VideoPreset.cs" />\r
+    <Compile Include="Services\Encode\Model\Models\Video\VideoProfile.cs" />\r
+    <Compile Include="Services\Encode\Model\Models\Video\VideoTune.cs" />\r
     <Compile Include="Services\Interfaces\IHbServiceCallback.cs" />\r
     <Compile Include="Services\Interfaces\IServerService.cs" />\r
     <Compile Include="Services\Scan\EventArgs\ScanCompletedEventArgs.cs" />\r
       <Name>HandBrakeInterop</Name>\r
     </ProjectReference>\r
   </ItemGroup>\r
-  <ItemGroup>\r
-    <Folder Include="Services\Encode\Factories\" />\r
-  </ItemGroup>\r
+  <ItemGroup />\r
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
   <Import Project="$(ProgramFiles)\MSBuild\StyleCop\v4.*\StyleCop.targets" />\r
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
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 (file)
index 0000000..375b7be
--- /dev/null
@@ -0,0 +1,38 @@
+// --------------------------------------------------------------------------------------------------------------------\r
+// <copyright file="VideoLevelFactory.cs" company="HandBrake Project (http://handbrake.fr)">\r
+//   This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.\r
+// </copyright>\r
+// <summary>\r
+//   The video level factory.\r
+// </summary>\r
+// --------------------------------------------------------------------------------------------------------------------\r
+\r
+namespace HandBrake.ApplicationServices.Services.Encode.Factories\r
+{\r
+    /// <summary>\r
+    /// The video tune factory.\r
+    /// </summary>\r
+    public class VideoLevelFactory\r
+    {\r
+        /// <summary>\r
+        /// The get display name for a given short name.\r
+        /// LibHB doesn't currently support this.\r
+        /// </summary>\r
+        /// <param name="shortName">\r
+        /// The short name.\r
+        /// </param>\r
+        /// <returns>\r
+        /// The <see cref="string"/>.\r
+        /// </returns>\r
+        public static string GetDisplayName(string shortName)\r
+        {\r
+            switch (shortName)\r
+            {\r
+                case "auto":\r
+                    return "Auto";\r
+            }\r
+\r
+            return shortName;\r
+        }\r
+    }\r
+}\r
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 (file)
index 0000000..4239b4c
--- /dev/null
@@ -0,0 +1,63 @@
+// --------------------------------------------------------------------------------------------------------------------\r
+// <copyright file="VideoPresetFactory.cs" company="HandBrake Project (http://handbrake.fr)">\r
+//   This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.\r
+// </copyright>\r
+// <summary>\r
+//   The video preset factory.\r
+// </summary>\r
+// --------------------------------------------------------------------------------------------------------------------\r
+\r
+namespace HandBrake.ApplicationServices.Services.Encode.Factories\r
+{\r
+    /// <summary>\r
+    /// The video tune factory.\r
+    /// </summary>\r
+    public class VideoPresetFactory\r
+    {\r
+        /// <summary>\r
+        /// The get display name for a given short name.\r
+        /// LibHB doesn't currently support this.\r
+        /// </summary>\r
+        /// <param name="shortName">\r
+        /// The short name.\r
+        /// </param>\r
+        /// <returns>\r
+        /// The <see cref="string"/>.\r
+        /// </returns>\r
+        public static string GetDisplayName(string shortName)\r
+        {\r
+            switch (shortName)\r
+            {\r
+                case "ultrafast":\r
+                    return "Ultrafast";\r
+                case "superfast":\r
+                    return "Superfast";\r
+                case "veryfast":\r
+                    return "Veryfast";\r
+                case "faster":\r
+                    return "Faster";\r
+                case "fast":\r
+                    return "Fast";\r
+                case "medium":\r
+                    return "Medium";\r
+                case "slow":\r
+                    return "Slow";\r
+                case "slower":\r
+                    return "Slower";\r
+                case "veryslow":\r
+                    return "VerySlow";\r
+                case "placebo":\r
+                    return "Placebo";\r
+\r
+                case "balanced":\r
+                    return "Balanced";\r
+                case "speed":\r
+                    return "Speed";\r
+                case "quality":\r
+                    return "Quality";\r
+            }\r
+\r
+            return shortName;\r
+        }\r
+    }\r
+}\r
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 (file)
index 0000000..f4a48f5
--- /dev/null
@@ -0,0 +1,44 @@
+// --------------------------------------------------------------------------------------------------------------------\r
+// <copyright file="VideoProfileFactory.cs" company="HandBrake Project (http://handbrake.fr)">\r
+//   This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.\r
+// </copyright>\r
+// <summary>\r
+//   The video profile factory.\r
+// </summary>\r
+// --------------------------------------------------------------------------------------------------------------------\r
+\r
+namespace HandBrake.ApplicationServices.Services.Encode.Factories\r
+{\r
+    /// <summary>\r
+    /// The video profile factory.\r
+    /// </summary>\r
+    public class VideoProfileFactory\r
+    {\r
+        /// <summary>\r
+        /// The get display name for a given short name.\r
+        /// LibHB doesn't currently support this.\r
+        /// </summary>\r
+        /// <param name="shortName">\r
+        /// The short name.\r
+        /// </param>\r
+        /// <returns>\r
+        /// The <see cref="string"/>.\r
+        /// </returns>\r
+        public static string GetDisplayName(string shortName)\r
+        {\r
+            switch (shortName)\r
+            {\r
+                case "auto":\r
+                    return "Auto";\r
+                case "main":\r
+                    return "Main";\r
+                case "high":\r
+                    return "High";\r
+                case "baseline":\r
+                    return "Baseline";\r
+            }\r
+\r
+            return shortName;\r
+        }\r
+    }\r
+}\r
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 (file)
index 0000000..b5aef77
--- /dev/null
@@ -0,0 +1,54 @@
+// --------------------------------------------------------------------------------------------------------------------\r
+// <copyright file="VideoTuneFactory.cs" company="HandBrake Project (http://handbrake.fr)">\r
+//   This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.\r
+// </copyright>\r
+// <summary>\r
+//   The video tune factory.\r
+// </summary>\r
+// --------------------------------------------------------------------------------------------------------------------\r
+\r
+namespace HandBrake.ApplicationServices.Services.Encode.Factories\r
+{\r
+    /// <summary>\r
+    /// The video tune factory.\r
+    /// </summary>\r
+    public class VideoTuneFactory\r
+    {\r
+        /// <summary>\r
+        /// The get display name for a given short name.\r
+        /// LibHB doesn't currently support this.\r
+        /// </summary>\r
+        /// <param name="shortName">\r
+        /// The short name.\r
+        /// </param>\r
+        /// <returns>\r
+        /// The <see cref="string"/>.\r
+        /// </returns>\r
+        public static string GetDisplayName(string shortName)\r
+        {\r
+            switch (shortName)\r
+            {\r
+                case "auto":\r
+                    return "Auto";\r
+                case "film":\r
+                    return "Film";\r
+                case "animation":\r
+                    return "Animation";\r
+                case "grain":\r
+                    return "Grain";\r
+                case "stillimage":\r
+                    return "Still Image";\r
+                case "psnr":\r
+                    return "PSNR";\r
+                case "ssim":\r
+                    return "SSIM";\r
+                case "fastdecode":\r
+                    return "Fast Decode";\r
+                case "zerolatency":\r
+                    return "Zero Latency";\r
+            }\r
+\r
+            return shortName;\r
+        }\r
+    }\r
+}\r
index 86735482a07a954a52ad7118442cd10734ab5c84..42210363a16059761e886cb7f16e53bbb641dc6b 100644 (file)
 namespace HandBrake.ApplicationServices.Services.Encode.Model\r
 {\r
     using System;\r
+    using System.Collections.Generic;\r
     using System.Collections.ObjectModel;\r
     using System.Linq;\r
-\r
     using Caliburn.Micro;\r
 \r
     using HandBrake.ApplicationServices.Services.Encode.Model.Models;\r
+    using HandBrake.ApplicationServices.Services.Encode.Model.Models.Video;\r
     using HandBrake.Interop.Model;\r
     using HandBrake.Interop.Model.Encoding;\r
-    using HandBrake.Interop.Model.Encoding.x264;\r
-    using HandBrake.Interop.Model.Encoding.x265;\r
-\r
-    using OutputFormat = HandBrake.ApplicationServices.Services.Encode.Model.Models.OutputFormat;\r
 \r
     /// <summary>\r
     /// An Encode Task\r
@@ -35,11 +32,6 @@ namespace HandBrake.ApplicationServices.Services.Encode.Model
         /// </summary>\r
         private bool showAdvancedTab;\r
 \r
-        /// <summary>\r
-        /// The advanced encoder options.\r
-        /// </summary>\r
-        private string advancedEncoderOptions;\r
-\r
         #endregion\r
 \r
         /// <summary>\r
@@ -52,15 +44,9 @@ namespace HandBrake.ApplicationServices.Services.Encode.Model
             this.SubtitleTracks = new ObservableCollection<SubtitleTrack>();\r
             this.ChapterNames = new ObservableCollection<ChapterMarker>();\r
             this.AllowedPassthruOptions = new AllowedPassthru();\r
-            this.X264Preset = x264Preset.Medium;\r
-            this.QsvPreset = QsvPreset.Quality;\r
-            this.H264Profile = x264Profile.Auto;\r
-            this.X264Tune = x264Tune.None;\r
             this.Modulus = 16;\r
 \r
-            this.H265Profile = x265Profile.None;\r
-            this.X265Preset = x265Preset.VeryFast;\r
-            this.X265Tune = x265Tune.None;\r
+            this.VideoTunes = new List<VideoTune>();\r
         }\r
 \r
         /// <summary>\r
@@ -138,19 +124,14 @@ namespace HandBrake.ApplicationServices.Services.Encode.Model
             this.VideoEncoder = task.VideoEncoder;\r
             this.VideoEncodeRateType = task.VideoEncodeRateType;\r
             this.Width = task.Width;\r
-            this.X264Preset = task.X264Preset;\r
-            this.QsvPreset = task.QsvPreset;\r
-            this.H264Profile = task.H264Profile;\r
-            this.X264Tune = task.X264Tune;\r
-            this.H264Level = task.H264Level;\r
-            this.FastDecode = task.FastDecode;\r
+\r
+            this.VideoLevel = task.VideoLevel;\r
+            this.VideoProfile = task.VideoProfile;\r
+            this.VideoPreset = task.VideoPreset;\r
+            this.VideoTunes = task.VideoTunes;\r
             this.ExtraAdvancedArguments = task.ExtraAdvancedArguments;\r
 \r
             this.ShowAdvancedTab = task.ShowAdvancedTab;\r
-\r
-            this.X265Preset = task.X265Preset;\r
-            this.X265Tune = task.X265Tune;\r
-            this.H265Profile = task.H265Profile;\r
         }\r
 \r
         #region Source\r
@@ -435,68 +416,33 @@ namespace HandBrake.ApplicationServices.Services.Encode.Model
         /// <summary>\r
         /// Gets or sets AdvancedEncoderOptions.\r
         /// </summary>\r
-        public string AdvancedEncoderOptions\r
-        {\r
-            get\r
-            {\r
-                return this.advancedEncoderOptions;\r
-            }\r
-            set\r
-            {\r
-                this.advancedEncoderOptions = value;\r
-            }\r
-        }\r
-\r
-        /// <summary>\r
-        /// Gets or sets x264Preset.\r
-        /// </summary>\r
-        public x264Preset X264Preset { get; set; }\r
-\r
-        /// <summary>\r
-        /// Gets or sets the qsv preset.\r
-        /// </summary>\r
-        public QsvPreset QsvPreset { get; set; }\r
+        public string AdvancedEncoderOptions { get; set; }\r
 \r
         /// <summary>\r
-        /// Gets or sets x264Profile.\r
+        /// Gets or sets the video profile.\r
         /// </summary>\r
-        public x264Profile H264Profile { get; set; }\r
+        public VideoProfile VideoProfile { get; set; }\r
 \r
         /// <summary>\r
-        /// Gets or sets the x 264 level.\r
+        /// Gets or sets the video level.\r
         /// </summary>\r
-        public string H264Level { get; set; }\r
+        public VideoLevel VideoLevel { get; set; }\r
 \r
         /// <summary>\r
-        /// Gets or sets X264Tune.\r
+        /// Gets or sets the video preset.\r
         /// </summary>\r
-        public x264Tune X264Tune { get; set; }\r
+        public VideoPreset VideoPreset { get; set; }\r
 \r
         /// <summary>\r
-        /// Gets or sets a value indicating whether fast decode.\r
+        /// Gets or sets the video tunes.\r
         /// </summary>\r
-        public bool FastDecode { get; set; }\r
+        public List<VideoTune> VideoTunes { get; set; }\r
 \r
         /// <summary>\r
         /// Gets or sets Extra Advanced Arguments for the Video Tab.\r
         /// </summary>\r
         public string ExtraAdvancedArguments { get; set; }\r
 \r
-        /// <summary>\r
-        /// Gets or sets x265Preset.\r
-        /// </summary>\r
-        public x265Preset X265Preset { get; set; }\r
-\r
-        /// <summary>\r
-        /// Gets or sets x265Profile.\r
-        /// </summary>\r
-        public x265Profile H265Profile { get; set; }\r
-\r
-        /// <summary>\r
-        /// Gets or sets X265Tune.\r
-        /// </summary>\r
-        public x265Tune X265Tune { get; set; }\r
-\r
         #endregion\r
 \r
         #region Preview\r
@@ -555,7 +501,7 @@ namespace HandBrake.ApplicationServices.Services.Encode.Model
             }\r
             set\r
             {\r
-                if (!object.Equals(value, this.showAdvancedTab))\r
+                if (!Equals(value, this.showAdvancedTab))\r
                 {\r
                     this.showAdvancedTab = value;\r
                     this.NotifyOfPropertyChange(() => this.ShowAdvancedTab);\r
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 (file)
index 0000000..f2a402c
--- /dev/null
@@ -0,0 +1,118 @@
+// --------------------------------------------------------------------------------------------------------------------\r
+// <copyright file="VideoLevel.cs" company="HandBrake Project (http://handbrake.fr)">\r
+//   This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.\r
+// </copyright>\r
+// <summary>\r
+//   The video level.\r
+// </summary>\r
+// --------------------------------------------------------------------------------------------------------------------\r
+\r
+namespace HandBrake.ApplicationServices.Services.Encode.Model.Models.Video\r
+{\r
+    using HandBrake.ApplicationServices.Services.Encode.Factories;\r
+\r
+    /// <summary>\r
+    /// The video level.\r
+    /// </summary>\r
+    public class VideoLevel\r
+    {\r
+        /// <summary>\r
+        /// An internal representation of the Auto Selection.\r
+        /// </summary>\r
+        public static VideoLevel Auto = new VideoLevel("Auto", "auto");\r
+\r
+        /// <summary>\r
+        /// Initializes a new instance of the <see cref="VideoLevel"/> class.\r
+        /// </summary>\r
+        public VideoLevel()\r
+        {\r
+        }\r
+\r
+        /// <summary>\r
+        /// Initializes a new instance of the <see cref="VideoLevel"/> class.\r
+        /// </summary>\r
+        /// <param name="displayName">\r
+        /// The display name.\r
+        /// </param>\r
+        /// <param name="shortName">\r
+        /// The short name.\r
+        /// </param>\r
+        public VideoLevel(string displayName, string shortName)\r
+        {\r
+            this.DisplayName = VideoLevelFactory.GetDisplayName(displayName);\r
+            this.ShortName = shortName;\r
+        }\r
+\r
+        /// <summary>\r
+        /// Gets or sets the display name.\r
+        /// </summary>\r
+        public string DisplayName { get; set; }\r
+\r
+        /// <summary>\r
+        /// Gets or sets the short name.\r
+        /// </summary>\r
+        public string ShortName { get; set; }\r
+\r
+        /// <summary>\r
+        /// The clone.\r
+        /// </summary>\r
+        /// <returns>\r
+        /// The <see cref="VideoProfile"/>.\r
+        /// </returns>\r
+        public VideoLevel Clone()\r
+        {\r
+            return new VideoLevel(this.DisplayName, this.ShortName);\r
+        }\r
+\r
+        /// <summary>\r
+        /// The equals.\r
+        /// </summary>\r
+        /// <param name="other">\r
+        /// The other.\r
+        /// </param>\r
+        /// <returns>\r
+        /// The <see cref="bool"/>.\r
+        /// </returns>\r
+        protected bool Equals(VideoLevel other)\r
+        {\r
+            return string.Equals(this.ShortName, other.ShortName);\r
+        }\r
+\r
+        /// <summary>\r
+        /// The equals.\r
+        /// </summary>\r
+        /// <param name="obj">\r
+        /// The obj.\r
+        /// </param>\r
+        /// <returns>\r
+        /// The <see cref="bool"/>.\r
+        /// </returns>\r
+        public override bool Equals(object obj)\r
+        {\r
+            if (ReferenceEquals(null, obj))\r
+            {\r
+                return false;\r
+            }\r
+            if (ReferenceEquals(this, obj))\r
+            {\r
+                return true;\r
+            }\r
+            if (obj.GetType() != this.GetType())\r
+            {\r
+                return false;\r
+            }\r
+            return Equals((VideoLevel)obj);\r
+        }\r
+\r
+        /// <summary>\r
+        /// The get hash code.\r
+        /// </summary>\r
+        /// <returns>\r
+        /// The <see cref="int"/>.\r
+        /// </returns>\r
+        public override int GetHashCode()\r
+        {\r
+            return (this.ShortName != null ? this.ShortName.GetHashCode() : 0);\r
+        }\r
+    }\r
+}\r
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 (file)
index 0000000..11dc041
--- /dev/null
@@ -0,0 +1,116 @@
+// --------------------------------------------------------------------------------------------------------------------\r
+// <copyright file="VideoPreset.cs" company="HandBrake Project (http://handbrake.fr)">\r
+//   This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.\r
+// </copyright>\r
+// <summary>\r
+//   The video preset.\r
+// </summary>\r
+// --------------------------------------------------------------------------------------------------------------------\r
+\r
+namespace HandBrake.ApplicationServices.Services.Encode.Model.Models.Video\r
+{\r
+    using HandBrake.ApplicationServices.Services.Encode.Factories;\r
+\r
+    /// <summary>\r
+    /// The video preset.\r
+    /// </summary>\r
+    public class VideoPreset\r
+    {\r
+        /// <summary>\r
+        /// Initializes a new instance of the <see cref="VideoPreset"/> class.\r
+        /// </summary>\r
+        public VideoPreset()\r
+        {\r
+        }\r
+\r
+        /// <summary>\r
+        /// Initializes a new instance of the <see cref="VideoPreset"/> class.\r
+        /// </summary>\r
+        /// <param name="displayName">\r
+        /// The display name.\r
+        /// </param>\r
+        /// <param name="shortName">\r
+        /// The short name.\r
+        /// </param>\r
+        public VideoPreset(string displayName, string shortName)\r
+        {\r
+            this.DisplayName = VideoPresetFactory.GetDisplayName(displayName);\r
+            this.ShortName = shortName;\r
+        }\r
+\r
+        /// <summary>\r
+        /// Gets or sets the display name.\r
+        /// </summary>\r
+        public string DisplayName { get; set; }\r
+\r
+        /// <summary>\r
+        /// Gets or sets the short name.\r
+        /// </summary>\r
+        public string ShortName { get; set; }\r
+\r
+        /// <summary>\r
+        /// The clone.\r
+        /// </summary>\r
+        /// <returns>\r
+        /// The <see cref="VideoProfile"/>.\r
+        /// </returns>\r
+        public VideoPreset Clone()\r
+        {\r
+            return new VideoPreset(this.DisplayName, this.ShortName);\r
+        }\r
+\r
+        /// <summary>\r
+        /// The equals.\r
+        /// </summary>\r
+        /// <param name="other">\r
+        /// The other.\r
+        /// </param>\r
+        /// <returns>\r
+        /// The <see cref="bool"/>.\r
+        /// </returns>\r
+        protected bool Equals(VideoPreset other)\r
+        {\r
+            return string.Equals(this.ShortName, other.ShortName);\r
+        }\r
+\r
+        /// <summary>\r
+        /// The equals.\r
+        /// </summary>\r
+        /// <param name="obj">\r
+        /// The obj.\r
+        /// </param>\r
+        /// <returns>\r
+        /// The <see cref="bool"/>.\r
+        /// </returns>\r
+        public override bool Equals(object obj)\r
+        {\r
+            if (ReferenceEquals(null, obj))\r
+            {\r
+                return false;\r
+            }\r
+\r
+            if (ReferenceEquals(this, obj))\r
+            {\r
+                return true;\r
+            }\r
+\r
+            if (obj.GetType() != this.GetType())\r
+            {\r
+                return false;\r
+            }\r
+\r
+            return this.Equals((VideoPreset)obj);\r
+        }\r
+\r
+        /// <summary>\r
+        /// The get hash code.\r
+        /// </summary>\r
+        /// <returns>\r
+        /// The <see cref="int"/>.\r
+        /// </returns>\r
+        public override int GetHashCode()\r
+        {\r
+            return (this.ShortName != null ? this.ShortName.GetHashCode() : 0);\r
+        }\r
+    }\r
+}\r
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 (file)
index 0000000..8c528df
--- /dev/null
@@ -0,0 +1,121 @@
+// --------------------------------------------------------------------------------------------------------------------\r
+// <copyright file="VideoProfile.cs" company="HandBrake Project (http://handbrake.fr)">\r
+//   This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.\r
+// </copyright>\r
+// <summary>\r
+//   The video profile.\r
+// </summary>\r
+// --------------------------------------------------------------------------------------------------------------------\r
+\r
+namespace HandBrake.ApplicationServices.Services.Encode.Model.Models.Video\r
+{\r
+    using HandBrake.ApplicationServices.Services.Encode.Factories;\r
+\r
+    /// <summary>\r
+    /// The video profile.\r
+    /// </summary>\r
+    public class VideoProfile\r
+    {\r
+        /// <summary>\r
+        /// An internal representation of the Auto Selection.\r
+        /// </summary>\r
+        public static VideoProfile Auto = new VideoProfile("Auto", "auto");\r
+\r
+        /// <summary>\r
+        /// Initializes a new instance of the <see cref="VideoProfile"/> class.\r
+        /// </summary>\r
+        public VideoProfile()\r
+        {\r
+        }\r
+\r
+        /// <summary>\r
+        /// Initializes a new instance of the <see cref="VideoProfile"/> class.\r
+        /// </summary>\r
+        /// <param name="displayName">\r
+        /// The display name.\r
+        /// </param>\r
+        /// <param name="shortName">\r
+        /// The short name.\r
+        /// </param>\r
+        public VideoProfile(string displayName, string shortName)\r
+        {\r
+            this.DisplayName = VideoProfileFactory.GetDisplayName(displayName);\r
+            this.ShortName = shortName;\r
+        }\r
+\r
+        /// <summary>\r
+        /// Gets or sets the display name.\r
+        /// </summary>\r
+        public string DisplayName { get; set; }\r
+\r
+        /// <summary>\r
+        /// Gets or sets the short name.\r
+        /// </summary>\r
+        public string ShortName { get; set; }\r
+\r
+        /// <summary>\r
+        /// The clone.\r
+        /// </summary>\r
+        /// <returns>\r
+        /// The <see cref="VideoProfile"/>.\r
+        /// </returns>\r
+        public VideoProfile Clone()\r
+        {\r
+            return new VideoProfile(this.DisplayName, this.ShortName);\r
+        }\r
+\r
+        /// <summary>\r
+        /// The equals.\r
+        /// </summary>\r
+        /// <param name="other">\r
+        /// The other.\r
+        /// </param>\r
+        /// <returns>\r
+        /// The <see cref="bool"/>.\r
+        /// </returns>\r
+        protected bool Equals(VideoProfile other)\r
+        {\r
+            return string.Equals(this.DisplayName, other.DisplayName) && string.Equals(this.ShortName, other.ShortName);\r
+        }\r
+\r
+        /// <summary>\r
+        /// The equals.\r
+        /// </summary>\r
+        /// <param name="obj">\r
+        /// The obj.\r
+        /// </param>\r
+        /// <returns>\r
+        /// The <see cref="bool"/>.\r
+        /// </returns>\r
+        public override bool Equals(object obj)\r
+        {\r
+            if (ReferenceEquals(null, obj))\r
+            {\r
+                return false;\r
+            }\r
+            if (ReferenceEquals(this, obj))\r
+            {\r
+                return true;\r
+            }\r
+            if (obj.GetType() != this.GetType())\r
+            {\r
+                return false;\r
+            }\r
+            return Equals((VideoProfile)obj);\r
+        }\r
+\r
+        /// <summary>\r
+        /// The get hash code.\r
+        /// </summary>\r
+        /// <returns>\r
+        /// The <see cref="int"/>.\r
+        /// </returns>\r
+        public override int GetHashCode()\r
+        {\r
+            unchecked\r
+            {\r
+                return ((this.DisplayName != null ? this.DisplayName.GetHashCode() : 0) * 397) ^ (this.ShortName != null ? this.ShortName.GetHashCode() : 0);\r
+            }\r
+        }\r
+    }\r
+}\r
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 (file)
index 0000000..b749933
--- /dev/null
@@ -0,0 +1,137 @@
+// --------------------------------------------------------------------------------------------------------------------\r
+// <copyright file="VideoTune.cs" company="HandBrake Project (http://handbrake.fr)">\r
+//   This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.\r
+// </copyright>\r
+// <summary>\r
+//   The video tune.\r
+// </summary>\r
+// --------------------------------------------------------------------------------------------------------------------\r
+\r
+namespace HandBrake.ApplicationServices.Services.Encode.Model.Models.Video\r
+{\r
+    using HandBrake.ApplicationServices.Services.Encode.Factories;\r
+\r
+    /// <summary>\r
+    /// The video tune.\r
+    /// </summary>\r
+    public class VideoTune\r
+    {\r
+        /// <summary>\r
+        /// Static object to represent "None" \r
+        /// </summary>\r
+        public static VideoTune None = new VideoTune("None", "none");\r
+\r
+        /// <summary>\r
+        /// Static object to represent "None" \r
+        /// </summary>\r
+        public static VideoTune FastDecode = new VideoTune("Fast Decode", "fastdecode");\r
+\r
+        /// <summary>\r
+        /// Initializes a new instance of the <see cref="VideoTune"/> class.\r
+        /// </summary>\r
+        public VideoTune()\r
+        {\r
+        }\r
+\r
+        /// <summary>\r
+        /// Initializes a new instance of the <see cref="VideoTune"/> class.\r
+        /// </summary>\r
+        /// <param name="displayName">\r
+        /// The display name.\r
+        /// </param>\r
+        /// <param name="shortName">\r
+        /// The short name.\r
+        /// </param>\r
+        public VideoTune(string displayName, string shortName)\r
+        {\r
+            this.DisplayName = VideoTuneFactory.GetDisplayName(displayName);\r
+            this.ShortName = shortName;\r
+        }\r
+\r
+        /// <summary>\r
+        /// Gets or sets the display name.\r
+        /// </summary>\r
+        public string DisplayName { get; set; }\r
+\r
+        /// <summary>\r
+        /// Gets or sets the short name.\r
+        /// </summary>\r
+        public string ShortName { get; set; }\r
+\r
+        /// <summary>\r
+        /// The clone.\r
+        /// </summary>\r
+        /// <returns>\r
+        /// The <see cref="VideoProfile"/>.\r
+        /// </returns>\r
+        public VideoTune Clone()\r
+        {\r
+            return new VideoTune(this.DisplayName, this.ShortName);\r
+        }\r
+\r
+        /// <summary>\r
+        /// The equals.\r
+        /// </summary>\r
+        /// <param name="other">\r
+        /// The other.\r
+        /// </param>\r
+        /// <returns>\r
+        /// The <see cref="bool"/>.\r
+        /// </returns>\r
+        protected bool Equals(VideoProfile other)\r
+        {\r
+            return string.Equals(this.DisplayName, other.DisplayName) && string.Equals(this.ShortName, other.ShortName);\r
+        }\r
+\r
+        /// <summary>\r
+        /// The equals.\r
+        /// </summary>\r
+        /// <param name="other">\r
+        /// The other.\r
+        /// </param>\r
+        /// <returns>\r
+        /// The <see cref="bool"/>.\r
+        /// </returns>\r
+        protected bool Equals(VideoTune other)\r
+        {\r
+            return string.Equals(this.ShortName, other.ShortName);\r
+        }\r
+\r
+        /// <summary>\r
+        /// The equals.\r
+        /// </summary>\r
+        /// <param name="obj">\r
+        /// The obj.\r
+        /// </param>\r
+        /// <returns>\r
+        /// The <see cref="bool"/>.\r
+        /// </returns>\r
+        public override bool Equals(object obj)\r
+        {\r
+            if (ReferenceEquals(null, obj))\r
+            {\r
+                return false;\r
+            }\r
+            if (ReferenceEquals(this, obj))\r
+            {\r
+                return true;\r
+            }\r
+            if (obj.GetType() != this.GetType())\r
+            {\r
+                return false;\r
+            }\r
+            return Equals((VideoTune)obj);\r
+        }\r
+\r
+        /// <summary>\r
+        /// The get hash code.\r
+        /// </summary>\r
+        /// <returns>\r
+        /// The <see cref="int"/>.\r
+        /// </returns>\r
+        public override int GetHashCode()\r
+        {\r
+            return (this.ShortName != null ? this.ShortName.GetHashCode() : 0);\r
+        }\r
+    }\r
+}\r
index d3fd4b6e5033d411ab3b01ddd72b4bc1b4fc647a..3bb040052fbf56dfd465253a0bf6602394ad0577 100644 (file)
@@ -14,8 +14,6 @@ namespace HandBrake.ApplicationServices.Utilities
 \r
     using HandBrake.ApplicationServices.Services.Encode.Model.Models;\r
     using HandBrake.Interop.Model.Encoding;\r
-    using HandBrake.Interop.Model.Encoding.x264;\r
-    using HandBrake.Interop.Model.Encoding.x265;\r
 \r
     /// <summary>\r
     /// A class to convert various things to native C# objects\r
@@ -342,192 +340,6 @@ namespace HandBrake.ApplicationServices.Utilities
 \r
         #endregion\r
 \r
-        #region x264\r
-\r
-        /// <summary>\r
-        /// Get the x264Preset from a cli parameter\r
-        /// </summary>\r
-        /// <param name="preset">\r
-        /// The preset.\r
-        /// </param>\r
-        /// <returns>\r
-        /// The x264Preset enum value\r
-        /// </returns>\r
-        public static x264Preset Getx264PresetFromCli(string preset)\r
-        {\r
-            switch (preset)\r
-            {\r
-                case "ultrafast":\r
-                    return x264Preset.Ultrafast;\r
-                case "superfast":\r
-                    return x264Preset.Superfast;\r
-                case "veryfast":\r
-                    return x264Preset.VeryFast;\r
-                case "faster":\r
-                    return x264Preset.Faster;\r
-                case "fast":\r
-                    return x264Preset.Fast;\r
-                case "medium":\r
-                    return x264Preset.Medium;\r
-                case "slow":\r
-                    return x264Preset.Slow;\r
-                case "slower":\r
-                    return x264Preset.Slower;\r
-                case "veryslow":\r
-                    return x264Preset.VerySlow;\r
-                case "placebo":\r
-                    return x264Preset.Placebo;\r
-                default:\r
-                    return x264Preset.Faster;\r
-            }\r
-        }\r
-\r
-        /// <summary>\r
-        /// Get the x264 Profile from the cli\r
-        /// </summary>\r
-        /// <param name="profile">\r
-        /// The preset.\r
-        /// </param>\r
-        /// <returns>\r
-        /// The x264Profile enum value\r
-        /// </returns>\r
-        public static x264Profile Getx264ProfileFromCli(string profile)\r
-        {\r
-            switch (profile)\r
-            {\r
-                case "baseline":\r
-                    return x264Profile.Baseline;\r
-                case "main":\r
-                    return x264Profile.Main;\r
-                case "high":\r
-                    return x264Profile.High;\r
-                default:\r
-                    return x264Profile.Main;\r
-            }\r
-        }\r
-\r
-        /// <summary>\r
-        /// Get x264Tune enum from a cli string\r
-        /// </summary>\r
-        /// <param name="tune">\r
-        /// The tune.\r
-        /// </param>\r
-        /// <returns>\r
-        /// The x264Tune enum value\r
-        /// </returns>\r
-        public static x264Tune Getx264TuneFromCli(string tune)\r
-        {\r
-            switch (tune)\r
-            {\r
-                case "film":\r
-                    return x264Tune.Film;\r
-                case "animation":\r
-                    return x264Tune.Animation;\r
-                case "grain":\r
-                    return x264Tune.Grain;\r
-                case "stillimage":\r
-                    return x264Tune.Stillimage;\r
-                case "psnr":\r
-                    return x264Tune.Psnr;\r
-                case "ssim":\r
-                    return x264Tune.Ssim;\r
-                case "fastdecode":\r
-                    return x264Tune.Fastdecode;\r
-                default:\r
-                    return x264Tune.Film;\r
-            }\r
-        }\r
-\r
-        #endregion\r
-\r
-        #region x265\r
-\r
-        /// <summary>\r
-        /// Get the x265Preset from a cli parameter\r
-        /// </summary>\r
-        /// <param name="preset">\r
-        /// The preset.\r
-        /// </param>\r
-        /// <returns>\r
-        /// The x265Preset enum value\r
-        /// </returns>\r
-        public static x265Preset Getx265PresetFromCli(string preset)\r
-        {\r
-            switch (preset)\r
-            {\r
-                case "ultrafast":\r
-                    return x265Preset.Ultrafast;\r
-                case "superfast":\r
-                    return x265Preset.Superfast;\r
-                case "veryfast":\r
-                    return x265Preset.VeryFast;\r
-                case "faster":\r
-                    return x265Preset.Faster;\r
-                case "fast":\r
-                    return x265Preset.Fast;\r
-                case "medium":\r
-                    return x265Preset.Medium;\r
-                case "slow":\r
-                    return x265Preset.Slow;\r
-                case "slower":\r
-                    return x265Preset.Slower;\r
-                case "veryslow":\r
-                    return x265Preset.VerySlow;\r
-                case "placebo":\r
-                    return x265Preset.Placebo;\r
-                default:\r
-                    return x265Preset.Faster;\r
-            }\r
-        }\r
-\r
-        /// <summary>\r
-        /// Get the x265 Profile from the cli\r
-        /// </summary>\r
-        /// <param name="profile">\r
-        /// The preset.\r
-        /// </param>\r
-        /// <returns>\r
-        /// The x265Profile enum value\r
-        /// </returns>\r
-        public static x265Profile Getx265ProfileFromCli(string profile)\r
-        {\r
-            switch (profile)\r
-            {\r
-                case "mainstillpicture":\r
-                    return x265Profile.Mainstillpicture;\r
-                case "main":\r
-                    return x265Profile.Main;\r
-                case "main10":\r
-                    return x265Profile.Main10;\r
-                default:\r
-                    return x265Profile.Main;\r
-            }\r
-        }\r
-\r
-        /// <summary>\r
-        /// Get x265Tune enum from a cli string\r
-        /// </summary>\r
-        /// <param name="tune">\r
-        /// The tune.\r
-        /// </param>\r
-        /// <returns>\r
-        /// The x265Tune enum value\r
-        /// </returns>\r
-        public static x265Tune Getx265TuneFromCli(string tune)\r
-        {\r
-            switch (tune)\r
-            {\r
-                case "psnr":\r
-                    return x265Tune.psnr;\r
-                case "ssim":\r
-                    return x265Tune.ssim;\r
-                default:\r
-                    return x265Tune.psnr;\r
-            }\r
-        }\r
-\r
-        #endregion\r
-\r
         #region File Format\r
 \r
         /// <summary>\r
index 0f2fa868834bd44a3a9af5c068d7b88ce6a2ca71..8cd9588b800b76cf2fd2dbf1fa70435e71914177 100644 (file)
@@ -18,8 +18,6 @@ namespace HandBrake.ApplicationServices.Utilities
     using HandBrake.ApplicationServices.Services.Encode.Model.Models;\r
     using HandBrake.Interop.Model;\r
     using HandBrake.Interop.Model.Encoding;\r
-    using HandBrake.Interop.Model.Encoding.x264;\r
-    using HandBrake.Interop.Model.Encoding.x265;\r
 \r
     /// <summary>\r
     /// A Utility Class to Convert a \r
@@ -189,44 +187,20 @@ namespace HandBrake.ApplicationServices.Utilities
             job.TwoPass = work.TwoPass;\r
             job.TurboFirstPass = work.TurboFirstPass;\r
 \r
-            if (work.VideoEncoder == VideoEncoder.X264)\r
+            if (work.VideoEncoder == VideoEncoder.X264 || work.VideoEncoder == VideoEncoder.X265 || work.VideoEncoder == VideoEncoder.QuickSync)\r
             {\r
-                job.VideoPreset = work.X264Preset.ToString().ToLower().Replace(" ", string.Empty);\r
-                job.VideoTunes = new List<string>();\r
+                job.VideoPreset = work.VideoPreset.ShortName;\r
+                job.VideoProfile = work.VideoProfile.ShortName; \r
+                job.VideoLevel = work.VideoLevel.ShortName;\r
 \r
-                if (work.X264Tune != x264Tune.None)\r
+                if (work.VideoEncoder != VideoEncoder.QuickSync)\r
                 {\r
-                    job.VideoTunes.Add(work.X264Tune.ToString().ToLower().Replace(" ", string.Empty));\r
-                }\r
-\r
-                if (work.FastDecode)\r
-                {\r
-                    job.VideoTunes.Add("fastdecode");\r
-                }\r
-\r
-                job.VideoProfile = work.H264Profile.ToString().ToLower().Replace(" ", string.Empty); // TODO change these away from strings.\r
-                job.VideoLevel = work.H264Level;\r
-            }\r
-            else if (work.VideoEncoder == VideoEncoder.X265)\r
-            {\r
-                job.VideoPreset = work.X265Preset.ToString().ToLower().Replace(" ", string.Empty);\r
-\r
-                if (work.H265Profile != x265Profile.None)\r
-                {\r
-                    job.VideoProfile = work.H265Profile.ToString().ToLower().Replace(" ", string.Empty);\r
-                }\r
-\r
-                job.VideoTunes = new List<string>();\r
-                if (work.X265Tune != x265Tune.None)\r
-                {\r
-                    job.VideoTunes.Add(work.X265Tune.ToString().ToLower().Replace(" ", string.Empty));\r
-                }\r
-            }\r
-            else if (work.VideoEncoder == VideoEncoder.QuickSync)\r
-            {\r
-                job.VideoPreset = work.QsvPreset.ToString().ToLower().Replace(" ", string.Empty);\r
-                job.VideoProfile = work.H264Profile.ToString().ToLower().Replace(" ", string.Empty);\r
-                job.VideoLevel = work.H264Level;\r
+                    job.VideoTunes = new List<string>();\r
+                    foreach (var item in work.VideoTunes)\r
+                    {\r
+                        job.VideoTunes.Add(item.ShortName);\r
+                    }\r
+                }     \r
             }\r
 \r
             // Chapter Markers\r
index 4c0eddac161629b801f24d0e8a35b0f929bfa0c0..47c29db0a03f2e3d76949f45aa381d4bfb743a82 100644 (file)
@@ -14,13 +14,12 @@ namespace HandBrake.ApplicationServices.Utilities
     using System.Collections.ObjectModel;\r
     using System.Globalization;\r
     using System.IO;\r
+    using System.Linq;\r
 \r
     using HandBrake.ApplicationServices.Model;\r
     using HandBrake.ApplicationServices.Services.Encode.Model;\r
     using HandBrake.ApplicationServices.Services.Encode.Model.Models;\r
     using HandBrake.Interop.Model.Encoding;\r
-    using HandBrake.Interop.Model.Encoding.x264;\r
-    using HandBrake.Interop.Model.Encoding.x265;\r
 \r
     /// <summary>\r
     /// Generate a CLI Query for HandBrakeCLI\r
@@ -942,64 +941,21 @@ namespace HandBrake.ApplicationServices.Utilities
         {\r
             string query = string.Empty;\r
 \r
-            // X264 Only\r
-            if (task.VideoEncoder == VideoEncoder.X264)\r
+            if (task.VideoEncoder == VideoEncoder.X264 || task.VideoEncoder == VideoEncoder.X265 || task.VideoEncoder == VideoEncoder.QuickSync)\r
             {\r
                 if (!task.ShowAdvancedTab)\r
                 {\r
-                    if (task.X264Preset != x264Preset.Medium)\r
-                    {\r
-                        query += string.Format(\r
-                            " --encoder-preset={0} ", task.X264Preset.ToString().ToLower().Replace(" ", string.Empty));\r
-                    }\r
+                    query += string.Format(" --encoder-preset={0} ", task.VideoPreset.ShortName);\r
 \r
-                    if (task.X264Tune != x264Tune.None)\r
+                    string tuneQuery = task.VideoTunes.Aggregate(string.Empty, (current, tune) => string.IsNullOrEmpty(current) ? tune.ShortName : string.Format(",{0}", tune.ShortName));\r
+                    if (!string.IsNullOrEmpty(tuneQuery))\r
                     {\r
-                        string tune = string.Empty;\r
-\r
-                        if (task.FastDecode)\r
-                        {\r
-                            tune = "fastdecode";\r
-                        }\r
-\r
-                        string tuneDropdown = task.X264Tune.ToString().ToLower().Replace(" ", string.Empty);\r
-                        if (task.X264Tune != x264Tune.None && !string.IsNullOrEmpty(tuneDropdown))\r
-                        {\r
-                            tune = string.IsNullOrEmpty(tune) ? tuneDropdown : string.Format(",{0}", tuneDropdown);\r
-                        }\r
-\r
-                        query += string.Format(" --encoder-tune=\"{0}\" ", tune);\r
+                        query += string.Format(" --encoder-tune=\"{0}\" ", tuneQuery);\r
                     }\r
 \r
-                    if (!string.IsNullOrEmpty(task.ExtraAdvancedArguments))\r
-                    {\r
-                        query += string.Format(" -x {0}", task.ExtraAdvancedArguments);\r
-                    }\r
-                }\r
-            }\r
+                    query += string.Format(" --encoder-profile={0} ", task.VideoProfile.ShortName);\r
 \r
-            // X265 Only\r
-            if (task.VideoEncoder == VideoEncoder.X265)\r
-            {\r
-                if (!task.ShowAdvancedTab)\r
-                {\r
-                    if (task.X265Preset != x265Preset.Medium)\r
-                    {\r
-                        query += string.Format(\r
-                            " --encoder-preset={0} ", task.X265Preset.ToString().ToLower().Replace(" ", string.Empty));\r
-                    }\r
-\r
-                    if (task.X265Tune != x265Tune.None)\r
-                    {\r
-                        query += string.Format(\r
-                            " --encoder-tune=\"{0}\" ", task.X265Tune.ToString().ToLower().Replace(" ", string.Empty));\r
-                    }\r
-\r
-                    if (task.H265Profile != x265Profile.None)\r
-                    {\r
-                        query += string.Format(\r
-                            " --encoder-profile={0} ", task.H265Profile.ToString().ToLower().Replace(" ", string.Empty));\r
-                    }\r
+                    query += string.Format(" --encoder-level=\"{0}\" ", task.VideoLevel.ShortName);\r
 \r
                     if (!string.IsNullOrEmpty(task.ExtraAdvancedArguments))\r
                     {\r
@@ -1007,37 +963,18 @@ namespace HandBrake.ApplicationServices.Utilities
                     }\r
                 }\r
             }\r
-\r
-            // QSV Only\r
-            if (task.VideoEncoder == VideoEncoder.QuickSync)\r
+            else if (!task.ShowAdvancedTab && !string.IsNullOrEmpty(task.ExtraAdvancedArguments))\r
             {\r
-                query += string.Format(" --encoder-preset={0}", task.QsvPreset.ToString().ToLower());\r
+                query += string.Format(" -x {0}", task.ExtraAdvancedArguments);\r
             }\r
 \r
+\r
             // options that apply to all encoders\r
-            if (!string.IsNullOrEmpty(task.AdvancedEncoderOptions))\r
+            if (task.ShowAdvancedTab && !string.IsNullOrEmpty(task.AdvancedEncoderOptions))\r
             {\r
                 query += string.Format(" -x {0}", task.AdvancedEncoderOptions);\r
             }\r
 \r
-            // Options that apply to both x264 and QuickSync\r
-            if (task.VideoEncoder == VideoEncoder.QuickSync || task.VideoEncoder == VideoEncoder.X264)\r
-            {\r
-                // when using x264 with the advanced panel, the H.264 profile/level widgets are disabled\r
-                if (!(task.VideoEncoder == VideoEncoder.X264 && task.ShowAdvancedTab))\r
-                {\r
-                    if (task.H264Level != "Auto")\r
-                    {\r
-                        query += string.Format(" --encoder-level=\"{0}\" ", task.H264Level);\r
-                    }\r
-                    if (task.H264Profile != x264Profile.Auto)\r
-                    {\r
-                        query += string.Format(\r
-                            " --encoder-profile={0} ", task.H264Profile.ToString().ToLower().Replace(" ", string.Empty));\r
-                    }\r
-                }\r
-            }\r
-\r
             return query;\r
         }\r
 \r
index c8c79116fe44c3de41ae1469dfd6c7cd6555936f..4955cc3ef78f3a17b4c6e2253be71f90fe87429f 100644 (file)
@@ -18,6 +18,7 @@ namespace HandBrake.ApplicationServices.Utilities
     using HandBrake.ApplicationServices.Model;\r
     using HandBrake.ApplicationServices.Services.Encode.Model;\r
     using HandBrake.ApplicationServices.Services.Encode.Model.Models;\r
+    using HandBrake.ApplicationServices.Services.Encode.Model.Models.Video;\r
     using HandBrake.Interop.Model;\r
     using HandBrake.Interop.Model.Encoding;\r
 \r
@@ -111,15 +112,11 @@ namespace HandBrake.ApplicationServices.Utilities
 \r
             // Advanced Tab\r
             Match advanced = Regex.Match(input, @"-x ([.,/a-zA-Z0-9=:-]*)");\r
-            Match x264Preset = Regex.Match(input, @"--x264-preset([=a-zA-Z0-9\s ]*)");\r
-            Match x264Tune = Regex.Match(input, @"--x264-tune([=,a-zA-Z0-9\s ]*)");\r
-            Match h264Profile = Regex.Match(input, @"--h264-profile([=a-zA-Z0-9\s ]*)");\r
-            Match x264Profile = Regex.Match(input, @"--x264-profile([=a-zA-Z0-9\s ]*)");\r
-            Match h264Level = Regex.Match(input, @"--h264-level([=a-zA-Z0-9.\s ]*)");\r
-\r
-            Match x265Profile = Regex.Match(input, @"--x265-profile([=a-zA-Z0-9\s ]*)");\r
-            Match x265Tune = Regex.Match(input, @"--x265-tune([=,a-zA-Z0-9\s ]*)");\r
-            Match x265Preset = Regex.Match(input, @"--x265-preset([=a-zA-Z0-9\s ]*)");\r
+            Match videoLevel = Regex.Match(input, @"--encoder-level([=a-zA-Z0-9.\s ]*)");\r
+            Match videoProfile = Regex.Match(input, @"--encoder-profile([=a-zA-Z0-9\s ]*)");\r
+            Match videoTune = Regex.Match(input, @"--encoder-tune([=,a-zA-Z0-9\s ]*)");\r
+            Match videoPreset = Regex.Match(input, @"--encoder-preset([=a-zA-Z0-9\s ]*)");\r
+\r
             #endregion\r
 \r
             #region Set Varibles\r
@@ -492,60 +489,39 @@ namespace HandBrake.ApplicationServices.Utilities
                 if (advanced.Success)\r
                     parsed.AdvancedEncoderOptions = advanced.ToString().Replace("-x ", string.Empty);\r
 \r
-                if (x264Preset.Success)\r
-                    parsed.X264Preset =\r
-                        Converters.Getx264PresetFromCli(x264Preset.ToString().Replace("--x264-preset", string.Empty).Replace("=", string.Empty).Trim());\r
-\r
-                if (h264Profile.Success)\r
-                    parsed.H264Profile =\r
-                        Converters.Getx264ProfileFromCli(h264Profile.ToString().Replace("--h264-profile", string.Empty).Replace("=", string.Empty).Trim());\r
-\r
-                if (x264Profile.Success)\r
-                    parsed.H264Profile =\r
-                       Converters.Getx264ProfileFromCli(x264Profile.ToString().Replace("--x264-profile", string.Empty).Replace("=", string.Empty).Trim());\r
-\r
-                if (h264Level.Success)\r
-                    parsed.H264Level =\r
-                        h264Level.ToString().Replace("--h264-level", string.Empty).Replace("=", string.Empty).Trim();\r
-\r
-                if (x264Tune.Success)\r
+                if (videoPreset.Success)\r
                 {\r
-                    string tuneOptions =\r
-                        x264Tune.ToString().Replace("--x264-tune", string.Empty).Replace("=", string.Empty).Trim();\r
-\r
-                    parsed.FastDecode = tuneOptions.Contains("fastdecode");\r
-\r
-                    // Remove these options. They are not in the dropdown.\r
-                    tuneOptions = tuneOptions.Replace("fastdecode", string.Empty).Replace(\r
-                        ",", string.Empty);\r
-\r
-                    parsed.X264Tune = Converters.Getx264TuneFromCli(tuneOptions);\r
+                    string preset = videoPreset.ToString().Replace("--encoder-preset", string.Empty).Replace("=", string.Empty).Trim();\r
+                    parsed.VideoPreset = new VideoPreset(preset, preset);\r
                 }\r
 \r
-                if (x265Preset.Success)\r
-                    parsed.X265Preset =\r
-                        Converters.Getx265PresetFromCli(x265Preset.ToString().Replace("--x265-preset", string.Empty).Replace("=", string.Empty).Trim());\r
-\r
-                if (h264Profile.Success)\r
-                    parsed.H265Profile =\r
-                        Converters.Getx265ProfileFromCli(h264Profile.ToString().Replace("--h265-profile", string.Empty).Replace("=", string.Empty).Trim());\r
+                if (videoProfile.Success)\r
+                {\r
+                    string profile = videoProfile.ToString().Replace("--encoder-profile", string.Empty).Replace("=", string.Empty).Trim();\r
+                    parsed.VideoProfile = new VideoProfile(profile, profile);\r
+                }\r
 \r
-                if (x265Profile.Success)\r
-                    parsed.H265Profile =\r
-                       Converters.Getx265ProfileFromCli(x265Profile.ToString().Replace("--x265-profile", string.Empty).Replace("=", string.Empty).Trim());\r
+                if (videoLevel.Success)\r
+                {\r
+                    string level = videoLevel.ToString().Replace("--encoder-level", string.Empty).Replace("=", string.Empty).Trim();\r
+                    parsed.VideoLevel = new VideoLevel(level, level);\r
+                }\r
 \r
-                if (x265Tune.Success)\r
+                if (videoTune.Success)\r
                 {\r
-                    string tuneOptions =\r
-                        x265Tune.ToString().Replace("--x265-tune", string.Empty).Replace("=", string.Empty).Trim();\r
+                    string tuneOptions = videoTune.ToString().Replace("--encoder-tune", string.Empty).Replace("=", string.Empty).Trim();\r
 \r
-                    parsed.FastDecode = tuneOptions.Contains("fastdecode");\r
+                    if (tuneOptions.Contains("fastdecode"))\r
+                    {\r
+                        parsed.VideoTunes.Add(new VideoTune("fastdecode", "fastdecode"));\r
+                    }                \r
 \r
                     // Remove these options. They are not in the dropdown.\r
-                    tuneOptions = tuneOptions.Replace("fastdecode", string.Empty).Replace(\r
-                        ",", string.Empty);\r
-\r
-                    parsed.X265Tune = Converters.Getx265TuneFromCli(tuneOptions);\r
+                    tuneOptions = tuneOptions.Replace("fastdecode", string.Empty).Replace(",", string.Empty);\r
+                    if (!string.IsNullOrEmpty(tuneOptions.Trim()))\r
+                    {\r
+                        parsed.VideoTunes.Add(new VideoTune(tuneOptions, tuneOptions));\r
+                    }\r
                 }\r
 \r
                 #endregion\r
index 68ba627cb87a1f51b1a169e006fbb05e6f0c3b05..13362040984cd0c7d8192b8a7285b59ca6b94aeb 100644 (file)
     <Compile Include="Json\State\WorkDone.cs" />\r
     <Compile Include="Json\State\Working.cs" />\r
     <Compile Include="Model\Encoding\PictureRotation.cs" />\r
-    <Compile Include="Model\Encoding\x265\x265Preset.cs" />\r
-    <Compile Include="Model\Encoding\x265\x265Profile.cs" />\r
-    <Compile Include="Model\Encoding\x265\x265Tune.cs" />\r
     <Compile Include="Model\Language.cs" />\r
     <Compile Include="HandBrakeLanguagesHelper.cs" />\r
     <Compile Include="EventArgs\MessageLoggedEventArgs.cs" />\r
     <Compile Include="Model\Encoding\Mixdown.cs" />\r
     <Compile Include="Model\Encoding\OutputExtension.cs" />\r
     <Compile Include="Model\Encoding\Container.cs" />\r
-    <Compile Include="Model\Encoding\QsvPreset.cs" />\r
     <Compile Include="Model\Encoding\ScaleMethod.cs" />\r
     <Compile Include="Model\Encoding\VideoEncoder.cs" />\r
     <Compile Include="Model\Encoding\VideoEncodeRateType.cs" />\r
-    <Compile Include="Model\Encoding\x264\x264Preset.cs" />\r
-    <Compile Include="Model\Encoding\x264\x264Profile.cs" />\r
-    <Compile Include="Model\Encoding\x264\x264Tune.cs" />\r
     <Compile Include="Model\BitrateLimits.cs" />\r
     <Compile Include="Model\RangeLimits.cs" />\r
     <Compile Include="Model\Size.cs" />\r
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 (file)
index 08147a5..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-// --------------------------------------------------------------------------------------------------------------------\r
-// <copyright file="QsvPreset.cs" company="HandBrake Project (http://handbrake.fr)">\r
-//   This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.\r
-// </copyright>\r
-// <summary>\r
-//   The qsv preset.\r
-// </summary>\r
-// --------------------------------------------------------------------------------------------------------------------\r
-\r
-namespace HandBrake.Interop.Model.Encoding\r
-{\r
-    using System.ComponentModel.DataAnnotations;\r
-\r
-    /// <summary>\r
-    /// The qsv preset.\r
-    /// </summary>\r
-    public enum QsvPreset\r
-    {\r
-        [Display(Name = "Best Speed")]\r
-        Speed,\r
-\r
-        [Display(Name = "Balanced")]\r
-        Balanced,\r
-\r
-        [Display(Name = "Best Quality")]\r
-        Quality,\r
-    }\r
-}\r
index 36c228d7753bb6181106177c26b9b68bec445f7d..e961cace26cea47dd2ac95854b3f767c1422ffcc 100644 (file)
@@ -23,6 +23,7 @@ namespace HandBrake.Interop.Model.Encoding
                X264 = 0,\r
 \r
         [Display(Name = "H.264 (Intel QSV)")]\r
+        [ShortName("qsv_h264")]\r
         QuickSync,\r
 \r
                [Display(Name = "MPEG-4")]\r
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 (file)
index f68c293..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-// --------------------------------------------------------------------------------------------------------------------\r
-// <copyright file="x264Preset.cs" company="HandBrake Project (http://handbrake.fr)">\r
-//   This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.\r
-// </copyright>\r
-// <summary>\r
-//   Defines the x264Preset type.\r
-// </summary>\r
-// --------------------------------------------------------------------------------------------------------------------\r
-\r
-namespace HandBrake.Interop.Model.Encoding.x264\r
-{\r
-    using System.ComponentModel.DataAnnotations;\r
-\r
-    /// <summary>\r
-    /// The X264 Preset\r
-    /// </summary>\r
-    public enum x264Preset\r
-    {\r
-        [Display(Name = "Ultrafast")]\r
-        Ultrafast,\r
-\r
-        [Display(Name = "Super Fast")]\r
-        Superfast,\r
-\r
-        [Display(Name = "Very Fast")]\r
-        VeryFast,\r
-\r
-        [Display(Name = "Faster")]\r
-        Faster,\r
-\r
-        [Display(Name = "Fast")]\r
-        Fast,\r
-\r
-        [Display(Name = "Medium")]\r
-        Medium,\r
-\r
-        [Display(Name = "Slow")]\r
-        Slow,\r
-\r
-        [Display(Name = "Slower")]\r
-        Slower,\r
-\r
-        [Display(Name = "Very Slow")]\r
-        VerySlow,\r
-\r
-        [Display(Name = "Placebo")]\r
-        Placebo,\r
-    }\r
-}\r
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 (file)
index d1c1fac..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-// --------------------------------------------------------------------------------------------------------------------\r
-// <copyright file="x264Profile.cs" company="HandBrake Project (http://handbrake.fr)">\r
-//   This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.\r
-// </copyright>\r
-// <summary>\r
-//   The X264 Profile\r
-// </summary>\r
-// --------------------------------------------------------------------------------------------------------------------\r
-\r
-namespace HandBrake.Interop.Model.Encoding.x264\r
-{\r
-    using System.ComponentModel.DataAnnotations;\r
-\r
-    /// <summary>\r
-    /// The X264 Profile\r
-    /// </summary>\r
-    public enum x264Profile\r
-    {\r
-        [Display(Name = "Auto")]\r
-        Auto = 0,\r
-\r
-        [Display(Name = "Baseline")]\r
-        Baseline,\r
-\r
-        [Display(Name = "Main")]\r
-        Main,\r
-\r
-        [Display(Name = "High")]\r
-        High\r
-    }\r
-}\r
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 (file)
index 1ae23c4..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-// --------------------------------------------------------------------------------------------------------------------\r
-// <copyright file="x264Tune.cs" company="HandBrake Project (http://handbrake.fr)">\r
-//   This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.\r
-// </copyright>\r
-// <summary>\r
-//   Defines the x264Tune type.\r
-// </summary>\r
-// --------------------------------------------------------------------------------------------------------------------\r
-\r
-namespace HandBrake.Interop.Model.Encoding.x264\r
-{\r
-    using System.ComponentModel.DataAnnotations;\r
-\r
-    /// <summary>\r
-    /// The X264 Tune MOdel\r
-    /// </summary>\r
-    public enum x264Tune\r
-    {\r
-        [Display(Name = "None")]\r
-        None = 0,\r
-\r
-        [Display(Name = "Film")]\r
-        Film,\r
-\r
-        [Display(Name = "Animation")]\r
-        Animation,\r
-\r
-        [Display(Name = "Grain")]\r
-        Grain,\r
-\r
-        [Display(Name = "Still Image")]\r
-        Stillimage,\r
-\r
-        [Display(Name = "PSNR")]\r
-        Psnr,\r
-\r
-        [Display(Name = "SSIM")]\r
-        Ssim,\r
-\r
-        [Display(Name = "Fast Decode")]\r
-        Fastdecode,\r
-    }\r
-}\r
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 (file)
index f8ec669..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-// --------------------------------------------------------------------------------------------------------------------\r
-// <copyright file="x265Preset.cs" company="HandBrake Project (http://handbrake.fr)">\r
-//   This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.\r
-// </copyright>\r
-// <summary>\r
-//   Defines the x265Preset type.\r
-// </summary>\r
-// --------------------------------------------------------------------------------------------------------------------\r
-\r
-namespace HandBrake.Interop.Model.Encoding.x265\r
-{\r
-    using System.ComponentModel.DataAnnotations;\r
-\r
-    /// <summary>\r
-    /// The X265 Preset\r
-    /// </summary>\r
-    public enum x265Preset\r
-    {\r
-        [Display(Name = "Ultrafast")]\r
-        Ultrafast,\r
-\r
-        [Display(Name = "Super Fast")]\r
-        Superfast,\r
-\r
-        [Display(Name = "Very Fast")]\r
-        VeryFast,\r
-\r
-        [Display(Name = "Faster")]\r
-        Faster,\r
-\r
-        [Display(Name = "Fast")]\r
-        Fast,\r
-\r
-        [Display(Name = "Medium")]\r
-        Medium,\r
-\r
-        [Display(Name = "Slow")]\r
-        Slow,\r
-\r
-        [Display(Name = "Slower")]\r
-        Slower,\r
-\r
-        [Display(Name = "Very Slow")]\r
-        VerySlow,\r
-\r
-        [Display(Name = "Placebo")]\r
-        Placebo,\r
-    }\r
-}
\ 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 (file)
index 8d3aab3..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-// --------------------------------------------------------------------------------------------------------------------\r
-// <copyright file="x265Profile.cs" company="HandBrake Project (http://handbrake.fr)">\r
-//   This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.\r
-// </copyright>\r
-// <summary>\r
-//   The X265 Profile\r
-// </summary>\r
-// --------------------------------------------------------------------------------------------------------------------\r
-\r
-namespace HandBrake.Interop.Model.Encoding.x265\r
-{\r
-    using System.ComponentModel.DataAnnotations;\r
-\r
-    /// <summary>\r
-    /// The X265 Profile\r
-    /// </summary>\r
-    public enum x265Profile\r
-    {\r
-        [Display(Name = "Auto")]\r
-        None = 0,\r
-\r
-        [Display(Name = "Main")]\r
-        Main,\r
-\r
-        [Display(Name = "Main10")]\r
-        Main10,\r
-\r
-        [Display(Name = "Mainstillpicture")]\r
-        Mainstillpicture,\r
-    }\r
-}
\ 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 (file)
index edbcbff..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-// --------------------------------------------------------------------------------------------------------------------\r
-// <copyright file="x265Tune.cs" company="HandBrake Project (http://handbrake.fr)">\r
-//   This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.\r
-// </copyright>\r
-// <summary>\r
-//   Defines the x265Tune type.\r
-// </summary>\r
-// --------------------------------------------------------------------------------------------------------------------\r
-\r
-namespace HandBrake.Interop.Model.Encoding.x265\r
-{\r
-    using System.ComponentModel.DataAnnotations;\r
-\r
-    /// <summary>\r
-    /// The X265 Tune MOdel\r
-    /// </summary>\r
-    public enum x265Tune\r
-    {\r
-        [Display(Name = "None")]\r
-        None = 0,\r
-\r
-        [Display(Name = "PSNR")]\r
-        psnr,\r
-\r
-        [Display(Name = "SSIM")]\r
-        ssim,\r
-\r
-        [Display(Name = "Zero Latency")]\r
-        zerolatency,\r
-\r
-        [Display(Name = "Fast Decode")]\r
-        fastdecode,\r
-\r
-    }\r
-}
\ No newline at end of file
index b488470e28d5617a4e5b6d4d227e2f3b280774c5..a0f2c78ed7d2554aff3bc17c691ddc8932ef553a 100644 (file)
@@ -18,7 +18,6 @@ namespace HandBrakeWPF.Converters
     using HandBrake.ApplicationServices.Services.Encode.Model.Models;\r
     using HandBrake.ApplicationServices.Utilities;\r
     using HandBrake.Interop.Model.Encoding;\r
-    using HandBrake.Interop.Model.Encoding.x264;\r
 \r
     using PresetPictureSettingsMode = HandBrakeWPF.Model.Picture.PresetPictureSettingsMode;\r
 \r
@@ -47,19 +46,12 @@ namespace HandBrakeWPF.Converters
         /// </returns>\r
         public object Convert(object value, Type targetType, object parameter, CultureInfo culture)\r
         {\r
-            // Lists\r
-            if (value is IEnumerable<x264Preset>)\r
-            {\r
-                return EnumHelper<x264Preset>.GetEnumDisplayValues(typeof(x264Preset));\r
-            }\r
-            if (value is IEnumerable<x264Profile>)\r
+            if (value == null)\r
             {\r
-                return EnumHelper<x264Profile>.GetEnumDisplayValues(typeof(x264Profile));\r
-            }\r
-            if (value is IEnumerable<x264Tune>)\r
-            {\r
-                return EnumHelper<x264Tune>.GetEnumDisplayValues(typeof(x264Tune));\r
+                return null;\r
             }\r
+\r
+            // Lists\r
             if (value is IEnumerable<VideoEncoder>)\r
             {\r
                 return EnumHelper<VideoEncoder>.GetEnumDisplayValues(typeof(VideoEncoder));\r
@@ -68,10 +60,6 @@ namespace HandBrakeWPF.Converters
             {\r
                 return EnumHelper<Mixdown>.GetEnumDisplayValues(typeof(Mixdown));\r
             }\r
-            if (targetType == typeof(QsvPreset) || value.GetType() == typeof(QsvPreset))\r
-            {\r
-                return EnumHelper<QsvPreset>.GetDisplay((QsvPreset)value);\r
-            }\r
             if (value is IEnumerable<PresetPictureSettingsMode>)\r
             {\r
                 return EnumHelper<PresetPictureSettingsMode>.GetEnumDisplayValues(typeof(PresetPictureSettingsMode));\r
@@ -102,18 +90,6 @@ namespace HandBrakeWPF.Converters
             }\r
 \r
             // Single Items\r
-            if (targetType == typeof(x264Preset) || value.GetType() == typeof(x264Preset))\r
-            {\r
-                return EnumHelper<x264Preset>.GetDisplay((x264Preset)value);\r
-            }\r
-            if (targetType == typeof(x264Profile) || value.GetType() == typeof(x264Profile))\r
-            {\r
-                return EnumHelper<x264Profile>.GetDisplay((x264Profile)value);\r
-            }\r
-            if (targetType == typeof(x264Tune) || value.GetType() == typeof(x264Tune))\r
-            {\r
-                return EnumHelper<x264Tune>.GetDisplay((x264Tune)value);\r
-            }\r
             if (targetType == typeof(VideoEncoder) || value.GetType() == typeof(VideoEncoder))\r
             {\r
                 return EnumHelper<VideoEncoder>.GetDisplay((VideoEncoder)value);\r
@@ -184,18 +160,6 @@ namespace HandBrakeWPF.Converters
         /// </exception>\r
         public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)\r
         {\r
-            if (targetType == typeof(x264Preset) || value.GetType() == typeof(x264Preset))\r
-            {\r
-                return EnumHelper<x264Preset>.GetValue(value.ToString());\r
-            }\r
-            if (targetType == typeof(x264Profile) || value.GetType() == typeof(x264Profile))\r
-            {\r
-                return EnumHelper<x264Profile>.GetValue(value.ToString());\r
-            }\r
-            if (targetType == typeof(x264Tune) || value.GetType() == typeof(x264Tune))\r
-            {\r
-                return EnumHelper<x264Tune>.GetValue(value.ToString());\r
-            }\r
             if (targetType == typeof(VideoEncoder) || value.GetType() == typeof(VideoEncoder))\r
             {\r
                 return EnumHelper<VideoEncoder>.GetValue(value.ToString());\r
@@ -204,10 +168,6 @@ namespace HandBrakeWPF.Converters
             {\r
                 return EnumHelper<Mixdown>.GetValue(value.ToString());\r
             }\r
-            if (targetType == typeof(QsvPreset) || value.GetType() == typeof(QsvPreset))\r
-            {\r
-                return EnumHelper<QsvPreset>.GetValue(value.ToString());\r
-            }\r
             if (targetType == typeof(PresetPictureSettingsMode) || value.GetType() == typeof(PresetPictureSettingsMode))\r
             {\r
                 return EnumHelper<PresetPictureSettingsMode>.GetValue(value.ToString());\r
index 18b246510b76697019b20c4484b08c6f19d7a793..a67fc9ad82014ea76eb955ef54ba875671622041 100644 (file)
@@ -13,11 +13,8 @@ namespace HandBrakeWPF.Converters.Video
     using System.Globalization;\r
     using System.Windows.Data;\r
 \r
-    using HandBrake.ApplicationServices.Model;\r
     using HandBrake.ApplicationServices.Services.Encode.Model;\r
-    using HandBrake.ApplicationServices.Utilities;\r
     using HandBrake.Interop.Model.Encoding;\r
-    using HandBrake.Interop.Model.Encoding.x264;\r
 \r
     /// <summary>\r
     /// The x 264 queue tooltip converter.\r
@@ -41,13 +38,13 @@ namespace HandBrakeWPF.Converters.Video
                     return task.AdvancedEncoderOptions;\r
                 }\r
 \r
-                return string.Format("Preset: {0}{5}Tune: {1}{5}Profile: {2}{5}Level: {3}{5}Extra Arguments: {4}{5}", \r
-                    EnumHelper<x264Preset>.GetDisplay(task.X264Preset),\r
-                    EnumHelper<x264Tune>.GetDisplay(task.X264Tune),\r
-                    task.H264Profile,\r
-                    task.H264Level, \r
-                    string.IsNullOrEmpty(task.ExtraAdvancedArguments) ? "None" : task.ExtraAdvancedArguments,\r
-                    Environment.NewLine);\r
+                //return string.Format("Preset: {0}{5}Tune: {1}{5}Profile: {2}{5}Level: {3}{5}Extra Arguments: {4}{5}", \r
+                //    EnumHelper<x264Preset>.GetDisplay(task.X264Preset),\r
+                //    EnumHelper<x264Tune>.GetDisplay(task.X264Tune),\r
+                //    task.H264Profile,\r
+                //    task.H264Level, \r
+                //    string.IsNullOrEmpty(task.ExtraAdvancedArguments) ? "None" : task.ExtraAdvancedArguments,\r
+                //    Environment.NewLine);\r
             }\r
 \r
             return task != null ? task.AdvancedEncoderOptions.Trim() : string.Empty;\r
index 45ceaacca7f4383434d5a6d1ef211c5dd2767e69..0edf6b02f8f9a6c1cffa5bca4343a33ff3fc24cc 100644 (file)
@@ -1,31 +1,31 @@
 < Devices\r
 \r
-   + 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\r
+   + 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\r
 \r
-   + 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\r
+   + 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\r
 \r
-   + 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\r
+   + 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\r
 \r
-   + 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\r
+   + 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\r
 \r
-   + 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\r
+   + 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\r
 \r
-   + 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\r
+   + 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\r
 \r
-   + 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\r
+   + 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\r
 \r
-   + 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\r
+   + 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\r
 \r
-   + 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\r
+   + 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\r
 \r
-   + 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\r
+   + 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\r
 \r
 >\r
 \r
 < Regular\r
 \r
-   + 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\r
+   + 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\r
 \r
-   + 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\r
+   + 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\r
 \r
->\r
+>
\ No newline at end of file
index 5cd4db14884852ba5a068fd6d9b1c0352397fc5b..5892978cd23c2590ca42bedfba129978e01d2ccc 100644 (file)
@@ -1,5 +1,5 @@
 // --------------------------------------------------------------------------------------------------------------------\r
-// <copyright file="PlistUtility.cs" company="HandBrake Project (http://handbrake.fr)">\r
+// <copyright file="PlistFactory.cs" company="HandBrake Project (http://handbrake.fr)">\r
 //   This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.\r
 // </copyright>\r
 // <summary>\r
@@ -9,10 +9,10 @@
 \r
 namespace HandBrakeWPF.Services.Presets.Factories\r
 {\r
+    using System.Linq;\r
     using System.Text;\r
     using System.Xml;\r
 \r
-    using HandBrake.ApplicationServices.Model;\r
     using HandBrake.ApplicationServices.Services.Encode.Model;\r
     using HandBrake.ApplicationServices.Services.Encode.Model.Models;\r
     using HandBrake.ApplicationServices.Utilities;\r
@@ -23,7 +23,7 @@ namespace HandBrakeWPF.Services.Presets.Factories
     /// <summary>\r
     /// Plist Preset Converter\r
     /// </summary>\r
-    public class PlistUtility\r
+    public class PlistFactory\r
     {\r
         #region Export\r
 \r
@@ -199,21 +199,19 @@ namespace HandBrakeWPF.Services.Presets.Factories
             AddEncodeElement(xmlWriter, "VideoFramerateMode", "string", parsed.FramerateMode.ToString().ToLower());\r
             AddBooleanElement(xmlWriter, "VideoGrayScale", parsed.Grayscale);\r
             AddEncodeElement(xmlWriter, "VideoQualitySlider", "real", parsed.Quality.ToString());\r
-            AddEncodeElement(xmlWriter, "h264Level", "string", parsed.H264Level);\r
-            AddEncodeElement(xmlWriter, "x264OptionExtra", "string", parsed.AdvancedEncoderOptions);\r
-            AddEncodeElement(xmlWriter, "x264Preset", "string", parsed.X264Preset.ToString().ToLower());\r
-            AddEncodeElement(xmlWriter, "h264Profile", "string", parsed.H264Profile.ToString().ToLower());\r
-            string tune = parsed.X264Tune.ToString().ToLower();\r
-            if (parsed.FastDecode)\r
-            {\r
-                tune = tune == "none" ? "fastdecode" : tune + ",fastdecode";\r
-            }\r
-            AddEncodeElement(xmlWriter, "x264Tune", "string", tune);\r
+\r
+            if (parsed.VideoPreset != null)\r
+                AddEncodeElement(xmlWriter, "VideoPreset", "string", parsed.VideoPreset.ShortName);\r
+            if (parsed.VideoLevel != null)\r
+                AddEncodeElement(xmlWriter, "VideoLevel", "string", parsed.VideoLevel.ShortName);\r
+            if (parsed.VideoProfile != null)\r
+                AddEncodeElement(xmlWriter, "VideoProfile", "string", parsed.VideoProfile.ShortName);\r
+            if (parsed.VideoTunes != null)\r
+                AddEncodeElement(xmlWriter, "VideoTune", "string",  parsed.VideoTunes.Aggregate(string.Empty, (current, item) => string.IsNullOrEmpty(current) ? item.ShortName : "," + item.ShortName));\r
+\r
+            AddEncodeElement(xmlWriter, "VideoOptionExtra", "string", parsed.ExtraAdvancedArguments);\r
             AddEncodeElement(xmlWriter, "x264UseAdvancedOptions", "integer", parsed.ShowAdvancedTab ? "1" : "0");\r
 \r
-            AddEncodeElement(xmlWriter, "h265Profile", "string", parsed.H265Profile.ToString().ToLower());\r
-            AddEncodeElement(xmlWriter, "x265Preset", "string", parsed.X265Preset.ToString().ToLower());\r
-            AddEncodeElement(xmlWriter, "x265Tune", "string", parsed.X265Tune.ToString().ToLower());\r
 \r
             int videoQualityType = 0;\r
             if (parsed.VideoBitrate != null) videoQualityType = 1;\r
index 7a6e336e8275ba7c2bea10d322c429466254468b..a98e63e6dfcc1fc4b19e939e469da7f0fc78d36b 100644 (file)
@@ -15,13 +15,11 @@ namespace HandBrakeWPF.Services.Presets.Factories
     using System.Globalization;\r
     using System.Linq;\r
 \r
-    using HandBrake.ApplicationServices.Model;\r
     using HandBrake.ApplicationServices.Services.Encode.Model;\r
     using HandBrake.ApplicationServices.Services.Encode.Model.Models;\r
+    using HandBrake.ApplicationServices.Services.Encode.Model.Models.Video;\r
     using HandBrake.ApplicationServices.Utilities;\r
     using HandBrake.Interop.Model.Encoding;\r
-    using HandBrake.Interop.Model.Encoding.x264;\r
-    using HandBrake.Interop.Model.Encoding.x265;\r
 \r
     using HandBrakeWPF.Model.Audio;\r
     using HandBrakeWPF.Model.Subtitles;\r
@@ -249,38 +247,25 @@ namespace HandBrakeWPF.Services.Presets.Factories
                 case "VideoTwoPass":\r
                     preset.Task.TwoPass = kvp.Value == 1;\r
                     break;\r
-                case "x264OptionExtra":\r
-                    preset.Task.AdvancedEncoderOptions = kvp.Value;\r
+\r
+                case "VideoOptionExtra":\r
+                    preset.Task.ExtraAdvancedArguments = kvp.Value;\r
                     break;\r
-                case "x264Preset":\r
-                    preset.Task.X264Preset = EnumHelper<x264Preset>.GetValue(kvp.Value, true);\r
+                case "VideoLevel":\r
+                    preset.Task.VideoLevel = new VideoLevel(kvp.Value, kvp.Value);\r
                     break;\r
-                case "h264Profile":\r
-                    preset.Task.H264Profile = EnumHelper<x264Profile>.GetValue(kvp.Value, true);\r
+                case "VideoProfile":\r
+                    preset.Task.VideoProfile = new VideoProfile(kvp.Value, kvp.Value);\r
                     break;\r
-                case "x264Tune":\r
-                    string value = kvp.Value;\r
-                    if (value.Contains("fastdecode"))\r
+                case "VideoPreset":\r
+                    preset.Task.VideoPreset = new VideoPreset(kvp.Value, kvp.Value);\r
+                    break;\r
+                case "VideoTune":\r
+                    string[] split = kvp.Value.ToString().Split(',');\r
+                    foreach (var item in split)\r
                     {\r
-                        preset.Task.FastDecode = true;\r
-                        value = value.Replace("fastdecode", string.Empty).Replace(",", string.Empty);\r
+                        preset.Task.VideoTunes.Add(new VideoTune(item, item));\r
                     }\r
-                    preset.Task.X264Tune = EnumHelper<x264Tune>.GetValue(value, true);\r
-                    break;\r
-                case "h264Level":\r
-                    preset.Task.H264Level = kvp.Value;\r
-                    break;\r
-                case "QsvPreset":\r
-                    preset.Task.QsvPreset = EnumHelper<QsvPreset>.GetValue(kvp.Value, true);\r
-                    break;\r
-                case "h265Profile":\r
-                    preset.Task.H265Profile = EnumHelper<x265Profile>.GetValue(kvp.Value, true);\r
-                    break;\r
-                case "x265Tune":\r
-                    preset.Task.X265Tune = EnumHelper<x265Tune>.GetValue(kvp.Value, true);\r
-                    break;\r
-                case "x265Preset":\r
-                    preset.Task.X265Preset = EnumHelper<x265Preset>.GetValue(kvp.Value, true);\r
                     break;\r
 \r
                 // Chapter Markers Tab\r
@@ -288,21 +273,13 @@ namespace HandBrakeWPF.Services.Presets.Factories
                     preset.Task.IncludeChapterMarkers = kvp.Value == true;\r
                     break;\r
 \r
-                // Advanced x264 tab\r
+                // Advanced tab\r
                 case "x264Option":\r
-                    if (preset.Task.VideoEncoder == VideoEncoder.X264) // TODO Temp fix until a better solution is found.\r
-                    {\r
-                        preset.Task.AdvancedEncoderOptions = kvp.Value;\r
-                    }\r
-                    break;\r
-\r
                 case "lavcOption":\r
-                    if (preset.Task.VideoEncoder != VideoEncoder.X264) // TODO Temp fix until a better solution is found.\r
-                    {\r
-                        preset.Task.AdvancedEncoderOptions = kvp.Value;\r
-                    }\r
+                    preset.Task.AdvancedEncoderOptions = kvp.Value;\r
                     break;\r
 \r
+\r
                 // Preset Information\r
                 case "PresetBuildNumber":\r
                     preset.Version = kvp.Value;\r
index e1b3d0e4deb729e990f17364742ccc6cbeea8247..1ea596ef783f1c0ba47c4341c59b3aed77999cd7 100644 (file)
@@ -11,7 +11,6 @@ namespace HandBrakeWPF.Services.Presets.Model
 {\r
     using Caliburn.Micro;\r
 \r
-    using HandBrake.ApplicationServices.Model;\r
     using HandBrake.ApplicationServices.Services.Encode.Model;\r
 \r
     using HandBrakeWPF.Model.Audio;\r
index be7e4afdcf32cadf738a4f19f6a21d5628c85c7c..f84f88b67c915db2cd16e1a9d5ee8a75b7688ea4 100644 (file)
@@ -9,8 +9,20 @@
 \r
 namespace HandBrakeWPF.Services.Presets.Model\r
 {\r
+    /// <summary>\r
+    /// The preset container.\r
+    /// </summary>\r
     public class PresetContainer\r
     {\r
+        /// <summary>\r
+        /// Initializes a new instance of the <see cref="PresetContainer"/> class.\r
+        /// </summary>\r
+        /// <param name="version">\r
+        /// The version.\r
+        /// </param>\r
+        /// <param name="presets">\r
+        /// The presets.\r
+        /// </param>\r
         public PresetContainer(int version, string presets)\r
         {\r
             Version = version;\r
index be8357f6877d4261d186ccde25128f3e9576f48c..cb9e161b28c83d287fff79d364f9358fe43bc038 100644 (file)
@@ -18,7 +18,6 @@ namespace HandBrakeWPF.Services.Presets
     using System.Text;\r
     using System.Text.RegularExpressions;\r
     using System.Windows;\r
-    using System.Windows.Forms;\r
     using System.Xml.Serialization;\r
 \r
     using HandBrake.ApplicationServices.Exceptions;\r
@@ -38,7 +37,7 @@ namespace HandBrakeWPF.Services.Presets
     {\r
         #region Private Variables\r
 \r
-        private static readonly int CurrentPresetVersion = 1;\r
+        private static readonly int CurrentPresetVersion = 2;\r
 \r
         /// <summary>\r
         /// XML Serializer\r
@@ -310,12 +309,12 @@ namespace HandBrakeWPF.Services.Presets
 \r
                             Preset newPreset = new Preset\r
                             {\r
-                                Category = category,\r
-                                Name = presetName[0].Replace("+", string.Empty).Trim(),\r
-                                Version = VersionHelper.GetVersion(),\r
+                                Category = category, \r
+                                Name = presetName[0].Replace("+", string.Empty).Trim(), \r
+                                Version = VersionHelper.GetVersion(), \r
                                 Description = string.Empty, // Maybe one day we will populate this.\r
-                                IsBuildIn = true,\r
-                                UsePictureFilters = true,\r
+                                IsBuildIn = true, \r
+                                UsePictureFilters = true, \r
                                 Task = QueryParserUtility.Parse(presetName[2])\r
                             };\r
 \r
@@ -374,8 +373,12 @@ namespace HandBrakeWPF.Services.Presets
         /// <summary>\r
         /// Check if the preset "name" exists in either Presets or UserPresets lists.\r
         /// </summary>\r
-        /// <param name="name">Name of the preset</param>\r
-        /// <returns>True if found</returns>\r
+        /// <param name="name">\r
+        /// Name of the preset\r
+        /// </param>\r
+        /// <returns>\r
+        /// True if found\r
+        /// </returns>\r
         public bool CheckIfPresetExists(string name)\r
         {\r
             return name == string.Empty || this.presets.Any(item => item.Name == name);\r
@@ -453,6 +456,7 @@ namespace HandBrakeWPF.Services.Presets
                         foreach (Preset preset in list)\r
                         {\r
                             preset.IsBuildIn = true;\r
+\r
                             // Older versions did not have this flag so explicitly make sure it is set.\r
                             this.presets.Add(preset);\r
                         }\r
@@ -519,9 +523,9 @@ namespace HandBrakeWPF.Services.Presets
                         string fileName = RecoverFromCorruptedPresetFile(this.userPresetFile);\r
                         this.errorService.ShowMessageBox(\r
                             "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."\r
-                            + Environment.NewLine + Environment.NewLine + "Archived File: " + fileName,\r
-                            "Unable to load user presets.",\r
-                            MessageBoxButton.OK,\r
+                            + Environment.NewLine + Environment.NewLine + "Archived File: " + fileName, \r
+                            "Unable to load user presets.", \r
+                            MessageBoxButton.OK, \r
                             MessageBoxImage.Exclamation);\r
                         return;\r
                     }\r
index b2605e7903be75b3dedddf6f8f9d5b4086d41791..8ece8c41a5903fb7ef7f3e32ba6853d90daaf3a1 100644 (file)
@@ -21,9 +21,7 @@ namespace HandBrakeWPF.Startup
     using Castle.Windsor;\r
 \r
     using HandBrake.ApplicationServices;\r
-    using HandBrake.ApplicationServices.Services;\r
     using HandBrake.ApplicationServices.Services.Encode.Interfaces;\r
-    using HandBrake.ApplicationServices.Services.Interfaces;\r
     using HandBrake.ApplicationServices.Services.Scan;\r
     using HandBrake.ApplicationServices.Services.Scan.Interfaces;\r
 \r
index 523f07312776ac806381617c4d2bf463fd344034..48bf428f9d9356f827ec434312d2701c40627b56 100644 (file)
@@ -1746,7 +1746,7 @@ namespace HandBrakeWPF.ViewModels
 \r
                 if (!string.IsNullOrEmpty(filename))\r
                 {\r
-                    PlistUtility.Export(\r
+                    PlistFactory.Export(\r
                         savefiledialog.FileName,\r
                         this.selectedPreset,\r
                         HandBrakeUtils.Build.ToString(CultureInfo.InvariantCulture));\r
index 7060530effc446d0fcd6e6da30a9b52717c8ca95..9fe599fc20bbcda78b65a8b15ad6dc0dd83be610 100644 (file)
@@ -14,19 +14,17 @@ namespace HandBrakeWPF.ViewModels
     using System.ComponentModel;\r
     using System.Globalization;\r
     using System.Linq;\r
-    using System.Windows;\r
 \r
     using Caliburn.Micro;\r
 \r
-    using HandBrake.ApplicationServices.Model;\r
+    using HandBrake.ApplicationServices.EventArgs;\r
     using HandBrake.ApplicationServices.Services.Encode.Model;\r
     using HandBrake.ApplicationServices.Services.Encode.Model.Models;\r
+    using HandBrake.ApplicationServices.Services.Encode.Model.Models.Video;\r
     using HandBrake.ApplicationServices.Services.Scan.Model;\r
     using HandBrake.ApplicationServices.Utilities;\r
     using HandBrake.Interop;\r
     using HandBrake.Interop.Model.Encoding;\r
-    using HandBrake.Interop.Model.Encoding.x264;\r
-    using HandBrake.Interop.Model.Encoding.x265;\r
 \r
     using HandBrakeWPF.Commands.Interfaces;\r
     using HandBrakeWPF.Properties;\r
@@ -34,112 +32,37 @@ namespace HandBrakeWPF.ViewModels
     using HandBrakeWPF.Services.Presets.Model;\r
     using HandBrakeWPF.ViewModels.Interfaces;\r
 \r
+    using Clipboard = System.Windows.Clipboard;\r
+\r
     /// <summary>\r
     /// The Video View Model\r
     /// </summary>\r
     public class VideoViewModel : ViewModelBase, IVideoViewModel\r
     {\r
         /*\r
-         * TODO\r
-         * 1. Refactor the Video Encoder Preset/Tune/Level options to be generic instead of encoder specific.\r
-         * 2. Model the UI Interactions in a better way.\r
-         */\r
+         * Hard Code "None" in the Models for Tune.\r
+         * Test Everything         */\r
 \r
         #region Constants and Fields\r
-        /// <summary>\r
-        /// Same as source constant.\r
-        /// </summary>\r
-        private const string SameAsSource = "Same as source";\r
-\r
-        /// <summary>\r
-        /// The possible h264 levels.\r
-        /// </summary>\r
-        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" };\r
 \r
-        /// <summary>\r
-        /// Backing field for the user setting service.\r
-        /// </summary>\r
+        private const string SameAsSource = "Same as source";\r
         private readonly IUserSettingService userSettingService;\r
-\r
-        /// <summary>\r
-        /// The advanced encoder options command\r
-        /// </summary>\r
         private readonly IAdvancedEncoderOptionsCommand advancedEncoderOptionsCommand;\r
 \r
-        /// <summary>\r
-        /// Backing field used to display / hide the x264 options\r
-        /// </summary>\r
-        private bool displayX264Options;\r
-\r
-        /// <summary>\r
-        /// Backing field used to display / hide the x265 options\r
-        /// </summary>\r
-        private bool displayX265Options;\r
-\r
-        /// <summary>\r
-        /// The display qsv options.\r
-        /// </summary>\r
-        private bool displayQSVOptions;\r
-\r
-        /// <summary>\r
-        /// Backing field used to display / hide the h264 options\r
-        /// </summary>\r
-        private bool displayEncoderOptions;\r
-\r
-        /// <summary>\r
-        /// The quality max.\r
-        /// </summary>\r
+        private bool displayOptimiseOptions;\r
         private int qualityMax;\r
-\r
-        /// <summary>\r
-        /// The quality min.\r
-        /// </summary>\r
         private int qualityMin;\r
-\r
-        /// <summary>\r
-        /// The show peak framerate.\r
-        /// </summary>\r
         private bool showPeakFramerate;\r
-\r
-        /// <summary>\r
-        /// The show peak framerate.\r
-        /// </summary>\r
         private int rf;\r
-\r
-        /// <summary>\r
-        /// The x264 preset value.\r
-        /// </summary>\r
-        private int x264PresetValue;\r
-\r
-        /// <summary>\r
-        /// The qsv preset value.\r
-        /// </summary>\r
-        private int qsvPresetValue;\r
-\r
-        /// <summary>\r
-        /// The can clear tracker.\r
-        /// </summary>\r
         private bool canClear;\r
-\r
-        /// <summary>\r
-        /// The use advanced tab.\r
-        /// </summary>\r
         private bool useAdvancedTab;\r
-\r
-        /// <summary>\r
-        /// The display framerate controls.\r
-        /// </summary>\r
-        private bool displayNonQSVControls;\r
-\r
-        /// <summary>\r
-        /// The x265 preset value.\r
-        /// </summary>\r
-        private int x265PresetValue;\r
-\r
-        /// <summary>\r
-        /// The display turbo first pass.\r
-        /// </summary>\r
         private bool displayTurboFirstPass;\r
+        private int videoPresetMaxValue;\r
+        private int? videoPresetValue;\r
+        private bool displayNonQsvControls;\r
+        private VideoTune videoTune;\r
+        private bool fastDecode;\r
+        private bool displayTuneControls;\r
 \r
         #endregion\r
 \r
@@ -164,15 +87,10 @@ namespace HandBrakeWPF.ViewModels
             this.IsConstantQuantity = true;\r
             this.VideoEncoders = EnumHelper<VideoEncoder>.GetEnumList();\r
 \r
-            X264Presets = new BindingList<x264Preset>(EnumHelper<x264Preset>.GetEnumList().ToList());\r
-            QsvPresets = new BindingList<QsvPreset>(EnumHelper<QsvPreset>.GetEnumList().ToList());\r
-            H264Profiles = EnumHelper<x264Profile>.GetEnumList();\r
-            X264Tunes = EnumHelper<x264Tune>.GetEnumList().Where(t => t != x264Tune.Fastdecode);\r
-            this.H264Levels = Levels;\r
-\r
-            X265Presets = new BindingList<x265Preset>(EnumHelper<x265Preset>.GetEnumList().ToList());\r
-            H265Profiles = EnumHelper<x265Profile>.GetEnumList();\r
-            X265Tunes = EnumHelper<x265Tune>.GetEnumList();\r
+            this.VideoProfiles = new BindingList<VideoProfile>();\r
+            this.VideoTunes = new BindingList<VideoTune>();\r
+            this.VideoPresets = new BindingList<VideoPreset>();\r
+            this.VideoLevels = new BindingList<VideoLevel>();\r
 \r
             this.userSettingService.SettingChanged += this.UserSettingServiceSettingChanged;\r
         }\r
@@ -219,7 +137,7 @@ namespace HandBrakeWPF.ViewModels
             }\r
             set\r
             {\r
-                if (!object.Equals(value, this.useAdvancedTab))\r
+                if (!Equals(value, this.useAdvancedTab))\r
                 {\r
                     // Set the Advanced Tab up with the current settings, if we can.\r
                     if (value)\r
@@ -560,38 +478,7 @@ namespace HandBrakeWPF.ViewModels
             {\r
                 this.Task.VideoEncoder = value;\r
                 this.NotifyOfPropertyChange(() => this.SelectedVideoEncoder);\r
-\r
-                // Tell the Advanced Panel off the change\r
-                IAdvancedViewModel advancedViewModel = IoC.Get<IAdvancedViewModel>();\r
-                advancedViewModel.SetEncoder(this.Task.VideoEncoder);\r
-\r
-                // Update the Quality Slider. Make sure the bounds are up to date with the users settings.\r
-                this.SetQualitySliderBounds();\r
-\r
-                // Hide the x264 controls when not needed.\r
-                this.DisplayX264Options = value == VideoEncoder.X264;\r
-\r
-                // Hide the x265 controls when not needed.\r
-                this.DisplayX265Options = value == VideoEncoder.X265;\r
-\r
-                this.DisplayQSVOptions = value == VideoEncoder.QuickSync;\r
-                this.DisplayH264Options = value == VideoEncoder.X264 || value == VideoEncoder.QuickSync;\r
-                this.UseAdvancedTab = value != VideoEncoder.QuickSync && this.UseAdvancedTab;\r
-                this.DisplayNonQSVControls = value != VideoEncoder.QuickSync;\r
-                this.DisplayTurboFirstPass = value == VideoEncoder.X264; \r
-\r
-                this.NotifyOfPropertyChange(() => this.Rfqp);\r
-                this.NotifyOfPropertyChange(() => this.ShowAdvancedTab);\r
-\r
-                this.NotifyOfPropertyChange(() => this.HighQualityLabel);\r
-                if (value == VideoEncoder.QuickSync)\r
-                {\r
-                    this.IsConstantFramerate = true;\r
-                    this.TwoPass = false;\r
-                    this.TurboFirstPass = false;\r
-                    this.Task.Framerate = null;\r
-                    this.NotifyOfPropertyChange(() => SelectedFramerate);\r
-                }\r
+                HandleEncoderChange(this.Task.VideoEncoder);\r
             }\r
         }\r
 \r
@@ -627,7 +514,7 @@ namespace HandBrakeWPF.ViewModels
             }\r
             set\r
             {\r
-                if (!object.Equals(this.Task.ExtraAdvancedArguments, value))\r
+                if (!Equals(this.Task.ExtraAdvancedArguments, value))\r
                 {\r
                     this.Task.ExtraAdvancedArguments = value;\r
                     this.NotifyOfPropertyChange(() => this.ExtraArguments);\r
@@ -639,276 +526,245 @@ namespace HandBrakeWPF.ViewModels
         /// <summary>\r
         /// Gets or sets a value indicating whether to display H264\r
         /// </summary>\r
-        public bool DisplayH264Options\r
+        public bool DisplayOptimiseOptions\r
         {\r
             get\r
             {\r
-                return this.displayEncoderOptions;\r
+                return this.displayOptimiseOptions;\r
             }\r
             set\r
             {\r
-                this.displayEncoderOptions = value;\r
-                this.NotifyOfPropertyChange(() => this.DisplayH264Options);\r
-            }\r
-        }\r
-\r
-        /// <summary>\r
-        /// Gets or sets a value indicating whether display x 264 options.\r
-        /// </summary>\r
-        public bool DisplayX264Options\r
-        {\r
-            get\r
-            {\r
-                return this.displayX264Options;\r
-            }\r
-            set\r
-            {\r
-                this.displayX264Options = value;\r
-                this.NotifyOfPropertyChange(() => this.DisplayX264Options);\r
-                this.NotifyOfPropertyChange(() => FullOptionsTooltip);\r
-            }\r
-        }\r
-\r
-        /// <summary>\r
-        /// Gets or sets a value indicating whether display x 264 options.\r
-        /// </summary>\r
-        public bool DisplayX265Options\r
-        {\r
-            get\r
-            {\r
-                return this.displayX265Options;\r
-            }\r
-            set\r
-            {\r
-                this.displayX265Options = value;\r
-                this.NotifyOfPropertyChange(() => this.DisplayX265Options);\r
+                this.displayOptimiseOptions = value;\r
+                this.NotifyOfPropertyChange(() => this.DisplayOptimiseOptions);\r
                 this.NotifyOfPropertyChange(() => FullOptionsTooltip);\r
             }\r
         }\r
 \r
         /// <summary>\r
-        /// Gets or sets a value indicating whether to display qsv options.\r
-        /// </summary>\r
-        public bool DisplayQSVOptions\r
-        {\r
-            get\r
-            {\r
-                return this.displayQSVOptions;\r
-            }\r
-            set\r
-            {\r
-                this.displayQSVOptions = value;\r
-                this.NotifyOfPropertyChange(() => this.DisplayQSVOptions);\r
-            }\r
-        }\r
-\r
-        /// <summary>\r
-        /// Gets or sets a value indicating whether display framerate controls.\r
+        /// Gets or sets a value indicating whether display non qsv controls.\r
         /// </summary>\r
         public bool DisplayNonQSVControls\r
+\r
         {\r
             get\r
             {\r
-                return this.displayNonQSVControls;\r
+                return this.displayNonQsvControls;\r
             }\r
-\r
             set\r
             {\r
-                this.displayNonQSVControls = value;\r
+                if (value.Equals(this.displayNonQsvControls))\r
+                {\r
+                    return;\r
+                }\r
+                this.displayNonQsvControls = value;\r
                 this.NotifyOfPropertyChange(() => this.DisplayNonQSVControls);\r
             }\r
         }\r
 \r
         /// <summary>\r
-        /// Gets or sets the x 264 preset value.\r
+        /// Gets or sets a value indicating whether display tune controls.\r
         /// </summary>\r
-        public int X264PresetValue\r
+        public bool DisplayTuneControls\r
         {\r
             get\r
             {\r
-                return this.x264PresetValue;\r
+                return this.displayTuneControls;\r
             }\r
             set\r
             {\r
-                if (!object.Equals(this.X264PresetValue, value))\r
+                if (value.Equals(this.displayTuneControls))\r
                 {\r
-                    this.x264PresetValue = value;\r
-                    this.X264Preset = this.X264Presets[value];\r
-                    this.NotifyOfPropertyChange(() => this.x264PresetValue);\r
-                    this.NotifyOfPropertyChange(() => FullOptionsTooltip);\r
+                    return;\r
                 }\r
+                this.displayTuneControls = value;\r
+                this.NotifyOfPropertyChange(() => this.DisplayTuneControls);\r
             }\r
         }\r
 \r
         /// <summary>\r
-        /// Gets or sets X264Preset.\r
+        /// Gets or sets a value indicating whether fast decode.\r
         /// </summary>\r
-        public x264Preset X264Preset\r
+        public bool FastDecode\r
         {\r
             get\r
             {\r
-                return this.Task.X264Preset;\r
+                return this.fastDecode;\r
             }\r
             set\r
             {\r
-                if (!object.Equals(this.X264Preset, value))\r
+                if (value.Equals(this.fastDecode))\r
                 {\r
-                    this.Task.X264Preset = value;\r
-                    this.NotifyOfPropertyChange(() => this.X264Preset);\r
-                    ResetAdvancedTab();\r
-                    this.NotifyOfPropertyChange(() => FullOptionsTooltip);\r
+                    return;\r
+                }\r
+                this.fastDecode = value;\r
+                this.NotifyOfPropertyChange(() => this.FastDecode);\r
+                this.NotifyOfPropertyChange(() => FullOptionsTooltip);\r
+                ResetAdvancedTab();\r
+\r
+                // Update the encode task\r
+                if (value && !this.Task.VideoTunes.Contains(VideoTune.FastDecode))\r
+                {\r
+                    this.Task.VideoTunes.Add(VideoTune.FastDecode);\r
                 }\r
+                else\r
+                {\r
+                    this.Task.VideoTunes.Remove(VideoTune.FastDecode);\r
+                }          \r
             }\r
         }\r
 \r
         /// <summary>\r
-        /// Gets or sets X264Preset.\r
+        /// Gets or sets the video preset.\r
         /// </summary>\r
-        public QsvPreset QsvPreset\r
+        public VideoPreset VideoPreset\r
         {\r
             get\r
             {\r
-                return this.Task.QsvPreset;\r
+                return this.Task.VideoPreset;\r
             }\r
             set\r
             {\r
-                if (!object.Equals(this.QsvPreset, value))\r
-                {\r
-                    this.Task.QsvPreset = value;\r
-                    this.NotifyOfPropertyChange(() => this.QsvPreset);\r
-                }\r
+                this.Task.VideoPreset = value;\r
+                this.NotifyOfPropertyChange(() => this.VideoPreset);\r
+                this.NotifyOfPropertyChange(() => FullOptionsTooltip);\r
+                ResetAdvancedTab();\r
             }\r
         }\r
 \r
         /// <summary>\r
-        /// Gets or sets the x 264 preset value.\r
+        /// Gets or sets the video preset value.\r
         /// </summary>\r
-        public int QsvPresetValue\r
+        public int? VideoPresetValue\r
         {\r
             get\r
             {\r
-                return this.qsvPresetValue;\r
+                return this.videoPresetValue;\r
             }\r
             set\r
             {\r
-                if (!object.Equals(this.QsvPresetValue, value))\r
+                this.videoPresetValue = value;\r
+\r
+                HBVideoEncoder encoder = HandBrakeEncoderHelpers.VideoEncoders.FirstOrDefault(s => s.ShortName == EnumHelper<VideoEncoder>.GetShortName(this.SelectedVideoEncoder));\r
+                if (encoder != null && value.HasValue)\r
                 {\r
-                    this.qsvPresetValue = value;\r
-                    this.QsvPreset = this.QsvPresets[value];\r
-                    this.NotifyOfPropertyChange(() => this.QsvPresetValue);\r
+                    string preset = encoder.Presets[value.Value];\r
+                    this.VideoPreset = new VideoPreset(preset, preset);\r
                 }\r
+\r
+                this.NotifyOfPropertyChange(() => this.VideoPresetValue);\r
             }\r
         }\r
 \r
         /// <summary>\r
-        /// Gets or sets H264Profile.\r
+        /// Gets or sets the video preset max value.\r
         /// </summary>\r
-        public x264Profile H264Profile\r
+        public int VideoPresetMaxValue\r
         {\r
             get\r
             {\r
-                return this.Task.H264Profile;\r
+                return this.videoPresetMaxValue;\r
             }\r
 \r
             set\r
             {\r
-                if (!object.Equals(this.H264Profile, value))\r
+                if (value == this.videoPresetMaxValue)\r
                 {\r
-                    this.Task.H264Profile = value;\r
-                    this.NotifyOfPropertyChange(() => this.H264Profile);\r
-                    ResetAdvancedTab();\r
-                    this.NotifyOfPropertyChange(() => FullOptionsTooltip);\r
+                    return;\r
                 }\r
+                this.videoPresetMaxValue = value;\r
+                this.NotifyOfPropertyChange(() => this.VideoPresetMaxValue);\r
             }\r
         }\r
 \r
         /// <summary>\r
-        /// Gets or sets H264Profile.\r
+        /// Gets or sets the video tune.\r
         /// </summary>\r
-        public string H264Level\r
+        public VideoTune VideoTune\r
         {\r
             get\r
             {\r
-                return this.Task.H264Level;\r
+                return this.videoTune;\r
             }\r
             set\r
             {\r
-                if (!object.Equals(this.H264Level, value))\r
+                if (Equals(value, this.videoTune))\r
                 {\r
-                    this.Task.H264Level = value;\r
-                    this.NotifyOfPropertyChange(() => this.H264Level);\r
-                    ResetAdvancedTab();\r
-                    this.NotifyOfPropertyChange(() => FullOptionsTooltip);\r
+                    return;\r
+                }\r
+                this.videoTune = value;\r
+                this.NotifyOfPropertyChange(() => this.VideoTune);\r
+                this.NotifyOfPropertyChange(() => FullOptionsTooltip);\r
+                ResetAdvancedTab();\r
+\r
+                // Update the encode task.\r
+                this.Task.VideoTunes.Clear();\r
+                if (value != null && !Equals(value, VideoTune.None))\r
+                {\r
+                    this.Task.VideoTunes.Add(value);\r
+                }\r
+\r
+                if (this.FastDecode)\r
+                {\r
+                    this.Task.VideoTunes.Add(VideoTune.FastDecode);\r
                 }\r
             }\r
         }\r
 \r
         /// <summary>\r
-        /// Gets or sets X264Tune.\r
+        /// Gets or sets the video profile.\r
         /// </summary>\r
-        public x264Tune X264Tune\r
+        public VideoProfile VideoProfile\r
         {\r
             get\r
             {\r
-                return this.Task.X264Tune;\r
+                return this.Task.VideoProfile;\r
             }\r
             set\r
             {\r
-                if (!object.Equals(this.X264Tune, value))\r
-                {\r
-                    this.Task.X264Tune = value;\r
-                    this.NotifyOfPropertyChange(() => this.X264Tune);\r
-                    ResetAdvancedTab();\r
-                    this.NotifyOfPropertyChange(() => FullOptionsTooltip);\r
-                }\r
+                this.Task.VideoProfile = value;\r
+                this.NotifyOfPropertyChange(() => this.VideoProfile);\r
+                this.NotifyOfPropertyChange(() => FullOptionsTooltip);\r
+                ResetAdvancedTab();\r
             }\r
         }\r
 \r
         /// <summary>\r
-        /// Gets or sets a value indicating whether fast decode.\r
+        /// Gets or sets the video level.\r
         /// </summary>\r
-        public bool FastDecode\r
+        public VideoLevel VideoLevel\r
         {\r
             get\r
             {\r
-                return this.Task.FastDecode;\r
+                return this.Task.VideoLevel;\r
             }\r
             set\r
             {\r
-                if (!object.Equals(this.FastDecode, value))\r
-                {\r
-                    this.Task.FastDecode = value;\r
-                    this.NotifyOfPropertyChange(() => this.FastDecode);\r
-                    ResetAdvancedTab();\r
-                    this.NotifyOfPropertyChange(() => FullOptionsTooltip);\r
-                }\r
+                this.Task.VideoLevel = value;\r
+                this.NotifyOfPropertyChange(() => this.VideoLevel);\r
+                this.NotifyOfPropertyChange(() => FullOptionsTooltip);\r
+                ResetAdvancedTab();\r
             }\r
         }\r
 \r
         /// <summary>\r
-        /// Gets or sets X264Presets.\r
+        /// Gets or sets the video presets.\r
         /// </summary>\r
-        public BindingList<x264Preset> X264Presets { get; set; }\r
+        public BindingList<VideoPreset> VideoPresets { get; set; }\r
 \r
         /// <summary>\r
-        /// Gets or sets QsvPreset.\r
+        /// Gets or sets the video tunes.\r
         /// </summary>\r
-        public BindingList<QsvPreset> QsvPresets { get; set; }\r
+        public BindingList<VideoTune> VideoTunes { get; set; }\r
 \r
         /// <summary>\r
-        /// Gets or sets X264Profiles.\r
+        /// Gets or sets the video profiles.\r
         /// </summary>\r
-        public IEnumerable<x264Profile> H264Profiles { get; set; }\r
+        public BindingList<VideoProfile> VideoProfiles { get; set; }\r
 \r
         /// <summary>\r
-        /// Gets or sets X264Tunes.\r
+        /// Gets or sets the video levels.\r
         /// </summary>\r
-        public IEnumerable<x264Tune> X264Tunes { get; set; }\r
-\r
-        /// <summary>\r
-        /// Gets or sets the x 264 levels.\r
-        /// </summary>\r
-        public IEnumerable<string> H264Levels { get; set; }\r
+        public BindingList<VideoLevel> VideoLevels { get; set; }\r
 \r
         /// <summary>\r
         /// Gets the full options tooltip.\r
@@ -921,117 +777,6 @@ namespace HandBrakeWPF.ViewModels
             }\r
         }\r
 \r
-        /// <summary>\r
-        /// Gets the qsv slider max.\r
-        /// </summary>\r
-        public int QsvSliderMax\r
-        {\r
-            get\r
-            {\r
-                return SystemInfo.IsHswOrNewer ? 2 : 1;\r
-            }\r
-        }\r
-\r
-        /// <summary>\r
-        /// Gets or sets the x 265 preset value.\r
-        /// </summary>\r
-        public int X265PresetValue\r
-        {\r
-            get\r
-            {\r
-                return this.x265PresetValue;\r
-            }\r
-            set\r
-            {\r
-                if (!object.Equals(this.X265PresetValue, value))\r
-                {\r
-                    this.x265PresetValue = value;\r
-                    this.X265Preset = this.X265Presets[value];\r
-                    this.NotifyOfPropertyChange(() => this.x265PresetValue);\r
-                    this.NotifyOfPropertyChange(() => FullOptionsTooltip);\r
-                }\r
-            }\r
-        }\r
-\r
-        /// <summary>\r
-        /// Gets or sets X265Preset.\r
-        /// </summary>\r
-        public x265Preset X265Preset\r
-        {\r
-            get\r
-            {\r
-                return this.Task.X265Preset;\r
-            }\r
-            set\r
-            {\r
-                if (!object.Equals(this.X265Preset, value))\r
-                {\r
-                    this.Task.X265Preset = value;\r
-                    this.NotifyOfPropertyChange(() => this.X265Preset);\r
-                    ResetAdvancedTab();\r
-                    this.NotifyOfPropertyChange(() => FullOptionsTooltip);\r
-                }\r
-            }\r
-        }\r
-\r
-        /// <summary>\r
-        /// Gets or sets H265Profile.\r
-        /// </summary>\r
-        public x265Profile H265Profile\r
-        {\r
-            get\r
-            {\r
-                return this.Task.H265Profile;\r
-            }\r
-\r
-            set\r
-            {\r
-                if (!object.Equals(this.H265Profile, value))\r
-                {\r
-                    this.Task.H265Profile = value;\r
-                    this.NotifyOfPropertyChange(() => this.H265Profile);\r
-                    ResetAdvancedTab();\r
-                    this.NotifyOfPropertyChange(() => FullOptionsTooltip);\r
-                }\r
-            }\r
-        }\r
-\r
-        /// <summary>\r
-        /// Gets or sets X265Tune.\r
-        /// </summary>\r
-        public x265Tune X265Tune\r
-        {\r
-            get\r
-            {\r
-                return this.Task.X265Tune;\r
-            }\r
-            set\r
-            {\r
-                if (!object.Equals(this.X265Tune, value))\r
-                {\r
-                    this.Task.X265Tune = value;\r
-                    this.NotifyOfPropertyChange(() => this.X265Tune);\r
-                    ResetAdvancedTab();\r
-                    this.NotifyOfPropertyChange(() => FullOptionsTooltip);\r
-                }\r
-            }\r
-        }\r
-\r
-        /// <summary>\r
-        /// Gets or sets X265Presets.\r
-        /// </summary>\r
-        public BindingList<x265Preset> X265Presets { get; set; }\r
-\r
-        /// <summary>\r
-        /// Gets or sets X265Profiles.\r
-        /// </summary>\r
-        public IEnumerable<x265Profile> H265Profiles { get; set; }\r
-\r
-        /// <summary>\r
-        /// Gets or sets X265Tunes.\r
-        /// </summary>\r
-        public IEnumerable<x265Tune> X265Tunes { get; set; }\r
-\r
         /// <summary>\r
         /// Gets or sets a value indicating whether display turbo first pass.\r
         /// </summary>\r
@@ -1123,60 +868,22 @@ namespace HandBrakeWPF.ViewModels
 \r
             if (preset.Task != null)\r
             {\r
-                this.SetEncoder(preset.Task.VideoEncoder);\r
-\r
-                // applies to both x264 and QSV\r
-                if (preset.Task.VideoEncoder == VideoEncoder.X264 ||\r
-                    preset.Task.VideoEncoder == VideoEncoder.QuickSync)\r
-                {\r
-                    this.H264Profile = preset.Task.H264Profile;\r
-                    this.H264Level = preset.Task.H264Level;\r
-                }\r
-                else\r
-                {\r
-                    this.H264Profile = x264Profile.Auto;\r
-                    this.H264Level = "Auto";\r
-                }\r
-\r
-                // x264 Only\r
-                if (preset.Task.VideoEncoder == VideoEncoder.X264)\r
-                {\r
-                    this.X264PresetValue = (int)preset.Task.X264Preset;\r
-                    this.X264Tune = preset.Task.X264Tune;\r
-                    this.FastDecode = preset.Task.FastDecode;\r
-                }\r
-                else\r
-                {\r
-                    this.X264PresetValue = (int)x264Preset.Medium;\r
-                    this.X264Tune = x264Tune.None;\r
-                    this.FastDecode = false;\r
-                }\r
+                this.HandleEncoderChange(preset.Task.VideoEncoder);\r
 \r
-                // x265 Only\r
-                if (preset.Task.VideoEncoder == VideoEncoder.X265)\r
+                HBVideoEncoder encoder = HandBrakeEncoderHelpers.VideoEncoders.FirstOrDefault(s => s.ShortName == EnumHelper<VideoEncoder>.GetShortName(preset.Task.VideoEncoder));\r
+                if (encoder != null)\r
                 {\r
-                    this.X265PresetValue = (int)preset.Task.X265Preset;\r
-                    this.X265Tune = preset.Task.X265Tune;\r
-                    this.H265Profile = preset.Task.H265Profile;\r
-                }\r
-                else\r
-                {\r
-                    this.X265PresetValue = (int)x265Preset.VeryFast;\r
-                    this.X265Tune = x265Tune.None;\r
-                    this.H265Profile = x265Profile.None;\r
+                    if (preset.Task.VideoEncoder == VideoEncoder.X264 || preset.Task.VideoEncoder == VideoEncoder.X265 || preset.Task.VideoEncoder == VideoEncoder.QuickSync)\r
+                    {\r
+                        this.VideoLevel = preset.Task.VideoLevel != null ? preset.Task.VideoLevel.Clone() : this.VideoLevels.FirstOrDefault();\r
+                        this.VideoProfile = preset.Task.VideoProfile != null ? preset.Task.VideoProfile.Clone() : this.VideoProfiles.FirstOrDefault();\r
+                        this.VideoPresetValue = preset.Task.VideoPreset != null ? this.VideoPresets.IndexOf(preset.Task.VideoPreset) : 0;\r
+                        this.FastDecode = preset.Task.VideoTunes != null && preset.Task.VideoTunes.Contains(VideoTune.FastDecode);\r
+                        this.VideoTune = preset.Task.VideoTunes != null ? preset.Task.VideoTunes.FirstOrDefault(t => !Equals(t, VideoTune.FastDecode)) : this.VideoTunes.FirstOrDefault();\r
+                    }\r
                 }\r
 \r
-                // QSV Only\r
-                if (preset.Task.VideoEncoder == VideoEncoder.QuickSync)\r
-                {\r
-                    this.QsvPresetValue = (int)preset.Task.QsvPreset;\r
-                }\r
-                else\r
-                {\r
-                    this.QsvPresetValue = SystemInfo.IsHswOrNewer\r
-                                              ? (int)QsvPreset.Quality\r
-                                              : (int)QsvPreset.Balanced;\r
-                }\r
+                // TODO Hide Controls.\r
 \r
                 this.ExtraArguments = preset.Task.ExtraAdvancedArguments;\r
                 this.UseAdvancedTab = !string.IsNullOrEmpty(preset.Task.AdvancedEncoderOptions) && this.ShowAdvancedTab;\r
@@ -1210,37 +917,12 @@ namespace HandBrakeWPF.ViewModels
             this.NotifyOfPropertyChange(() => this.Task.TwoPass);\r
             this.NotifyOfPropertyChange(() => this.Task.TurboFirstPass);\r
 \r
-            this.NotifyOfPropertyChange(() => this.X264Tune);\r
-            this.NotifyOfPropertyChange(() => this.X264Preset);\r
-            this.NotifyOfPropertyChange(() => this.H264Level);\r
-            this.NotifyOfPropertyChange(() => this.H264Profile);\r
+            this.NotifyOfPropertyChange(() => this.VideoTune);\r
+            this.NotifyOfPropertyChange(() => this.VideoProfile);\r
+            this.NotifyOfPropertyChange(() => this.VideoProfile);\r
+            this.NotifyOfPropertyChange(() => this.VideoLevel);\r
             this.NotifyOfPropertyChange(() => this.FastDecode);\r
             this.NotifyOfPropertyChange(() => this.ExtraArguments);\r
-            this.NotifyOfPropertyChange(() => this.QsvPreset);\r
-\r
-            this.NotifyOfPropertyChange(() => this.H265Profile);\r
-            this.NotifyOfPropertyChange(() => this.X265Preset);\r
-            this.NotifyOfPropertyChange(() => this.X265Tune);\r
-        }\r
-\r
-        /// <summary>\r
-        /// Set the currently selected encoder.\r
-        /// </summary>\r
-        /// <param name="encoder">\r
-        /// The Video Encoder.\r
-        /// </param>\r
-        public void SetEncoder(VideoEncoder encoder)\r
-        {\r
-            this.DisplayH264Options = encoder == VideoEncoder.X264 || encoder == VideoEncoder.QuickSync;\r
-            this.DisplayX264Options = encoder == VideoEncoder.X264;\r
-            this.DisplayQSVOptions = encoder == VideoEncoder.QuickSync;\r
-            this.DisplayX265Options = encoder == VideoEncoder.X265;\r
-            this.DisplayTurboFirstPass = encoder == VideoEncoder.X264;\r
-\r
-            if (encoder == VideoEncoder.QuickSync)\r
-            {\r
-                this.UseAdvancedTab = false;\r
-            }\r
         }\r
 \r
         /// <summary>\r
@@ -1262,17 +944,15 @@ namespace HandBrakeWPF.ViewModels
         public void ClearAdvancedSettings()\r
         {\r
             this.canClear = false;\r
-            this.X264PresetValue = 5;\r
-            this.X264Tune = x264Tune.None;\r
-            this.H264Profile = x264Profile.Auto;\r
             this.FastDecode = false;\r
-            this.H264Level = "Auto";\r
+            this.VideoTune = null;\r
+            this.VideoProfile = new VideoProfile("auto", "auto");\r
+            this.VideoPreset = null;\r
+            this.VideoPresetValue = 1;\r
+            this.VideoLevel = new VideoLevel("auto", "auto");\r
+\r
             this.ExtraArguments = string.Empty;\r
             this.canClear = true;\r
-\r
-            this.H265Profile = x265Profile.None;\r
-            this.x265PresetValue = 1;\r
-            this.X265Tune = x265Tune.None;\r
         }\r
 \r
         /// <summary>\r
@@ -1340,13 +1020,13 @@ namespace HandBrakeWPF.ViewModels
                 return string.Empty; // Feature is disabled.\r
             }\r
 \r
-            string preset = EnumHelper<x264Preset>.GetDisplay(this.X264Preset).ToLower().Replace(" ", string.Empty);\r
-            string profile = EnumHelper<x264Profile>.GetDisplay(this.H264Profile).ToLower();\r
+            string preset = this.VideoPreset != null ? this.VideoPreset.ShortName : string.Empty;\r
+            string profile = this.VideoProfile != null ? this.VideoProfile.ShortName : string.Empty; \r
 \r
             List<string> tunes = new List<string>();\r
-            if (X264Tune != x264Tune.None)\r
+            if (this.VideoTune != null && this.VideoTune.ShortName != "none")\r
             {\r
-                tunes.Add(this.X264Tune.ToString().ToLower().Replace(" ", string.Empty)); // TODO tidy this sillyness up.\r
+                tunes.Add(this.VideoTune.ShortName);\r
             }\r
             if (this.FastDecode)\r
             {\r
@@ -1370,12 +1050,12 @@ namespace HandBrakeWPF.ViewModels
             try\r
             {\r
                 return HandBrakeUtils.CreateX264OptionsString(\r
-                    preset,\r
-                    tunes,\r
-                    this.ExtraArguments,\r
-                    profile,\r
-                    this.H264Level,\r
-                    width,\r
+                    preset, \r
+                    tunes, \r
+                    this.ExtraArguments, \r
+                    profile, \r
+                    this.VideoLevel != null ? this.VideoLevel.ShortName : string.Empty, \r
+                    width, \r
                     height);\r
             }\r
             catch (Exception)\r
@@ -1393,7 +1073,7 @@ namespace HandBrakeWPF.ViewModels
         /// <param name="e">\r
         /// The e.\r
         /// </param>\r
-        private void UserSettingServiceSettingChanged(object sender, HandBrake.ApplicationServices.EventArgs.SettingChangedEventArgs e)\r
+        private void UserSettingServiceSettingChanged(object sender, SettingChangedEventArgs e)\r
         {\r
             if (e.Key == UserSettingConstants.ShowAdvancedTab)\r
             {\r
@@ -1458,5 +1138,124 @@ namespace HandBrakeWPF.ViewModels
                     break;\r
             }\r
         }\r
+\r
+        /// <summary>\r
+        /// The handle encoder change.\r
+        /// </summary>\r
+        /// <param name="selectedEncoder">\r
+        /// The selected encoder.\r
+        /// </param>\r
+        private void HandleEncoderChange(VideoEncoder selectedEncoder)\r
+        {\r
+            HBVideoEncoder encoder = HandBrakeEncoderHelpers.VideoEncoders.FirstOrDefault(s => s.ShortName == EnumHelper<VideoEncoder>.GetShortName(selectedEncoder));\r
+            if (encoder != null)\r
+            {\r
+                // Setup Profile\r
+                this.VideoProfiles.Clear();\r
+                if (encoder.Profiles != null)\r
+                {\r
+                    foreach (var item in encoder.Profiles)\r
+                    {\r
+                        this.VideoProfiles.Add(new VideoProfile(item, item));\r
+                    }\r
+                    this.VideoProfile = this.VideoProfiles.FirstOrDefault();\r
+                }\r
+                else\r
+                {\r
+                    this.VideoProfile = null;\r
+                }\r
+\r
+                // Setup Tune\r
+                this.VideoTunes.Clear();\r
+                if (encoder.Tunes != null)\r
+                {\r
+                    this.VideoTunes.Add(VideoTune.None);\r
+                    foreach (var item in encoder.Tunes)\r
+                    {\r
+                        if (item != VideoTune.FastDecode.ShortName)\r
+                        {\r
+                            this.VideoTunes.Add(new VideoTune(item, item));\r
+                        }\r
+                    }\r
+                    this.FastDecode = false;\r
+                    this.VideoTune = VideoTune.None;\r
+                }\r
+                else\r
+                {\r
+                    this.FastDecode = false;\r
+                    this.VideoTune = VideoTune.None;\r
+                }\r
+\r
+                // Setup Levels\r
+                this.VideoLevels.Clear();\r
+                if (encoder.Levels != null)\r
+                {\r
+                    foreach (var item in encoder.Levels)\r
+                    {\r
+                        this.VideoLevels.Add(new VideoLevel(item, item));\r
+                    }\r
+\r
+                    this.VideoLevel = this.VideoLevels.FirstOrDefault();\r
+                }\r
+                else\r
+                {\r
+                    this.VideoLevel = VideoLevel.Auto;\r
+                }\r
+                \r
+\r
+                // Setup Presets.\r
+                this.VideoPresets.Clear();\r
+                if (encoder.Presets != null)\r
+                {\r
+                    foreach (var item in encoder.Presets)\r
+                    {\r
+                        this.VideoPresets.Add(new VideoPreset(item, item));\r
+                    }\r
+\r
+                    this.VideoPresetMaxValue = encoder.Presets.Count - 1;\r
+                    int middlePreset = (int)Math.Round((decimal)(this.VideoPresetMaxValue / 2), 0);\r
+                    this.VideoPreset = new VideoPreset(encoder.Presets[middlePreset], encoder.Presets[middlePreset]);\r
+                }\r
+                else\r
+                {\r
+                    this.VideoPreset = null;\r
+                }\r
+            }\r
+\r
+            // Tell the Advanced Panel off the change\r
+            IAdvancedViewModel advancedViewModel = IoC.Get<IAdvancedViewModel>();\r
+            advancedViewModel.SetEncoder(this.Task.VideoEncoder);\r
+\r
+            // Update the Quality Slider. Make sure the bounds are up to date with the users settings.\r
+            this.SetQualitySliderBounds();\r
+\r
+            if (this.SelectedVideoEncoder == VideoEncoder.X264 || this.SelectedVideoEncoder == VideoEncoder.X265 || this.SelectedVideoEncoder == VideoEncoder.QuickSync)\r
+            {\r
+                this.DisplayOptimiseOptions = true;\r
+            }\r
+\r
+            this.DisplayNonQSVControls = this.SelectedVideoEncoder != VideoEncoder.QuickSync;\r
+\r
+            // Update control display\r
+            this.UseAdvancedTab = selectedEncoder != VideoEncoder.QuickSync && this.UseAdvancedTab;\r
+            this.DisplayTurboFirstPass = selectedEncoder == VideoEncoder.X264;\r
+            this.DisplayTuneControls = SelectedVideoEncoder == VideoEncoder.X264;\r
+\r
+            // Refresh Display\r
+            this.NotifyOfPropertyChange(() => this.Rfqp);\r
+            this.NotifyOfPropertyChange(() => this.ShowAdvancedTab);\r
+            this.NotifyOfPropertyChange(() => this.HighQualityLabel);\r
+\r
+            // Handle some quicksync specific options.\r
+            if (selectedEncoder == VideoEncoder.QuickSync)\r
+            {\r
+                this.IsConstantFramerate = true;\r
+                this.TwoPass = false;\r
+                this.TurboFirstPass = false;\r
+                this.Task.Framerate = null;\r
+                this.NotifyOfPropertyChange(() => SelectedFramerate);\r
+                this.UseAdvancedTab = false;\r
+            }\r
+        }\r
     }\r
 }
\ No newline at end of file
index 8e235ec5f5a013fe3a58af3bf1db56bd02c68bbf..0de80531647aa787795de7e86c08133ab5813141 100644 (file)
 \r
 \r
                     <!-- Row 1 -->\r
-                    <TextBlock Text="x264 Preset:" Grid.Row="1" Grid.Column="0" VerticalAlignment="Center"\r
-                               Visibility="{Binding DisplayX264Options, Converter={StaticResource boolToVisConverter}}" />\r
-                    <StackPanel Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3" Orientation="Horizontal"\r
-                                Visibility="{Binding DisplayX264Options, Converter={StaticResource boolToVisConverter}}" >\r
-                        <Slider Minimum="0" Maximum="9" Width="150" Value="{Binding X264PresetValue, Mode=Default, UpdateSourceTrigger=PropertyChanged}" \r
+                    <TextBlock Text="Encoder Preset:" Grid.Row="1" Grid.Column="0" VerticalAlignment="Center" />\r
+                    <StackPanel Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3" Orientation="Horizontal" >\r
+                        <Slider Minimum="0" Maximum="{Binding VideoPresetMaxValue}" Width="150" Value="{Binding VideoPresetValue, Mode=Default, UpdateSourceTrigger=PropertyChanged}" \r
                             IsSnapToTickEnabled="True" TickFrequency="1" TickPlacement="BottomRight" ToolTip="{x:Static Properties:Resources.Video_EncoderPreset}" \r
                             Style="{StaticResource LongToolTipHolder}" />\r
-                        <TextBlock Text="{Binding X264Preset, Converter={StaticResource enumComboConverter}}" Margin="5,0,0,0" />\r
+                        <TextBlock Text="{Binding VideoPreset.DisplayName}" Margin="5,0,0,0" />\r
                     </StackPanel>\r
 \r
-                    <TextBlock Text="x264 Tune:" Grid.Row="2" Grid.Column="0" VerticalAlignment="Center" Margin="0,10,0,0" \r
-                               Visibility="{Binding DisplayX264Options, Converter={StaticResource boolToVisConverter}}" />\r
+                    <TextBlock Text="Encoder Tune:" Grid.Row="2" Grid.Column="0" VerticalAlignment="Center" Margin="0,10,0,0"\r
+                               Visibility="{Binding DisplayTuneControls, Converter={StaticResource boolToVisConverter}}"/>\r
                     <ComboBox Width="100" Grid.Row="2" Grid.Column="1" Margin="5,10,5,0" Height="22"\r
-                              ItemsSource="{Binding X264Tunes, Converter={StaticResource enumComboConverter}}" \r
-                              SelectedItem="{Binding X264Tune, Converter={StaticResource enumComboConverter}}"\r
-                              Visibility="{Binding DisplayX264Options, Converter={StaticResource boolToVisConverter}}"\r
-                              ToolTip="{x:Static Properties:Resources.Video_EncoderTune}"\r
+                              ItemsSource="{Binding VideoTunes}" DisplayMemberPath="DisplayName" SelectedItem="{Binding VideoTune}"\r
+                              ToolTip="{x:Static Properties:Resources.Video_EncoderTune}" Visibility="{Binding DisplayTuneControls, Converter={StaticResource boolToVisConverter}}"\r
                               Style="{StaticResource LongToolTipHolder}" />\r
                     <CheckBox IsChecked="{Binding FastDecode}" Content="Fast Decode" Grid.Row="2" Grid.Column="2" Margin="10,10,10,0" VerticalAlignment="Center"\r
-                              Visibility="{Binding DisplayX264Options, Converter={StaticResource boolToVisConverter}}"\r
-                              ToolTip="{x:Static Properties:Resources.Video_x264FastDecode}"/>\r
-\r
-                    <TextBlock Text="QSV Preset:" Grid.Row="1" Grid.Column="0" VerticalAlignment="Center"\r
-                               Visibility="{Binding DisplayQSVOptions, Converter={StaticResource boolToVisConverter}}" />\r
-                    <StackPanel Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3" Orientation="Horizontal"\r
-                                Visibility="{Binding DisplayQSVOptions, Converter={StaticResource boolToVisConverter}}" >\r
-                        <Slider Minimum="0" Maximum="{Binding QsvSliderMax}" Width="150" Value="{Binding QsvPresetValue, Mode=Default, UpdateSourceTrigger=PropertyChanged}" \r
-                            IsSnapToTickEnabled="True" TickFrequency="1" TickPlacement="BottomRight" />\r
-                        <TextBlock Text="{Binding QsvPreset, Converter={StaticResource enumComboConverter}}" Margin="5,0,0,0" />\r
-                    </StackPanel>\r
-\r
+                              ToolTip="{x:Static Properties:Resources.Video_x264FastDecode}" Visibility="{Binding DisplayTuneControls, Converter={StaticResource boolToVisConverter}}"/>\r
 \r
+          \r
                     <!-- Row 2-->\r
                     <TextBlock Text="H.264 Profile:" Grid.Row="3" Grid.Column="0" Margin="0,10,0,0" VerticalAlignment="Center" />\r
                     <ComboBox Width="100" Grid.Row="3" Grid.Column="1" Margin="5,10,5,0" Height="22" VerticalAlignment="Center"\r
-                          ItemsSource="{Binding H264Profiles, Converter={StaticResource enumComboConverter}}" \r
-                          SelectedItem="{Binding H264Profile, Converter={StaticResource enumComboConverter}}"\r
-                          Style="{StaticResource LongToolTipHolder}"\r
-                          ToolTip="{x:Static Properties:Resources.Video_EncoderProfile}" />\r
+                          ItemsSource="{Binding VideoProfiles}" DisplayMemberPath="DisplayName" SelectedItem="{Binding VideoProfile}"\r
+                          Style="{StaticResource LongToolTipHolder}" ToolTip="{x:Static Properties:Resources.Video_EncoderProfile}" />\r
 \r
                     <TextBlock Text="H.264 Level:" Grid.Row="3" Grid.Column="2" Margin="10,10,0,0" VerticalAlignment="Center" />\r
                     <ComboBox Width="100" Grid.Row="3" Grid.Column="3" Margin="5,10,5,0" Height="22" VerticalAlignment="Center"\r
-                          ItemsSource="{Binding H264Levels}" \r
-                          SelectedItem="{Binding H264Level}"\r
-                          Style="{StaticResource LongToolTipHolder}"\r
-                          ToolTip="{x:Static Properties:Resources.Video_EncoderLevel}"/>\r
+                          ItemsSource="{Binding VideoLevels}"  DisplayMemberPath="DisplayName" SelectedItem="{Binding VideoLevel}"\r
+                          Style="{StaticResource LongToolTipHolder}" ToolTip="{x:Static Properties:Resources.Video_EncoderLevel}"/>\r
 \r
                     <!-- Row 3 -->\r
-                    <TextBlock Text="Extra Options:" Grid.Row="4" Grid.Column="0" Margin="0,10,0,0" VerticalAlignment="Center" HorizontalAlignment="Left"\r
-                               Visibility="{Binding DisplayX264Options, Converter={StaticResource boolToVisConverter}}" />\r
+                    <TextBlock Text="Extra Options:" Grid.Row="4" Grid.Column="0" Margin="0,10,0,0" VerticalAlignment="Center" HorizontalAlignment="Left" />\r
                     <TextBox Text="{Binding ExtraArguments, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"\r
                              Height="30" MaxLines="2" Grid.Row="4" Grid.Column="1" Grid.ColumnSpan="3" Margin="5,10,0,0" VerticalAlignment="Center"\r
-                             ToolTip="{Binding FullOptionsTooltip}" Style="{StaticResource LongToolTipHolder}"\r
-                             Visibility="{Binding DisplayX264Options, Converter={StaticResource boolToVisConverter}}" >\r
+                             ToolTip="{Binding FullOptionsTooltip}" Style="{StaticResource LongToolTipHolder}" >\r
                         <TextBox.ContextMenu>\r
                             <ContextMenu>\r
                                 <MenuItem Header="Copy Full Query" cal:Message.Attach="[Event Click] = [Action CopyQuery]"  />\r
             </Grid>\r
 \r
 \r
-            <!-- H265 settings -->\r
-\r
-            <Grid Grid.Row="1" Grid.ColumnSpan="2" Margin="0,10,0,0" Visibility="{Binding DisplayX265Options, Converter={StaticResource boolToVisConverter}}">\r
-                <Grid.RowDefinitions>\r
-                    <RowDefinition Height="Auto" />\r
-                    <RowDefinition Height="Auto" />\r
-                    <RowDefinition Height="*" />\r
-                </Grid.RowDefinitions>\r
-\r
-                <TextBlock Text="Optimise Video:" Margin="0,0,0,8" Grid.Row="0"  Grid.ColumnSpan="2" FontWeight="Bold" VerticalAlignment="Center" />\r
-\r
-                <CheckBox Content="Use Advanced Tab instead" Grid.Row="1" IsChecked="{Binding UseAdvancedTab}" \r
-                           Visibility="{Binding DisplayX265Options, Converter={StaticResource boolToVisConverter}, ConverterParameter=false}" />\r
-\r
-                <Grid Grid.Row="2" Margin="0,5,0,0" IsEnabled="{Binding UseAdvancedTab, Converter={StaticResource inverseConverter}}">\r
-\r
-                    <Grid.RowDefinitions>\r
-                        <RowDefinition Height="Auto" />\r
-                        <RowDefinition Height="Auto" />\r
-                        <RowDefinition Height="Auto" />\r
-                        <RowDefinition Height="Auto" />\r
-                        <RowDefinition Height="Auto" />\r
-                        <RowDefinition Height="*" />\r
-                    </Grid.RowDefinitions>\r
-\r
-                    <Grid.ColumnDefinitions>\r
-                        <ColumnDefinition Width="Auto" />\r
-                        <ColumnDefinition Width="Auto" />\r
-                        <ColumnDefinition Width="Auto" />\r
-                        <ColumnDefinition Width="Auto" />\r
-                    </Grid.ColumnDefinitions>\r
-\r
-\r
-                    <!-- Row 1 -->\r
-\r
-                    <TextBlock Text="x265 Preset:" Grid.Row="1" Grid.Column="0" VerticalAlignment="Center"\r
-                                Visibility="{Binding DisplayX265Options, Converter={StaticResource boolToVisConverter}}" />\r
-                    <StackPanel Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3" Orientation="Horizontal"\r
-                                 Visibility="{Binding DisplayX265Options, Converter={StaticResource boolToVisConverter}}" >\r
-                        <Slider Minimum="0" Maximum="9" Width="150" Value="{Binding X265PresetValue, Mode=Default, UpdateSourceTrigger=PropertyChanged}" \r
-                             IsSnapToTickEnabled="True" TickFrequency="1" TickPlacement="BottomRight" ToolTip="{x:Static Properties:Resources.Video_EncoderPreset}" \r
-                             Style="{StaticResource LongToolTipHolder}" />\r
-                        <TextBlock Text="{Binding X265Preset}" Margin="5,0,0,0" />\r
-                    </StackPanel>\r
-\r
-                    <TextBlock Text="x265 Tune:" Grid.Row="2" Grid.Column="0" VerticalAlignment="Center" Margin="0,10,0,0" \r
-                                Visibility="{Binding DisplayX265Options, Converter={StaticResource boolToVisConverter}}" />\r
-                    <ComboBox Width="100" Grid.Row="2" Grid.Column="1" Margin="5,10,5,0" Height="22"\r
-                               ItemsSource="{Binding X265Tunes}" \r
-                               SelectedItem="{Binding X265Tune}"\r
-                               Visibility="{Binding DisplayX265Options, Converter={StaticResource boolToVisConverter}}"\r
-                               ToolTip="{x:Static Properties:Resources.Video_EncoderTune}"\r
-                               Style="{StaticResource LongToolTipHolder}" />\r
-\r
-                    <TextBlock Text="H.265 Profile:" Grid.Row="2" Grid.Column="2" Margin="10,10,0,0" VerticalAlignment="Center" \r
-                                Visibility="{Binding DisplayX265Options, Converter={StaticResource boolToVisConverter}}" />\r
-                    <ComboBox Width="100" Grid.Row="2" Grid.Column="3" Margin="5,10,5,0" Height="22" VerticalAlignment="Center"\r
-                               Visibility="{Binding DisplayX265Options, Converter={StaticResource boolToVisConverter}}"\r
-                           ItemsSource="{Binding H265Profiles}" \r
-                           SelectedItem="{Binding H265Profile}"\r
-                           Style="{StaticResource LongToolTipHolder}"\r
-                           ToolTip="{x:Static Properties:Resources.Video_EncoderProfile}" />\r
-\r
-                    <!-- Row 3 -->\r
-                    <TextBlock Text="Extra Options:" Grid.Row="4" Grid.Column="0" Margin="0,10,0,0" VerticalAlignment="Center" HorizontalAlignment="Left"\r
-                                Visibility="{Binding DisplayX265Options, Converter={StaticResource boolToVisConverter}}" />\r
-                    <TextBox Text="{Binding ExtraArguments, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"\r
-                              Height="30" MaxLines="2" Grid.Row="4" Grid.Column="1" Grid.ColumnSpan="3" Margin="5,10,0,0" VerticalAlignment="Center"\r
-                              ToolTip="{Binding FullOptionsTooltip}" Style="{StaticResource LongToolTipHolder}"\r
-                              Visibility="{Binding DisplayX265Options, Converter={StaticResource boolToVisConverter}}" >\r
-                        <TextBox.ContextMenu>\r
-                            <ContextMenu>\r
-                                <MenuItem Header="Copy Full Query" cal:Message.Attach="[Event Click] = [Action CopyQuery]"  />\r
-                            </ContextMenu>\r
-                        </TextBox.ContextMenu>\r
-                    </TextBox>\r
-                </Grid>\r
-            </Grid>\r
         </Grid>\r
 \r
     </Grid>\r