return ac;
}
- in_planar = av_sample_fmt_is_planar(in_fmt);
- out_planar = av_sample_fmt_is_planar(out_fmt);
+ in_planar = ff_sample_fmt_is_planar(in_fmt, channels);
+ out_planar = ff_sample_fmt_is_planar(out_fmt, channels);
if (in_planar == out_planar) {
ac->func_type = CONV_FUNC_TYPE_FLAT;
a->ptr_align = min_align;
}
+int ff_sample_fmt_is_planar(enum AVSampleFormat sample_fmt, int channels)
+{
+ if (channels == 1)
+ return 1;
+ else
+ return av_sample_fmt_is_planar(sample_fmt);
+}
+
int ff_audio_data_set_channels(AudioData *a, int channels)
{
if (channels < 1 || channels > AVRESAMPLE_MAX_CHANNELS ||
av_log(a, AV_LOG_ERROR, "invalid sample format\n");
return AVERROR(EINVAL);
}
- a->is_planar = av_sample_fmt_is_planar(sample_fmt);
+ a->is_planar = ff_sample_fmt_is_planar(sample_fmt, channels);
a->planes = a->is_planar ? channels : 1;
a->stride = a->sample_size * (a->is_planar ? 1 : channels);
av_free(a);
return NULL;
}
- a->is_planar = av_sample_fmt_is_planar(sample_fmt);
+ a->is_planar = ff_sample_fmt_is_planar(sample_fmt, channels);
a->planes = a->is_planar ? channels : 1;
a->stride = a->sample_size * (a->is_planar ? 1 : channels);
#include "avresample.h"
#include "internal.h"
+int ff_sample_fmt_is_planar(enum AVSampleFormat sample_fmt, int channels);
+
/**
* Audio buffer used for intermediate storage between conversion phases.
*/
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);
}
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;