lavr: Do not change the sample format for mono audio

This treats mono as planar internally within libavresample rather
than changing the sample format.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
This commit is contained in:
Justin Ruggles
2014-07-18 17:39:01 -04:00
committed by Luca Barbato
parent 9f17685dfb
commit fbc0b86599
4 changed files with 16 additions and 12 deletions

View File

@@ -101,16 +101,10 @@ int avresample_open(AVAudioResampleContext *avr)
av_get_sample_fmt_name(avr->internal_sample_fmt));
}
/* treat all mono as planar for easier comparison */
if (avr->in_channels == 1)
avr->in_sample_fmt = av_get_planar_sample_fmt(avr->in_sample_fmt);
if (avr->out_channels == 1)
avr->out_sample_fmt = av_get_planar_sample_fmt(avr->out_sample_fmt);
/* we may need to add an extra conversion in order to remap channels if
the output format is not planar */
if (avr->use_channel_map && !avr->mixing_needed && !avr->resample_needed &&
!av_sample_fmt_is_planar(avr->out_sample_fmt)) {
!ff_sample_fmt_is_planar(avr->out_sample_fmt, avr->out_channels)) {
avr->internal_sample_fmt = av_get_planar_sample_fmt(avr->out_sample_fmt);
}
@@ -119,7 +113,7 @@ int avresample_open(AVAudioResampleContext *avr)
avr->in_convert_needed = avr->in_sample_fmt != avr->internal_sample_fmt;
else
avr->in_convert_needed = avr->use_channel_map &&
!av_sample_fmt_is_planar(avr->out_sample_fmt);
!ff_sample_fmt_is_planar(avr->out_sample_fmt, avr->out_channels);
if (avr->resample_needed || avr->mixing_needed || avr->in_convert_needed)
avr->out_convert_needed = avr->internal_sample_fmt != avr->out_sample_fmt;