History

lavu/samplefmt: add av_samples_alloc_array_and_pointers()

Stefano Sabatini committed 13 years ago

Commit 5c736451 parent 39aad434 files · +32 −1Browse files

Unified · Split

4 files
  1. doc/APIchanges +3 −0
  2. libavutil/samplefmt.c +15 −0
  3. libavutil/samplefmt.h +13 −0
  4. libavutil/version.h +1 −1
doc/APIchanges+3−0
@@ -15,6 +15,9 @@ libavutil: 2012-10-22 · 14 unmodified lines
15 15
16API changes, most recent first:16API changes, most recent first:
17 17
182013-03-30 - xxxxxxx - lavu 52.24.100 - samplefmt.h
19 Add av_samples_alloc_array_and_samples().
20
182013-03-29 - xxxxxxx - lavf 55.1.100 - avformat.h212013-03-29 - xxxxxxx - lavf 55.1.100 - avformat.h
19 Add av_guess_frame_rate()22 Add av_guess_frame_rate()
20 23
libavutil/samplefmt.c+15−0
@@ -207,6 +207,21 @@ int av_samples_alloc(uint8_t **audio_data, int *linesize, int nb_channels, · 206 unmodified lines
207#endif207#endif
208}208}
209 209
210int av_samples_alloc_array_and_samples(uint8_t ***audio_data, int *linesize, int nb_channels,
211 int nb_samples, enum AVSampleFormat sample_fmt, int align)
212{
213 int ret, nb_planes = av_sample_fmt_is_planar(sample_fmt) ? nb_channels : 1;
214
215 *audio_data = av_calloc(nb_planes, sizeof(*audio_data));
216 if (!*audio_data)
217 return AVERROR(ENOMEM);
218 ret = av_samples_alloc(*audio_data, linesize, nb_channels,
219 nb_samples, sample_fmt, align);
220 if (ret < 0)
221 av_freep(audio_data);
222 return ret;
223}
224
210int av_samples_copy(uint8_t **dst, uint8_t * const *src, int dst_offset,225int av_samples_copy(uint8_t **dst, uint8_t * const *src, int dst_offset,
211 int src_offset, int nb_samples, int nb_channels,226 int src_offset, int nb_samples, int nb_channels,
212 enum AVSampleFormat sample_fmt)227 enum AVSampleFormat sample_fmt)
libavutil/samplefmt.h+13−0
@@ -209,10 +209,23 @@ int av_samples_fill_arrays(uint8_t **audio_data, int *linesize, · 208 unmodified lines
209 * @return >=0 on success or a negative error code on failure209 * @return >=0 on success or a negative error code on failure
210 * @todo return the size of the allocated buffer in case of success at the next bump210 * @todo return the size of the allocated buffer in case of success at the next bump
211 * @see av_samples_fill_arrays()211 * @see av_samples_fill_arrays()
212 * @see av_samples_alloc_array_and_samples()
212 */213 */
213int av_samples_alloc(uint8_t **audio_data, int *linesize, int nb_channels,214int av_samples_alloc(uint8_t **audio_data, int *linesize, int nb_channels,
214 int nb_samples, enum AVSampleFormat sample_fmt, int align);215 int nb_samples, enum AVSampleFormat sample_fmt, int align);
215 216
217/**
218 * Allocate a data pointers array, samples buffer for nb_samples
219 * samples, and fill data pointers and linesize accordingly.
220 *
221 * This is the same as av_samples_alloc(), but also allocates the data
222 * pointers array.
223 *
224 * @see av_samples_alloc()
225 */
226int av_samples_alloc_array_and_samples(uint8_t ***audio_data, int *linesize, int nb_channels,
227 int nb_samples, enum AVSampleFormat sample_fmt, int align);
228
216/**229/**
217 * Copy samples from src to dst.230 * Copy samples from src to dst.
218 *231 *
libavutil/version.h+1−1
@@ -75,7 +75,7 @@ · 74 unmodified lines
75 */75 */
76 76
77#define LIBAVUTIL_VERSION_MAJOR 5277#define LIBAVUTIL_VERSION_MAJOR 52
78#define LIBAVUTIL_VERSION_MINOR 2378#define LIBAVUTIL_VERSION_MINOR 24
79#define LIBAVUTIL_VERSION_MICRO 10079#define LIBAVUTIL_VERSION_MICRO 100
80 80
81#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \81#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t