summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF/Services
diff options
context:
space:
mode:
authorsr55 <[email protected]>2020-02-07 20:04:34 +0000
committersr55 <[email protected]>2020-02-07 20:04:34 +0000
commitb436ec04facbb390431738d37856e887fd2155e8 (patch)
treeb9c0673db490aba2374a3b758531c1fe1ddfe3e8 /win/CS/HandBrakeWPF/Services
parent4b2b5c36bae5c88e8106c5df5283717d11c46e90 (diff)
WinGui: AutoPassthru is now implemented using libhb using hb_autopassthru_get_encoder. This should solve a number of issues around selection. Fixes #2627 and #2611
Diffstat (limited to 'win/CS/HandBrakeWPF/Services')
-rw-r--r--win/CS/HandBrakeWPF/Services/Encode/Model/Models/AudioTrack.cs24
-rw-r--r--win/CS/HandBrakeWPF/Services/Encode/Model/Models/OutputFormat.cs6
2 files changed, 24 insertions, 6 deletions
diff --git a/win/CS/HandBrakeWPF/Services/Encode/Model/Models/AudioTrack.cs b/win/CS/HandBrakeWPF/Services/Encode/Model/Models/AudioTrack.cs
index 458d60ece..a5111ce6c 100644
--- a/win/CS/HandBrakeWPF/Services/Encode/Model/Models/AudioTrack.cs
+++ b/win/CS/HandBrakeWPF/Services/Encode/Model/Models/AudioTrack.cs
@@ -123,18 +123,36 @@ namespace HandBrakeWPF.Services.Encode.Model.Models
/// <param name="fallback">
/// An encoder to fall back to.
/// </param>
- public AudioTrack(AudioBehaviourTrack track, Audio sourceTrack, AudioEncoder fallback)
+ public AudioTrack(AudioBehaviourTrack track, Audio sourceTrack, AllowedPassthru fallback, OutputFormat container)
{
AudioEncoder chosenEncoder = track.Encoder;
HBAudioEncoder encoderInfo = HandBrakeEncoderHelpers.GetAudioEncoder(EnumHelper<AudioEncoder>.GetShortName(track.Encoder));
if (track.IsPassthru && (sourceTrack.Codec & encoderInfo.Id) == 0)
{
- chosenEncoder = fallback;
+ chosenEncoder = fallback.AudioEncoderFallback;
}
if (track.IsPassthru && chosenEncoder == AudioEncoder.Passthrough)
{
- chosenEncoder = fallback;
+ HBAudioEncoder fallbackEncoderInfo = HandBrakeEncoderHelpers.GetAudioEncoder(EnumHelper<AudioEncoder>.GetShortName(fallback.AudioEncoderFallback));
+
+ if (fallbackEncoderInfo != null)
+ {
+ int format = HandBrakeEncoderHelpers.GetContainer(EnumHelper<OutputFormat>.GetShortName(container)).Id;
+ int copyMask = checked((int)HandBrakeEncoderHelpers.BuildCopyMask(
+ fallback.AudioAllowMP3Pass,
+ fallback.AudioAllowAACPass,
+ fallback.AudioAllowAC3Pass,
+ fallback.AudioAllowDTSPass,
+ fallback.AudioAllowDTSHDPass,
+ fallback.AudioAllowEAC3Pass,
+ fallback.AudioAllowFlacPass,
+ fallback.AudioAllowTrueHDPass));
+
+ HBAudioEncoder autoPassthruEncoderOption = HandBrakeEncoderHelpers.GetAutoPassthruEncoder(sourceTrack.Codec, copyMask, fallbackEncoderInfo.Id, format);
+ AudioEncoder autoPassthru = EnumHelper<AudioEncoder>.GetValue(autoPassthruEncoderOption.ShortName);
+ chosenEncoder = autoPassthru;
+ }
}
encoderInfo = HandBrakeEncoderHelpers.GetAudioEncoder(EnumHelper<AudioEncoder>.GetShortName(chosenEncoder));
diff --git a/win/CS/HandBrakeWPF/Services/Encode/Model/Models/OutputFormat.cs b/win/CS/HandBrakeWPF/Services/Encode/Model/Models/OutputFormat.cs
index e9eb3c53a..5ee20aed6 100644
--- a/win/CS/HandBrakeWPF/Services/Encode/Model/Models/OutputFormat.cs
+++ b/win/CS/HandBrakeWPF/Services/Encode/Model/Models/OutputFormat.cs
@@ -17,15 +17,15 @@ namespace HandBrakeWPF.Services.Encode.Model.Models
public enum OutputFormat
{
[DisplayName("MP4")]
- [ShortName("mp4")]
+ [ShortName("av_mp4")]
Mp4 = 0,
[DisplayName("MKV")]
- [ShortName("mkv")]
+ [ShortName("av_mkv")]
Mkv,
[DisplayName("WebM")]
- [ShortName("webm")]
+ [ShortName("av_webm")]
WebM
}
}