FFmpeg
4.0
libavcodec
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
{
28
int64_t
pts
;
29
int
duration
;
30
}
AudioFrame
;
31
32
typedef
struct
AudioFrameQueue
{
33
AVCodecContext
*
avctx
;
34
int
remaining_delay
;
35
int
remaining_samples
;
36
AudioFrame
*
frames
;
37
unsigned
frame_count
;
38
unsigned
frame_alloc
;
39
}
AudioFrameQueue
;
40
41
/**
42
* Initialize AudioFrameQueue.
43
*
44
* @param avctx context to use for time_base and av_log
45
* @param afq queue context
46
*/
47
void
ff_af_queue_init
(
AVCodecContext
*avctx,
AudioFrameQueue
*afq);
48
49
/**
50
* Close AudioFrameQueue.
51
*
52
* Frees memory if needed.
53
*
54
* @param afq queue context
55
*/
56
void
ff_af_queue_close
(
AudioFrameQueue
*afq);
57
58
/**
59
* Add a frame to the queue.
60
*
61
* @param afq queue context
62
* @param f frame to add to the queue
63
*/
64
int
ff_af_queue_add
(
AudioFrameQueue
*afq,
const
AVFrame
*f);
65
66
/**
67
* Remove frame(s) from the queue.
68
*
69
* Retrieves the pts of the next available frame, or a generated pts based on
70
* the last frame duration if there are no frames left in the queue. The number
71
* of requested samples should be the full number of samples represented by the
72
* packet that will be output by the encoder. If fewer samples are available
73
* in the queue, a smaller value will be used for the output duration.
74
*
75
* @param afq queue context
76
* @param nb_samples number of samples to remove from the queue
77
* @param[out] pts output packet pts
78
* @param[out] duration output packet duration
79
*/
80
void
ff_af_queue_remove
(
AudioFrameQueue
*afq,
int
nb_samples, int64_t *
pts
,
81
int64_t *
duration
);
82
83
#endif
/* AVCODEC_AUDIO_FRAME_QUEUE_H */
AVFrame
This structure describes decoded (raw) audio or video data.
Definition:
frame.h:218
AudioFrame::pts
int64_t pts
Definition:
audio_frame_queue.h:28
AudioFrameQueue::frames
AudioFrame * frames
Definition:
audio_frame_queue.h:36
AudioFrameQueue::remaining_delay
int remaining_delay
Definition:
audio_frame_queue.h:34
AudioFrameQueue::remaining_samples
int remaining_samples
Definition:
audio_frame_queue.h:35
ff_af_queue_remove
void ff_af_queue_remove(AudioFrameQueue *afq, int nb_samples, int64_t *pts, int64_t *duration)
Remove frame(s) from the queue.
Definition:
audio_frame_queue.c:75
AudioFrameQueue::avctx
AVCodecContext * avctx
Definition:
audio_frame_queue.h:33
ff_af_queue_close
void ff_af_queue_close(AudioFrameQueue *afq)
Close AudioFrameQueue.
Definition:
audio_frame_queue.c:36
AudioFrame
Definition:
audio_frame_queue.h:27
AudioFrameQueue::frame_count
unsigned frame_count
Definition:
audio_frame_queue.h:37
AudioFrameQueue
Definition:
audio_frame_queue.h:32
avcodec.h
Libavcodec external API header.
ff_af_queue_init
void ff_af_queue_init(AVCodecContext *avctx, AudioFrameQueue *afq)
Initialize AudioFrameQueue.
Definition:
audio_frame_queue.c:28
AudioFrameQueue::frame_alloc
unsigned frame_alloc
Definition:
audio_frame_queue.h:38
AVCodecContext
main external API structure.
Definition:
avcodec.h:1518
AudioFrame::duration
int duration
Definition:
audio_frame_queue.h: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:44
Generated on Tue May 22 2018 07:06:28 for FFmpeg by
1.8.13