/// <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); }
// Tries to select the given mixdown. If it cannot, selects the last mixdown on the list. // Does not raise the propertychanged event. private void SelectMixdown(HBMixdown mixdown) { MixdownViewModel mixdownToSelect = this.MixdownChoices.FirstOrDefault(m => m.Mixdown == mixdown); if (mixdownToSelect != null) { this.selectedMixdown = mixdownToSelect; } else { this.selectedMixdown = this.MixdownChoices[this.MixdownChoices.Count - 1]; } }
/// <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 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> /// 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 }; }