diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-08-04 04:49:43 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-08-04 04:49:48 +0400 |
commit | c62fea75747de132d69cdf8504ab6c8af26fa307 (patch) | |
tree | aa43d49d22eff48477167fd9aa359637015b7185 /libavresample/audio_data.c | |
parent | 8f6d36b3cb8e3afc6cfa3abb1582ec4d71a3e1ee (diff) | |
parent | fbc0b8659967ea54a8472b5f795270d38bb085dd (diff) |
Merge commit 'fbc0b8659967ea54a8472b5f795270d38bb085dd'
* commit 'fbc0b8659967ea54a8472b5f795270d38bb085dd':
lavr: Do not change the sample format for mono audio
Merged-by: Michael Niedermayer <michaelni@gmx.at>
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 1521d7e2d1..c2f545013c 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); |