Beispiel #1
0
        /// <summary>
        /// The setup quality compression limits.
        /// </summary>
        private void SetupQualityCompressionLimits()
        {
            HBAudioEncoder hbAudioEncoder = HandBrakeEncoderHelpers.GetAudioEncoder(EnumHelper <AudioEncoder> .GetShortName(this.Encoder));

            if (hbAudioEncoder.SupportsQuality)
            {
                RangeLimits limits = null;

                if (hbAudioEncoder.SupportsQuality)
                {
                    limits = hbAudioEncoder.QualityLimits;
                }

                if (limits != null)
                {
                    double        value  = limits.Ascending ? limits.Low : limits.High;
                    List <double> values = new List <double> {
                        value
                    };

                    if (limits.Ascending)
                    {
                        while (value < limits.High)
                        {
                            value += limits.Granularity;
                            values.Add(value);
                        }
                    }
                    else
                    {
                        while (value > limits.Low)
                        {
                            value -= limits.Granularity;
                            values.Add(value);
                        }
                    }

                    this.encoderQualityValues = values;
                }
                else
                {
                    this.encoderQualityValues = new List <double>();
                }
            }
            else
            {
                this.encoderQualityValues = new List <double>();
            }

            // Default the audio quality value if it's out of range.
            if (Equals(this.EncoderRateType, AudioEncoderRateType.Quality))
            {
                if (this.Quality.HasValue && !this.encoderQualityValues.Contains(this.Quality.Value))
                {
                    this.Quality = HandBrakeEncoderHelpers.GetDefaultQuality(hbAudioEncoder);
                }
            }

            this.NotifyOfPropertyChange(() => this.EncoderQualityValues);
        }
Beispiel #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HBAudioEncoder"/> class.
 /// </summary>
 /// <param name="compatibleContainers">
 /// The compatible containers.
 /// </param>
 /// <param name="compressionLimits">
 /// The compression limits.
 /// </param>
 /// <param name="defaultCompression">
 /// The default compression.
 /// </param>
 /// <param name="defaultQuality">
 /// The default quality.
 /// </param>
 /// <param name="displayName">
 /// The display name.
 /// </param>
 /// <param name="id">
 /// The id.
 /// </param>
 /// <param name="qualityLimits">
 /// The quality limits.
 /// </param>
 /// <param name="shortName">
 /// The short name.
 /// </param>
 public HBAudioEncoder(int compatibleContainers, RangeLimits compressionLimits, float defaultCompression, float defaultQuality, string displayName, int id, RangeLimits qualityLimits, string shortName)
 {
     this.CompatibleContainers = compatibleContainers;
     this.CompressionLimits = compressionLimits;
     this.DefaultCompression = defaultCompression;
     this.DefaultQuality = defaultQuality;
     this.DisplayName = displayName;
     this.Id = id;
     this.QualityLimits = qualityLimits;
     this.ShortName = shortName;
 }
Beispiel #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HBAudioEncoder"/> class.
 /// </summary>
 /// <param name="compatibleContainers">
 /// The compatible containers.
 /// </param>
 /// <param name="compressionLimits">
 /// The compression limits.
 /// </param>
 /// <param name="defaultCompression">
 /// The default compression.
 /// </param>
 /// <param name="defaultQuality">
 /// The default quality.
 /// </param>
 /// <param name="displayName">
 /// The display name.
 /// </param>
 /// <param name="id">
 /// The id.
 /// </param>
 /// <param name="qualityLimits">
 /// The quality limits.
 /// </param>
 /// <param name="shortName">
 /// The short name.
 /// </param>
 public HBAudioEncoder(int compatibleContainers, RangeLimits compressionLimits, float defaultCompression, float defaultQuality, string displayName, int id, RangeLimits qualityLimits, string shortName)
 {
     this.CompatibleContainers = compatibleContainers;
     this.CompressionLimits    = compressionLimits;
     this.DefaultCompression   = defaultCompression;
     this.DefaultQuality       = defaultQuality;
     this.DisplayName          = displayName;
     this.Id            = id;
     this.QualityLimits = qualityLimits;
     this.ShortName     = shortName;
 }