FFmpeg
fftools
ffmpeg_mux.h
Go to the documentation of this file.
1
/*
2
* Muxer internal APIs - should not be included outside of ffmpeg_mux*
3
*
4
* This file is part of FFmpeg.
5
*
6
* FFmpeg is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU Lesser General Public
8
* License as published by the Free Software Foundation; either
9
* version 2.1 of the License, or (at your option) any later version.
10
*
11
* FFmpeg is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* Lesser General Public License for more details.
15
*
16
* You should have received a copy of the GNU Lesser General Public
17
* License along with FFmpeg; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
*/
20
21
#ifndef FFTOOLS_FFMPEG_MUX_H
22
#define FFTOOLS_FFMPEG_MUX_H
23
24
#include <stdatomic.h>
25
#include <stdint.h>
26
27
#include "
thread_queue.h
"
28
29
#include "
libavformat/avformat.h
"
30
31
#include "
libavcodec/packet.h
"
32
33
#include "
libavutil/dict.h
"
34
#include "
libavutil/fifo.h
"
35
#include "
libavutil/thread.h
"
36
37
typedef
struct
MuxStream
{
38
OutputStream
ost
;
39
40
// name used for logging
41
char
log_name
[32];
42
43
/* the packets are buffered here until the muxer is ready to be initialized */
44
AVFifo
*
muxing_queue
;
45
46
AVBSFContext
*
bsf_ctx
;
47
48
int64_t
max_frames
;
49
50
/*
51
* The size of the AVPackets' buffers in queue.
52
* Updated when a packet is either pushed or pulled from the queue.
53
*/
54
size_t
muxing_queue_data_size
;
55
56
int
max_muxing_queue_size
;
57
58
/* Threshold after which max_muxing_queue_size will be in effect */
59
size_t
muxing_queue_data_threshold
;
60
61
/* dts of the last packet sent to the muxer, in the stream timebase
62
* used for making up missing dts values */
63
int64_t
last_mux_dts
;
64
}
MuxStream
;
65
66
typedef
struct
Muxer
{
67
OutputFile
of
;
68
69
// name used for logging
70
char
log_name
[32];
71
72
AVFormatContext
*
fc
;
73
74
pthread_t
thread
;
75
ThreadQueue
*
tq
;
76
77
AVDictionary
*
opts
;
78
79
int
thread_queue_size
;
80
81
/* filesize limit expressed in bytes */
82
int64_t
limit_filesize
;
83
atomic_int_least64_t
last_filesize
;
84
int
header_written
;
85
86
SyncQueue
*
sq_mux
;
87
AVPacket
*
sq_pkt
;
88
}
Muxer
;
89
90
/* whether we want to print an SDP, set in of_open() */
91
extern
int
want_sdp
;
92
93
int
mux_check_init
(
Muxer
*mux);
94
95
static
MuxStream
*
ms_from_ost
(
OutputStream
*
ost
)
96
{
97
return
(
MuxStream
*)
ost
;
98
}
99
100
#endif
/* FFTOOLS_FFMPEG_MUX_H */
MuxStream::ost
OutputStream ost
Definition:
ffmpeg_mux.h:38
Muxer::fc
AVFormatContext * fc
Definition:
ffmpeg_mux.h:72
ms_from_ost
static MuxStream * ms_from_ost(OutputStream *ost)
Definition:
ffmpeg_mux.h:95
want_sdp
int want_sdp
Definition:
ffmpeg_mux.c:41
Muxer::thread
pthread_t thread
Definition:
ffmpeg_mux.h:74
thread.h
MuxStream::muxing_queue
AVFifo * muxing_queue
Definition:
ffmpeg_mux.h:44
MuxStream::max_muxing_queue_size
int max_muxing_queue_size
Definition:
ffmpeg_mux.h:56
Muxer::thread_queue_size
int thread_queue_size
Definition:
ffmpeg_mux.h:79
MuxStream::muxing_queue_data_threshold
size_t muxing_queue_data_threshold
Definition:
ffmpeg_mux.h:59
Muxer::of
OutputFile of
Definition:
ffmpeg_mux.h:67
AVDictionary
Definition:
dict.c:32
ost
static AVStream * ost
Definition:
vaapi_transcode.c:45
AVBSFContext
The bitstream filter state.
Definition:
bsf.h:68
mux_check_init
int mux_check_init(Muxer *mux)
Definition:
ffmpeg_mux.c:497
Muxer
Definition:
ffmpeg_mux.h:66
fifo.h
Muxer::tq
ThreadQueue * tq
Definition:
ffmpeg_mux.h:75
Muxer::sq_pkt
AVPacket * sq_pkt
Definition:
ffmpeg_mux.h:87
MuxStream::log_name
char log_name[32]
Definition:
ffmpeg_mux.h:41
MuxStream::max_frames
int64_t max_frames
Definition:
ffmpeg_mux.h:48
Muxer::limit_filesize
int64_t limit_filesize
Definition:
ffmpeg_mux.h:82
AVFormatContext
Format I/O context.
Definition:
avformat.h:1216
MuxStream::bsf_ctx
AVBSFContext * bsf_ctx
Definition:
ffmpeg_mux.h:46
Muxer::log_name
char log_name[32]
Definition:
ffmpeg_mux.h:70
Muxer::last_filesize
atomic_int_least64_t last_filesize
Definition:
ffmpeg_mux.h:83
Muxer::sq_mux
SyncQueue * sq_mux
Definition:
ffmpeg_mux.h:86
AVFifo
Definition:
fifo.c:35
Muxer::opts
AVDictionary * opts
Definition:
ffmpeg_mux.h:77
MuxStream
Definition:
ffmpeg_mux.h:37
pthread_t
Definition:
os2threads.h:44
MuxStream::muxing_queue_data_size
size_t muxing_queue_data_size
Definition:
ffmpeg_mux.h:54
packet.h
atomic_int_least64_t
intptr_t atomic_int_least64_t
Definition:
stdatomic.h:68
Muxer::header_written
int header_written
Definition:
ffmpeg_mux.h:84
ThreadQueue
Definition:
thread_queue.c:42
avformat.h
dict.h
SyncQueue
Definition:
sync_queue.c:45
thread_queue.h
AVPacket
This structure stores compressed data.
Definition:
packet.h:351
OutputStream
Definition:
muxing.c:54
MuxStream::last_mux_dts
int64_t last_mux_dts
Definition:
ffmpeg_mux.h:63
OutputFile
Definition:
ffmpeg.h:674
Generated on Mon Jan 30 2023 19:21:06 for FFmpeg by
1.8.17