diff options
author | Justin Ruggles <justin.ruggles@gmail.com> | 2012-03-27 21:34:47 -0400 |
---|---|---|
committer | Justin Ruggles <justin.ruggles@gmail.com> | 2012-04-09 10:20:35 -0400 |
commit | 18ed3788b0ebdfde916eac969d7f9ecd5e884f39 (patch) | |
tree | f3cc288123abb473fbee2d1e64249fcbf8f2eaa5 /libavutil/samplefmt.c | |
parent | b6c4518a87fa7c91d00cf4e1acf9230f308b8f14 (diff) | |
download | ffmpeg-18ed3788b0ebdfde916eac969d7f9ecd5e884f39.tar.gz |
avutil: allow NULL linesize in av_samples_fill_arrays() and av_samples_alloc()
Diffstat (limited to 'libavutil/samplefmt.c')
-rw-r--r-- | libavutil/samplefmt.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libavutil/samplefmt.c b/libavutil/samplefmt.c index 960168d852..761009f2e2 100644 --- a/libavutil/samplefmt.c +++ b/libavutil/samplefmt.c @@ -140,17 +140,20 @@ int av_samples_fill_arrays(uint8_t **audio_data, int *linesize, uint8_t *buf, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align) { - int ch, planar, buf_size; + int ch, planar, buf_size, line_size; planar = av_sample_fmt_is_planar(sample_fmt); - buf_size = av_samples_get_buffer_size(linesize, nb_channels, nb_samples, + buf_size = av_samples_get_buffer_size(&line_size, nb_channels, nb_samples, sample_fmt, align); if (buf_size < 0) return buf_size; audio_data[0] = buf; for (ch = 1; planar && ch < nb_channels; ch++) - audio_data[ch] = audio_data[ch-1] + *linesize; + audio_data[ch] = audio_data[ch-1] + line_size; + + if (linesize) + *linesize = line_size; return 0; } |