Lines Matching refs:nb_samples
74 int channels, int nb_samples, in ff_audio_data_init() argument
104 a->allocated_samples = nb_samples * !read_only; in ff_audio_data_init()
105 a->nb_samples = nb_samples; in ff_audio_data_init()
119 AudioData *ff_audio_data_alloc(int channels, int nb_samples, in ff_audio_data_alloc() argument
149 if (nb_samples > 0) { in ff_audio_data_alloc()
150 ret = ff_audio_data_realloc(a, nb_samples); in ff_audio_data_alloc()
162 int ff_audio_data_realloc(AudioData *a, int nb_samples) in ff_audio_data_realloc() argument
167 if (a->allocated_samples >= nb_samples) in ff_audio_data_realloc()
175 a->allocated_channels, nb_samples, in ff_audio_data_realloc()
183 if (a->nb_samples > 0 && a->is_planar) { in ff_audio_data_realloc()
187 nb_samples, a->sample_fmt, 0); in ff_audio_data_realloc()
192 memcpy(new_data[p], a->data[p], a->nb_samples * a->stride); in ff_audio_data_realloc()
203 a->allocated_channels, nb_samples, in ff_audio_data_realloc()
209 a->allocated_samples = nb_samples; in ff_audio_data_realloc()
239 if (!src->nb_samples) { in ff_audio_data_copy()
240 dst->nb_samples = 0; in ff_audio_data_copy()
245 ret = ff_audio_data_realloc(dst, src->nb_samples); in ff_audio_data_copy()
255 src->nb_samples * src->stride); in ff_audio_data_copy()
262 src->nb_samples * src->stride); in ff_audio_data_copy()
264 av_samples_set_silence(&dst->data[p], 0, src->nb_samples, in ff_audio_data_copy()
270 memcpy(dst->data[p], src->data[p], src->nb_samples * src->stride); in ff_audio_data_copy()
273 dst->nb_samples = src->nb_samples; in ff_audio_data_copy()
279 int src_offset, int nb_samples) in ff_audio_data_combine() argument
290 if (dst_offset < 0 || dst_offset > dst->nb_samples || in ff_audio_data_combine()
291 src_offset < 0 || src_offset > src->nb_samples) { in ff_audio_data_combine()
298 if (nb_samples > src->nb_samples - src_offset) in ff_audio_data_combine()
299 nb_samples = src->nb_samples - src_offset; in ff_audio_data_combine()
300 if (nb_samples <= 0) in ff_audio_data_combine()
310 ret = ff_audio_data_realloc(dst, dst->nb_samples + nb_samples); in ff_audio_data_combine()
316 dst_offset2 = dst_offset + nb_samples; in ff_audio_data_combine()
317 dst_move_size = dst->nb_samples - dst_offset; in ff_audio_data_combine()
327 nb_samples * src->stride); in ff_audio_data_combine()
329 dst->nb_samples += nb_samples; in ff_audio_data_combine()
334 void ff_audio_data_drain(AudioData *a, int nb_samples) in ff_audio_data_drain() argument
336 if (a->nb_samples <= nb_samples) { in ff_audio_data_drain()
338 a->nb_samples = 0; in ff_audio_data_drain()
341 int move_offset = a->stride * nb_samples; in ff_audio_data_drain()
342 int move_size = a->stride * (a->nb_samples - nb_samples); in ff_audio_data_drain()
347 a->nb_samples -= nb_samples; in ff_audio_data_drain()
352 int nb_samples) in ff_audio_data_add_to_fifo() argument
357 if (offset >= a->nb_samples) in ff_audio_data_add_to_fifo()
363 return av_audio_fifo_write(af, (void **)offset_data, nb_samples); in ff_audio_data_add_to_fifo()
366 int ff_audio_data_read_from_fifo(AVAudioFifo *af, AudioData *a, int nb_samples) in ff_audio_data_read_from_fifo() argument
373 ret = ff_audio_data_realloc(a, nb_samples); in ff_audio_data_read_from_fifo()
377 ret = av_audio_fifo_read(af, (void **)a->data, nb_samples); in ff_audio_data_read_from_fifo()
379 a->nb_samples = ret; in ff_audio_data_read_from_fifo()