diff options
author | sr55 <[email protected]> | 2012-01-15 21:31:31 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2012-01-15 21:31:31 +0000 |
commit | 36a94e10b20fa086a56beaeaeaa4ffdd37fbc297 (patch) | |
tree | 5c7a164746bb14d33073fe1ed4d006b0742e4723 /win | |
parent | 93b80efe3131f046cd6bb59a4e39384523803d7a (diff) |
WinGui: Updated app-services library with support for auto-passthru.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4412 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win')
3 files changed, 66 insertions, 2 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs b/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs index 13216b608..6f3500d9e 100644 --- a/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs +++ b/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs @@ -29,6 +29,7 @@ namespace HandBrake.ApplicationServices.Model this.AudioTracks = new ObservableCollection<AudioTrack>();
this.SubtitleTracks = new ObservableCollection<SubtitleTrack>();
this.ChapterNames = new ObservableCollection<ChapterMarker>();
+ this.AllowedPassthruOptions = new AllowedPassthru();
}
#region Source
@@ -262,6 +263,11 @@ namespace HandBrake.ApplicationServices.Model /// Gets or sets AudioEncodings.
/// </summary>
public ObservableCollection<AudioTrack> AudioTracks { get; set; }
+
+ /// <summary>
+ /// Gets or sets AllowedPassthruOptions.
+ /// </summary>
+ public AllowedPassthru AllowedPassthruOptions { get; set; }
#endregion
#region Subtitles
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs b/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs index 7ba4d2f7d..2f3d2b557 100644 --- a/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs +++ b/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs @@ -602,6 +602,44 @@ namespace HandBrake.ApplicationServices.Utilities if (audioItems.Trim() != String.Empty)
query += " -D " + audioItems;
+ // Passthru Settings
+ if (task.AllowedPassthruOptions != null)
+ {
+ string fallbackEncoders = string.Empty;
+
+ if (task.AllowedPassthruOptions.AudioAllowAACPass)
+ {
+ fallbackEncoders += "aac";
+ }
+
+ if (task.AllowedPassthruOptions.AudioAllowAC3Pass)
+ {
+ fallbackEncoders += string.IsNullOrEmpty(fallbackEncoders) ? "ac3" : ",ac3";
+ }
+
+ if (task.AllowedPassthruOptions.AudioAllowDTSHDPass)
+ {
+ fallbackEncoders += string.IsNullOrEmpty(fallbackEncoders) ? "dtshd" : ",dtshd";
+ }
+
+ if (task.AllowedPassthruOptions.AudioAllowDTSPass)
+ {
+ fallbackEncoders += string.IsNullOrEmpty(fallbackEncoders) ? "dts" : ",dts";
+ }
+
+ if (task.AllowedPassthruOptions.AudioAllowMP3Pass)
+ {
+ fallbackEncoders += string.IsNullOrEmpty(fallbackEncoders) ? "mp3" : ",mp3";
+ }
+
+ if (!string.IsNullOrEmpty(fallbackEncoders))
+ {
+ query += string.Format(" --audio-copy-mask {0}", fallbackEncoders);
+ }
+
+ query += string.Format(" --audio-fallback {0}", Converters.GetCliAudioEncoder(task.AllowedPassthruOptions.AudioEncoderFallback));
+ }
+
return query;
}
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/QueryParserUtility.cs b/win/CS/HandBrake.ApplicationServices/Utilities/QueryParserUtility.cs index 527ba35f4..e61db7dd7 100644 --- a/win/CS/HandBrake.ApplicationServices/Utilities/QueryParserUtility.cs +++ b/win/CS/HandBrake.ApplicationServices/Utilities/QueryParserUtility.cs @@ -9,6 +9,7 @@ namespace HandBrake.ApplicationServices.Utilities using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Globalization;
+ using System.Linq;
using System.Text.RegularExpressions;
using HandBrake.ApplicationServices.Functions;
@@ -100,6 +101,8 @@ namespace HandBrake.ApplicationServices.Utilities Match audioSampleRates = Regex.Match(input, @"-R ([0-9a-zA-Z.,]*)"); // Auto = a-z
Match drcValues = Regex.Match(input, @"-D ([0-9.,]*)");
Match gainValues = Regex.Match(input, @"--gain=([0-9.,-]*)");
+ Match fallbackEncoder = Regex.Match(input, @"--audio-fallback([a-zA-Z0-9:=\s]*)");
+ Match allowedPassthru = Regex.Match(input, @"--audio-copy-mask([a-zA-Z0-9:,=\s]*)");
// Chapters Tab
Match chapterMarkers = Regex.Match(input, @" -m");
@@ -139,7 +142,7 @@ namespace HandBrake.ApplicationServices.Utilities parsed.EndPoint = parsed.StartPoint;
}
}
-
+
#endregion
#region Output Settings
@@ -401,6 +404,23 @@ namespace HandBrake.ApplicationServices.Utilities parsed.AudioTracks = allAudioTrackInfo;
+ if (fallbackEncoder.Success)
+ {
+ parsed.AllowedPassthruOptions.AudioEncoderFallback =
+ Converters.GetAudioEncoderFromCliString(fallbackEncoder.Groups[1].ToString().Trim());
+ }
+
+ if (allowedPassthru.Success)
+ {
+ string[] allowedEncoders = allowedPassthru.Groups[1].ToString().Trim().Split(',');
+
+ parsed.AllowedPassthruOptions.AudioAllowAACPass = allowedEncoders.Contains("aac");
+ parsed.AllowedPassthruOptions.AudioAllowAC3Pass = allowedEncoders.Contains("ac3");
+ parsed.AllowedPassthruOptions.AudioAllowDTSHDPass = allowedEncoders.Contains("dtshd");
+ parsed.AllowedPassthruOptions.AudioAllowDTSPass = allowedEncoders.Contains("dts");
+ parsed.AllowedPassthruOptions.AudioAllowMP3Pass = allowedEncoders.Contains("mp3");
+ }
+
#endregion
#region Chapters Tab
@@ -422,7 +442,7 @@ namespace HandBrake.ApplicationServices.Utilities if (x264Profile.Success)
parsed.x264Profile =
Converters.Getx264ProfileFromCli(x264Profile.ToString().Replace("--x264-profile", string.Empty).Replace("=", string.Empty).Trim());
-
+
if (x264Tune.Success)
parsed.X264Tune =
Converters.Getx264TuneFromCli(x264Tune.ToString().Replace("--x264-tune", string.Empty).Replace("=", string.Empty).Trim());
|