FFmpeg
Loading...
Searching...
No Matches
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 "
ffmpeg_sched.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
36
typedef
struct
MuxStream
{
37
OutputStream
ost
;
38
39
/**
40
* Codec parameters for packets submitted to the muxer (i.e. before
41
* bitstream filtering, if any).
42
*/
43
AVCodecParameters
*
par_in
;
44
45
// name used for logging
46
char
log_name
[32];
47
48
AVBSFContext
*
bsf_ctx
;
49
AVPacket
*
bsf_pkt
;
50
51
AVPacket
*
pkt
;
52
53
EncStats
stats
;
54
55
int
sch_idx
;
56
int
sch_idx_enc
;
57
int
sch_idx_src
;
58
59
int
sq_idx_mux
;
60
61
int64_t
max_frames
;
62
63
// timestamp from which the streamcopied streams should start,
64
// in AV_TIME_BASE_Q;
65
// everything before it should be discarded
66
int64_t
ts_copy_start
;
67
68
/* dts of the last packet sent to the muxer, in the stream timebase
69
* used for making up missing dts values */
70
int64_t
last_mux_dts
;
71
72
int64_t
stream_duration
;
73
AVRational
stream_duration_tb
;
74
75
// state for av_rescale_delta() call for audio in write_packet()
76
int64_t
ts_rescale_delta_last
;
77
78
// combined size of all the packets sent to the muxer
79
uint64_t
data_size_mux
;
80
81
int
copy_initial_nonkeyframes
;
82
int
copy_prior_start
;
83
int
streamcopy_started
;
84
85
AVRational
frame_rate
;
86
AVRational
max_frame_rate
;
87
int
force_fps
;
88
89
const
char
*
apad
;
90
}
MuxStream
;
91
92
typedef
struct
Muxer
{
93
OutputFile
of
;
94
95
// name used for logging
96
char
log_name
[32];
97
98
AVFormatContext
*
fc
;
99
100
Scheduler
*
sch
;
101
unsigned
sch_idx
;
102
103
// OutputStream indices indexed by scheduler stream indices
104
int
*
sch_stream_idx
;
105
int
nb_sch_stream_idx
;
106
107
AVDictionary
*
opts
;
108
109
// used to validate that all encoder avoptions have been actually used
110
AVDictionary
*
enc_opts_used
;
111
112
/* filesize limit expressed in bytes */
113
int64_t
limit_filesize
;
114
atomic_int_least64_t
last_filesize
;
115
int
header_written
;
116
117
SyncQueue
*
sq_mux
;
118
AVPacket
*
sq_pkt
;
119
}
Muxer
;
120
121
int
mux_check_init
(
void
*
arg
);
122
123
static
inline
MuxStream
*
ms_from_ost
(
OutputStream
*
ost
)
124
{
125
return
(
MuxStream
*)
ost
;
126
}
127
128
#endif
/* FFTOOLS_FFMPEG_MUX_H */
avformat.h
Main libavformat public API header.
int64_t
long long int64_t
Definition
coverity.c:34
dict.h
Public dictionary API.
atomic_int_least64_t
intptr_t atomic_int_least64_t
Definition
stdatomic.h:68
ms_from_ost
static MuxStream * ms_from_ost(OutputStream *ost)
Definition
ffmpeg_mux.h:123
mux_check_init
int mux_check_init(void *arg)
Definition
ffmpeg_mux.c:550
ffmpeg_sched.h
fifo.h
A generic FIFO API.
arg
const char * arg
Definition
jacosubdec.c:65
packet.h
AVBSFContext
The bitstream filter state.
Definition
bsf.h:68
AVCodecParameters
This struct describes the properties of an encoded stream.
Definition
codec_par.h:49
AVDictionary
Definition
dict.c:32
AVFormatContext
Format I/O context.
Definition
avformat.h:1333
AVPacket
This structure stores compressed data.
Definition
packet.h:580
AVRational
Rational number (pair of numerator and denominator).
Definition
rational.h:58
EncStats
Definition
ffmpeg.h:576
MuxStream
Definition
ffmpeg_mux.h:36
MuxStream::ost
OutputStream ost
Definition
ffmpeg_mux.h:37
MuxStream::apad
const char * apad
Definition
ffmpeg_mux.h:89
MuxStream::log_name
char log_name[32]
Definition
ffmpeg_mux.h:46
MuxStream::copy_prior_start
int copy_prior_start
Definition
ffmpeg_mux.h:82
MuxStream::pkt
AVPacket * pkt
Definition
ffmpeg_mux.h:51
MuxStream::sq_idx_mux
int sq_idx_mux
Definition
ffmpeg_mux.h:59
MuxStream::bsf_ctx
AVBSFContext * bsf_ctx
Definition
ffmpeg_mux.h:48
MuxStream::max_frames
int64_t max_frames
Definition
ffmpeg_mux.h:61
MuxStream::par_in
AVCodecParameters * par_in
Codec parameters for packets submitted to the muxer (i.e.
Definition
ffmpeg_mux.h:43
MuxStream::sch_idx_enc
int sch_idx_enc
Definition
ffmpeg_mux.h:56
MuxStream::bsf_pkt
AVPacket * bsf_pkt
Definition
ffmpeg_mux.h:49
MuxStream::data_size_mux
uint64_t data_size_mux
Definition
ffmpeg_mux.h:79
MuxStream::copy_initial_nonkeyframes
int copy_initial_nonkeyframes
Definition
ffmpeg_mux.h:81
MuxStream::sch_idx_src
int sch_idx_src
Definition
ffmpeg_mux.h:57
MuxStream::ts_rescale_delta_last
int64_t ts_rescale_delta_last
Definition
ffmpeg_mux.h:76
MuxStream::ts_copy_start
int64_t ts_copy_start
Definition
ffmpeg_mux.h:66
MuxStream::stream_duration
int64_t stream_duration
Definition
ffmpeg_mux.h:72
MuxStream::stream_duration_tb
AVRational stream_duration_tb
Definition
ffmpeg_mux.h:73
MuxStream::force_fps
int force_fps
Definition
ffmpeg_mux.h:87
MuxStream::last_mux_dts
int64_t last_mux_dts
Definition
ffmpeg_mux.h:70
MuxStream::stats
EncStats stats
Definition
ffmpeg_mux.h:53
MuxStream::sch_idx
int sch_idx
Definition
ffmpeg_mux.h:55
MuxStream::max_frame_rate
AVRational max_frame_rate
Definition
ffmpeg_mux.h:86
MuxStream::streamcopy_started
int streamcopy_started
Definition
ffmpeg_mux.h:83
MuxStream::frame_rate
AVRational frame_rate
Definition
ffmpeg_mux.h:85
Muxer
Definition
ffmpeg_mux.h:92
Muxer::opts
AVDictionary * opts
Definition
ffmpeg_mux.h:107
Muxer::enc_opts_used
AVDictionary * enc_opts_used
Definition
ffmpeg_mux.h:110
Muxer::of
OutputFile of
Definition
ffmpeg_mux.h:93
Muxer::last_filesize
atomic_int_least64_t last_filesize
Definition
ffmpeg_mux.h:114
Muxer::sq_pkt
AVPacket * sq_pkt
Definition
ffmpeg_mux.h:118
Muxer::nb_sch_stream_idx
int nb_sch_stream_idx
Definition
ffmpeg_mux.h:105
Muxer::header_written
int header_written
Definition
ffmpeg_mux.h:115
Muxer::sch
Scheduler * sch
Definition
ffmpeg_mux.h:100
Muxer::log_name
char log_name[32]
Definition
ffmpeg_mux.h:96
Muxer::sq_mux
SyncQueue * sq_mux
Definition
ffmpeg_mux.h:117
Muxer::fc
AVFormatContext * fc
Definition
ffmpeg_mux.h:98
Muxer::sch_idx
unsigned sch_idx
Definition
ffmpeg_mux.h:101
Muxer::sch_stream_idx
int * sch_stream_idx
Definition
ffmpeg_mux.h:104
Muxer::limit_filesize
int64_t limit_filesize
Definition
ffmpeg_mux.h:113
OutputFile
Definition
ffmpeg.h:687
OutputStream
Definition
mux.c:53
Scheduler
Definition
ffmpeg_sched.c:278
SyncQueue
A sync queue provides timestamp synchronization between multiple streams.
Definition
sync_queue.c:90
ost
static AVStream * ost
Definition
vaapi_transcode.c:42
Generated on Sun Aug 16 2026 20:20:43 for FFmpeg by
1.13.2