FFmpeg
audio_frame_queue.h
Go to the documentation of this file.
1 /*
2  * Audio Frame Queue
3  * Copyright (c) 2012 Justin Ruggles
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #ifndef AVCODEC_AUDIO_FRAME_QUEUE_H
23 #define AVCODEC_AUDIO_FRAME_QUEUE_H
24 
25 #include "avcodec.h"
26 
27 typedef struct AudioFrame {
29  int duration;
30 } AudioFrame;
31 
32 typedef struct AudioFrameQueue {
38  unsigned frame_count;
39  unsigned frame_alloc;
41 
42 /**
43  * Initialize AudioFrameQueue.
44  *
45  * @param avctx context to use for time_base and av_log
46  * @param afq queue context
47  */
49 
50 /**
51  * Close AudioFrameQueue.
52  *
53  * Frees memory if needed.
54  *
55  * @param afq queue context
56  */
58 
59 /**
60  * Add a frame to the queue.
61  *
62  * @param afq queue context
63  * @param f frame to add to the queue
64  */
65 int ff_af_queue_add(AudioFrameQueue *afq, const AVFrame *f);
66 
67 /**
68  * Remove frame(s) from the queue.
69  *
70  * Retrieves the pts of the next available frame, or a generated pts based on
71  * the last frame duration if there are no frames left in the queue. The number
72  * of requested samples should be the full number of samples represented by the
73  * packet that will be output by the encoder. If fewer samples are available
74  * in the queue, a smaller value will be used for the output duration.
75  *
76  * @param afq queue context
77  * @param nb_samples number of samples to remove from the queue
78  * @param[out] pkt output packet
79  * @return 0 on success, negative AVERROR code on failure
80  */
81 int ff_af_queue_remove(AudioFrameQueue *afq, int nb_samples, AVPacket *pkt);
82 
83 #endif /* AVCODEC_AUDIO_FRAME_QUEUE_H */
AudioFrameQueue::frames
AudioFrame * frames
Definition: audio_frame_queue.h:37
int64_t
long long int64_t
Definition: coverity.c:34
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:472
AudioFrame::pts
int64_t pts
Definition: audio_frame_queue.h:28
AudioFrameQueue::remaining_delay
int remaining_delay
Definition: audio_frame_queue.h:35
AudioFrameQueue::remaining_samples
int remaining_samples
Definition: audio_frame_queue.h:36
AudioFrameQueue
Definition: audio_frame_queue.h:32
AudioFrameQueue::avctx
AVCodecContext * avctx
Definition: audio_frame_queue.h:33
f
f
Definition: af_crystalizer.c:122
ff_af_queue_close
void ff_af_queue_close(AudioFrameQueue *afq)
Close AudioFrameQueue.
Definition: audio_frame_queue.c:38
ff_af_queue_init
void ff_af_queue_init(AVCodecContext *avctx, AudioFrameQueue *afq)
Initialize AudioFrameQueue.
Definition: audio_frame_queue.c:29
ff_af_queue_add
int ff_af_queue_add(AudioFrameQueue *afq, const AVFrame *f)
Add a frame to the queue.
Definition: audio_frame_queue.c:46
AudioFrameQueue::output_delay
int output_delay
Definition: audio_frame_queue.h:34
avcodec.h
AudioFrameQueue::frame_count
unsigned frame_count
Definition: audio_frame_queue.h:38
AVCodecContext
main external API structure.
Definition: avcodec.h:443
AudioFrameQueue::frame_alloc
unsigned frame_alloc
Definition: audio_frame_queue.h:39
ff_af_queue_remove
int ff_af_queue_remove(AudioFrameQueue *afq, int nb_samples, AVPacket *pkt)
Remove frame(s) from the queue.
Definition: audio_frame_queue.c:87
AVPacket
This structure stores compressed data.
Definition: packet.h:580
AudioFrame
Definition: audio_frame_queue.h:27
pkt
static AVPacket * pkt
Definition: demux_decode.c:55
AudioFrame::duration
int duration
Definition: audio_frame_queue.h:29