51 memset(afq, 0,
sizeof(*afq));
76 while (queue_end && queue_end->
next)
77 queue_end = queue_end->
next;
80 if (!(new_frame =
av_malloc(
sizeof(*new_frame))))
100 queue_end->
next = new_frame;
106 af_queue_log_state(afq);
116 int removed_samples = 0;
119 af_queue_log_state(afq);
145 while (removed_samples < nb_samples && afq->frame_queue) {
153 if (removed_samples < nb_samples && afq->remaining_samples > 0) {
155 nb_samples - removed_samples);
156 removed_samples += add_samples;
159 if (removed_samples > nb_samples)
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
This structure describes decoded (raw) audio or video data.
av_dlog(ac->avr,"%d samples - audio_convert: %s to %s (%s)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt), use_generic?ac->func_descr_generic:ac->func_descr)
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
void av_freep(void *arg)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
int64_t pts
presentation timestamp in time_base units (time when frame should be shown to user) If AV_NOPTS_VALUE...
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
void av_log(void *avcl, int level, const char *fmt,...)
int ff_af_queue_add(AudioFrameQueue *afq, const AVFrame *f)
Add a frame to the queue.
int sample_rate
samples per second
main external API structure.
rational number numerator/denominator
static void delete_next_frame(AudioFrameQueue *afq)
common internal api header.
common internal and external API header
void ff_af_queue_init(AVCodecContext *avctx, AudioFrameQueue *afq)
Initialize AudioFrameQueue.
void ff_af_queue_remove(AudioFrameQueue *afq, int nb_samples, int64_t *pts, int *duration)
Remove frame(s) from the queue.
void ff_af_queue_close(AudioFrameQueue *afq)
Close AudioFrameQueue.
static av_always_inline int64_t ff_samples_to_time_base(AVCodecContext *avctx, int64_t samples)
Rescale from sample rate to AVCodecContext.time_base.
int nb_samples
number of audio samples (per channel) described by this frame