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 
49 
50 #define VSYNC_AUTO -1
51 #define VSYNC_PASSTHROUGH 0
52 #define VSYNC_CFR 1
53 #define VSYNC_VFR 2
54 #define VSYNC_DROP 0xff
55 
56 #define MAX_STREAMS 1024 /* arbitrary sanity check value */
57 
58 /* select an input stream for an output stream */
59 typedef struct StreamMap {
60  int disabled; /* 1 is this mapping is disabled by a negative map */
65  char *linklabel; /* name of an output link, for mapping lavfi outputs */
66 } StreamMap;
67 
68 typedef struct {
69  int file_idx, stream_idx, channel_idx; // input
70  int ofile_idx, ostream_idx; // output
72 
73 typedef struct OptionsContext {
75 
76  /* input/output options */
77  int64_t start_time;
78  const char *format;
79 
92 
93  /* input options */
94  int64_t input_ts_offset;
95  int rate_emu;
96 
101 
102  /* output options */
105  AudioChannelMap *audio_channel_maps; /* one info entry per -map_channel */
106  int nb_audio_channel_maps; /* number of (valid) -map_channel settings */
110  const char **attachments;
112 
114 
115  int64_t recording_time;
116  int64_t stop_time;
117  uint64_t limit_filesize;
118  float mux_preload;
120  int shortest;
121 
126 
127  /* indexed by output file stream index */
130 
176  int nb_pass;
182 
183 typedef struct InputFilter {
185  struct InputStream *ist;
188 } InputFilter;
189 
190 typedef struct OutputFilter {
192  struct OutputStream *ost;
195 
196  /* temporary storage until stream maps are processed */
198 } OutputFilter;
199 
200 typedef struct FilterGraph {
201  int index;
202  const char *graph_desc;
203 
206 
211 } FilterGraph;
212 
213 typedef struct InputStream {
216  int discard; /* true if stream data should be discarded */
217  int decoding_needed; /* true if the packets must be decoded in 'raw_fifo' */
220  AVFrame *filter_frame; /* a ref of decoded_frame, to be sent to filters */
221 
222  int64_t start; /* time when read started */
223  /* predicted dts of the next packet read for this stream or (when there are
224  * several frames in a packet) of the next frame in current packet (in AV_TIME_BASE units) */
225  int64_t next_dts;
226  int64_t dts; ///< dts of the last packet read for this stream (in AV_TIME_BASE units)
227 
228  int64_t next_pts; ///< synthetic pts for the next decode frame (in AV_TIME_BASE units)
229  int64_t pts; ///< current pts of the decoded frame (in AV_TIME_BASE units)
231 
233 
234  double ts_scale;
235  int is_start; /* is 1 at the start and after a discontinuity */
239  AVRational framerate; /* framerate forced with -r */
242 
246 
251 
253  struct { /* previous decoded subtitle and related variables */
255  int ret;
257  } prev_sub;
258 
259  struct sub2video {
260  int64_t last_pts;
261  int64_t end_pts;
263  int w, h;
264  } sub2video;
265 
266  int dr1;
267 
268  /* decoded data from this stream goes into all those filters
269  * currently video and audio only */
272 
274 } InputStream;
275 
276 typedef struct InputFile {
278  int eof_reached; /* true if eof reached */
279  int eagain; /* true if last read attempt returned EAGAIN */
280  int ist_index; /* index of first stream in input_streams */
281  int64_t ts_offset;
282  int64_t last_ts;
283  int nb_streams; /* number of stream that ffmpeg is aware of; may be different
284  from ctx.nb_streams if new streams appear during av_read_frame() */
285  int nb_streams_warn; /* number of streams that the user was warned of */
286  int rate_emu;
287 
288 #if HAVE_PTHREADS
289  pthread_t thread; /* thread reading from this file */
290  int finished; /* the thread has exited */
291  int joined; /* the thread has been joined */
292  pthread_mutex_t fifo_lock; /* lock for access to fifo */
293  pthread_cond_t fifo_cond; /* the main thread will signal on this cond after reading from fifo */
294  AVFifoBuffer *fifo; /* demuxed packets are stored here; freed by the main thread */
295 #endif
296 } InputFile;
297 
305 };
306 
307 extern const char *const forced_keyframes_const_names[];
308 
309 typedef struct OutputStream {
310  int file_index; /* file index */
311  int index; /* stream index in the output file */
312  int source_index; /* InputStream index */
313  AVStream *st; /* stream in the output file */
314  int encoding_needed; /* true if encoding needed for this stream */
316  /* input pts and corresponding output pts
317  for A/V sync */
318  struct InputStream *sync_ist; /* input stream to sync against */
319  int64_t sync_opts; /* output frame counter, could be changed to some true timestamp */ // FIXME look at frame_number
320  /* pts of the first frame encoded for this stream, used for limiting
321  * recording time */
322  int64_t first_pts;
325  int64_t max_frames;
327 
328  /* video only */
332 
334 
335  /* forced key frames */
336  int64_t *forced_kf_pts;
341  double forced_keyframes_expr_const_values[FKF_NB];
342 
343  /* audio only */
344  int audio_channels_map[SWR_CH_MAX]; /* list of the channels id to pick from the source stream */
345  int audio_channels_mapped; /* number of channels in audio_channels_map */
346 
348  FILE *logfile;
349 
351  char *avfilter;
352 
353  int64_t sws_flags;
357  int finished; /* no more packets should be written for this stream */
358  int unavailable; /* true if the steram is unavailable (possibly temporarily) */
360  const char *attachment_filename;
363 
365 } OutputStream;
366 
367 typedef struct OutputFile {
370  int ost_index; /* index of the first stream in output_streams */
371  int64_t recording_time; ///< desired length of the resulting file in microseconds == AV_TIME_BASE units
372  int64_t start_time; ///< start time in microseconds == AV_TIME_BASE units
373  uint64_t limit_filesize; /* filesize limit expressed in bytes */
374 
375  int shortest;
376 } OutputFile;
377 
378 extern InputStream **input_streams;
379 extern int nb_input_streams;
380 extern InputFile **input_files;
381 extern int nb_input_files;
382 
384 extern int nb_output_streams;
385 extern OutputFile **output_files;
386 extern int nb_output_files;
387 
388 extern FilterGraph **filtergraphs;
389 extern int nb_filtergraphs;
390 
391 extern char *vstats_filename;
392 
393 extern float audio_drift_threshold;
394 extern float dts_delta_threshold;
395 extern float dts_error_threshold;
396 
397 extern int audio_volume;
398 extern int audio_sync_method;
399 extern int video_sync_method;
400 extern int do_benchmark;
401 extern int do_benchmark_all;
402 extern int do_deinterlace;
403 extern int do_hex_dump;
404 extern int do_pkt_dump;
405 extern int copy_ts;
406 extern int copy_tb;
407 extern int debug_ts;
408 extern int exit_on_error;
409 extern int print_stats;
410 extern int qp_hist;
411 extern int stdin_interaction;
412 extern int frame_bits_per_raw_sample;
413 extern AVIOContext *progress_avio;
414 
415 extern const AVIOInterruptCB int_cb;
416 
417 extern const OptionDef options[];
418 
419 void term_init(void);
420 void term_exit(void);
421 
422 void reset_options(OptionsContext *o, int is_input);
423 void show_usage(void);
424 
425 void opt_output_file(void *optctx, const char *filename);
426 
428 
430 
431 enum AVPixelFormat choose_pixel_fmt(AVStream *st, AVCodec *codec, enum AVPixelFormat target);
432 void choose_sample_fmt(AVStream *st, AVCodec *codec);
433 
438 
439 int ffmpeg_parse_options(int argc, char **argv);
440 
441 #endif /* FFMPEG_H */
int64_t pts
current pts of the decoded frame (in AV_TIME_BASE units)
Definition: ffmpeg.h:229
SpecifierOpt * passlogfiles
Definition: ffmpeg.h:177
int nb_dump_attachment
Definition: ffmpeg.h:100
int got_output
Definition: ffmpeg.h:254
int nb_metadata
Definition: ffmpeg.h:132
int nb_streamid_map
Definition: ffmpeg.h:129
int frame_number
Definition: ffmpeg.h:315
Definition: ffmpeg.h:299
int keep_pix_fmt
Definition: ffmpeg.h:364
Bytestream IO Context.
Definition: avio.h:68
float mux_preload
Definition: ffmpeg.h:118
int64_t recording_time
desired length of the resulting file in microseconds == AV_TIME_BASE units
Definition: ffmpeg.h:371
Buffered I/O operations.
uint8_t * name
Definition: ffmpeg.h:194
int nb_outputs
Definition: ffmpeg.h:210
AVDictionary * swr_opts
Definition: ffmpeg.h:355
int resample_channels
Definition: ffmpeg.h:249
This structure describes decoded (raw) audio or video data.
Definition: frame.h:76
int stream_copy
Definition: ffmpeg.h:359
AVRational frame_rate
Definition: ffmpeg.h:329
int64_t * forced_kf_pts
Definition: ffmpeg.h:336
int data_disable
Definition: ffmpeg.h:125
float mux_max_delay
Definition: ffmpeg.h:119
int exit_on_error
Definition: ffmpeg_opt.c:82
OutputFile ** output_files
Definition: ffmpeg.c:152
int nb_forced_key_frames
Definition: ffmpeg.h:144
int * streamid_map
Definition: ffmpeg.h:128
external API header
int nb_stream_maps
Definition: ffmpeg.h:104
SpecifierOpt * copy_initial_nonkeyframes
Definition: ffmpeg.h:161
int ostream_idx
Definition: ffmpeg.h:70
AVStream * st
Definition: ffmpeg.h:313
AVRational framerate
Definition: ffmpeg.h:239
void choose_sample_fmt(AVStream *st, AVCodec *codec)
Definition: ffmpeg_filter.c:71
SpecifierOpt * reinit_filters
Definition: ffmpeg.h:169
SpecifierOpt * ts_scale
Definition: ffmpeg.h:97
AVFilterInOut * out_tmp
Definition: ffmpeg.h:197
int decoding_needed
Definition: ffmpeg.h:217
int nb_canvas_sizes
Definition: ffmpeg.h:174
FilterGraph * init_simple_filtergraph(InputStream *ist, OutputStream *ost)
int nb_frame_pix_fmts
Definition: ffmpeg.h:91
SpecifierOpt * sample_fmts
Definition: ffmpeg.h:139
SpecifierOpt * guess_layout_max
Definition: ffmpeg.h:179
int eagain
Definition: ffmpeg.h:279
AVBitStreamFilterContext * bitstream_filters
Definition: ffmpeg.h:323
external API header
forced_keyframes_const
Definition: ffmpeg.h:298
AVFrame * filter_frame
Definition: ffmpeg.h:220
int do_benchmark_all
Definition: ffmpeg_opt.c:76
FilterGraph ** filtergraphs
Definition: ffmpeg.c:155
int do_hex_dump
Definition: ffmpeg_opt.c:77
int nb_filter_scripts
Definition: ffmpeg.h:168
SpecifierOpt * filters
Definition: ffmpeg.h:165
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:372
int index
Definition: ffmpeg.h:201
SpecifierOpt * qscale
Definition: ffmpeg.h:141
SpecifierOpt * frame_pix_fmts
Definition: ffmpeg.h:90
struct FilterGraph * graph
Definition: ffmpeg.h:186
SpecifierOpt * intra_matrices
Definition: ffmpeg.h:151
int encoding_needed
Definition: ffmpeg.h:314
Format I/O context.
Definition: avformat.h:944
struct InputFilter InputFilter
struct InputStream * ist
Definition: ffmpeg.h:185
AVFilterGraph * graph
Definition: ffmpeg.h:204
Public dictionary API.
char * logfile_prefix
Definition: ffmpeg.h:347
HMTX pthread_mutex_t
Definition: os2threads.h:38
int copy_initial_nonkeyframes
Definition: ffmpeg.h:361
uint8_t
window constants for m
int is_start
Definition: ffmpeg.h:235
int stdin_interaction
Definition: ffmpeg_opt.c:85
FILE * logfile
Definition: ffmpeg.h:348
AVDictionary * opts
Definition: ffmpeg.h:369
AVDictionary * opts
Definition: ffmpeg.h:354
Definition: eval.c:140
int do_benchmark
Definition: ffmpeg_opt.c:75
int audio_sync_method
Definition: ffmpeg_opt.c:72
int nb_max_frames
Definition: ffmpeg.h:134
int shortest
Definition: ffmpeg.h:375
int nb_output_streams
Definition: ffmpeg.c:151
int nb_streams
Definition: ffmpeg.h:283
pthread_t thread
Definition: ffmpeg.h:289
int sync_file_index
Definition: ffmpeg.h:63
AVDictionary * resample_opts
Definition: ffmpeg.h:356
void reset_options(OptionsContext *o, int is_input)
AVFilterContext * filter
Definition: ffmpeg.h:191
SpecifierOpt * bitstream_filters
Definition: ffmpeg.h:135
int resample_sample_rate
Definition: ffmpeg.h:248
AVCodec * dec
Definition: ffmpeg.h:218
int top_field_first
Definition: ffmpeg.h:240
int file_index
Definition: ffmpeg.h:214
const OptionDef options[]
Definition: ffserver.c:4697
int resample_pix_fmt
Definition: ffmpeg.h:245
int resample_height
Definition: ffmpeg.h:243
int64_t filter_in_rescale_delta_last
Definition: ffmpeg.h:232
int wrap_correction_done
Definition: ffmpeg.h:230
int ist_in_filtergraph(FilterGraph *fg, InputStream *ist)
int64_t next_dts
Definition: ffmpeg.h:225
Callback for checking whether to abort blocking functions.
Definition: avio.h:51
struct InputStream InputStream
libswresample public header
int nb_top_field_first
Definition: ffmpeg.h:156
int rate_emu
Definition: ffmpeg.h:286
int ffmpeg_parse_options(int argc, char **argv)
Definition: ffmpeg_opt.c:2490
AVFilterContext * filter
Definition: ffmpeg.h:184
int nb_filters
Definition: ffmpeg.h:166
int64_t start_time
Definition: ffmpeg.h:77
int64_t start
Definition: ffmpeg.h:222
int video_sync_method
Definition: ffmpeg_opt.c:73
int64_t sws_flags
Definition: ffmpeg.h:353
int dr1
Definition: ffmpeg.h:266
AudioChannelMap * audio_channel_maps
Definition: ffmpeg.h:105
int finished
Definition: ffmpeg.h:357
SpecifierOpt * codec_tags
Definition: ffmpeg.h:137
SpecifierOpt * rc_overrides
Definition: ffmpeg.h:149
int video_disable
Definition: ffmpeg.h:122
int nb_input_files
Definition: ffmpeg.c:148
int force_fps
Definition: ffmpeg.h:330
int nb_codec_names
Definition: ffmpeg.h:81
external API header
int qp_hist
Definition: ffmpeg_opt.c:84
StreamMap * stream_maps
Definition: ffmpeg.h:103
uint64_t limit_filesize
Definition: ffmpeg.h:117
const char * format
Definition: ffmpeg.h:78
struct OutputStream OutputStream
int nb_passlogfiles
Definition: ffmpeg.h:178
int nb_force_fps
Definition: ffmpeg.h:146
OutputFilter * filter
Definition: ffmpeg.h:350
AVRational frame_aspect_ratio
Definition: ffmpeg.h:333
int nb_sample_fmts
Definition: ffmpeg.h:140
AVDictionary * opts
Definition: ffmpeg.h:238
int file_index
Definition: ffmpeg.h:61
int nb_audio_channel_maps
Definition: ffmpeg.h:106
SpecifierOpt * filter_scripts
Definition: ffmpeg.h:167
int nb_attachments
Definition: ffmpeg.h:111
char * linklabel
Definition: ffmpeg.h:65
int nb_ts_scale
Definition: ffmpeg.h:98
SpecifierOpt * audio_channels
Definition: ffmpeg.h:82
struct FilterGraph FilterGraph
int saw_first_ts
Definition: ffmpeg.h:236
int nb_audio_sample_rate
Definition: ffmpeg.h:85
struct OutputFile OutputFile
int metadata_chapters_manual
Definition: ffmpeg.h:109
struct OutputStream * ost
Definition: ffmpeg.h:192
AVFifoBuffer * fifo
Definition: ffmpeg.h:294
SpecifierOpt * pass
Definition: ffmpeg.h:175
SpecifierOpt * audio_sample_rate
Definition: ffmpeg.h:84
void opt_output_file(void *optctx, const char *filename)
SpecifierOpt * dump_attachment
Definition: ffmpeg.h:99
void assert_avoptions(AVDictionary *m)
Definition: ffmpeg.c:510
SpecifierOpt * canvas_sizes
Definition: ffmpeg.h:173
int nb_codec_tags
Definition: ffmpeg.h:138
int64_t last_ts
Definition: ffmpeg.h:282
SpecifierOpt * metadata_map
Definition: ffmpeg.h:157
int do_pkt_dump
Definition: ffmpeg_opt.c:78
int64_t max_frames
Definition: ffmpeg.h:325
int audio_channels_mapped
Definition: ffmpeg.h:345
SpecifierOpt * copy_prior_start
Definition: ffmpeg.h:163
SpecifierOpt * frame_aspect_ratios
Definition: ffmpeg.h:147
SpecifierOpt * frame_sizes
Definition: ffmpeg.h:88
int stream_idx
Definition: ffmpeg.h:69
int finished
Definition: ffmpeg.h:290
struct StreamMap StreamMap
int ret
Definition: ffmpeg.h:255
int audio_volume
Definition: ffmpeg_opt.c:71
Stream structure.
Definition: avformat.h:643
A linked-list of the inputs/outputs of the filter chain.
Definition: avfilter.h:1123
InputFilter ** filters
Definition: ffmpeg.h:270
int fix_sub_duration
Definition: ffmpeg.h:252
SpecifierOpt * frame_rates
Definition: ffmpeg.h:86
pthread_mutex_t fifo_lock
Definition: ffmpeg.h:292
int nb_presets
Definition: ffmpeg.h:160
int ost_index
Definition: ffmpeg.h:370
struct InputStream * sync_ist
Definition: ffmpeg.h:318
double ts_scale
Definition: ffmpeg.h:234
int64_t recording_time
Definition: ffmpeg.h:115
int unavailable
Definition: ffmpeg.h:358
void term_exit(void)
Definition: ffmpeg.c:302
int chapters_input_file
Definition: ffmpeg.h:113
int64_t stop_time
Definition: ffmpeg.h:116
int nb_copy_prior_start
Definition: ffmpeg.h:164
OutputStream ** output_streams
Definition: ffmpeg.c:150
int ist_index
Definition: ffmpeg.h:280
const char * graph_desc
Definition: ffmpeg.h:202
int guess_layout_max
Definition: ffmpeg.h:241
enum AVPixelFormat choose_pixel_fmt(AVStream *st, AVCodec *codec, enum AVPixelFormat target)
Definition: ffmpeg_filter.c:38
InputFile ** input_files
Definition: ffmpeg.c:147
int rate_emu
Definition: ffmpeg.h:95
int metadata_streams_manual
Definition: ffmpeg.h:108
const char * attachment_filename
Definition: ffmpeg.h:360
int configure_output_filter(FilterGraph *fg, OutputFilter *ofilter, AVFilterInOut *out)
a very simple circular buffer FIFO implementation
int audio_disable
Definition: ffmpeg.h:123
int64_t input_ts_offset
Definition: ffmpeg.h:94
int nb_filtergraphs
Definition: ffmpeg.c:156
AVFrame * decoded_frame
Definition: ffmpeg.h:219
int nb_bitstream_filters
Definition: ffmpeg.h:136
SpecifierOpt * top_field_first
Definition: ffmpeg.h:155
AVStream * st
Definition: ffmpeg.h:215
int configure_filtergraph(FilterGraph *fg)
rational number numerator/denominator
Definition: rational.h:43
int file_index
Definition: ffmpeg.h:310
int metadata_global_manual
Definition: ffmpeg.h:107
int64_t sync_opts
Definition: ffmpeg.h:319
char * vstats_filename
Definition: ffmpeg_opt.c:65
SpecifierOpt * force_fps
Definition: ffmpeg.h:145
int nb_fix_sub_duration
Definition: ffmpeg.h:172
int nb_inter_matrices
Definition: ffmpeg.h:154
int nb_streams_warn
Definition: ffmpeg.h:285
int shortest
Definition: ffmpeg.h:120
int showed_multi_packet_warning
Definition: ffmpeg.h:237
int frame_bits_per_raw_sample
Definition: ffmpeg_opt.c:86
int64_t ts_offset
Definition: ffmpeg.h:281
int nb_qscale
Definition: ffmpeg.h:142
int nb_input_streams
Definition: ffmpeg.c:146
float audio_drift_threshold
Definition: ffmpeg_opt.c:67
AVFrame * filtered_frame
Definition: ffmpeg.h:326
int nb_audio_channels
Definition: ffmpeg.h:83
int source_index
Definition: ffmpeg.h:312
InputStream ** input_streams
Definition: ffmpeg.c:145
int copy_prior_start
Definition: ffmpeg.h:362
SpecifierOpt * metadata
Definition: ffmpeg.h:131
AVIOContext * progress_avio
Definition: ffmpeg.c:134
int nb_filters
Definition: ffmpeg.h:271
AVExpr * forced_keyframes_pexpr
Definition: ffmpeg.h:340
int64_t dts
dts of the last packet read for this stream (in AV_TIME_BASE units)
Definition: ffmpeg.h:226
int forced_kf_count
Definition: ffmpeg.h:337
int resample_sample_fmt
Definition: ffmpeg.h:247
int nb_intra_matrices
Definition: ffmpeg.h:152
char * forced_keyframes
Definition: ffmpeg.h:339
int nb_frame_rates
Definition: ffmpeg.h:87
const AVIOInterruptCB int_cb
Definition: ffmpeg.c:422
int resample_width
Definition: ffmpeg.h:244
int64_t next_pts
synthetic pts for the next decode frame (in AV_TIME_BASE units)
Definition: ffmpeg.h:228
Main libavformat public API header.
int reconfiguration
Definition: ffmpeg.h:205
struct FilterGraph * graph
Definition: ffmpeg.h:193
uint64_t limit_filesize
Definition: ffmpeg.h:373
SpecifierOpt * presets
Definition: ffmpeg.h:159
int reinit_filters
Definition: ffmpeg.h:273
int nb_frame_sizes
Definition: ffmpeg.h:89
rational numbers
OptionGroup * g
Definition: ffmpeg.h:74
SpecifierOpt * inter_matrices
Definition: ffmpeg.h:153
const char *const forced_keyframes_const_names[]
Definition: ffmpeg.c:111
#define SWR_CH_MAX
Maximum number of channels.
Definition: swresample.h:102
SpecifierOpt * forced_key_frames
Definition: ffmpeg.h:143
const char ** attachments
Definition: ffmpeg.h:110
int copy_ts
Definition: ffmpeg_opt.c:79
AVFormatContext * ctx
Definition: ffmpeg.h:277
int stream_index
Definition: ffmpeg.h:62
AVCodec * enc
Definition: ffmpeg.h:324
AVSubtitle subtitle
Definition: ffmpeg.h:256
int eof_reached
Definition: ffmpeg.h:278
int nb_metadata_map
Definition: ffmpeg.h:158
int forced_kf_index
Definition: ffmpeg.h:338
int nb_rc_overrides
Definition: ffmpeg.h:150
int do_deinterlace
Definition: ffmpeg_opt.c:74
SpecifierOpt * fix_sub_duration
Definition: ffmpeg.h:171
Definition: ffmpeg.h:304
pixel format definitions
char * avfilter
Definition: ffmpeg.h:351
uint8_t * name
Definition: ffmpeg.h:187
struct InputFile InputFile
float dts_delta_threshold
Definition: ffmpeg_opt.c:68
int guess_input_channel_layout(InputStream *ist)
Definition: ffmpeg.c:1464
int top_field_first
Definition: ffmpeg.h:331
struct OutputFilter OutputFilter
OutputFilter ** outputs
Definition: ffmpeg.h:209
SpecifierOpt * max_frames
Definition: ffmpeg.h:133
struct OptionsContext OptionsContext
int nb_copy_initial_nonkeyframes
Definition: ffmpeg.h:162
int disabled
Definition: ffmpeg.h:60
AVFormatContext * ctx
Definition: ffmpeg.h:368
int nb_output_files
Definition: ffmpeg.c:153
pthread_cond_t fifo_cond
Definition: ffmpeg.h:293
SpecifierOpt * codec_names
Definition: ffmpeg.h:80
void show_usage(void)
Definition: ffmpeg_opt.c:2440
An instance of a filter.
Definition: avfilter.h:524
InputFilter ** inputs
Definition: ffmpeg.h:207
int sync_stream_index
Definition: ffmpeg.h:64
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(const int16_t *) pi >> 8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t,*(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t,*(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(const int32_t *) pi >> 24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t,*(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t,*(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31))))#define SET_CONV_FUNC_GROUP(ofmt, ifmt) static void set_generic_function(AudioConvert *ac){}void ff_audio_convert_free(AudioConvert **ac){if(!*ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);}AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, int sample_rate, int apply_map){AudioConvert *ac;int in_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) return NULL;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);return NULL;}return ac;}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;}else if(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;else ac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);return ac;}int ff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in){int use_generic=1;int len=in->nb_samples;int p;if(ac->dc){av_dlog(ac->avr,"%d samples - audio_convert: %s to %s (dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));return ff_convert_dither(ac-> out
int copy_tb
Definition: ffmpeg_opt.c:80
int discard
Definition: ffmpeg.h:216
int64_t first_pts
Definition: ffmpeg.h:322
int nb_inputs
Definition: ffmpeg.h:208
int index
Definition: ffmpeg.h:311
AVPixelFormat
Pixel format.
Definition: pixfmt.h:66
uint64_t resample_channel_layout
Definition: ffmpeg.h:250
int nb_reinit_filters
Definition: ffmpeg.h:170
int debug_ts
Definition: ffmpeg_opt.c:81
int nb_guess_layout_max
Definition: ffmpeg.h:180
void term_init(void)
Definition: ffmpeg.c:324
int joined
Definition: ffmpeg.h:291
int nb_frame_aspect_ratios
Definition: ffmpeg.h:148
Definition: ffmpeg.h:303
simple arithmetic expression evaluator
int subtitle_disable
Definition: ffmpeg.h:124