41 for (p = 0; p < a->
planes; p++) {
43 while ((intptr_t)a->
data[p] % cur_align)
45 if (cur_align < min_align)
46 min_align = cur_align;
80 memset(a, 0,
sizeof(*a));
97 for (p = 0; p < (a->
is_planar ? channels : 1); p++) {
111 a->
name = name ? name :
"{no name}";
147 a->
name = name ? name :
"{no name}";
149 if (nb_samples > 0) {
164 int ret, new_buf_size, plane_size, p;
177 if (new_buf_size < 0)
191 for (p = 0; p < a->
planes; p++)
195 memcpy(a->
data, new_data,
sizeof(new_data));
252 for (p = 0; p < src->
planes; p++) {
259 for (p = 0; p < src->
planes; p++) {
269 for (p = 0; p < src->
planes; p++)
279 int src_offset,
int nb_samples)
281 int ret, p, dst_offset2, dst_move_size;
290 if (dst_offset < 0 || dst_offset > dst->
nb_samples ||
291 src_offset < 0 || src_offset > src->
nb_samples) {
293 src_offset, dst_offset);
298 if (nb_samples > src->
nb_samples - src_offset)
316 dst_offset2 = dst_offset + nb_samples;
319 for (p = 0; p < src->
planes; p++) {
320 if (dst_move_size > 0) {
321 memmove(dst->
data[p] + dst_offset2 * dst->
stride,
323 dst_move_size * dst->
stride);
325 memcpy(dst->
data[p] + dst_offset * dst->
stride,
327 nb_samples * src->
stride);
341 int move_offset = a->
stride * nb_samples;
344 for (p = 0; p < a->
planes; p++)
345 memmove(a->
data[p], a->
data[p] + move_offset, move_size);
359 offset_size = offset * a->
stride;
360 for (p = 0; p < a->
planes; p++)
361 offset_data[p] = a->
data[p] + offset_size;
unsigned int buffer_size
allocated buffer size
static void calc_ptr_alignment(AudioData *a)
const char * name
name for debug logging
int av_audio_fifo_read(AVAudioFifo *af, void **data, int nb_samples)
Read data from an AVAudioFifo.
int ff_audio_data_realloc(AudioData *a, int nb_samples)
Reallocate AudioData.
Audio buffer used for intermediate storage between conversion phases.
#define LIBAVUTIL_VERSION_INT
Memory handling functions.
int ff_audio_data_add_to_fifo(AVAudioFifo *af, AudioData *a, int offset, int nb_samples)
Add samples in AudioData to an AVAudioFifo.
int do_zero
zeroing needed
AudioData * ff_audio_data_alloc(int channels, int nb_samples, enum AVSampleFormat sample_fmt, const char *name)
Allocate AudioData.
int allow_realloc
realloc is allowed
const char * av_default_item_name(void *ptr)
Return the context name.
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
int channel_zero[AVRESAMPLE_MAX_CHANNELS]
dest index to zero
int nb_samples
current number of samples
static const AVClass audio_data_class
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
int sample_size
bytes per sample
int allocated_channels
allocated channel count
int read_only
data is read-only
int ff_sample_fmt_is_planar(enum AVSampleFormat sample_fmt, int channels)
int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt)
Check if the sample format is planar.
int ff_audio_data_set_channels(AudioData *a, int channels)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int av_samples_set_silence(uint8_t **audio_data, int offset, int nb_samples, int nb_channels, enum AVSampleFormat sample_fmt)
Fill an audio buffer with silence.
int stride
sample byte offset within a plane
int channels
channel count
int ff_audio_data_init(AudioData *a, uint8_t *const *src, int plane_size, int channels, int nb_samples, enum AVSampleFormat sample_fmt, int read_only, const char *name)
Initialize AudioData using a given source.
static const uint8_t offset[127][2]
int ff_audio_data_read_from_fifo(AVAudioFifo *af, AudioData *a, int nb_samples)
Read samples from an AVAudioFifo to AudioData.
int is_planar
sample format is planar
uint8_t * buffer
data buffer
Context for an Audio FIFO Buffer.
const AVClass * class
AVClass for logging.
int channel_copy[AVRESAMPLE_MAX_CHANNELS]
dest index to copy from
int ff_audio_data_combine(AudioData *dst, int dst_offset, AudioData *src, int src_offset, int nb_samples)
Append data from one AudioData to the end of another.
void ff_audio_data_drain(AudioData *a, int nb_samples)
Drain samples from the start of the AudioData.
int av_samples_alloc(uint8_t **audio_data, int *linesize, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align)
Allocate a samples buffer for nb_samples samples, and fill data pointers and linesize accordingly...
AVSampleFormat
Audio sample formats.
uint8_t * data[AVRESAMPLE_MAX_CHANNELS]
data plane pointers
#define AVRESAMPLE_MAX_CHANNELS
Describe the class of an AVClass context structure.
int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align)
Get the required buffer size for the given audio parameters.
const VDPAUPixFmtMap * map
int channel_map[AVRESAMPLE_MAX_CHANNELS]
source index of each output channel, -1 if not remapped
int av_audio_fifo_write(AVAudioFifo *af, void **data, int nb_samples)
Write data to an AVAudioFifo.
int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt)
Return number of bytes per sample.
int samples_align
allocated samples alignment
int ff_audio_data_copy(AudioData *dst, AudioData *src, ChannelMapInfo *map)
Copy data from one AudioData to another.
int av_samples_fill_arrays(uint8_t **audio_data, int *linesize, const uint8_t *buf, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align)
Fill plane data pointers and linesize for samples with sample format sample_fmt.
int allocated_samples
number of samples the buffer can hold
enum AVSampleFormat sample_fmt
sample format
void ff_audio_data_free(AudioData **a)
Free AudioData.
int ptr_align
minimum data pointer alignment
int planes
number of data planes