summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsr55 <[email protected]>2018-04-23 21:52:42 +0100
committersr55 <[email protected]>2018-04-23 21:52:52 +0100
commitde49d8c04a8e31ef41368c5a09223f2d84c74944 (patch)
tree10877b8c6f13fdf008cf459e42cd1ddb20711380
parent128041edb0a8183bb4b27d906e31df4e3dfc32f4 (diff)
WinGui: Add support for setting mixdown, bitrate, sample rate, gain and DRC for the passthru encoder on the audio behaviour screen. This is used for the audio fallback encoder. #1291
-rw-r--r--win/CS/HandBrakeWPF/Model/Audio/AudioBehaviourTrack.cs15
-rw-r--r--win/CS/HandBrakeWPF/Services/Encode/Model/Models/AudioTrack.cs6
-rw-r--r--win/CS/HandBrakeWPF/Views/AudioDefaultsView.xaml29
3 files changed, 24 insertions, 26 deletions
diff --git a/win/CS/HandBrakeWPF/Model/Audio/AudioBehaviourTrack.cs b/win/CS/HandBrakeWPF/Model/Audio/AudioBehaviourTrack.cs
index 1297ecb71..0e16f83f1 100644
--- a/win/CS/HandBrakeWPF/Model/Audio/AudioBehaviourTrack.cs
+++ b/win/CS/HandBrakeWPF/Model/Audio/AudioBehaviourTrack.cs
@@ -127,7 +127,7 @@ namespace HandBrakeWPF.Model.Audio
{
get
{
- return this.IsPassthru ? null : this.mixDown;
+ return this.mixDown;
}
set
@@ -409,7 +409,7 @@ namespace HandBrakeWPF.Model.Audio
{
get
{
- if (this.IsPassthru || this.Encoder == AudioEncoder.ffflac || this.Encoder == AudioEncoder.ffflac24)
+ if (this.Encoder == AudioEncoder.ffflac || this.Encoder == AudioEncoder.ffflac24)
{
return false;
}
@@ -426,7 +426,7 @@ namespace HandBrakeWPF.Model.Audio
{
get
{
- if (this.IsPassthru || this.Encoder == AudioEncoder.ffflac || this.Encoder == AudioEncoder.ffflac24)
+ if (this.Encoder == AudioEncoder.ffflac || this.Encoder == AudioEncoder.ffflac24)
{
return false;
}
@@ -443,7 +443,7 @@ namespace HandBrakeWPF.Model.Audio
{
get
{
- if (this.IsPassthru || this.Encoder == AudioEncoder.ffflac || this.Encoder == AudioEncoder.ffflac24)
+ if (this.Encoder == AudioEncoder.ffflac || this.Encoder == AudioEncoder.ffflac24)
{
return false;
}
@@ -588,13 +588,13 @@ namespace HandBrakeWPF.Model.Audio
private void SetupMixdowns()
{
this.mixdowns = new BindingList<HBMixdown>(HandBrakeEncoderHelpers.Mixdowns.ToList());
-
+
HBAudioEncoder audioEncoder = HandBrakeEncoderHelpers.GetAudioEncoder(EnumHelper<AudioEncoder>.GetShortName(this.Encoder));
BindingList<HBMixdown> mixdownList = new BindingList<HBMixdown>();
foreach (HBMixdown mixdown in HandBrakeEncoderHelpers.Mixdowns)
{
- if (HandBrakeEncoderHelpers.MixdownHasCodecSupport(mixdown, audioEncoder))
+ if (HandBrakeEncoderHelpers.MixdownHasCodecSupport(mixdown, audioEncoder) || this.IsPassthru) // Show only supported, or all for passthru.
{
mixdownList.Add(mixdown);
}
@@ -606,7 +606,8 @@ namespace HandBrakeWPF.Model.Audio
// If the mixdown isn't supported, downgrade it to the best available.
if (!this.Mixdowns.Contains(this.MixDown))
{
- this.MixDown = this.Mixdowns.LastOrDefault();
+ this.mixDown = this.Mixdowns.LastOrDefault();
+ this.NotifyOfPropertyChange(() => this.MixDown);
}
}
diff --git a/win/CS/HandBrakeWPF/Services/Encode/Model/Models/AudioTrack.cs b/win/CS/HandBrakeWPF/Services/Encode/Model/Models/AudioTrack.cs
index 7cc073125..24a56a8b2 100644
--- a/win/CS/HandBrakeWPF/Services/Encode/Model/Models/AudioTrack.cs
+++ b/win/CS/HandBrakeWPF/Services/Encode/Model/Models/AudioTrack.cs
@@ -113,9 +113,11 @@ namespace HandBrakeWPF.Services.Encode.Model.Models
{
AudioEncoder chosenEncoder = track.Encoder;
HBAudioEncoder encoderInfo = HandBrakeEncoderHelpers.GetAudioEncoder(EnumHelper<AudioEncoder>.GetShortName(track.Encoder));
+ HBAudioEncoder fallbackEncoderInfo;
if (track.IsPassthru && (sourceTrack.Codec & encoderInfo.Id) == 0)
{
chosenEncoder = fallback;
+ encoderInfo = HandBrakeEncoderHelpers.GetAudioEncoder(EnumHelper<AudioEncoder>.GetShortName(track.Encoder));
}
this.scannedTrack = sourceTrack;
@@ -125,7 +127,9 @@ namespace HandBrakeWPF.Services.Encode.Model.Models
this.mixDown = track.MixDown != null ? track.MixDown.ShortName : "dpl2";
// If the mixdown isn't supported, downgrade it.
- if (track.MixDown != null && encoderInfo != null && !HandBrakeEncoderHelpers.MixdownIsSupported(track.MixDown, encoderInfo, sourceTrack.ChannelLayout))
+
+
+ if (track.IsPassthru && track.MixDown != null && encoderInfo != null && !HandBrakeEncoderHelpers.MixdownIsSupported(track.MixDown, encoderInfo, sourceTrack.ChannelLayout))
{
HBMixdown changedMixdown = HandBrakeEncoderHelpers.GetDefaultMixdown(encoderInfo, (ulong)sourceTrack.ChannelLayout);
if (changedMixdown != null)
diff --git a/win/CS/HandBrakeWPF/Views/AudioDefaultsView.xaml b/win/CS/HandBrakeWPF/Views/AudioDefaultsView.xaml
index 83214b6bc..bf6ee04ae 100644
--- a/win/CS/HandBrakeWPF/Views/AudioDefaultsView.xaml
+++ b/win/CS/HandBrakeWPF/Views/AudioDefaultsView.xaml
@@ -267,33 +267,26 @@
SelectedItem="{Binding Bitrate}"
Visibility="{Binding IsBitrateVisible, Converter={StaticResource boolToVisConverter}, ConverterParameter=false}" />
- <TextBlock Grid.Row="0" Grid.Column="6" VerticalAlignment="Center" FontWeight="Bold" Text="{x:Static Properties:ResourcesUI.AudioView_Mixdown}"
- Visibility="{Binding IsPassthru, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}" />
+ <TextBlock Grid.Row="0" Grid.Column="6" VerticalAlignment="Center" FontWeight="Bold" Text="{x:Static Properties:ResourcesUI.AudioView_Mixdown}" />
<ComboBox Grid.Row="0" Grid.Column="7" Height="22" Width="120" Margin="5,0,5,0" HorizontalAlignment="Stretch"
- ItemsSource="{Binding Mixdowns}"
- SelectedItem="{Binding MixDown}"
- DisplayMemberPath="DisplayName"
- Visibility="{Binding IsPassthru, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}" />
+ ItemsSource="{Binding Mixdowns}" SelectedItem="{Binding MixDown}"
+ DisplayMemberPath="DisplayName" />
- <TextBlock VerticalAlignment="Center" Grid.Column="8" FontWeight="Bold" Text="{x:Static Properties:ResourcesUI.AudioView_Samplerate}"
- Visibility="{Binding IsPassthru, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}" />
+ <TextBlock VerticalAlignment="Center" Grid.Column="8" FontWeight="Bold" Text="{x:Static Properties:ResourcesUI.AudioView_Samplerate}" />
<ComboBox Width="70" Height="22" Margin="5,0,5,0" Grid.Column="9"
ItemsSource="{Binding DataContext.SampleRates, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}"
- SelectedItem="{Binding SampleRateDisplayValue}"
- Visibility="{Binding IsPassthru, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}" />
+ SelectedItem="{Binding SampleRateDisplayValue}" />
- <TextBlock VerticalAlignment="Center" FontWeight="Bold" Text="{x:Static Properties:ResourcesUI.AudioView_DRC}" Grid.Column="10"
- Visibility="{Binding IsPassthru, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}" />
+ <TextBlock VerticalAlignment="Center" FontWeight="Bold" Text="{x:Static Properties:ResourcesUI.AudioView_DRC}" Grid.Column="10" />
<controls:NumberBox Name="drcNumericCtl" Width="45" Margin="5,0,5,0" HorizontalAlignment="Left" Grid.Column="11"
- Minimum="0" Modulus="0.1" Maximum="4" Number="{Binding DRC, Mode=TwoWay}" UpdateBindingOnTextChange="True" ShowIncrementButtons="True" AllowEmpty="False"
- Visibility="{Binding IsPassthru, Converter={StaticResource boolToHiddenVisConverter}, ConverterParameter=true}"/>
+ Minimum="0" Modulus="0.1" Maximum="4" Number="{Binding DRC, Mode=TwoWay}" UpdateBindingOnTextChange="True"
+ ShowIncrementButtons="True" AllowEmpty="False" />
- <TextBlock VerticalAlignment="Center" FontWeight="Bold" Text="{x:Static Properties:ResourcesUI.AudioView_Gain}" Grid.Column="12"
- Visibility="{Binding IsPassthru, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}" />
+ <TextBlock VerticalAlignment="Center" FontWeight="Bold" Text="{x:Static Properties:ResourcesUI.AudioView_Gain}" Grid.Column="12" />
<controls:NumberBox Name="gainNumericCtl" Width="45" Margin="5,0,5,0" HorizontalAlignment="Left" Grid.Column="13"
- Minimum="-20" Modulus="1" Maximum="20" Number="{Binding Gain, Mode=TwoWay}" UpdateBindingOnTextChange="True" ShowIncrementButtons="True" AllowEmpty="False"
- Visibility="{Binding IsPassthru, Converter={StaticResource boolToHiddenVisConverter}, ConverterParameter=true}"/>
+ Minimum="-20" Modulus="1" Maximum="20" Number="{Binding Gain, Mode=TwoWay}" UpdateBindingOnTextChange="True"
+ ShowIncrementButtons="True" AllowEmpty="False" />
</Grid>