diff options
author | sr55 <[email protected]> | 2011-10-08 15:33:37 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2011-10-08 15:33:37 +0000 |
commit | ae4e2cc4418c306249b80e7da1af006b5d1d9af2 (patch) | |
tree | f0c4bc50f4524aa22d705d9cfc5075860274317c /win/CS/HandBrake.ApplicationServices | |
parent | f85679b10f531df9a734692058aae734789267e5 (diff) |
WinGui: Converters and cli query handling code update for new x264 options.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4273 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrake.ApplicationServices')
3 files changed, 147 insertions, 1 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Functions/Converters.cs b/win/CS/HandBrake.ApplicationServices/Functions/Converters.cs index 34f9db46e..5557d2488 100644 --- a/win/CS/HandBrake.ApplicationServices/Functions/Converters.cs +++ b/win/CS/HandBrake.ApplicationServices/Functions/Converters.cs @@ -9,6 +9,7 @@ namespace HandBrake.ApplicationServices.Functions using System.Text.RegularExpressions;
using HandBrake.Interop.Model.Encoding;
+ using HandBrake.Interop.Model.Encoding.x264;
using OutputFormat = HandBrake.ApplicationServices.Model.Encoding.OutputFormat;
@@ -90,6 +91,7 @@ namespace HandBrake.ApplicationServices.Functions return Mixdown.DolbyProLogicII;
case "6 Channel Discrete":
return Mixdown.SixChannelDiscrete;
+ case "None":
case "Passthru":
return Mixdown.None;
default:
@@ -153,6 +155,8 @@ namespace HandBrake.ApplicationServices.Functions return "DTS-HD Passthru";
case "ffaac":
return "AAC (ffmpeg)";
+ case "ffflac":
+ return "Flac (ffmpeg)";
default:
return "AAC (faac)";
}
@@ -177,6 +181,8 @@ namespace HandBrake.ApplicationServices.Functions return AudioEncoder.Vorbis;
case "ac3":
return AudioEncoder.Ac3;
+ case "ffflac":
+ return AudioEncoder.ffflac;
case "copy:ac3":
return AudioEncoder.Ac3Passthrough;
case "copy:dts":
@@ -223,6 +229,8 @@ namespace HandBrake.ApplicationServices.Functions return AudioEncoder.AacPassthru;
case "MP3 Passthru":
return AudioEncoder.Mp3Passthru;
+ case "Flac (ffmpeg)":
+ return AudioEncoder.ffflac;
default:
return AudioEncoder.Faac;
}
@@ -261,7 +269,8 @@ namespace HandBrake.ApplicationServices.Functions return "copy:aac";
case AudioEncoder.Mp3Passthru:
return "copy:mp3";
-
+ case AudioEncoder.ffflac:
+ return "ffflac";
default:
return "faac";
}
@@ -325,6 +334,112 @@ namespace HandBrake.ApplicationServices.Functions #endregion
+ #region x264
+
+ /// <summary>
+ /// Get the x264Preset from a cli parameter
+ /// </summary>
+ /// <param name="preset">
+ /// The preset.
+ /// </param>
+ /// <returns>
+ /// The x264Preset enum value
+ /// </returns>
+ public static x264Preset Getx264PresetFromCli(string preset)
+ {
+ switch (preset)
+ {
+ case "ultrafast":
+ return x264Preset.Ultrafast;
+ case "superfast":
+ return x264Preset.Superfast;
+ case "veryfast":
+ return x264Preset.VeryFast;
+ case "faster":
+ return x264Preset.Faster;
+ case "fast":
+ return x264Preset.Fast;
+ case "medium":
+ return x264Preset.Medium;
+ case "slow":
+ return x264Preset.Slow;
+ case "slower":
+ return x264Preset.Slower;
+ case "veryslow":
+ return x264Preset.VerySlow;
+ case "placebo":
+ return x264Preset.Placebo;
+ default:
+ return x264Preset.Faster;
+ }
+ }
+
+ /// <summary>
+ /// Get the x264 Profile from the cli
+ /// </summary>
+ /// <param name="profile">
+ /// The preset.
+ /// </param>
+ /// <returns>
+ /// The x264Profile enum value
+ /// </returns>
+ public static x264Profile Getx264ProfileFromCli(string profile)
+ {
+ switch (profile)
+ {
+ case "baseline":
+ return x264Profile.Baseline;
+ case "main":
+ return x264Profile.Main;
+ case "high":
+ return x264Profile.High;
+ case "high10":
+ return x264Profile.High10;
+ case "high422":
+ return x264Profile.High422;
+ case "high444":
+ return x264Profile.High444;
+ default:
+ return x264Profile.Main;
+ }
+ }
+
+ /// <summary>
+ /// Get x264Tune enum from a cli string
+ /// </summary>
+ /// <param name="tune">
+ /// The tune.
+ /// </param>
+ /// <returns>
+ /// The x264Tune enum value
+ /// </returns>
+ public static x264Tune Getx264TuneFromCli(string tune)
+ {
+ switch (tune)
+ {
+ case "film":
+ return x264Tune.Film;
+ case "animation":
+ return x264Tune.Animation;
+ case "grain":
+ return x264Tune.Grain;
+ case "stillimage":
+ return x264Tune.Stillimage;
+ case "psnr":
+ return x264Tune.Psnr;
+ case "ssim":
+ return x264Tune.Ssim;
+ case "fastdecode":
+ return x264Tune.Fastdecode;
+ case "zerolatency":
+ return x264Tune.Zerolatency;
+ default:
+ return x264Tune.Film;
+ }
+ }
+
+ #endregion
+
#region File Format
/// <summary>
diff --git a/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs b/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs index ce46132af..593bd9e48 100644 --- a/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs +++ b/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs @@ -10,6 +10,7 @@ namespace HandBrake.ApplicationServices.Model using HandBrake.ApplicationServices.Model.Encoding;
using HandBrake.Interop.Model;
using HandBrake.Interop.Model.Encoding;
+ using HandBrake.Interop.Model.Encoding.x264;
using OutputFormat = HandBrake.ApplicationServices.Model.Encoding.OutputFormat;
@@ -294,6 +295,21 @@ namespace HandBrake.ApplicationServices.Model public string AdvancedEncoderOptions { get; set; }
/// <summary>
+ /// Gets or sets x264Preset.
+ /// </summary>
+ public x264Preset x264Preset { get; set; }
+
+ /// <summary>
+ /// Gets or sets x264Profile.
+ /// </summary>
+ public x264Profile x264Profile { get; set; }
+
+ /// <summary>
+ /// Gets or sets X264Tune.
+ /// </summary>
+ public x264Tune X264Tune { get; set; }
+
+ /// <summary>
/// Gets or sets Verbosity.
/// </summary>
public int Verbosity { get; set; }
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/QueryParserUtility.cs b/win/CS/HandBrake.ApplicationServices/Utilities/QueryParserUtility.cs index 99e673db9..ac9965c48 100644 --- a/win/CS/HandBrake.ApplicationServices/Utilities/QueryParserUtility.cs +++ b/win/CS/HandBrake.ApplicationServices/Utilities/QueryParserUtility.cs @@ -106,6 +106,9 @@ namespace HandBrake.ApplicationServices.Utilities // Advanced Tab
Match advanced = Regex.Match(input, @"-x ([.,/a-zA-Z0-9=:-]*)");
+ Match x264Preset = Regex.Match(input, @"--x264-preset([=a-zA-Z0-9\s]*)");
+ Match x264Tune = Regex.Match(input, @"--x264-tune([=a-zA-Z0-9\s]*)");
+ Match x264Profile = Regex.Match(input, @"-x264-profile([=a-zA-Z0-9\s]*)");
#endregion
@@ -408,6 +411,18 @@ namespace HandBrake.ApplicationServices.Utilities if (advanced.Success)
parsed.AdvancedEncoderOptions = advanced.ToString().Replace("-x ", string.Empty);
+ if (x264Preset.Success)
+ parsed.x264Preset =
+ Converters.Getx264PresetFromCli(x264Preset.ToString().Replace("--x264-preset", string.Empty).Replace("=", string.Empty).Trim());
+
+ if (x264Profile.Success)
+ parsed.x264Preset =
+ Converters.Getx264PresetFromCli(x264Profile.ToString().Replace("--x264-profile", string.Empty).Replace("=", string.Empty).Trim());
+
+ if (x264Tune.Success)
+ parsed.x264Preset =
+ Converters.Getx264PresetFromCli(x264Tune.ToString().Replace("--x264-tune", string.Empty).Replace("=", string.Empty).Trim());
+
#endregion
}
catch (Exception exc)
|