Esempio n. 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AllowedPassthru"/> class.
 /// Copy Constructor
 /// </summary>
 /// <param name="initialValue">
 /// The initial value.
 /// </param>
 public AllowedPassthru(AllowedPassthru initialValue)
 {
     this.AudioAllowAACPass = initialValue.AudioAllowAACPass;
     this.AudioAllowAC3Pass = initialValue.AudioAllowAC3Pass;
     this.AudioAllowDTSHDPass = initialValue.AudioAllowDTSHDPass;
     this.AudioAllowDTSPass = initialValue.AudioAllowDTSPass;
     this.AudioAllowMP3Pass = initialValue.AudioAllowMP3Pass;
     this.AudioAllowEAC3Pass = initialValue.AudioAllowEAC3Pass;
     this.AudioAllowTrueHDPass = initialValue.AudioAllowTrueHDPass;
     this.AudioAllowFlacPass = initialValue.AudioAllowFlacPass;
     this.AudioEncoderFallback = initialValue.AudioEncoderFallback;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="AllowedPassthru"/> class.
 /// Copy Constructor
 /// </summary>
 /// <param name="initialValue">
 /// The initial value.
 /// </param>
 public AllowedPassthru(AllowedPassthru initialValue)
 {
     this.AudioAllowAACPass    = initialValue.AudioAllowAACPass;
     this.AudioAllowAC3Pass    = initialValue.AudioAllowAC3Pass;
     this.AudioAllowDTSHDPass  = initialValue.AudioAllowDTSHDPass;
     this.AudioAllowDTSPass    = initialValue.AudioAllowDTSPass;
     this.AudioAllowMP3Pass    = initialValue.AudioAllowMP3Pass;
     this.AudioAllowEAC3Pass   = initialValue.AudioAllowEAC3Pass;
     this.AudioAllowTrueHDPass = initialValue.AudioAllowTrueHDPass;
     this.AudioAllowFlacPass   = initialValue.AudioAllowFlacPass;
     this.AudioEncoderFallback = initialValue.AudioEncoderFallback;
 }
Esempio n. 3
0
        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.AudioEncoderFallback;
            }

            if (track.IsPassthru && chosenEncoder == AudioEncoder.Passthrough)
            {
                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.AudioAllowMP2Pass,
                                                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));

            this.scannedTrack = sourceTrack;
            this.drc          = track.DRC;
            this.encoder      = chosenEncoder;
            this.gain         = track.Gain;
            this.mixDown      = track.MixDown != null ? track.MixDown.ShortName : "dpl2";

            // If the mixdown isn't supported, downgrade it.
            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)
                {
                    this.mixDown = changedMixdown.ShortName;
                }
            }

            this.sampleRate      = track.SampleRate;
            this.encoderRateType = track.EncoderRateType;
            this.quality         = track.Quality;
            this.bitrate         = track.Bitrate;

            if (!string.IsNullOrEmpty(this.scannedTrack?.Name))
            {
                this.TrackName = this.scannedTrack.Name;
            }

            this.SetupLimits();
        }