From 7617bc4c41c7d79e1676e7edadd0ba71579c7ce3 Mon Sep 17 00:00:00 2001 From: sr55 Date: Sun, 5 Aug 2012 15:02:10 +0000 Subject: WinGui: Add Audio Track Name option back in. For now, I've used a toggle button on the audio track to expand the row to show hidden audio options. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4890 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- .../Model/Encoding/AudioTrack.cs | 21 ++++++++++++++--- .../Utilities/QueryGeneratorUtility.cs | 27 ++++++++++++++++++++++ 2 files changed, 45 insertions(+), 3 deletions(-) (limited to 'win/CS/HandBrake.ApplicationServices') diff --git a/win/CS/HandBrake.ApplicationServices/Model/Encoding/AudioTrack.cs b/win/CS/HandBrake.ApplicationServices/Model/Encoding/AudioTrack.cs index 7af4806f7..6e5803c09 100644 --- a/win/CS/HandBrake.ApplicationServices/Model/Encoding/AudioTrack.cs +++ b/win/CS/HandBrake.ApplicationServices/Model/Encoding/AudioTrack.cs @@ -63,9 +63,6 @@ namespace HandBrake.ApplicationServices.Model.Encoding [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] private Audio scannedTrack; - /// - /// The track name. - /// private string trackName; #endregion @@ -84,6 +81,7 @@ namespace HandBrake.ApplicationServices.Model.Encoding this.Bitrate = 160; this.DRC = 0; this.ScannedTrack = new Audio(); + this.TrackName = string.Empty; } /// @@ -102,6 +100,7 @@ namespace HandBrake.ApplicationServices.Model.Encoding this.mixDown = track.MixDown; this.sampleRate = track.SampleRate; this.scannedTrack = track.ScannedTrack ?? new Audio(); + this.TrackName = track.TrackName; } #endregion @@ -352,6 +351,22 @@ namespace HandBrake.ApplicationServices.Model.Encoding { get { return this; } } + + /// + /// Gets or sets the track name. + /// + public string TrackName + { + get + { + return this.trackName; + } + set + { + this.trackName = value; + } + } + #endregion } } \ No newline at end of file diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs b/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs index a3c84f089..c22ef6926 100644 --- a/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs +++ b/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs @@ -494,6 +494,7 @@ namespace HandBrake.ApplicationServices.Utilities List bitrates = new List(); List drcs = new List(); List gains = new List(); + List trackNames = new List(); // No Audio if (audioTracks.Count == 0) @@ -526,6 +527,9 @@ namespace HandBrake.ApplicationServices.Utilities // Gain (--gain) gains.Add(track.IsPassthru ? 0 : track.Gain); + + // Audio Track Name (--aname) + trackNames.Add(track.TrackName); } // Audio Track (-a) @@ -645,6 +649,29 @@ namespace HandBrake.ApplicationServices.Utilities if (audioItems.Trim() != String.Empty) query += " --gain " + audioItems; + audioItems = string.Empty; // Reset for another pass. + firstLoop = true; + + // Audio Track Names (--aname) + bool foundTrackName = false; + foreach (string trackName in trackNames) + { + if (!string.IsNullOrEmpty(trackName)) + { + foundTrackName = true; + } + + if (firstLoop) + { + audioItems = string.IsNullOrEmpty(trackName) ? "\"\"" : string.Format("\"{0}\"", trackName.Trim()); + firstLoop = false; + } + else + audioItems += "," + (string.IsNullOrEmpty(trackName) ? "\"\"" : string.Format("\"{0}\"", trackName.Trim())); + } + if (foundTrackName) + query += string.Format(" --aname={0}", audioItems); + // Passthru Settings if (task.AllowedPassthruOptions != null) { -- cgit v1.2.3