/// <summary>
        /// Adds new audio stream with <see cref="Mp3LameAudioEncoder"/>.
        /// </summary>
        /// <seealso cref="AviWriter.AddEncodingAudioStream"/>
        /// <seealso cref="Mp3LameAudioEncoder"/>
        public static IAviAudioStream AddMp3LameAudioStream(this AviWriter writer, int channelCount, int sampleRate, int outputBitRateKbps = 160)
        {
            Argument.IsNotNull(writer, nameof(writer));
            Argument.IsInRange(channelCount, 1, 2, nameof(channelCount));
            Argument.IsPositive(sampleRate, nameof(sampleRate));
            Argument.Meets(Mp3LameAudioEncoder.SupportedBitRates.Contains(outputBitRateKbps), nameof(outputBitRateKbps));

            var encoder = new Mp3LameAudioEncoder(channelCount, sampleRate, outputBitRateKbps);

            return(writer.AddEncodingAudioStream(encoder, true));
        }
Beispiel #2
0
        /// <summary>
        /// Adds new audio stream with <see cref="Mp3AudioEncoderLame"/>.
        /// </summary>
        /// <seealso cref="AviWriter.AddEncodingAudioStream"/>
        /// <seealso cref="Mp3AudioEncoderLame"/>
        public static IAviAudioStream AddMp3AudioStream(this AviWriter writer, int channelCount, int sampleRate, int outputBitRateKbps = 160)
        {
            Contract.Requires(writer != null);
            Contract.Requires(channelCount == 1 || channelCount == 2);
            Contract.Requires(sampleRate > 0);
            Contract.Requires(Mp3AudioEncoderLame.SupportedBitRates.Contains(outputBitRateKbps));
            Contract.Ensures(Contract.Result <IAviAudioStream>() != null);

            var encoder = new Mp3AudioEncoderLame(channelCount, sampleRate, outputBitRateKbps);

            return(writer.AddEncodingAudioStream(encoder, true));
        }