summaryrefslogtreecommitdiffstats
path: root/win/CS
diff options
context:
space:
mode:
Diffstat (limited to 'win/CS')
-rw-r--r--win/CS/HandBrake.ApplicationServices/Model/Encoding/AudioTrack.cs21
-rw-r--r--win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs27
-rw-r--r--win/CS/HandBrakeWPF/Views/AudioView.xaml62
3 files changed, 91 insertions, 19 deletions
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;
- /// <summary>
- /// The track name.
- /// </summary>
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;
}
/// <summary>
@@ -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; }
}
+
+ /// <summary>
+ /// Gets or sets the track name.
+ /// </summary>
+ 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<int> bitrates = new List<int>();
List<double> drcs = new List<double>();
List<double> gains = new List<double>();
+ List<string> trackNames = new List<string>();
// 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)
{
diff --git a/win/CS/HandBrakeWPF/Views/AudioView.xaml b/win/CS/HandBrakeWPF/Views/AudioView.xaml
index a014c4e68..4e9c6d92f 100644
--- a/win/CS/HandBrakeWPF/Views/AudioView.xaml
+++ b/win/CS/HandBrakeWPF/Views/AudioView.xaml
@@ -20,6 +20,7 @@
<Audio:AudioBitrateConverter x:Key="audioBitrateConverter" />
<Audio:AudioEncoderConverter x:Key="audioEncoderConverter" />
</UserControl.Resources>
+
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
@@ -116,7 +117,14 @@
<ListBox.ItemTemplate>
<DataTemplate>
+
+
+
<Grid HorizontalAlignment="Stretch">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ </Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
@@ -124,14 +132,14 @@
</Grid.ColumnDefinitions>
<!-- Marker -->
- <Image Grid.Column="0"
+ <Image Grid.Column="0" Grid.Row="0"
Width="16"
Height="16"
Margin="10,0,10,0"
Source="Images/Movies.png" />
<!-- Settings -->
- <Grid Grid.Column="1" HorizontalAlignment="Stretch">
+ <Grid Grid.Column="1" Grid.Row="0" HorizontalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" MaxWidth="160" />
@@ -300,26 +308,48 @@
Value="{Binding Gain,
Mode=TwoWay}" />
+ <ToggleButton Name="advancedOptionsToggle" VerticalAlignment="Center" Grid.Column="6" Grid.Row="1" Grid.ColumnSpan="2"
+ FontWeight="Bold" Height="22" Padding="4,0" HorizontalAlignment="Left" >
+ <ToggleButton.Style>
+ <Style TargetType="{x:Type ToggleButton}">
+ <Setter Property="Content" Value="Show Advanced"/>
+ <Style.Triggers>
+ <Trigger Property="IsChecked" Value="True">
+ <Setter Property="Content" Value="Hide Advanced"/>
+ </Trigger>
+ <Trigger Property="IsChecked" Value="False">
+ <Setter Property="Content" Value="Show Advanced"/>
+ </Trigger>
+ </Style.Triggers>
+ </Style>
+ </ToggleButton.Style>
+ </ToggleButton>
+
</Grid>
<!-- Delete -->
- <Image Grid.Column="2"
- Width="16"
- Height="16"
- Margin="10,0,10,0"
- Source="Images/delete.png">
- <i:Interaction.Triggers>
- <i:EventTrigger EventName="MouseDown">
- <cal:ActionMessage MethodName="Remove">
- <cal:Parameter Value="{Binding}" />
- </cal:ActionMessage>
- </i:EventTrigger>
- </i:Interaction.Triggers>
- </Image>
+ <StackPanel Grid.Column="2" Grid.Row="0" VerticalAlignment="Center">
+ <Image Width="16" Height="16" Margin="10,0,10,0" Source="Images/delete.png">
+ <i:Interaction.Triggers>
+ <i:EventTrigger EventName="MouseDown">
+ <cal:ActionMessage MethodName="Remove">
+ <cal:Parameter Value="{Binding}" />
+ </cal:ActionMessage>
+ </i:EventTrigger>
+ </i:Interaction.Triggers>
+ </Image>
+ </StackPanel>
+ <!-- Hidden Row -->
+ <Grid Grid.Column="1" Grid.Row="1" HorizontalAlignment="Stretch" Visibility="{Binding IsChecked, ElementName=advancedOptionsToggle, Converter={StaticResource boolToVisConverter}}">
+ <StackPanel Orientation="Horizontal" Margin="0,5,0,5" >
+ <TextBlock Text="Track Name:" VerticalAlignment="Center" FontWeight="Bold" Margin="0,0,5,0" />
+ <TextBox Text="{Binding TrackName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Width="138" Height="22" />
+ </StackPanel>
+
+ </Grid>
</Grid>
-
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>