lavu/samplefmt: return the size of the allocated samples buffer at the next bump
Make the functions av_samples_fill_arrays, av_samples_alloc, and avcodec_fill_audio_frame return a buffer size rather than 0 in case of success. This will be enabled at the next libavutil major bump, in order to preserve backward compatibility. Returning the size allows to simplify the code, avoiding a few function calls.
This commit is contained in:
@ -171,7 +171,11 @@ int av_samples_fill_arrays(uint8_t **audio_data, int *linesize,
|
||||
if (linesize)
|
||||
*linesize = line_size;
|
||||
|
||||
#if FF_API_SAMPLES_UTILS_RETURN_ZERO
|
||||
return 0;
|
||||
#else
|
||||
return buf_size;
|
||||
#endif
|
||||
}
|
||||
|
||||
int av_samples_alloc(uint8_t **audio_data, int *linesize, int nb_channels,
|
||||
@ -196,7 +200,11 @@ int av_samples_alloc(uint8_t **audio_data, int *linesize, int nb_channels,
|
||||
|
||||
av_samples_set_silence(audio_data, 0, nb_samples, nb_channels, sample_fmt);
|
||||
|
||||
#if FF_API_SAMPLES_UTILS_RETURN_ZERO
|
||||
return 0;
|
||||
#else
|
||||
return size;
|
||||
#endif
|
||||
}
|
||||
|
||||
int av_samples_copy(uint8_t **dst, uint8_t * const *src, int dst_offset,
|
||||
|
Reference in New Issue
Block a user