FFmpeg  2.1.1
ffmpeg.h
Go to the documentation of this file.
1 /*
2  * This file is part of FFmpeg.
3  *
4  * FFmpeg is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * FFmpeg is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with FFmpeg; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 #ifndef FFMPEG_H
20 #define FFMPEG_H
21 
22 #include "config.h"
23 
24 #include <stdint.h>
25 #include <stdio.h>
26 #include <signal.h>
27 
28 #if HAVE_PTHREADS
29 #include <pthread.h>
30 #endif
31 
32 #include "cmdutils.h"
33 
34 #include "libavformat/avformat.h"
35 #include "libavformat/avio.h"
36 
37 #include "libavcodec/avcodec.h"
38 
39 #include "libavfilter/avfilter.h"
40 
41 #include "libavutil/avutil.h"
42 #include "libavutil/dict.h"
43 #include "libavutil/eval.h"
44 #include "libavutil/fifo.h"
45 #include "libavutil/pixfmt.h"
46 #include "libavutil/rational.h"
47 
48 #include "libswresample/swresample.h"
49 
50 #define VSYNC_AUTO -1
51 #define VSYNC_PASSTHROUGH 0
52 #define VSYNC_CFR 1
53 #define VSYNC_VFR 2
54 #define VSYNC_VSCFR 0xfe
55 #define VSYNC_DROP 0xff
56 
57 #define MAX_STREAMS 1024 /* arbitrary sanity check value */
58 
59 /* select an input stream for an output stream */
60 typedef struct StreamMap {
61  int disabled; /* 1 is this mapping is disabled by a negative map */
66  char *linklabel; /* name of an output link, for mapping lavfi outputs */
67 } StreamMap;
68 
69 typedef struct {
70  int file_idx, stream_idx, channel_idx; // input
71  int ofile_idx, ostream_idx; // output
73 
74 typedef struct OptionsContext {
76 
77  /* input/output options */
78  int64_t start_time;
79  const char *format;
80 
93 
94  /* input options */
95  int64_t input_ts_offset;
96  int rate_emu;
98 
103 
104  /* output options */
107  AudioChannelMap *audio_channel_maps; /* one info entry per -map_channel */
108  int nb_audio_channel_maps; /* number of (valid) -map_channel settings */
112  const char **attachments;
114 
116 
117  int64_t recording_time;
118  int64_t stop_time;
119  uint64_t limit_filesize;
120  float mux_preload;
122  int shortest;
123 
128 
129  /* indexed by output file stream index */
132 
178  int nb_pass;
184  int nb_apad;
186 
187 typedef struct InputFilter {
189  struct InputStream *ist;
192 } InputFilter;
193 
194 typedef struct OutputFilter {
196  struct OutputStream *ost;
199 
200  /* temporary storage until stream maps are processed */
202 } OutputFilter;
203 
204 typedef struct FilterGraph {
205  int index;
206  const char *graph_desc;
207 
210 
215 } FilterGraph;
216 
217 typedef struct InputStream {
220  int discard; /* true if stream data should be discarded */
221  int decoding_needed; /* true if the packets must be decoded in 'raw_fifo' */
224  AVFrame *filter_frame; /* a ref of decoded_frame, to be sent to filters */
225 
226  int64_t start; /* time when read started */
227  /* predicted dts of the next packet read for this stream or (when there are
228  * several frames in a packet) of the next frame in current packet (in AV_TIME_BASE units) */
229  int64_t next_dts;
230  int64_t dts; ///< dts of the last packet read for this stream (in AV_TIME_BASE units)
231 
232  int64_t next_pts; ///< synthetic pts for the next decode frame (in AV_TIME_BASE units)
233  int64_t pts; ///< current pts of the decoded frame (in AV_TIME_BASE units)
235 
237 
238  double ts_scale;
239  int is_start; /* is 1 at the start and after a discontinuity */
243  AVRational framerate; /* framerate forced with -r */
246 
250 
255 
257  struct { /* previous decoded subtitle and related variables */
259  int ret;
261  } prev_sub;
262 
263  struct sub2video {
264  int64_t last_pts;
265  int64_t end_pts;
267  int w, h;
268  } sub2video;
269 
270  int dr1;
271 
272  /* decoded data from this stream goes into all those filters
273  * currently video and audio only */
276 
278 } InputStream;
279 
280 typedef struct InputFile {
282  int eof_reached; /* true if eof reached */
283  int eagain; /* true if last read attempt returned EAGAIN */
284  int ist_index; /* index of first stream in input_streams */
286  int64_t ts_offset;
287  int64_t last_ts;
288  int64_t start_time; /* user-specified start time in AV_TIME_BASE or AV_NOPTS_VALUE */
289  int64_t recording_time;
290  int nb_streams; /* number of stream that ffmpeg is aware of; may be different
291  from ctx.nb_streams if new streams appear during av_read_frame() */
292  int nb_streams_warn; /* number of streams that the user was warned of */
293  int rate_emu;
295 
296 #if HAVE_PTHREADS
297  pthread_t thread; /* thread reading from this file */
298  int finished; /* the thread has exited */
299  int joined; /* the thread has been joined */
300  pthread_mutex_t fifo_lock; /* lock for access to fifo */
301  pthread_cond_t fifo_cond; /* the main thread will signal on this cond after reading from fifo */
302  AVFifoBuffer *fifo; /* demuxed packets are stored here; freed by the main thread */
303 #endif
304 } InputFile;
305 
313 };
314 
315 extern const char *const forced_keyframes_const_names[];
316 
317 typedef struct OutputStream {
318  int file_index; /* file index */
319  int index; /* stream index in the output file */
320  int source_index; /* InputStream index */
321  AVStream *st; /* stream in the output file */
322  int encoding_needed; /* true if encoding needed for this stream */
324  /* input pts and corresponding output pts
325  for A/V sync */
326  struct InputStream *sync_ist; /* input stream to sync against */
327  int64_t sync_opts; /* output frame counter, could be changed to some true timestamp */ // FIXME look at frame_number
328  /* pts of the first frame encoded for this stream, used for limiting
329  * recording time */
330  int64_t first_pts;
331  /* dts of the last packet sent to the muxer */
332  int64_t last_mux_dts;
335  int64_t max_frames;
337 
338  /* video only */
342 
344 
345  /* forced key frames */
346  int64_t *forced_kf_pts;
352 
353  /* audio only */
354  int audio_channels_map[SWR_CH_MAX]; /* list of the channels id to pick from the source stream */
355  int audio_channels_mapped; /* number of channels in audio_channels_map */
356 
358  FILE *logfile;
359 
361  char *avfilter;
362 
363  int64_t sws_flags;
367  char *apad;
368  int finished; /* no more packets should be written for this stream */
369  int unavailable; /* true if the steram is unavailable (possibly temporarily) */
371  const char *attachment_filename;
374 
376 } OutputStream;
377 
378 typedef struct OutputFile {
381  int ost_index; /* index of the first stream in output_streams */
382  int64_t recording_time; ///< desired length of the resulting file in microseconds == AV_TIME_BASE units
383  int64_t start_time; ///< start time in microseconds == AV_TIME_BASE units
384  uint64_t limit_filesize; /* filesize limit expressed in bytes */
385 
386  int shortest;
387 } OutputFile;
388 
389 extern InputStream **input_streams;
390 extern int nb_input_streams;
391 extern InputFile **input_files;
392 extern int nb_input_files;
393 
395 extern int nb_output_streams;
396 extern OutputFile **output_files;
397 extern int nb_output_files;
398 
399 extern FilterGraph **filtergraphs;
400 extern int nb_filtergraphs;
401 
402 extern char *vstats_filename;
403 
404 extern float audio_drift_threshold;
405 extern float dts_delta_threshold;
406 extern float dts_error_threshold;
407 
408 extern int audio_volume;
409 extern int audio_sync_method;
410 extern int video_sync_method;
411 extern int do_benchmark;
412 extern int do_benchmark_all;
413 extern int do_deinterlace;
414 extern int do_hex_dump;
415 extern int do_pkt_dump;
416 extern int copy_ts;
417 extern int copy_tb;
418 extern int debug_ts;
419 extern int exit_on_error;
420 extern int print_stats;
421 extern int qp_hist;
422 extern int stdin_interaction;
423 extern int frame_bits_per_raw_sample;
424 extern AVIOContext *progress_avio;
425 extern float max_error_rate;
426 
427 extern const AVIOInterruptCB int_cb;
428 
429 extern const OptionDef options[];
430 
431 void term_init(void);
432 void term_exit(void);
433 
434 void reset_options(OptionsContext *o, int is_input);
435 void show_usage(void);
436 
437 void opt_output_file(void *optctx, const char *filename);
438 
440 
442 
443 enum AVPixelFormat choose_pixel_fmt(AVStream *st, AVCodec *codec, enum AVPixelFormat target);
444 void choose_sample_fmt(AVStream *st, AVCodec *codec);
445 
450 
451 int ffmpeg_parse_options(int argc, char **argv);
452 
453 #endif /* FFMPEG_H */
int64_t pts
current pts of the decoded frame (in AV_TIME_BASE units)
Definition: ffmpeg.h:233
SpecifierOpt * passlogfiles
Definition: ffmpeg.h:179
int nb_dump_attachment
Definition: ffmpeg.h:102
int got_output
Definition: ffmpeg.h:258
int guess_input_channel_layout(InputStream *ist)
Definition: ffmpeg.c:1505
int nb_metadata
Definition: ffmpeg.h:134
int nb_streamid_map
Definition: ffmpeg.h:131
int frame_number
Definition: ffmpeg.h:323
Definition: ffmpeg.h:307
int keep_pix_fmt
Definition: ffmpeg.h:375
Bytestream IO Context.
Definition: avio.h:68
float mux_preload
Definition: ffmpeg.h:120
int64_t recording_time
desired length of the resulting file in microseconds == AV_TIME_BASE units
Definition: ffmpeg.h:382
void term_init(void)
Definition: ffmpeg.c:325
uint8_t * name
Definition: ffmpeg.h:198
int nb_outputs
Definition: ffmpeg.h:214
AVDictionary * swr_opts
Definition: ffmpeg.h:365
int resample_channels
Definition: ffmpeg.h:253
This structure describes decoded (raw) audio or video data.
Definition: frame.h:96
void term_exit(void)
Definition: ffmpeg.c:303
int stream_copy
Definition: ffmpeg.h:370
AVRational frame_rate
Definition: ffmpeg.h:339
int64_t * forced_kf_pts
Definition: ffmpeg.h:346
int data_disable
Definition: ffmpeg.h:127
float mux_max_delay
Definition: ffmpeg.h:121
int exit_on_error
Definition: ffmpeg_opt.c:82
int accurate_seek
Definition: ffmpeg.h:294
int nb_forced_key_frames
Definition: ffmpeg.h:146
int * streamid_map
Definition: ffmpeg.h:130
int nb_stream_maps
Definition: ffmpeg.h:106
SpecifierOpt * copy_initial_nonkeyframes
Definition: ffmpeg.h:163
int ostream_idx
Definition: ffmpeg.h:71
AVStream * st
Definition: ffmpeg.h:321
AVRational framerate
Definition: ffmpeg.h:243
void choose_sample_fmt(AVStream *st, AVCodec *codec)
Definition: ffmpeg_filter.c:71
SpecifierOpt * reinit_filters
Definition: ffmpeg.h:171
SpecifierOpt * ts_scale
Definition: ffmpeg.h:99
AVFilterInOut * out_tmp
Definition: ffmpeg.h:201
int decoding_needed
Definition: ffmpeg.h:221
int nb_canvas_sizes
Definition: ffmpeg.h:176
FilterGraph * init_simple_filtergraph(InputStream *ist, OutputStream *ost)
int nb_frame_pix_fmts
Definition: ffmpeg.h:92
SpecifierOpt * sample_fmts
Definition: ffmpeg.h:141
SpecifierOpt * guess_layout_max
Definition: ffmpeg.h:181
int eagain
Definition: ffmpeg.h:283
AVBitStreamFilterContext * bitstream_filters
Definition: ffmpeg.h:333
forced_keyframes_const
Definition: ffmpeg.h:306
AVFrame * filter_frame
Definition: ffmpeg.h:224
int do_benchmark_all
Definition: ffmpeg_opt.c:76
int64_t input_ts_offset
Definition: ffmpeg.h:285
int do_hex_dump
Definition: ffmpeg_opt.c:77
int nb_filter_scripts
Definition: ffmpeg.h:170
int nb_input_streams
Definition: ffmpeg.c:145
AVCodec.
Definition: avcodec.h:2922
SpecifierOpt * filters
Definition: ffmpeg.h:167
int print_stats
Definition: ffmpeg_opt.c:83
float dts_error_threshold
Definition: ffmpeg_opt.c:69
int64_t start_time
start time in microseconds == AV_TIME_BASE units
Definition: ffmpeg.h:383
int index
Definition: ffmpeg.h:205
SpecifierOpt * qscale
Definition: ffmpeg.h:143
SpecifierOpt * frame_pix_fmts
Definition: ffmpeg.h:91
struct FilterGraph * graph
Definition: ffmpeg.h:190
SpecifierOpt * intra_matrices
Definition: ffmpeg.h:153
int encoding_needed
Definition: ffmpeg.h:322
Format I/O context.
Definition: avformat.h:968
struct InputStream * ist
Definition: ffmpeg.h:189
AVFilterGraph * graph
Definition: ffmpeg.h:208
char * logfile_prefix
Definition: ffmpeg.h:357
HMTX pthread_mutex_t
Definition: os2threads.h:38
int copy_initial_nonkeyframes
Definition: ffmpeg.h:372
uint8_t
int is_start
Definition: ffmpeg.h:239
int stdin_interaction
Definition: ffmpeg_opt.c:85
FILE * logfile
Definition: ffmpeg.h:358
AVDictionary * opts
Definition: ffmpeg.h:380
AVDictionary * opts
Definition: ffmpeg.h:364
Definition: eval.c:141
int do_benchmark
Definition: ffmpeg_opt.c:75
int audio_sync_method
Definition: ffmpeg_opt.c:72
int nb_max_frames
Definition: ffmpeg.h:136
int shortest
Definition: ffmpeg.h:386
int nb_streams
Definition: ffmpeg.h:290
pthread_t thread
Definition: ffmpeg.h:297
int sync_file_index
Definition: ffmpeg.h:64
AVDictionary * resample_opts
Definition: ffmpeg.h:366
void reset_options(OptionsContext *o, int is_input)
AVFilterContext * filter
Definition: ffmpeg.h:195
int nb_input_files
Definition: ffmpeg.c:147
SpecifierOpt * bitstream_filters
Definition: ffmpeg.h:137
int resample_sample_rate
Definition: ffmpeg.h:252
AVCodec * dec
Definition: ffmpeg.h:222
int top_field_first
Definition: ffmpeg.h:244
int nb_output_streams
Definition: ffmpeg.c:150
int file_index
Definition: ffmpeg.h:218
const OptionDef options[]
Definition: ffserver.c:4682
struct InputStream::sub2video sub2video
int resample_pix_fmt
Definition: ffmpeg.h:249
int resample_height
Definition: ffmpeg.h:247
int64_t filter_in_rescale_delta_last
Definition: ffmpeg.h:236
int wrap_correction_done
Definition: ffmpeg.h:234
int ist_in_filtergraph(FilterGraph *fg, InputStream *ist)
int64_t next_dts
Definition: ffmpeg.h:229
Callback for checking whether to abort blocking functions.
Definition: avio.h:51
int nb_top_field_first
Definition: ffmpeg.h:158
int rate_emu
Definition: ffmpeg.h:293
int ffmpeg_parse_options(int argc, char **argv)
Definition: ffmpeg_opt.c:2519
FilterGraph ** filtergraphs
Definition: ffmpeg.c:154
const AVIOInterruptCB int_cb
Definition: ffmpeg.c:422
AVFilterContext * filter
Definition: ffmpeg.h:188
int nb_filters
Definition: ffmpeg.h:168
int64_t start_time
Definition: ffmpeg.h:78
int64_t start
Definition: ffmpeg.h:226
unsigned m
Definition: audioconvert.c:186
int64_t last_mux_dts
Definition: ffmpeg.h:332
int video_sync_method
Definition: ffmpeg_opt.c:73
SpecifierOpt * apad
Definition: ffmpeg.h:183
int64_t sws_flags
Definition: ffmpeg.h:363
const char *const forced_keyframes_const_names[]
Definition: ffmpeg.c:110
int dr1
Definition: ffmpeg.h:270
AudioChannelMap * audio_channel_maps
Definition: ffmpeg.h:107
int finished
Definition: ffmpeg.h:368
SpecifierOpt * codec_tags
Definition: ffmpeg.h:139
SpecifierOpt * rc_overrides
Definition: ffmpeg.h:151
int video_disable
Definition: ffmpeg.h:124
int force_fps
Definition: ffmpeg.h:340
int nb_codec_names
Definition: ffmpeg.h:82
AVPixelFormat
Pixel format.
Definition: pixfmt.h:66
int qp_hist
Definition: ffmpeg_opt.c:84
StreamMap * stream_maps
Definition: ffmpeg.h:105
uint64_t limit_filesize
Definition: ffmpeg.h:119
const char * format
Definition: ffmpeg.h:79
int nb_passlogfiles
Definition: ffmpeg.h:180
int nb_force_fps
Definition: ffmpeg.h:148
OutputFilter * filter
Definition: ffmpeg.h:360
AVRational frame_aspect_ratio
Definition: ffmpeg.h:343
int nb_sample_fmts
Definition: ffmpeg.h:142
AVDictionary * opts
Definition: ffmpeg.h:242
int file_index
Definition: ffmpeg.h:62
int nb_audio_channel_maps
Definition: ffmpeg.h:108
SpecifierOpt * filter_scripts
Definition: ffmpeg.h:169
int nb_attachments
Definition: ffmpeg.h:113
int nb_output_files
Definition: ffmpeg.c:152
char * linklabel
Definition: ffmpeg.h:66
int nb_ts_scale
Definition: ffmpeg.h:100
SpecifierOpt * audio_channels
Definition: ffmpeg.h:83
int saw_first_ts
Definition: ffmpeg.h:240
int nb_audio_sample_rate
Definition: ffmpeg.h:86
int metadata_chapters_manual
Definition: ffmpeg.h:111
struct OutputStream * ost
Definition: ffmpeg.h:196
int accurate_seek
Definition: ffmpeg.h:97
char * apad
Definition: ffmpeg.h:367
AVFifoBuffer * fifo
Definition: ffmpeg.h:302
SpecifierOpt * pass
Definition: ffmpeg.h:177
SpecifierOpt * audio_sample_rate
Definition: ffmpeg.h:85
double forced_keyframes_expr_const_values[FKF_NB]
Definition: ffmpeg.h:351
void opt_output_file(void *optctx, const char *filename)
SpecifierOpt * dump_attachment
Definition: ffmpeg.h:101
SpecifierOpt * canvas_sizes
Definition: ffmpeg.h:175
int nb_codec_tags
Definition: ffmpeg.h:140
int nb_filtergraphs
Definition: ffmpeg.c:155
int64_t last_ts
Definition: ffmpeg.h:287
SpecifierOpt * metadata_map
Definition: ffmpeg.h:159
int do_pkt_dump
Definition: ffmpeg_opt.c:78
int64_t max_frames
Definition: ffmpeg.h:335
int audio_channels_mapped
Definition: ffmpeg.h:355
SpecifierOpt * copy_prior_start
Definition: ffmpeg.h:165
SpecifierOpt * frame_aspect_ratios
Definition: ffmpeg.h:149
SpecifierOpt * frame_sizes
Definition: ffmpeg.h:89
int stream_idx
Definition: ffmpeg.h:70
int finished
Definition: ffmpeg.h:298
int ret
Definition: ffmpeg.h:259
int audio_volume
Definition: ffmpeg_opt.c:71
Stream structure.
Definition: avformat.h:667
A linked-list of the inputs/outputs of the filter chain.
Definition: avfilter.h:1338
InputFilter ** filters
Definition: ffmpeg.h:274
int fix_sub_duration
Definition: ffmpeg.h:256
int64_t recording_time
Definition: ffmpeg.h:289
SpecifierOpt * frame_rates
Definition: ffmpeg.h:87
pthread_mutex_t fifo_lock
Definition: ffmpeg.h:300
int nb_presets
Definition: ffmpeg.h:162
int ost_index
Definition: ffmpeg.h:381
struct InputStream * sync_ist
Definition: ffmpeg.h:326
double ts_scale
Definition: ffmpeg.h:238
int64_t recording_time
Definition: ffmpeg.h:117
int unavailable
Definition: ffmpeg.h:369
int chapters_input_file
Definition: ffmpeg.h:115
int64_t stop_time
Definition: ffmpeg.h:118
float max_error_rate
Definition: ffmpeg_opt.c:87
int nb_copy_prior_start
Definition: ffmpeg.h:166
int ist_index
Definition: ffmpeg.h:284
const char * graph_desc
Definition: ffmpeg.h:206
int guess_layout_max
Definition: ffmpeg.h:245
enum AVPixelFormat choose_pixel_fmt(AVStream *st, AVCodec *codec, enum AVPixelFormat target)
Definition: ffmpeg_filter.c:38
int64_t start_time
Definition: ffmpeg.h:288
int rate_emu
Definition: ffmpeg.h:96
int metadata_streams_manual
Definition: ffmpeg.h:110
const char * attachment_filename
Definition: ffmpeg.h:371
int configure_output_filter(FilterGraph *fg, OutputFilter *ofilter, AVFilterInOut *out)
void assert_avoptions(AVDictionary *m)
Definition: ffmpeg.c:514
int audio_disable
Definition: ffmpeg.h:125
int64_t input_ts_offset
Definition: ffmpeg.h:95
AVFrame * decoded_frame
Definition: ffmpeg.h:223
int audio_channels_map[SWR_CH_MAX]
Definition: ffmpeg.h:354
int nb_bitstream_filters
Definition: ffmpeg.h:138
SpecifierOpt * top_field_first
Definition: ffmpeg.h:157
AVStream * st
Definition: ffmpeg.h:219
int configure_filtergraph(FilterGraph *fg)
OutputStream ** output_streams
Definition: ffmpeg.c:149
rational number numerator/denominator
Definition: rational.h:43
int file_index
Definition: ffmpeg.h:318
int metadata_global_manual
Definition: ffmpeg.h:109
int64_t sync_opts
Definition: ffmpeg.h:327
char * vstats_filename
Definition: ffmpeg_opt.c:65
SpecifierOpt * force_fps
Definition: ffmpeg.h:147
int nb_fix_sub_duration
Definition: ffmpeg.h:174
int nb_inter_matrices
Definition: ffmpeg.h:156
int nb_streams_warn
Definition: ffmpeg.h:292
int shortest
Definition: ffmpeg.h:122
int showed_multi_packet_warning
Definition: ffmpeg.h:241
int frame_bits_per_raw_sample
Definition: ffmpeg_opt.c:86
int64_t ts_offset
Definition: ffmpeg.h:286
int nb_qscale
Definition: ffmpeg.h:144
float audio_drift_threshold
Definition: ffmpeg_opt.c:67
AVFrame * filtered_frame
Definition: ffmpeg.h:336
int nb_audio_channels
Definition: ffmpeg.h:84
int source_index
Definition: ffmpeg.h:320
int copy_prior_start
Definition: ffmpeg.h:373
struct InputStream::@39 prev_sub
SpecifierOpt * metadata
Definition: ffmpeg.h:133
int nb_filters
Definition: ffmpeg.h:275
AVExpr * forced_keyframes_pexpr
Definition: ffmpeg.h:350
int64_t dts
dts of the last packet read for this stream (in AV_TIME_BASE units)
Definition: ffmpeg.h:230
int forced_kf_count
Definition: ffmpeg.h:347
int resample_sample_fmt
Definition: ffmpeg.h:251
int nb_intra_matrices
Definition: ffmpeg.h:154
char * forced_keyframes
Definition: ffmpeg.h:349
int nb_frame_rates
Definition: ffmpeg.h:88
int resample_width
Definition: ffmpeg.h:248
int64_t next_pts
synthetic pts for the next decode frame (in AV_TIME_BASE units)
Definition: ffmpeg.h:232
int reconfiguration
Definition: ffmpeg.h:209
struct FilterGraph * graph
Definition: ffmpeg.h:197
uint64_t limit_filesize
Definition: ffmpeg.h:384
SpecifierOpt * presets
Definition: ffmpeg.h:161
AVIOContext * progress_avio
Definition: ffmpeg.c:133
int reinit_filters
Definition: ffmpeg.h:277
int nb_frame_sizes
Definition: ffmpeg.h:90
OptionGroup * g
Definition: ffmpeg.h:75
SpecifierOpt * inter_matrices
Definition: ffmpeg.h:155
#define SWR_CH_MAX
Maximum number of channels.
Definition: swresample.h:102
SpecifierOpt * forced_key_frames
Definition: ffmpeg.h:145
const char ** attachments
Definition: ffmpeg.h:112
int copy_ts
Definition: ffmpeg_opt.c:79
AVFormatContext * ctx
Definition: ffmpeg.h:281
int stream_index
Definition: ffmpeg.h:63
AVCodec * enc
Definition: ffmpeg.h:334
AVSubtitle subtitle
Definition: ffmpeg.h:260
int eof_reached
Definition: ffmpeg.h:282
int nb_metadata_map
Definition: ffmpeg.h:160
int forced_kf_index
Definition: ffmpeg.h:348
int nb_rc_overrides
Definition: ffmpeg.h:152
int do_deinterlace
Definition: ffmpeg_opt.c:74
SpecifierOpt * fix_sub_duration
Definition: ffmpeg.h:173
Definition: ffmpeg.h:312
char * avfilter
Definition: ffmpeg.h:361
uint8_t * name
Definition: ffmpeg.h:191
float dts_delta_threshold
Definition: ffmpeg_opt.c:68
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31))))#defineSET_CONV_FUNC_GROUP(ofmt, ifmt) staticvoidset_generic_function(AudioConvert *ac){}voidff_audio_convert_free(AudioConvert **ac){return;ff_dither_free(&(*ac) ->dc);av_freep(ac);}AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, intsample_rate, intapply_map){AudioConvert *ac;intin_planar, out_planar;ac=av_mallocz(sizeof(*ac));returnNULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method!=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt)>2){ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc){av_free(ac);returnNULL;}returnac;}in_planar=av_sample_fmt_is_planar(in_fmt);out_planar=av_sample_fmt_is_planar(out_fmt);if(in_planar==out_planar){ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar?ac->channels:1;}elseif(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;elseac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);ff_audio_convert_init_arm(ac);ff_audio_convert_init_x86(ac);returnac;}intff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in){intuse_generic=1;intlen=in->nb_samples;intp;if(ac->dc){av_dlog(ac->avr,"%dsamples-audio_convert:%sto%s(dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));returnff_convert_dither(ac-> out
int top_field_first
Definition: ffmpeg.h:341
OutputFilter ** outputs
Definition: ffmpeg.h:213
InputFile ** input_files
Definition: ffmpeg.c:146
SpecifierOpt * max_frames
Definition: ffmpeg.h:135
int nb_copy_initial_nonkeyframes
Definition: ffmpeg.h:164
int disabled
Definition: ffmpeg.h:61
AVFormatContext * ctx
Definition: ffmpeg.h:379
pthread_cond_t fifo_cond
Definition: ffmpeg.h:301
SpecifierOpt * codec_names
Definition: ffmpeg.h:81
void show_usage(void)
Definition: ffmpeg_opt.c:2469
An instance of a filter.
Definition: avfilter.h:627
InputFilter ** inputs
Definition: ffmpeg.h:211
int sync_stream_index
Definition: ffmpeg.h:65
OutputFile ** output_files
Definition: ffmpeg.c:151
int copy_tb
Definition: ffmpeg_opt.c:80
int discard
Definition: ffmpeg.h:220
int64_t first_pts
Definition: ffmpeg.h:330
int nb_inputs
Definition: ffmpeg.h:212
int index
Definition: ffmpeg.h:319
uint64_t resample_channel_layout
Definition: ffmpeg.h:254
int nb_reinit_filters
Definition: ffmpeg.h:172
int debug_ts
Definition: ffmpeg_opt.c:81
int nb_guess_layout_max
Definition: ffmpeg.h:182
int joined
Definition: ffmpeg.h:299
InputStream ** input_streams
Definition: ffmpeg.c:144
int nb_frame_aspect_ratios
Definition: ffmpeg.h:150
Definition: ffmpeg.h:311
int subtitle_disable
Definition: ffmpeg.h:126