diff options
author | Justin Ruggles <justin.ruggles@gmail.com> | 2014-07-18 17:39:01 -0400 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2014-08-03 23:13:26 +0200 |
commit | fbc0b8659967ea54a8472b5f795270d38bb085dd (patch) | |
tree | cef4d2a848b8e6e27e20479eb51e82fb866771c0 /libavresample/audio_data.c | |
parent | 9f17685dfb70a73823aca16ad246ee3b831d1de8 (diff) | |
download | ffmpeg-fbc0b8659967ea54a8472b5f795270d38bb085dd.tar.gz |
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>
Diffstat (limited to 'libavresample/audio_data.c')
-rw-r--r-- | libavresample/audio_data.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/libavresample/audio_data.c b/libavresample/audio_data.c index c52f518e9a..7a6fe74551 100644 --- a/libavresample/audio_data.c +++ b/libavresample/audio_data.c @@ -48,6 +48,14 @@ static void calc_ptr_alignment(AudioData *a) 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 || @@ -81,7 +89,7 @@ int ff_audio_data_init(AudioData *a, uint8_t **src, int plane_size, int 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); @@ -125,7 +133,7 @@ AudioData *ff_audio_data_alloc(int channels, int nb_samples, 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); |