diff options
author | sr55 <[email protected]> | 2015-07-05 12:12:01 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2015-07-05 12:12:01 +0000 |
commit | e32a4681e63cfb7842488842047da1b8f14c72c5 (patch) | |
tree | 54314f5debe1d73237d31b24d1e23609c436f946 /win/CS | |
parent | 32363c86e5b1847289d9cc0dc741a5f536176225 (diff) |
WinGui: Initial Implementation of the json preset export code.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7347 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS')
24 files changed, 348 insertions, 347 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakePresetService.cs b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakePresetService.cs index 8d4f34e9e..fcc6d61da 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakePresetService.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakePresetService.cs @@ -11,6 +11,7 @@ namespace HandBrake.ApplicationServices.Interop {
using System;
using System.Collections.Generic;
+ using System.IO;
using System.Runtime.InteropServices;
using HandBrake.ApplicationServices.Interop.HbLib;
@@ -65,5 +66,23 @@ namespace HandBrake.ApplicationServices.Interop return preset;
}
+
+ /// <summary>
+ /// The export preset.
+ /// </summary>
+ /// <param name="filename">
+ /// The filename.
+ /// </param>
+ /// <param name="container">
+ /// The container.
+ /// </param>
+ public static void ExportPreset(string filename, PresetTransportContainer container)
+ {
+ string preset = JsonConvert.SerializeObject(container, Formatting.Indented);
+ using (StreamWriter writer = new StreamWriter(filename))
+ {
+ writer.Write(preset);
+ }
+ }
}
}
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Json/Presets/HBPreset.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Presets/HBPreset.cs index 6bfeadcdd..6112a26a3 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/Json/Presets/HBPreset.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/Json/Presets/HBPreset.cs @@ -19,7 +19,7 @@ namespace HandBrake.ApplicationServices.Interop.Json.Presets /// <summary>
/// Gets or sets the audio copy mask.
/// </summary>
- public List<object> AudioCopyMask { get; set; }
+ public List<string> AudioCopyMask { get; set; }
/// <summary>
/// Gets or sets the audio encoder fallback.
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/Anamorphic.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/Anamorphic.cs index 1fe67db0b..85e240ba9 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/Anamorphic.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/Anamorphic.cs @@ -11,18 +11,24 @@ namespace HandBrake.ApplicationServices.Interop.Model.Encoding {
using System.ComponentModel.DataAnnotations;
+ using HandBrake.ApplicationServices.Attributes;
+
/// <summary>
/// The anamorphic.
/// </summary>
public enum Anamorphic
{
[Display(Name = "None")]
+ [ShortName("none")]
None = 0,
[Display(Name = "Strict")]
+ [ShortName("strict")]
Strict = 1,
[Display(Name = "Loose")]
+ [ShortName("loose")]
Loose = 2,
[Display(Name = "Custom")]
+ [ShortName("custom")]
Custom = 3
}
}
\ No newline at end of file diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/Decomb.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/Decomb.cs index f49ccffc7..58e1003e3 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/Decomb.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/Decomb.cs @@ -9,15 +9,26 @@ namespace HandBrake.ApplicationServices.Interop.Model.Encoding
{
+ using HandBrake.ApplicationServices.Attributes;
+
/// <summary>
/// The decomb.
/// </summary>
public enum Decomb
{
+ [ShortName("off")]
Off = 0,
+
+ [ShortName("default")]
Default = 2,
+
+ [ShortName("fast")]
Fast = 3,
+
+ [ShortName("bob")]
Bob = 4,
+
+ [ShortName("custom")]
Custom = 1
}
}
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/Deinterlace.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/Deinterlace.cs index f5f76b71e..f7b8f0a42 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/Deinterlace.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/Deinterlace.cs @@ -9,16 +9,29 @@ namespace HandBrake.ApplicationServices.Interop.Model.Encoding
{
+ using HandBrake.ApplicationServices.Attributes;
+
/// <summary>
/// The deinterlace.
/// </summary>
public enum Deinterlace
{
+ [ShortName("off")]
Off = 0,
+
+ [ShortName("fast")]
Fast = 2,
+
+ [ShortName("slow")]
Slow = 3,
+
+ [ShortName("slower")]
Slower = 4,
+
+ [ShortName("bob")]
Bob = 5,
+
+ [ShortName("custom")]
Custom = 1
}
}
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/Denoise.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/Denoise.cs index 1bb510c29..4374372ff 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/Denoise.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/Denoise.cs @@ -9,13 +9,20 @@ namespace HandBrake.ApplicationServices.Interop.Model.Encoding
{
+ using HandBrake.ApplicationServices.Attributes;
+
/// <summary>
/// The denoise.
/// </summary>
public enum Denoise
{
+ [ShortName("off")]
Off = 0,
+
+ [ShortName("hqdn3d")]
hqdn3d = 1,
+
+ [ShortName("nlmeans")]
NLMeans = 2,
}
}
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/Detelecine.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/Detelecine.cs index ff26a394d..f93c754a4 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/Detelecine.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/Detelecine.cs @@ -9,13 +9,18 @@ namespace HandBrake.ApplicationServices.Interop.Model.Encoding
{
+ using HandBrake.ApplicationServices.Attributes;
+
/// <summary>
/// The detelecine.
/// </summary>
public enum Detelecine
{
+ [ShortName("off")]
Off = 0,
+ [ShortName("default")]
Default = 2,
+ [ShortName("custom")]
Custom = 1
}
}
diff --git a/win/CS/HandBrake.ApplicationServices/Model/VideoScaler.cs b/win/CS/HandBrake.ApplicationServices/Model/VideoScaler.cs index 8fd6bcd07..5d26040a8 100644 --- a/win/CS/HandBrake.ApplicationServices/Model/VideoScaler.cs +++ b/win/CS/HandBrake.ApplicationServices/Model/VideoScaler.cs @@ -11,15 +11,19 @@ namespace HandBrake.ApplicationServices.Model {
using System.ComponentModel.DataAnnotations;
+ using HandBrake.ApplicationServices.Attributes;
+
/// <summary>
/// The different scaling modes available in HandBrake
/// </summary>
public enum VideoScaler
{
[Display(Name = "Lanczos (default)")]
+ [ShortName("swscale")]
Lanczos = 0,
[Display(Name = "Bicubic (OpenCL)")]
+ [ShortName("opencl")]
BicubicCl,
}
}
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/AllowedPassthru.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/AllowedPassthru.cs index d2ac4d5ac..796ae3cd6 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/AllowedPassthru.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/AllowedPassthru.cs @@ -9,7 +9,7 @@ namespace HandBrake.ApplicationServices.Services.Encode.Model.Models
{
- using HandBrake.ApplicationServices.Interop.Model.Encoding;
+ using System.Collections.Generic;
/// <summary>
/// Allowed Passthru Options
@@ -122,6 +122,51 @@ namespace HandBrake.ApplicationServices.Services.Encode.Model.Models /// </summary>
public AudioEncoder AudioEncoderFallback { get; set; }
+ /// <summary>
+ /// Gets the allowed passthru options.
+ /// </summary>
+ public IEnumerable<AudioEncoder> AllowedPassthruOptions
+ {
+ get
+ {
+ List<AudioEncoder> audioEncoders = new List<AudioEncoder>();
+ if (AudioAllowAACPass)
+ {
+ audioEncoders.Add(AudioEncoder.AacPassthru);
+ }
+ if (AudioAllowAC3Pass)
+ {
+ audioEncoders.Add(AudioEncoder.Ac3Passthrough);
+ }
+ if (AudioAllowDTSHDPass)
+ {
+ audioEncoders.Add(AudioEncoder.DtsHDPassthrough);
+ }
+ if (AudioAllowDTSPass)
+ {
+ audioEncoders.Add(AudioEncoder.DtsPassthrough);
+ }
+ if (AudioAllowMP3Pass)
+ {
+ audioEncoders.Add(AudioEncoder.Mp3Passthru);
+ }
+ if (AudioAllowTrueHDPass)
+ {
+ audioEncoders.Add(AudioEncoder.TrueHDPassthrough);
+ }
+ if (AudioAllowFlacPass)
+ {
+ audioEncoders.Add(AudioEncoder.FlacPassthru);
+ }
+ if (AudioAllowEAC3Pass)
+ {
+ audioEncoders.Add(AudioEncoder.EAc3Passthrough);
+ }
+
+ return audioEncoders;
+ }
+ }
+
#endregion
}
}
\ No newline at end of file diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/DenoisePreset.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/DenoisePreset.cs index 1b83f0d40..10b28140b 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/DenoisePreset.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/DenoisePreset.cs @@ -11,27 +11,35 @@ namespace HandBrake.ApplicationServices.Services.Encode.Model.Models {
using System.ComponentModel.DataAnnotations;
+ using HandBrake.ApplicationServices.Attributes;
+
/// <summary>
/// The denoise preset.
/// </summary>
public enum DenoisePreset
{
[Display(Name = "Weak")]
+ [ShortName("weak")]
Weak = 0,
[Display(Name = "Medium")]
+ [ShortName("medium")]
Medium,
[Display(Name = "Strong")]
+ [ShortName("strong")]
Strong,
[Display(Name = "Custom")]
+ [ShortName("custom")]
Custom,
[Display(Name = "Ultralight")] // NLMeans only
+ [ShortName("ultralight")]
Ultralight,
[Display(Name = "Light")] // NLMeans only
+ [ShortName("light")]
Light,
}
}
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/DenoiseTune.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/DenoiseTune.cs index 745039a35..f58834d81 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/DenoiseTune.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/DenoiseTune.cs @@ -11,24 +11,31 @@ namespace HandBrake.ApplicationServices.Services.Encode.Model.Models {
using System.ComponentModel.DataAnnotations;
+ using HandBrake.ApplicationServices.Attributes;
+
/// <summary>
/// The denoise tune.
/// </summary>
public enum DenoiseTune
{
[Display(Name = "None")]
+ [ShortName("none")]
None = 0,
[Display(Name = "Film")]
+ [ShortName("film")]
Film,
[Display(Name = "Grain")]
+ [ShortName("grain")]
Grain,
[Display(Name = "High Motion")]
+ [ShortName("highmotion")]
HighMotion,
[Display(Name = "Animation")]
+ [ShortName("animation")]
Animation,
}
}
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/FramerateMode.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/FramerateMode.cs index 542fb6b4e..c61abd40b 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/FramerateMode.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/FramerateMode.cs @@ -9,13 +9,20 @@ namespace HandBrake.ApplicationServices.Services.Encode.Model.Models
{
+ using HandBrake.ApplicationServices.Attributes;
+
/// <summary>
/// The Mode of Video Encoding. CFR, VFR, PFR
/// </summary>
public enum FramerateMode
{
+ [ShortName("cfr")]
CFR = 0,
+
+ [ShortName("pfr")]
PFR,
+
+ [ShortName("vfr")]
VFR
}
}
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/OutputFormat.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/OutputFormat.cs index d36071b73..8f01b3f6b 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/OutputFormat.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/OutputFormat.cs @@ -12,6 +12,8 @@ namespace HandBrake.ApplicationServices.Services.Encode.Model.Models using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
+ using HandBrake.ApplicationServices.Attributes;
+
/// <summary>
/// The Output format.
/// </summary>
@@ -19,10 +21,12 @@ namespace HandBrake.ApplicationServices.Services.Encode.Model.Models {
[Description("MP4")]
[Display(Name = "MP4")]
+ [ShortName("av_mp4")]
Mp4 = 0,
[Description("MKV")]
[Display(Name = "MKV")]
+ [ShortName("av_mkv")]
Mkv,
}
}
diff --git a/win/CS/HandBrake10.sln.DotSettings b/win/CS/HandBrake10.sln.DotSettings index ddd8bf654..1de4d3235 100644 --- a/win/CS/HandBrake10.sln.DotSettings +++ b/win/CS/HandBrake10.sln.DotSettings @@ -491,6 +491,7 @@ <s:Boolean x:Key="/Default/Environment/OpenDocument/OpenDocumentAfterModification/@EntryValue">True</s:Boolean> <s:Boolean x:Key="/Default/Environment/SearchAndNavigation/MergeOccurences/@EntryValue">True</s:Boolean> <s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpFileLayoutPatternsUpgrade/@EntryIndexedValue">True</s:Boolean> + <s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAddAccessorOwnerDeclarationBracesMigration/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateThisQualifierSettings/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002EJavaScript_002ECodeStyle_002ESettingsUpgrade_002EJsCodeFormatterSettingsUpgrader/@EntryIndexedValue">True</s:Boolean> diff --git a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj index c7ebecb48..096fdd379 100644 --- a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj +++ b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj @@ -171,7 +171,6 @@ <DesignTime>True</DesignTime>
</Compile>
<Compile Include="Services\Presets\Factories\JsonPresetFactory.cs" />
- <Compile Include="Services\Presets\Factories\PlistFactory.cs" />
<Compile Include="Services\Queue\Interfaces\IQueueProcessor.cs" />
<Compile Include="Helpers\FileHelper.cs" />
<Compile Include="Services\Presets\Model\Preset.cs" />
diff --git a/win/CS/HandBrakeWPF/Model/Audio/AudioBehaviourModes.cs b/win/CS/HandBrakeWPF/Model/Audio/AudioBehaviourModes.cs index 11f19f2e4..63d88cf21 100644 --- a/win/CS/HandBrakeWPF/Model/Audio/AudioBehaviourModes.cs +++ b/win/CS/HandBrakeWPF/Model/Audio/AudioBehaviourModes.cs @@ -11,18 +11,23 @@ namespace HandBrakeWPF.Model.Audio {
using System.ComponentModel.DataAnnotations;
+ using HandBrake.ApplicationServices.Attributes;
+
/// <summary>
/// The audio behaviours.
/// </summary>
public enum AudioBehaviourModes
{
[Display(Name = "No Audio")]
+ [ShortName("none")]
None = 0,
[Display(Name = "First Matching Selected Language")]
+ [ShortName("first")]
FirstMatch,
[Display(Name = "All Matching Selected Languages")]
+ [ShortName("all")]
AllMatching,
}
}
diff --git a/win/CS/HandBrakeWPF/Model/Subtitles/SubtitleBehaviourModes.cs b/win/CS/HandBrakeWPF/Model/Subtitles/SubtitleBehaviourModes.cs index 004190a5f..ed3e8ed5a 100644 --- a/win/CS/HandBrakeWPF/Model/Subtitles/SubtitleBehaviourModes.cs +++ b/win/CS/HandBrakeWPF/Model/Subtitles/SubtitleBehaviourModes.cs @@ -11,18 +11,23 @@ namespace HandBrakeWPF.Model.Subtitles {
using System.ComponentModel.DataAnnotations;
+ using HandBrake.ApplicationServices.Attributes;
+
/// <summary>
/// The subtitle behaviours modes.
/// </summary>
public enum SubtitleBehaviourModes
{
[Display(Name = "None")]
+ [ShortName("none")]
None = 0,
[Display(Name = "First Matching Selected Language")]
+ [ShortName("first")]
FirstMatch,
[Display(Name = "All Matching Selected Languages")]
+ [ShortName("all")]
AllMatching,
}
}
diff --git a/win/CS/HandBrakeWPF/Model/Subtitles/SubtitleBurnInBehaviourModes.cs b/win/CS/HandBrakeWPF/Model/Subtitles/SubtitleBurnInBehaviourModes.cs index 174b4a5e8..193fc2a45 100644 --- a/win/CS/HandBrakeWPF/Model/Subtitles/SubtitleBurnInBehaviourModes.cs +++ b/win/CS/HandBrakeWPF/Model/Subtitles/SubtitleBurnInBehaviourModes.cs @@ -11,21 +11,27 @@ namespace HandBrakeWPF.Model.Subtitles {
using System.ComponentModel.DataAnnotations;
+ using HandBrake.ApplicationServices.Attributes;
+
/// <summary>
/// The subtitle behaviours modes.
/// </summary>
public enum SubtitleBurnInBehaviourModes
{
[Display(Name = "None")]
+ [ShortName("none")]
None = 0,
[Display(Name = "Foreign Audio Track")]
+ [ShortName("foreign")]
ForeignAudio,
[Display(Name = "First Track")]
+ [ShortName("first")]
FirstTrack,
[Display(Name = "Foreign Audio Preferred, else First")]
+ [ShortName("foreign_first")]
ForeignAudioPreferred,
}
}
diff --git a/win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs b/win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs index acc63874f..4dedd9660 100644 --- a/win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs +++ b/win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs @@ -9,13 +9,15 @@ namespace HandBrakeWPF.Services.Presets.Factories
{
- using System;
+ using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Globalization;
+ using System.Linq;
using HandBrake.ApplicationServices.Interop.Json.Presets;
using HandBrake.ApplicationServices.Interop.Model;
using HandBrake.ApplicationServices.Interop.Model.Encoding;
+ using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Services.Encode.Model;
using HandBrake.ApplicationServices.Services.Encode.Model.Models;
using HandBrake.ApplicationServices.Services.Encode.Model.Models.Video;
@@ -46,7 +48,6 @@ namespace HandBrakeWPF.Services.Presets.Factories preset.Name = importedPreset.PresetName;
preset.Description = importedPreset.PresetDescription;
preset.UsePictureFilters = importedPreset.UsesPictureFilters;
- preset.UseDeinterlace = !importedPreset.PictureDecombDeinterlace;
preset.Task = new EncodeTask();
// Step 1, Create the EncodeTask Object that can be loaded into the UI.
@@ -106,6 +107,11 @@ namespace HandBrakeWPF.Services.Presets.Factories preset.Task.CustomDecomb = importedPreset.PictureDecombCustom;
+ if (!importedPreset.PictureDecombDeinterlace)
+ {
+ preset.Task.Decomb = Decomb.Off;
+ }
+
switch (importedPreset.PictureDeinterlace)
{
case "custom":
@@ -367,16 +373,158 @@ namespace HandBrakeWPF.Services.Presets.Factories /// <param name="export">
/// The export.
/// </param>
+ /// <param name="config">
+ /// HandBrakes configuration options.
+ /// </param>
/// <returns>
/// The <see cref="Preset"/>.
/// </returns>
- public HandBrake.ApplicationServices.Interop.Json.Presets.HBPreset ExportPreset(Preset export)
+ public static PresetTransportContainer ExportPreset(Preset export, HBConfiguration config)
{
- HandBrake.ApplicationServices.Interop.Json.Presets.HBPreset preset = new HandBrake.ApplicationServices.Interop.Json.Presets.HBPreset();
+ PresetTransportContainer container = new PresetTransportContainer();
+ container.VersionMajor = "0";
+ container.VersionMinor = "10";
+ container.VersionMicro = "2";
+ container.PresetList = new List<HBPreset> { CreateHbPreset(export, config) };
+
+ return container;
+ }
+
+ /// <summary>
+ /// The create hb preset.
+ /// </summary>
+ /// <param name="export">
+ /// The export.
+ /// </param>
+ /// <param name="config">HandBrakes current configuration</param>
+ /// <returns>
+ /// The <see cref="HBPreset"/>.
+ /// </returns>
+ private static HBPreset CreateHbPreset(Preset export, HBConfiguration config)
+ {
+ HBPreset preset = new HBPreset();
+
+ // Preset
+ preset.PresetDescription = export.Description;
+ preset.PresetName = export.Name;
+ preset.Type = 1; // User Preset
+ preset.UsesPictureFilters = export.UsePictureFilters;
+ preset.UsesPictureSettings = (int)export.PictureSettingsMode;
+ preset.Default = false; // TODO Can other GUI's handle this?
+
+ // Audio
+ preset.AudioCopyMask = export.Task.AllowedPassthruOptions.AllowedPassthruOptions.Select(EnumHelper<AudioEncoder>.GetShortName).ToList();
+ preset.AudioEncoderFallback = EnumHelper<AudioEncoder>.GetShortName(export.Task.AllowedPassthruOptions.AudioEncoderFallback);
+ preset.AudioLanguageList = LanguageUtilities.GetLanguageCodes(export.AudioTrackBehaviours.SelectedLangauges);
+ preset.AudioTrackSelectionBehavior = EnumHelper<AudioBehaviourModes>.GetShortName(export.AudioTrackBehaviours.SelectedBehaviour);
+ preset.AudioSecondaryEncoderMode = false; // TODO -> Check what this is.
+ preset.AudioList = new List<AudioList>();
+ foreach (var item in export.Task.AudioTracks)
+ {
+ AudioList track = new AudioList
+ {
+ AudioBitrate = item.Bitrate,
+ AudioCompressionLevel = 0, // TODO
+ AudioDitherMethod = null, // TODO
+ AudioEncoder = EnumHelper<AudioEncoder>.GetShortName(item.Encoder),
+ AudioMixdown = EnumHelper<Mixdown>.GetShortName(item.MixDown),
+ AudioNormalizeMixLevel = false, // TODO
+ AudioSamplerate = item.SampleRate == 0 ? "auto" : item.SampleRate.ToString(), // TODO check formatting.
+ AudioTrackDRCSlider = item.DRC,
+ AudioTrackGainSlider = item.Gain,
+ AudioTrackQuality = item.Quality ?? 0,
+ AudioTrackQualityEnable = item.Quality.HasValue && item.IsQualityVisible
+ };
+
+ preset.AudioList.Add(track);
+ }
+
+
+ // Subtitles
+ preset.SubtitleAddCC = export.SubtitleTrackBehaviours.AddClosedCaptions;
+ preset.SubtitleAddForeignAudioSearch = export.SubtitleTrackBehaviours.AddForeignAudioScanTrack;
+ preset.SubtitleBurnBDSub = false; // TODO not supported yet.
+ preset.SubtitleBurnDVDSub = false; // TODO not supported yet.
+ preset.SubtitleBurnBehavior = EnumHelper<SubtitleBurnInBehaviourModes>.GetShortName(export.SubtitleTrackBehaviours.SelectedBurnInBehaviour);
+ preset.SubtitleLanguageList = LanguageUtilities.GetLanguageCodes(export.SubtitleTrackBehaviours.SelectedLangauges);
+ preset.SubtitleTrackSelectionBehavior = EnumHelper<SubtitleBehaviourModes>.GetShortName(export.SubtitleTrackBehaviours.SelectedBehaviour);
+
+ // Chapters
+ preset.ChapterMarkers = export.Task.IncludeChapterMarkers;
+
+ // Output Settings
+ preset.FileFormat = EnumHelper<OutputFormat>.GetShortName(export.Task.OutputFormat);
+ preset.Mp4HttpOptimize = export.Task.OptimizeMP4;
+ preset.Mp4iPodCompatible = export.Task.IPod5GSupport;
+
+ // Picture Settings
+ preset.PictureForceHeight = 0; // TODO
+ preset.PictureForceWidth = 0; // TODO
+ preset.PictureHeight = preset.UsesPictureSettings >= 1 ? export.Task.MaxHeight : 0; // TODO; // TODO
+ preset.PictureItuPAR = false; // TODO Not supported Yet
+ preset.PictureKeepRatio = export.Task.KeepDisplayAspect;
+ preset.PictureLeftCrop = export.Task.Cropping.Left;
+ preset.PictureLooseCrop = false; // TODO Not Supported Yet
+ preset.PictureModulus = export.Task.Modulus ?? 16;
+ preset.PicturePAR = EnumHelper<Anamorphic>.GetShortName(export.Task.Anamorphic);
+ preset.PicturePARHeight = export.Task.PixelAspectY;
+ preset.PicturePARWidth = export.Task.PixelAspectX;
+ preset.PictureRightCrop = export.Task.Cropping.Right;
+ preset.PictureRotate = 0; // TODO Not supported yet.
+ preset.PictureTopCrop = export.Task.Cropping.Top;
+ preset.PictureWidth = preset.UsesPictureSettings >= 1 ? export.Task.MaxWidth : 0; // TODO
+ preset.PictureDARWidth = export.Task.DisplayWidth.HasValue ? (int)export.Task.DisplayWidth.Value : 0;
+ preset.PictureAutoCrop = export.Task.HasCropping;
+ preset.PictureBottomCrop = export.Task.Cropping.Bottom;
+
+ // Filters
+ preset.PictureDeblock = export.Task.Deblock;
+ preset.PictureDecomb = EnumHelper<Decomb>.GetShortName(export.Task.Decomb);
+ preset.PictureDecombCustom = export.Task.CustomDecomb;
+ preset.PictureDecombDeinterlace = export.Task.Decomb != Decomb.Off;
+ preset.PictureDeinterlace = EnumHelper<Deinterlace>.GetShortName(export.Task.Deinterlace);
+ preset.PictureDeinterlaceCustom = export.Task.CustomDeinterlace;
+ preset.PictureDenoiseCustom = export.Task.CustomDenoise;
+ preset.PictureDenoiseFilter = EnumHelper<Denoise>.GetShortName(export.Task.Denoise);
+ preset.PictureDenoisePreset = EnumHelper<DenoisePreset>.GetShortName(export.Task.DenoisePreset);
+ preset.PictureDenoiseTune = EnumHelper<DenoiseTune>.GetShortName(export.Task.DenoiseTune);
+ preset.PictureDetelecine = EnumHelper<Detelecine>.GetShortName(export.Task.Detelecine);
+ preset.PictureDetelecineCustom = export.Task.CustomDetelecine;
+
+ // Video
+ preset.VideoEncoder = EnumHelper<VideoEncoder>.GetShortName(export.Task.VideoEncoder);
+ preset.VideoFramerate = export.Task.Framerate.ToString();
+ preset.VideoFramerateMode = EnumHelper<FramerateMode>.GetShortName(export.Task.FramerateMode);
+ preset.VideoGrayScale = export.Task.Grayscale;
+ preset.VideoHWDecode = false;
+ preset.VideoLevel = export.Task.VideoLevel.ShortName;
+ preset.VideoOptionExtra = export.Task.ExtraAdvancedArguments;
+ preset.VideoPreset = export.Task.VideoPreset.ShortName;
+ preset.VideoProfile = export.Task.VideoProfile.ShortName;
+ preset.VideoQSVAsyncDepth = 4; // Defaulted to 4 for now.
+ preset.VideoQSVDecode = !config.DisableQuickSyncDecoding;
+ preset.VideoQualitySlider = export.Task.Quality.HasValue ? export.Task.Quality.Value : 0;
+ preset.VideoQualityType = (int)export.Task.VideoEncodeRateType;
+ preset.VideoScaler = EnumHelper<VideoScaler>.GetShortName(config.ScalingMode);
+ preset.VideoTune = export.Task.VideoTunes.Aggregate(string.Empty, (current, item) => !string.IsNullOrEmpty(current) ? string.Format("{0}, {1}", current, item.ShortName) : item.ShortName);
+ preset.VideoAvgBitrate = export.Task.VideoBitrate ?? 0;
+ preset.VideoColorMatrixCode = 0; // TODO not supported.
+ preset.VideoTurboTwoPass = export.Task.TurboFirstPass;
+ preset.VideoTwoPass = export.Task.TwoPass;
+
+ // Advanced
+ preset.x264Option = export.Task.AdvancedEncoderOptions;
+ preset.x264UseAdvancedOptions = export.Task.ShowAdvancedTab;
+
+ // Unknown
+ preset.ChildrenArray = new List<object>(); // TODO
+ preset.Folder = false; // TODO
+ preset.FolderOpen = false; // TODO
return preset;
}
+
/// <summary>
/// Get the OutputFormat Enum for a given string
/// </summary>
@@ -385,8 +533,8 @@ namespace HandBrakeWPF.Services.Presets.Factories /// </param>
/// <returns>
/// An OutputFormat Enum
- /// </returns>
- public static OutputFormat GetFileFormat(string format)
+ /// </returns>
+ private static OutputFormat GetFileFormat(string format)
{
switch (format.ToLower())
{
diff --git a/win/CS/HandBrakeWPF/Services/Presets/Factories/PlistFactory.cs b/win/CS/HandBrakeWPF/Services/Presets/Factories/PlistFactory.cs deleted file mode 100644 index d50f23be9..000000000 --- a/win/CS/HandBrakeWPF/Services/Presets/Factories/PlistFactory.cs +++ /dev/null @@ -1,320 +0,0 @@ -// --------------------------------------------------------------------------------------------------------------------
-// <copyright file="PlistFactory.cs" company="HandBrake Project (http://handbrake.fr)">
-// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
-// </copyright>
-// <summary>
-// Plist Preset Converter
-// </summary>
-// --------------------------------------------------------------------------------------------------------------------
-
-namespace HandBrakeWPF.Services.Presets.Factories
-{
- using System.Linq;
- using System.Text;
- using System.Xml;
-
- using HandBrake.ApplicationServices.Services.Encode.Model;
- using HandBrake.ApplicationServices.Services.Encode.Model.Models;
- using HandBrake.ApplicationServices.Utilities;
- using HandBrake.ApplicationServices.Interop.Model.Encoding;
-
- using HandBrakeWPF.Services.Presets.Model;
-
- /// <summary>
- /// Plist Preset Converter
- /// </summary>
- public class PlistFactory
- {
- #region Export
-
- /// <summary>
- /// Export a MacGui style plist preset.
- /// </summary>
- /// <param name="path">
- /// The path.
- /// </param>
- /// <param name="preset">
- /// The preset.
- /// </param>
- /// <param name="build">
- /// The build.PictureModulusPictureModulus
- /// </param>
- public static void Export(string path, Preset preset, string build)
- {
- if (string.IsNullOrEmpty(path))
- {
- return;
- }
-
- EncodeTask parsed = new EncodeTask(preset.Task);
- using (XmlTextWriter xmlWriter = new XmlTextWriter(path, Encoding.UTF8) { Formatting = Formatting.Indented })
- {
- // Header
- xmlWriter.WriteStartDocument();
- xmlWriter.WriteDocType(
- "plist", "-//Apple//DTD PLIST 1.0//EN", @"http://www.apple.com/DTDs/PropertyList-1.0.dtd", null);
-
- xmlWriter.WriteStartElement("plist");
- xmlWriter.WriteStartElement("array");
-
- // Add New Preset Here. Can write multiple presets here if required in future.
- WritePreset(xmlWriter, parsed, preset, build);
-
- // Footer
- xmlWriter.WriteEndElement();
- xmlWriter.WriteEndElement();
-
- xmlWriter.WriteEndDocument();
-
- // Closeout
- xmlWriter.Close();
- }
- }
-
- /// <summary>
- /// Write the Preset to a file
- /// </summary>
- /// <param name="xmlWriter">
- /// The xml writer.
- /// </param>
- /// <param name="parsed">
- /// The parsed.
- /// </param>
- /// <param name="preset">
- /// The preset.
- /// </param>
- /// <param name="build">
- /// The build.
- /// </param>
- private static void WritePreset(XmlTextWriter xmlWriter, EncodeTask parsed, Preset preset, string build)
- {
- xmlWriter.WriteStartElement("dict");
- AudioListArrayDict(xmlWriter, parsed);
- AddEncodeSettings(xmlWriter, parsed, preset, build);
-
- xmlWriter.WriteEndElement();
- }
-
- /// <summary>
- /// Add the encode settings to the preset
- /// </summary>
- /// <param name="xmlWriter">
- /// The xml writer.
- /// </param>
- /// <param name="parsed">
- /// The parsed.
- /// </param>
- /// <param name="preset">
- /// The preset.
- /// </param>
- /// <param name="build">
- /// The build.
- /// </param>
- private static void AddEncodeSettings(XmlTextWriter xmlWriter, EncodeTask parsed, Preset preset, string build)
- {
- AddBooleanElement(xmlWriter, "AudioAllowAACPass", parsed.AllowedPassthruOptions.AudioAllowAACPass);
- AddBooleanElement(xmlWriter, "AudioAllowAC3Pass", parsed.AllowedPassthruOptions.AudioAllowAC3Pass);
- AddBooleanElement(xmlWriter, "AudioAllowDTSHDPass", parsed.AllowedPassthruOptions.AudioAllowDTSHDPass);
- AddBooleanElement(xmlWriter, "AudioAllowDTSPass", parsed.AllowedPassthruOptions.AudioAllowDTSPass);
- AddBooleanElement(xmlWriter, "AudioAllowMP3Pass", parsed.AllowedPassthruOptions.AudioAllowMP3Pass);
-
- // TODO Update
- AddEncodeElement(xmlWriter, "AudioEncoderFallback", "string", EnumHelper<AudioEncoder>.GetDisplay(parsed.AllowedPassthruOptions.AudioEncoderFallback));
-
- AddBooleanElement(xmlWriter, "ChapterMarkers", parsed.IncludeChapterMarkers);
- AddEncodeElement(xmlWriter, "Default", "integer", "0");
- AddEncodeElement(xmlWriter, "FileFormat", "string", (parsed.OutputFormat == OutputFormat.Mp4) ? "MP4 file" : "MKV file"); // TODO
- AddBooleanElement(xmlWriter, "Folder", false);
- AddEncodeElement(xmlWriter, "Mp4HttpOptimize", "integer", parsed.OptimizeMP4 ? "1" : "0");
- AddEncodeElement(xmlWriter, "Mp4iPodCompatible", "integer", parsed.IPod5GSupport ? "1" : "0");
- AddEncodeElement(xmlWriter, "PictureAutoCrop", "integer", "1");
-
- // Filters
- AddEncodeElement(xmlWriter, "PictureDeblock", "integer", parsed.Deblock.ToString());
-
- AddBooleanElement(xmlWriter, "PictureDecombDeinterlace", parsed.Decomb != Decomb.Off);
- AddEncodeElement(xmlWriter, "PictureDecombCustom", "string", parsed.Decomb == Decomb.Custom ? parsed.CustomDecomb : string.Empty);
- AddEncodeElement(xmlWriter, "PictureDecomb", "integer", ((int)parsed.Decomb).ToString());
- AddEncodeElement(xmlWriter, "PictureDeinterlaceCustom", "string", parsed.Deinterlace == Deinterlace.Custom ? parsed.CustomDeinterlace : string.Empty);
- AddEncodeElement(xmlWriter, "PictureDeinterlace", "integer", ((int)parsed.Deinterlace).ToString());
-
- AddEncodeElement(xmlWriter, "PictureDenoiseFilter", "string", parsed.Denoise.ToString().ToLower());
- AddEncodeElement(xmlWriter, "PictureDenoiseCustom", "string", parsed.DenoisePreset == DenoisePreset.Custom ? parsed.CustomDenoise : string.Empty);
- AddEncodeElement(xmlWriter, "PictureDenoisePreset", "string", parsed.DenoisePreset.ToString().ToLower());
- if (parsed.Denoise == Denoise.NLMeans)
- {
- AddEncodeElement(xmlWriter, "PictureDenoiseTune", "string", parsed.DenoiseTune.ToString().ToLower());
- }
-
- AddEncodeElement(xmlWriter, "PictureDetelecine", "integer", ((int)parsed.Detelecine).ToString());
- AddEncodeElement(xmlWriter, "PictureDetelecineCustom", "string", parsed.Detelecine == Detelecine.Custom ? parsed.CustomDecomb : string.Empty);
-
- // Picture Settings
- AddEncodeElement(xmlWriter, "PictureHeight", "integer", parsed.MaxHeight.HasValue ? parsed.MaxHeight.Value.ToString() : parsed.Height.HasValue ? parsed.Height.Value.ToString() : "0");
- AddEncodeElement(xmlWriter, "PictureKeepRatio", "integer", parsed.KeepDisplayAspect ? "1" : "0");
- AddEncodeElement(xmlWriter, "PictureModulus", "integer", parsed.Modulus.ToString());
- AddEncodeElement(xmlWriter, "PicturePAR", "integer", ((int)parsed.Anamorphic).ToString());
- AddEncodeElement(xmlWriter, "PictureLeftCrop", "integer", parsed.Cropping.Left.ToString());
- AddEncodeElement(xmlWriter, "PictureRightCrop", "integer", parsed.Cropping.Right.ToString());
- AddEncodeElement(xmlWriter, "PictureTopCrop", "integer", parsed.Cropping.Top.ToString());
- AddEncodeElement(xmlWriter, "PictureBottomCrop", "integer", parsed.Cropping.Bottom.ToString());
- AddEncodeElement(xmlWriter, "PictureWidth", "integer", parsed.MaxWidth.HasValue ? parsed.MaxWidth.Value.ToString() : parsed.Width.HasValue ? parsed.Width.Value.ToString() : "0");
-
- // Preset Information
- AddEncodeElement(xmlWriter, "PresetBuildNumber", "string", build);
- AddEncodeElement(xmlWriter, "PresetDescription", "string", "No Description");
- AddEncodeElement(xmlWriter, "PresetName", "string", preset.Name);
- AddEncodeElement(xmlWriter, "Type", "integer", "1"); // 1 is user preset, 0 is built in
-
- // Preset Settings
- AddEncodeElement(xmlWriter, "UsesMaxPictureSettings", "integer", (parsed.MaxWidth != 0 || parsed.MaxHeight != 0) ? "1" : "0");
- AddEncodeElement(xmlWriter, "UsesPictureFilters", "integer", "1");
- AddEncodeElement(xmlWriter, "UsesPictureSettings", "integer", "1");
-
- // Video Settings
- AddEncodeElement(xmlWriter, "VideoAvgBitrate", "string", parsed.VideoBitrate.ToString());
- AddEncodeElement(xmlWriter, "VideoEncoder", "string", EnumHelper<VideoEncoder>.GetDisplay(parsed.VideoEncoder));
- AddEncodeElement(xmlWriter, "VideoFramerate", "string", parsed.Framerate == null ? "Same as source" : parsed.Framerate.ToString());
- AddEncodeElement(xmlWriter, "VideoFramerateMode", "string", parsed.FramerateMode.ToString().ToLower());
- AddBooleanElement(xmlWriter, "VideoGrayScale", parsed.Grayscale);
- AddEncodeElement(xmlWriter, "VideoQualitySlider", "real", parsed.Quality.ToString());
-
- if (parsed.VideoPreset != null)
- AddEncodeElement(xmlWriter, "VideoPreset", "string", parsed.VideoPreset.ShortName);
- if (parsed.VideoLevel != null)
- AddEncodeElement(xmlWriter, "VideoLevel", "string", parsed.VideoLevel.ShortName);
- if (parsed.VideoProfile != null)
- AddEncodeElement(xmlWriter, "VideoProfile", "string", parsed.VideoProfile.ShortName);
- if (parsed.VideoTunes != null)
- AddEncodeElement(xmlWriter, "VideoTune", "string", parsed.VideoTunes.Aggregate(string.Empty, (current, item) => string.IsNullOrEmpty(current) ? item.ShortName : "," + item.ShortName));
-
- AddEncodeElement(xmlWriter, "VideoOptionExtra", "string", parsed.ExtraAdvancedArguments);
- AddEncodeElement(xmlWriter, "x264UseAdvancedOptions", "integer", parsed.ShowAdvancedTab ? "1" : "0");
-
- int videoQualityType = 0;
- if (parsed.VideoBitrate != null) videoQualityType = 1;
- else if (parsed.Quality != null) videoQualityType = 2;
-
- AddEncodeElement(xmlWriter, "VideoQualityType", "integer", videoQualityType.ToString());
- AddEncodeElement(xmlWriter, "VideoTargetSize", "string", string.Empty);
- AddEncodeElement(xmlWriter, "VideoTurboTwoPass", "integer", parsed.TurboFirstPass ? "1" : "0");
- AddEncodeElement(xmlWriter, "VideoTwoPass", "integer", parsed.TwoPass ? "1" : "0");
-
- // x264 string
- AddEncodeElement(xmlWriter, "x264Option", "string", parsed.AdvancedEncoderOptions);
- }
-
- /// <summary>
- /// Add a boolean element
- /// </summary>
- /// <param name="xmlWriter">
- /// The xml writer.
- /// </param>
- /// <param name="keyName">
- /// The key name.
- /// </param>
- /// <param name="value">
- /// The value.
- /// </param>
- private static void AddBooleanElement(XmlTextWriter xmlWriter, string keyName, bool? value)
- {
- xmlWriter.WriteStartElement("key");
- xmlWriter.WriteString(keyName);
- xmlWriter.WriteEndElement();
- xmlWriter.WriteStartElement(value.HasValue ? value.Value ? "true" : "false" : "false");
- xmlWriter.WriteEndElement();
- }
-
- /// <summary>
- /// Add an encode setting element
- /// </summary>
- /// <param name="xmlWriter">
- /// The xml writer.
- /// </param>
- /// <param name="keyName">
- /// The key name.
- /// </param>
- /// <param name="type">
- /// The type.
- /// </param>
- /// <param name="value">
- /// The value.
- /// </param>
- private static void AddEncodeElement(XmlTextWriter xmlWriter, string keyName, string type, string value)
- {
- xmlWriter.WriteElementString("key", keyName);
-
- // This is a hack for Apples XML parser. It doesn't understand <integer /> so instead, always set a default value
- // of 0 if the value is empty.
- if (type == "integer" && string.IsNullOrEmpty(value))
- {
- value = "0";
- }
- xmlWriter.WriteElementString(type, value);
- }
-
- /// <summary>
- /// Add an Audio Track Array Dict
- /// </summary>
- /// <param name="xmlWriter">
- /// The xml writer.
- /// </param>
- /// <param name="parsed">
- /// The parsed.
- /// </param>
- private static void AudioListArrayDict(XmlTextWriter xmlWriter, EncodeTask parsed)
- {
- xmlWriter.WriteStartElement("key");
- xmlWriter.WriteString("AudioList");
- xmlWriter.WriteEndElement();
-
- xmlWriter.WriteStartElement("array");
- foreach (AudioTrack track in parsed.AudioTracks)
- {
- AddAudioItem(xmlWriter, track);
- }
- xmlWriter.WriteEndElement();
- }
-
- /// <summary>
- /// Add an audio track
- /// </summary>
- /// <param name="xmlWriter">
- /// The xml writer.
- /// </param>
- /// <param name="audioTrack">
- /// The audio track.
- /// </param>
- private static void AddAudioItem(XmlTextWriter xmlWriter, AudioTrack audioTrack)
- {
- xmlWriter.WriteStartElement("dict");
-
- xmlWriter.WriteElementString("key", "AudioBitrate");
- xmlWriter.WriteElementString("string", audioTrack.Bitrate.ToString());
-
- xmlWriter.WriteElementString("key", "AudioEncoder");
- xmlWriter.WriteElementString("string", EnumHelper<AudioEncoder>.GetDisplay(audioTrack.Encoder));
-
- xmlWriter.WriteElementString("key", "AudioMixdown");
- xmlWriter.WriteElementString("string", EnumHelper<Mixdown>.GetDisplay(audioTrack.MixDown));
-
- xmlWriter.WriteElementString("key", "AudioSamplerate");
- xmlWriter.WriteElementString("string", audioTrack.SampleRate.ToString().Replace("0", "Auto"));
-
- xmlWriter.WriteElementString("key", "AudioTrack");
- xmlWriter.WriteElementString("integer", audioTrack.Track.ToString());
-
- xmlWriter.WriteElementString("key", "AudioTrackDRCSlider");
- xmlWriter.WriteElementString("real", audioTrack.DRC.ToString());
-
- xmlWriter.WriteElementString("key", "AudioTrackDescription");
- xmlWriter.WriteElementString("string", "Unknown");
-
- xmlWriter.WriteElementString("key", "AudioTrackGainSlider");
- xmlWriter.WriteElementString("real", audioTrack.Gain.ToString());
-
- xmlWriter.WriteEndElement();
- }
- #endregion
- }
-}
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/Services/Presets/Interfaces/IPresetService.cs b/win/CS/HandBrakeWPF/Services/Presets/Interfaces/IPresetService.cs index de76a1af3..4f30c0aa3 100644 --- a/win/CS/HandBrakeWPF/Services/Presets/Interfaces/IPresetService.cs +++ b/win/CS/HandBrakeWPF/Services/Presets/Interfaces/IPresetService.cs @@ -11,6 +11,8 @@ namespace HandBrakeWPF.Services.Presets.Interfaces {
using System.Collections.ObjectModel;
+ using HandBrake.ApplicationServices.Model;
+
using HandBrakeWPF.Services.Presets.Model;
/// <summary>
@@ -53,6 +55,21 @@ namespace HandBrakeWPF.Services.Presets.Interfaces /// </param>
void Import(string filename);
+
+ /// <summary>
+ /// The export.
+ /// </summary>
+ /// <param name="filename">
+ /// The filename.
+ /// </param>
+ /// <param name="preset">
+ /// The preset.
+ /// </param>
+ /// <param name="configuration">
+ /// The configuration.
+ /// </param>
+ void Export(string filename, Preset preset, HBConfiguration configuration);
+
/// <summary>
/// Update a preset
/// </summary>
diff --git a/win/CS/HandBrakeWPF/Services/Presets/Model/Preset.cs b/win/CS/HandBrakeWPF/Services/Presets/Model/Preset.cs index 6f1da9c99..8e43dc4bb 100644 --- a/win/CS/HandBrakeWPF/Services/Presets/Model/Preset.cs +++ b/win/CS/HandBrakeWPF/Services/Presets/Model/Preset.cs @@ -77,11 +77,6 @@ namespace HandBrakeWPF.Services.Presets.Model public PresetPictureSettingsMode PictureSettingsMode { get; set; }
/// <summary>
- /// Gets or sets a value indicating whether use deinterlace.
- /// </summary>
- public bool UseDeinterlace { get; set; }
-
- /// <summary>
/// Gets or sets task.
/// </summary>
public EncodeTask Task { get; set; }
diff --git a/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs b/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs index e3aee79bf..c47b101a1 100644 --- a/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs +++ b/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs @@ -22,6 +22,7 @@ namespace HandBrakeWPF.Services.Presets using HandBrake.ApplicationServices.Interop;
using HandBrake.ApplicationServices.Interop.Json.Presets;
using HandBrake.ApplicationServices.Interop.Model.Encoding;
+ using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Services.Encode.Model.Models;
using HandBrake.ApplicationServices.Utilities;
@@ -193,13 +194,6 @@ namespace HandBrakeWPF.Services.Presets preset = JsonPresetFactory.ImportPreset(hbPreset);
preset.Category = UserPresetCatgoryName;
- // Handle the PictureDecombDeinterlace key
- if (preset.UseDeinterlace)
- {
- preset.Task.Decomb = Decomb.Off;
- preset.Task.CustomDecomb = string.Empty;
- }
-
// Depending on the selected preset options, we may need to change some settings around.
// If the user chose not to use fitlers, remove them.
if (!preset.UsePictureFilters)
@@ -254,6 +248,24 @@ namespace HandBrakeWPF.Services.Presets }
/// <summary>
+ /// The export.
+ /// </summary>
+ /// <param name="filename">
+ /// The filename.
+ /// </param>
+ /// <param name="preset">
+ /// The preset.
+ /// </param>
+ /// <param name="configuration">
+ /// The configuration.
+ /// </param>
+ public void Export(string filename, Preset preset, HBConfiguration configuration)
+ {
+ PresetTransportContainer container = JsonPresetFactory.ExportPreset(preset, configuration);
+ HandBrakePresetService.ExportPreset(filename, container);
+ }
+
+ /// <summary>
/// Update a preset
/// </summary>
/// <param name="update">
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index 60b0c74a5..4f4fbaf2d 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -1827,10 +1827,10 @@ namespace HandBrakeWPF.ViewModels {
SaveFileDialog savefiledialog = new SaveFileDialog
{
- Filter = "plist|*.plist",
+ Filter = "json|*.json",
CheckPathExists = true,
AddExtension = true,
- DefaultExt = ".plist",
+ DefaultExt = ".json",
OverwritePrompt = true,
FilterIndex = 0
};
@@ -1841,10 +1841,7 @@ namespace HandBrakeWPF.ViewModels if (!string.IsNullOrEmpty(filename))
{
- PlistFactory.Export(
- savefiledialog.FileName,
- this.selectedPreset,
- HandBrakeUtils.Build.ToString(CultureInfo.InvariantCulture));
+ this.presetService.Export(savefiledialog.FileName, this.selectedPreset, HBConfigurationFactory.Create());
}
}
else
|