/// <summary> /// Initializes a new instance of the <see cref="AudioTrack"/> class. /// Copy Constructor /// </summary> /// <param name="track"> /// The track. /// </param> public AudioBehaviourTrack(AudioBehaviourTrack track) { this.bitrate = track.Bitrate; this.drc = track.DRC; this.encoder = track.Encoder; this.gain = track.Gain; this.mixDown = track.MixDown; this.sampleRate = track.SampleRate; this.Quality = track.Quality; this.encoderRateType = track.EncoderRateType; this.SetupLimits(); }
/// <summary> /// Sanitizes a mixdown given the output codec and input channel layout. /// </summary> /// <param name="mixdown"> /// The desired mixdown. /// </param> /// <param name="encoder"> /// The output encoder to be used. /// </param> /// <param name="layout"> /// The input channel layout. /// </param> /// <returns> /// A sanitized mixdown value. /// </returns> public static HBMixdown SanitizeMixdown(HBMixdown mixdown, HBAudioEncoder encoder, ulong layout) { int sanitizedMixdown = HBFunctions.hb_mixdown_get_best((uint)encoder.Id, layout, mixdown.Id); return Mixdowns.Single(m => m.Id == sanitizedMixdown); }
/// <summary> /// Determines if the given mixdown supports the given channel layout. /// </summary> /// <param name="mixdown"> /// The mixdown to evaluate. /// </param> /// <param name="layout"> /// The channel layout to evaluate. /// </param> /// <returns> /// True if the mixdown supports the given channel layout. /// </returns> public static bool MixdownHasRemixSupport(HBMixdown mixdown, ulong layout) { return HBFunctions.hb_mixdown_has_remix_support(mixdown.Id, layout) > 0; }
/// <summary> /// Sanitizes an audio bitrate given the output codec, sample rate and mixdown. /// </summary> /// <param name="audioBitrate"> /// The desired audio bitrate. /// </param> /// <param name="encoder"> /// The output encoder to be used. /// </param> /// <param name="sampleRate"> /// The output sample rate to be used. /// </param> /// <param name="mixdown"> /// The mixdown to be used. /// </param> /// <returns> /// A sanitized audio bitrate. /// </returns> public static int SanitizeAudioBitrate(int audioBitrate, HBAudioEncoder encoder, int sampleRate, HBMixdown mixdown) { return HBFunctions.hb_audio_bitrate_get_best((uint)encoder.Id, audioBitrate, sampleRate, mixdown.Id); }
/// <summary> /// Determines if the given encoder supports the given mixdown. /// </summary> /// <param name="mixdown"> /// The mixdown to evaluate. /// </param> /// <param name="encoder"> /// The encoder to evaluate. /// </param> /// <returns> /// True if the encoder supports the mixdown. /// </returns> public static bool MixdownHasCodecSupport(HBMixdown mixdown, HBAudioEncoder encoder) { return HBFunctions.hb_mixdown_has_codec_support(mixdown.Id, (uint) encoder.Id) > 0; }
/// <summary> /// Gets the default audio bitrate for the given parameters. /// </summary> /// <param name="encoder"> /// The encoder to use. /// </param> /// <param name="sampleRate"> /// The sample rate to use. /// </param> /// <param name="mixdown"> /// The mixdown to use. /// </param> /// <returns> /// The default bitrate for these parameters. /// </returns> public static int GetDefaultBitrate(HBAudioEncoder encoder, int sampleRate, HBMixdown mixdown) { return HBFunctions.hb_audio_bitrate_get_default((uint) encoder.Id, sampleRate, mixdown.Id); }
/// <summary> /// Gets the bitrate limits for the given audio codec, sample rate and mixdown. /// </summary> /// <param name="encoder"> /// The audio encoder used. /// </param> /// <param name="sampleRate"> /// The sample rate used (Hz). /// </param> /// <param name="mixdown"> /// The mixdown used. /// </param> /// <returns> /// Limits on the audio bitrate for the given settings. /// </returns> public static BitrateLimits GetBitrateLimits(HBAudioEncoder encoder, int sampleRate, HBMixdown mixdown) { int low = 0; int high = 0; HBFunctions.hb_audio_bitrate_get_limits((uint)encoder.Id, sampleRate, mixdown.Id, ref low, ref high); return new BitrateLimits { Low = low, High = high }; }
/// <summary> /// Sanitizes a mixdown given the output codec and input channel layout. /// </summary> /// <param name="mixdown"> /// The desired mixdown. /// </param> /// <param name="encoder"> /// The output encoder to be used. /// </param> /// <param name="layout"> /// The input channel layout. /// </param> /// <returns> /// A sanitized mixdown value. /// </returns> public static HBMixdown SanitizeMixdown(HBMixdown mixdown, HBAudioEncoder encoder, ulong layout) { if (mixdown == null) { return null; } int sanitizedMixdown = HBFunctions.hb_mixdown_get_best((uint)encoder.Id, layout, mixdown.Id); if (sanitizedMixdown != -1) { return Mixdowns.Single(m => m.Id == sanitizedMixdown); } return Mixdowns.FirstOrDefault(); // "none" }
/// <summary> /// Determines if a mixdown is available for a given track and encoder. /// </summary> /// <param name="mixdown"> /// The mixdown to evaluate. /// </param> /// <param name="encoder"> /// The encoder to evaluate. /// </param> /// <param name="channelLayout">channel layout of the source track</param> /// <returns>True if available.</returns> public static bool MixdownIsSupported(HBMixdown mixdown, HBAudioEncoder encoder, int channelLayout) { return HBFunctions.hb_mixdown_is_supported(mixdown.Id, (uint)encoder.Id, (uint)channelLayout) > 0; }