FFmpeg
Data Structures | Macros | Enumerations | Functions | Variables
ffmpeg.h File Reference
#include "config.h"
#include <stdatomic.h>
#include <stdint.h>
#include <stdio.h>
#include <signal.h>
#include "cmdutils.h"
#include "sync_queue.h"
#include "libavformat/avformat.h"
#include "libavformat/avio.h"
#include "libavcodec/avcodec.h"
#include "libavcodec/bsf.h"
#include "libavfilter/avfilter.h"
#include "libavutil/avutil.h"
#include "libavutil/dict.h"
#include "libavutil/eval.h"
#include "libavutil/fifo.h"
#include "libavutil/hwcontext.h"
#include "libavutil/pixfmt.h"
#include "libavutil/rational.h"
#include "libavutil/thread.h"
#include "libavutil/threadmessage.h"
#include "libswresample/swresample.h"

Go to the source code of this file.

Data Structures

struct  HWDevice
 
struct  StreamMap
 
struct  AudioChannelMap
 
struct  DemuxPktData
 
struct  OptionsContext
 
struct  InputFilter
 
struct  OutputFilter
 
struct  FilterGraph
 
struct  InputStream
 
struct  InputStream::sub2video
 
struct  LastFrameDuration
 
struct  InputFile
 
struct  EncStatsComponent
 
struct  EncStats
 
struct  KeyframeForceCtx
 
struct  OutputStream
 
struct  OutputFile
 
struct  FrameData
 

Macros

#define FFMPEG_OPT_PSNR   1
 
#define FFMPEG_OPT_MAP_CHANNEL   1
 
#define FFMPEG_OPT_MAP_SYNC   1
 
#define FFMPEG_ROTATION_METADATA   1
 
#define FFMPEG_OPT_QPHIST   1
 
#define FFMPEG_OPT_ADRIFT_THRESHOLD   1
 
#define FFMPEG_OPT_ENC_TIME_BASE_NUM   1
 
#define FFMPEG_OPT_TOP   1
 
#define FFMPEG_OPT_FORCE_KF_SOURCE_NO_DROP   1
 
#define DECODING_FOR_OST   1
 
#define DECODING_FOR_FILTER   2
 
#define ABORT_ON_FLAG_EMPTY_OUTPUT   (1 << 0)
 
#define ABORT_ON_FLAG_EMPTY_OUTPUT_STREAM   (1 << 1)
 
#define SPECIFIER_OPT_FMT_str   "%s"
 
#define SPECIFIER_OPT_FMT_i   "%i"
 
#define SPECIFIER_OPT_FMT_i64   "%"PRId64
 
#define SPECIFIER_OPT_FMT_ui64   "%"PRIu64
 
#define SPECIFIER_OPT_FMT_f   "%f"
 
#define SPECIFIER_OPT_FMT_dbl   "%lf"
 
#define WARN_MULTIPLE_OPT_USAGE(name, type, so, st)
 
#define MATCH_PER_STREAM_OPT(name, type, outvar, fmtctx, st)
 
#define MATCH_PER_TYPE_OPT(name, type, outvar, fmtctx, mediatype)
 

Enumerations

enum  VideoSyncMethod {
  VSYNC_AUTO = -1, VSYNC_PASSTHROUGH, VSYNC_CFR, VSYNC_VFR,
  VSYNC_VSCFR, VSYNC_DROP
}
 
enum  EncTimeBase { ENC_TIME_BASE_DEMUX = -1, ENC_TIME_BASE_FILTER = -2 }
 
enum  HWAccelID { HWACCEL_NONE = 0, HWACCEL_AUTO, HWACCEL_GENERIC }
 
enum  forced_keyframes_const {
  FKF_N, FKF_N_FORCED, FKF_PREV_FORCED_N, FKF_PREV_FORCED_T,
  FKF_T, FKF_NB
}
 
enum  EncStatsType {
  ENC_STATS_LITERAL = 0, ENC_STATS_FILE_IDX, ENC_STATS_STREAM_IDX, ENC_STATS_FRAME_NUM,
  ENC_STATS_FRAME_NUM_IN, ENC_STATS_TIMEBASE, ENC_STATS_TIMEBASE_IN, ENC_STATS_PTS,
  ENC_STATS_PTS_TIME, ENC_STATS_PTS_IN, ENC_STATS_PTS_TIME_IN, ENC_STATS_DTS,
  ENC_STATS_DTS_TIME, ENC_STATS_SAMPLE_NUM, ENC_STATS_NB_SAMPLES, ENC_STATS_PKT_SIZE,
  ENC_STATS_BITRATE, ENC_STATS_AVG_BITRATE
}
 
enum  OSTFinished { ENCODER_FINISHED = 1, MUXER_FINISHED = 2 }
 
enum  { KF_FORCE_SOURCE = 1, KF_FORCE_SOURCE_NO_DROP = 2 }
 

Functions

void term_init (void)
 
void term_exit (void)
 
void show_usage (void)
 
void remove_avoptions (AVDictionary **a, AVDictionary *b)
 
int check_avoptions (AVDictionary *m)
 
int assert_file_overwrite (const char *filename)
 
char * file_read (const char *filename)
 
AVDictionarystrip_specifiers (const AVDictionary *dict)
 
int find_codec (void *logctx, const char *name, enum AVMediaType type, int encoder, const AVCodec **codec)
 
int parse_and_set_vsync (const char *arg, int *vsync_var, int file_idx, int st_idx, int is_global)
 
int check_filter_outputs (void)
 
int filtergraph_is_simple (const FilterGraph *fg)
 
int init_simple_filtergraph (InputStream *ist, OutputStream *ost, char *graph_desc)
 
int init_complex_filtergraph (FilterGraph *fg)
 
int copy_av_subtitle (AVSubtitle *dst, const AVSubtitle *src)
 
int subtitle_wrap_frame (AVFrame *frame, AVSubtitle *subtitle, int copy)
 
FrameDataframe_data (AVFrame *frame)
 Get our axiliary frame data attached to the frame, allocating it if needed. More...
 
int ifilter_send_frame (InputFilter *ifilter, AVFrame *frame, int keep_reference)
 
int ifilter_send_eof (InputFilter *ifilter, int64_t pts, AVRational tb)
 
int ifilter_sub2video (InputFilter *ifilter, const AVFrame *frame)
 
void ifilter_sub2video_heartbeat (InputFilter *ifilter, int64_t pts, AVRational tb)
 
int ifilter_parameters_from_dec (InputFilter *ifilter, const AVCodecContext *dec)
 Set up fallback filtering parameters from a decoder context. More...
 
int ofilter_bind_ost (OutputFilter *ofilter, OutputStream *ost)
 
int fg_create (FilterGraph **pfg, char *graph_desc)
 Create a new filtergraph in the global filtergraph list. More...
 
void fg_free (FilterGraph **pfg)
 
int fg_transcode_step (FilterGraph *graph, InputStream **best_ist)
 Perform a step of transcoding for the specified filter graph. More...
 
void fg_send_command (FilterGraph *fg, double time, const char *target, const char *command, const char *arg, int all_filters)
 
int reap_filters (FilterGraph *fg, int flush)
 Get and encode new output from specified filtergraph, without causing activity. More...
 
int ffmpeg_parse_options (int argc, char **argv)
 
void enc_stats_write (OutputStream *ost, EncStats *es, const AVFrame *frame, const AVPacket *pkt, uint64_t frame_num)
 
HWDevicehw_device_get_by_name (const char *name)
 
HWDevicehw_device_get_by_type (enum AVHWDeviceType type)
 
int hw_device_init_from_string (const char *arg, HWDevice **dev)
 
int hw_device_init_from_type (enum AVHWDeviceType type, const char *device, HWDevice **dev_out)
 
void hw_device_free_all (void)
 
AVBufferRefhw_device_for_filter (void)
 Get a hardware device to be used with this filtergraph. More...
 
int hwaccel_retrieve_data (AVCodecContext *avctx, AVFrame *input)
 
int dec_open (InputStream *ist)
 
void dec_free (Decoder **pdec)
 
int dec_packet (InputStream *ist, const AVPacket *pkt, int no_eof)
 Submit a packet for decoding. More...
 
int enc_alloc (Encoder **penc, const AVCodec *codec)
 
void enc_free (Encoder **penc)
 
int enc_open (OutputStream *ost, const AVFrame *frame)
 
int enc_subtitle (OutputFile *of, OutputStream *ost, const AVSubtitle *sub)
 
int enc_frame (OutputStream *ost, AVFrame *frame)
 
int enc_flush (void)
 
int of_stream_init (OutputFile *of, OutputStream *ost)
 
int of_write_trailer (OutputFile *of)
 
int of_open (const OptionsContext *o, const char *filename)
 
void of_free (OutputFile **pof)
 
void of_enc_stats_close (void)
 
int of_output_packet (OutputFile *of, OutputStream *ost, AVPacket *pkt)
 
int of_streamcopy (OutputStream *ost, const AVPacket *pkt, int64_t dts)
 
int64_t of_filesize (OutputFile *of)
 
int ifile_open (const OptionsContext *o, const char *filename)
 
void ifile_close (InputFile **f)
 
int ifile_get_packet (InputFile *f, AVPacket **pkt)
 Get next input packet from the demuxer. More...
 
int ist_output_add (InputStream *ist, OutputStream *ost)
 
int ist_filter_add (InputStream *ist, InputFilter *ifilter, int is_simple)
 
InputStreamist_find_unused (enum AVMediaType type)
 Find an unused input stream of given type. More...
 
InputStreamist_iter (InputStream *prev)
 
OutputStreamost_iter (OutputStream *prev)
 
void close_output_stream (OutputStream *ost)
 
int trigger_fix_sub_duration_heartbeat (OutputStream *ost, const AVPacket *pkt)
 
int fix_sub_duration_heartbeat (InputStream *ist, int64_t signal_pts)
 
void update_benchmark (const char *fmt,...)
 
static int err_merge (int err0, int err1)
 Merge two return codes - return one of the error codes if at least one of them was negative, 0 otherwise. More...
 
static void pkt_move (void *dst, void *src)
 
static void frame_move (void *dst, void *src)
 

Variables

const char *const forced_keyframes_const_names []
 
InputFile ** input_files
 
int nb_input_files
 
OutputFile ** output_files
 
int nb_output_files
 
FilterGraph ** filtergraphs
 
int nb_filtergraphs
 
char * vstats_filename
 
char * sdp_filename
 
float dts_delta_threshold
 
float dts_error_threshold
 
enum VideoSyncMethod video_sync_method
 
float frame_drop_threshold
 
int do_benchmark
 
int do_benchmark_all
 
int do_hex_dump
 
int do_pkt_dump
 
int copy_ts
 
int start_at_zero
 
int copy_tb
 
int debug_ts
 
int exit_on_error
 
int abort_on_flags
 
int print_stats
 
int64_t stats_period
 
int stdin_interaction
 
AVIOContextprogress_avio
 
float max_error_rate
 
char * filter_nbthreads
 
int filter_complex_nbthreads
 
int vstats_version
 
int auto_conversion_filters
 
const AVIOInterruptCB int_cb
 
const OptionDef options []
 
HWDevicefilter_hw_device
 
unsigned nb_output_dumped
 
int ignore_unknown_streams
 
int copy_unknown_streams
 
int recast_media
 
FILE * vstats_file
 
int do_psnr
 
const char *const opt_name_codec_names []
 
const char *const opt_name_codec_tags []
 
const char *const opt_name_frame_rates []
 
const char *const opt_name_top_field_first []
 

Macro Definition Documentation

◆ FFMPEG_OPT_PSNR

#define FFMPEG_OPT_PSNR   1

Definition at line 53 of file ffmpeg.h.

◆ FFMPEG_OPT_MAP_CHANNEL

#define FFMPEG_OPT_MAP_CHANNEL   1

Definition at line 54 of file ffmpeg.h.

◆ FFMPEG_OPT_MAP_SYNC

#define FFMPEG_OPT_MAP_SYNC   1

Definition at line 55 of file ffmpeg.h.

◆ FFMPEG_ROTATION_METADATA

#define FFMPEG_ROTATION_METADATA   1

Definition at line 56 of file ffmpeg.h.

◆ FFMPEG_OPT_QPHIST

#define FFMPEG_OPT_QPHIST   1

Definition at line 57 of file ffmpeg.h.

◆ FFMPEG_OPT_ADRIFT_THRESHOLD

#define FFMPEG_OPT_ADRIFT_THRESHOLD   1

Definition at line 58 of file ffmpeg.h.

◆ FFMPEG_OPT_ENC_TIME_BASE_NUM

#define FFMPEG_OPT_ENC_TIME_BASE_NUM   1

Definition at line 59 of file ffmpeg.h.

◆ FFMPEG_OPT_TOP

#define FFMPEG_OPT_TOP   1

Definition at line 60 of file ffmpeg.h.

◆ FFMPEG_OPT_FORCE_KF_SOURCE_NO_DROP

#define FFMPEG_OPT_FORCE_KF_SOURCE_NO_DROP   1

Definition at line 61 of file ffmpeg.h.

◆ DECODING_FOR_OST

#define DECODING_FOR_OST   1

Definition at line 334 of file ffmpeg.h.

◆ DECODING_FOR_FILTER

#define DECODING_FOR_FILTER   2

Definition at line 335 of file ffmpeg.h.

◆ ABORT_ON_FLAG_EMPTY_OUTPUT

#define ABORT_ON_FLAG_EMPTY_OUTPUT   (1 << 0)

Definition at line 444 of file ffmpeg.h.

◆ ABORT_ON_FLAG_EMPTY_OUTPUT_STREAM

#define ABORT_ON_FLAG_EMPTY_OUTPUT_STREAM   (1 << 1)

Definition at line 445 of file ffmpeg.h.

◆ SPECIFIER_OPT_FMT_str

#define SPECIFIER_OPT_FMT_str   "%s"

Definition at line 894 of file ffmpeg.h.

◆ SPECIFIER_OPT_FMT_i

#define SPECIFIER_OPT_FMT_i   "%i"

Definition at line 895 of file ffmpeg.h.

◆ SPECIFIER_OPT_FMT_i64

#define SPECIFIER_OPT_FMT_i64   "%"PRId64

Definition at line 896 of file ffmpeg.h.

◆ SPECIFIER_OPT_FMT_ui64

#define SPECIFIER_OPT_FMT_ui64   "%"PRIu64

Definition at line 897 of file ffmpeg.h.

◆ SPECIFIER_OPT_FMT_f

#define SPECIFIER_OPT_FMT_f   "%f"

Definition at line 898 of file ffmpeg.h.

◆ SPECIFIER_OPT_FMT_dbl

#define SPECIFIER_OPT_FMT_dbl   "%lf"

Definition at line 899 of file ffmpeg.h.

◆ WARN_MULTIPLE_OPT_USAGE

#define WARN_MULTIPLE_OPT_USAGE (   name,
  type,
  so,
  st 
)
Value:
{\
char namestr[128] = "";\
const char *spec = so->specifier && so->specifier[0] ? so->specifier : "";\
for (int _i = 0; opt_name_##name[_i]; _i++)\
av_strlcatf(namestr, sizeof(namestr), "-%s%s", opt_name_##name[_i], opt_name_##name[_i+1] ? (opt_name_##name[_i+2] ? ", " : " or ") : "");\
av_log(NULL, AV_LOG_WARNING, "Multiple %s options specified for stream %d, only the last option '-%s%s%s "SPECIFIER_OPT_FMT_##type"' will be used.\n",\
namestr, st->index, opt_name_##name[0], spec[0] ? ":" : "", spec, so->u.type);\
}

Definition at line 901 of file ffmpeg.h.

◆ MATCH_PER_STREAM_OPT

#define MATCH_PER_STREAM_OPT (   name,
  type,
  outvar,
  fmtctx,
  st 
)
Value:
{\
int _ret, _matches = 0;\
SpecifierOpt *so;\
for (int _i = 0; _i < o->nb_ ## name; _i++) {\
char *spec = o->name[_i].specifier;\
if ((_ret = check_stream_specifier(fmtctx, st, spec)) > 0) {\
outvar = o->name[_i].u.type;\
so = &o->name[_i];\
_matches++;\
} else if (_ret < 0)\
return _ret;\
}\
if (_matches > 1)\
WARN_MULTIPLE_OPT_USAGE(name, type, so, st);\
}

Definition at line 911 of file ffmpeg.h.

◆ MATCH_PER_TYPE_OPT

#define MATCH_PER_TYPE_OPT (   name,
  type,
  outvar,
  fmtctx,
  mediatype 
)
Value:
{\
int i;\
for (i = 0; i < o->nb_ ## name; i++) {\
char *spec = o->name[i].specifier;\
if (!strcmp(spec, mediatype))\
outvar = o->name[i].u.type;\
}\
}

Definition at line 928 of file ffmpeg.h.

Enumeration Type Documentation

◆ VideoSyncMethod

Enumerator
VSYNC_AUTO 
VSYNC_PASSTHROUGH 
VSYNC_CFR 
VSYNC_VFR 
VSYNC_VSCFR 
VSYNC_DROP 

Definition at line 63 of file ffmpeg.h.

◆ EncTimeBase

Enumerator
ENC_TIME_BASE_DEMUX 
ENC_TIME_BASE_FILTER 

Definition at line 72 of file ffmpeg.h.

◆ HWAccelID

enum HWAccelID
Enumerator
HWACCEL_NONE 
HWACCEL_AUTO 
HWACCEL_GENERIC 

Definition at line 77 of file ffmpeg.h.

◆ forced_keyframes_const

Enumerator
FKF_N 
FKF_N_FORCED 
FKF_PREV_FORCED_N 
FKF_PREV_FORCED_T 
FKF_T 
FKF_NB 

Definition at line 435 of file ffmpeg.h.

◆ EncStatsType

Enumerator
ENC_STATS_LITERAL 
ENC_STATS_FILE_IDX 
ENC_STATS_STREAM_IDX 
ENC_STATS_FRAME_NUM 
ENC_STATS_FRAME_NUM_IN 
ENC_STATS_TIMEBASE 
ENC_STATS_TIMEBASE_IN 
ENC_STATS_PTS 
ENC_STATS_PTS_TIME 
ENC_STATS_PTS_IN 
ENC_STATS_PTS_TIME_IN 
ENC_STATS_DTS 
ENC_STATS_DTS_TIME 
ENC_STATS_SAMPLE_NUM 
ENC_STATS_NB_SAMPLES 
ENC_STATS_PKT_SIZE 
ENC_STATS_BITRATE 
ENC_STATS_AVG_BITRATE 

Definition at line 447 of file ffmpeg.h.

◆ OSTFinished

Enumerator
ENCODER_FINISHED 
MUXER_FINISHED 

Definition at line 484 of file ffmpeg.h.

◆ anonymous enum

anonymous enum
Enumerator
KF_FORCE_SOURCE 
KF_FORCE_SOURCE_NO_DROP 

Definition at line 489 of file ffmpeg.h.

Function Documentation

◆ term_init()

void term_init ( void  )

Definition at line 241 of file ffmpeg.c.

Referenced by assert_file_overwrite().

◆ term_exit()

void term_exit ( void  )

Definition at line 171 of file ffmpeg.c.

Referenced by assert_file_overwrite(), ffmpeg_cleanup(), and transcode().

◆ show_usage()

void show_usage ( void  )

Definition at line 1248 of file ffmpeg_opt.c.

Referenced by main(), and show_help_default().

◆ remove_avoptions()

void remove_avoptions ( AVDictionary **  a,
AVDictionary b 
)

Definition at line 446 of file ffmpeg.c.

Referenced by ifile_open().

◆ check_avoptions()

int check_avoptions ( AVDictionary m)

Definition at line 455 of file ffmpeg.c.

Referenced by dec_open(), enc_open(), and ifile_open().

◆ assert_file_overwrite()

int assert_file_overwrite ( const char *  filename)

Definition at line 704 of file ffmpeg_opt.c.

Referenced by dump_attachment(), and of_open().

◆ file_read()

char* file_read ( const char *  filename)

◆ strip_specifiers()

AVDictionary* strip_specifiers ( const AVDictionary dict)

Definition at line 169 of file ffmpeg_opt.c.

Referenced by ifile_open(), and validate_enc_avopt().

◆ find_codec()

int find_codec ( void *  logctx,
const char *  name,
enum AVMediaType  type,
int  encoder,
const AVCodec **  codec 
)

Definition at line 671 of file ffmpeg_opt.c.

Referenced by choose_decoder(), choose_encoder(), and ifile_open().

◆ parse_and_set_vsync()

int parse_and_set_vsync ( const char *  arg,
int vsync_var,
int  file_idx,
int  st_idx,
int  is_global 
)

Definition at line 186 of file ffmpeg_opt.c.

Referenced by new_stream_video(), and opt_vsync().

◆ check_filter_outputs()

int check_filter_outputs ( void  )

Definition at line 1349 of file ffmpeg_filter.c.

◆ filtergraph_is_simple()

int filtergraph_is_simple ( const FilterGraph fg)

Definition at line 1812 of file ffmpeg_filter.c.

Referenced by configure_filtergraph(), ifilter_bind_ist(), and print_stream_maps().

◆ init_simple_filtergraph()

int init_simple_filtergraph ( InputStream ist,
OutputStream ost,
char *  graph_desc 
)

Definition at line 957 of file ffmpeg_filter.c.

Referenced by ost_add().

◆ init_complex_filtergraph()

int init_complex_filtergraph ( FilterGraph fg)

Definition at line 1063 of file ffmpeg_filter.c.

Referenced by init_complex_filters().

◆ copy_av_subtitle()

int copy_av_subtitle ( AVSubtitle dst,
const AVSubtitle src 
)

Definition at line 651 of file ffmpeg.c.

Referenced by subtitle_wrap_frame().

◆ subtitle_wrap_frame()

int subtitle_wrap_frame ( AVFrame frame,
AVSubtitle subtitle,
int  copy 
)

Definition at line 738 of file ffmpeg.c.

Referenced by fix_sub_duration_heartbeat(), and transcode_subtitles().

◆ frame_data()

FrameData* frame_data ( AVFrame frame)

Get our axiliary frame data attached to the frame, allocating it if needed.

Definition at line 429 of file ffmpeg.c.

Referenced by choose_out_timebase(), dwt_plane(), fg_output_step(), fg_transcode_step(), generate_raw_frame(), nvenc_retrieve_frame_data(), nvenc_store_frame_data(), and packet_decode().

◆ ifilter_send_frame()

int ifilter_send_frame ( InputFilter ifilter,
AVFrame frame,
int  keep_reference 
)

Definition at line 2355 of file ffmpeg_filter.c.

Referenced by send_frame_to_filters().

◆ ifilter_send_eof()

int ifilter_send_eof ( InputFilter ifilter,
int64_t  pts,
AVRational  tb 
)

Definition at line 2307 of file ffmpeg_filter.c.

Referenced by send_filter_eof().

◆ ifilter_sub2video()

int ifilter_sub2video ( InputFilter ifilter,
const AVFrame frame 
)

Definition at line 2274 of file ffmpeg_filter.c.

Referenced by process_subtitle(), and sub2video_flush().

◆ ifilter_sub2video_heartbeat()

void ifilter_sub2video_heartbeat ( InputFilter ifilter,
int64_t  pts,
AVRational  tb 
)

Definition at line 2248 of file ffmpeg_filter.c.

Referenced by sub2video_heartbeat().

◆ ifilter_parameters_from_dec()

int ifilter_parameters_from_dec ( InputFilter ifilter,
const AVCodecContext dec 
)

Set up fallback filtering parameters from a decoder context.

They will only be used if no frames are ever sent on this input, otherwise the actual parameters are taken from the frame.

Definition at line 1749 of file ffmpeg_filter.c.

Referenced by ist_filter_add().

◆ ofilter_bind_ost()

int ofilter_bind_ost ( OutputFilter ofilter,
OutputStream ost 
)

Definition at line 665 of file ffmpeg_filter.c.

Referenced by init_simple_filtergraph(), and ost_add().

◆ fg_create()

int fg_create ( FilterGraph **  pfg,
char *  graph_desc 
)

Create a new filtergraph in the global filtergraph list.

Parameters
graph_descGraph description; an av_malloc()ed string, filtergraph takes ownership of it.

Definition at line 866 of file ffmpeg_filter.c.

Referenced by init_simple_filtergraph(), opt_filter_complex(), and opt_filter_complex_script().

◆ fg_free()

void fg_free ( FilterGraph **  pfg)

Definition at line 800 of file ffmpeg_filter.c.

Referenced by ffmpeg_cleanup().

◆ fg_transcode_step()

int fg_transcode_step ( FilterGraph graph,
InputStream **  best_ist 
)

Perform a step of transcoding for the specified filter graph.

Parameters
[in]graphfilter graph to consider
[out]best_istinput stream where a frame would allow to continue
Returns
0 for success, <0 for error

Definition at line 2452 of file ffmpeg_filter.c.

Referenced by transcode_step().

◆ fg_send_command()

void fg_send_command ( FilterGraph fg,
double  time,
const char *  target,
const char *  command,
const char *  arg,
int  all_filters 
)

Definition at line 1818 of file ffmpeg_filter.c.

Referenced by check_keyboard_interaction().

◆ reap_filters()

int reap_filters ( FilterGraph fg,
int  flush 
)

Get and encode new output from specified filtergraph, without causing activity.

Returns
0 for success, <0 for severe errors

Definition at line 2228 of file ffmpeg_filter.c.

Referenced by fg_transcode_step(), ifilter_send_frame(), and transcode_step().

◆ ffmpeg_parse_options()

int ffmpeg_parse_options ( int  argc,
char **  argv 
)

Referenced by main().

◆ enc_stats_write()

void enc_stats_write ( OutputStream ost,
EncStats es,
const AVFrame frame,
const AVPacket pkt,
uint64_t  frame_num 
)

Definition at line 481 of file ffmpeg_enc.c.

Referenced by encode_frame(), and write_packet().

◆ hw_device_get_by_name()

HWDevice* hw_device_get_by_name ( const char *  name)

◆ hw_device_get_by_type()

HWDevice* hw_device_get_by_type ( enum AVHWDeviceType  type)

◆ hw_device_init_from_string()

int hw_device_init_from_string ( const char *  arg,
HWDevice **  dev 
)

Definition at line 94 of file ffmpeg_hw.c.

Referenced by opt_init_hw_device().

◆ hw_device_init_from_type()

int hw_device_init_from_type ( enum AVHWDeviceType  type,
const char *  device,
HWDevice **  dev_out 
)

Definition at line 245 of file ffmpeg_hw.c.

Referenced by hw_device_setup_for_decode().

◆ hw_device_free_all()

void hw_device_free_all ( void  )

Definition at line 288 of file ffmpeg_hw.c.

Referenced by ffmpeg_cleanup().

◆ hw_device_for_filter()

AVBufferRef* hw_device_for_filter ( void  )

Get a hardware device to be used with this filtergraph.

The returned reference is owned by the callee, the caller must ref it explicitly for long-term use.

Definition at line 342 of file ffmpeg_hw.c.

Referenced by configure_filtergraph().

◆ hwaccel_retrieve_data()

int hwaccel_retrieve_data ( AVCodecContext avctx,
AVFrame input 
)

Definition at line 300 of file ffmpeg_hw.c.

Referenced by video_frame_process().

◆ dec_open()

int dec_open ( InputStream ist)

Definition at line 1070 of file ffmpeg_dec.c.

Referenced by ist_use().

◆ dec_free()

void dec_free ( Decoder **  pdec)

Definition at line 97 of file ffmpeg_dec.c.

Referenced by dec_alloc(), and ist_free().

◆ dec_packet()

int dec_packet ( InputStream ist,
const AVPacket pkt,
int  no_eof 
)

Submit a packet for decoding.

When pkt==NULL and no_eof=0, there will be no more input. Flush decoders and mark all downstreams as finished.

When pkt==NULL and no_eof=1, the stream was reset (e.g. after a seek). Flush decoders and await further input.

Definition at line 772 of file ffmpeg_dec.c.

Referenced by decode_flush(), and process_input_packet().

◆ enc_alloc()

int enc_alloc ( Encoder **  penc,
const AVCodec codec 
)

Definition at line 70 of file ffmpeg_enc.c.

Referenced by ost_add().

◆ enc_free()

void enc_free ( Encoder **  penc)

Definition at line 56 of file ffmpeg_enc.c.

Referenced by enc_alloc(), and ost_free().

◆ enc_open()

int enc_open ( OutputStream ost,
const AVFrame frame 
)

Definition at line 168 of file ffmpeg_enc.c.

Referenced by enc_frame(), fg_transcode_step(), and init_output_stream_nofilter().

◆ enc_subtitle()

int enc_subtitle ( OutputFile of,
OutputStream ost,
const AVSubtitle sub 
)

Definition at line 395 of file ffmpeg_enc.c.

Referenced by process_subtitle().

◆ enc_frame()

int enc_frame ( OutputStream ost,
AVFrame frame 
)

Definition at line 850 of file ffmpeg_enc.c.

Referenced by fg_output_frame(), and submit_encode_frame().

◆ enc_flush()

int enc_flush ( void  )

Definition at line 863 of file ffmpeg_enc.c.

Referenced by transcode().

◆ of_stream_init()

int of_stream_init ( OutputFile of,
OutputStream ost 
)

Definition at line 671 of file ffmpeg_mux.c.

Referenced by enc_open(), and init_output_stream_nofilter().

◆ of_write_trailer()

int of_write_trailer ( OutputFile of)

Definition at line 799 of file ffmpeg_mux.c.

Referenced by transcode().

◆ of_open()

int of_open ( const OptionsContext o,
const char *  filename 
)

Definition at line 2624 of file ffmpeg_mux_init.c.

◆ of_free()

void of_free ( OutputFile **  pof)

Definition at line 920 of file ffmpeg_mux.c.

Referenced by ffmpeg_cleanup().

◆ of_enc_stats_close()

void of_enc_stats_close ( void  )

Definition at line 235 of file ffmpeg_mux_init.c.

Referenced by ffmpeg_cleanup().

◆ of_output_packet()

int of_output_packet ( OutputFile of,
OutputStream ost,
AVPacket pkt 
)

Definition at line 349 of file ffmpeg_mux.c.

Referenced by enc_subtitle(), encode_frame(), of_streamcopy(), and process_input().

◆ of_streamcopy()

int of_streamcopy ( OutputStream ost,
const AVPacket pkt,
int64_t  dts 
)
Parameters
dtspredicted packet dts in AV_TIME_BASE_Q

Definition at line 406 of file ffmpeg_mux.c.

Referenced by process_input_packet().

◆ of_filesize()

int64_t of_filesize ( OutputFile of)

Definition at line 947 of file ffmpeg_mux.c.

Referenced by mux_final_stats(), and print_report().

◆ ifile_open()

int ifile_open ( const OptionsContext o,
const char *  filename 
)

Definition at line 1350 of file ffmpeg_demux.c.

◆ ifile_close()

void ifile_close ( InputFile **  f)

Definition at line 807 of file ffmpeg_demux.c.

Referenced by ffmpeg_cleanup().

◆ ifile_get_packet()

int ifile_get_packet ( InputFile f,
AVPacket **  pkt 
)

Get next input packet from the demuxer.

Parameters
pktthe packet is written here when this function returns 0
Returns
  • 0 when a packet has been read successfully
  • 1 when stream end was reached, but the stream is looped; caller should flush decoders and read from this demuxer again
  • a negative error code on failure

Definition at line 723 of file ffmpeg_demux.c.

Referenced by process_input().

◆ ist_output_add()

int ist_output_add ( InputStream ist,
OutputStream ost 
)

Definition at line 853 of file ffmpeg_demux.c.

Referenced by ost_add().

◆ ist_filter_add()

int ist_filter_add ( InputStream ist,
InputFilter ifilter,
int  is_simple 
)

Definition at line 870 of file ffmpeg_demux.c.

Referenced by ifilter_bind_ist().

◆ ist_find_unused()

InputStream* ist_find_unused ( enum AVMediaType  type)

Find an unused input stream of given type.

Definition at line 135 of file ffmpeg_demux.c.

Referenced by init_input_filter().

◆ ist_iter()

InputStream* ist_iter ( InputStream prev)

◆ ost_iter()

OutputStream* ost_iter ( OutputStream prev)

Definition at line 397 of file ffmpeg.c.

Referenced by choose_output(), enc_flush(), print_report(), print_stream_maps(), and reset_eagain().

◆ close_output_stream()

void close_output_stream ( OutputStream ost)

Definition at line 487 of file ffmpeg.c.

Referenced by check_recording_time(), fg_transcode_step(), and submit_encode_frame().

◆ trigger_fix_sub_duration_heartbeat()

int trigger_fix_sub_duration_heartbeat ( OutputStream ost,
const AVPacket pkt 
)

Definition at line 771 of file ffmpeg.c.

Referenced by encode_frame(), and of_streamcopy().

◆ fix_sub_duration_heartbeat()

int fix_sub_duration_heartbeat ( InputStream ist,
int64_t  signal_pts 
)

Definition at line 454 of file ffmpeg_dec.c.

Referenced by ost_add(), and trigger_fix_sub_duration_heartbeat().

◆ update_benchmark()

void update_benchmark ( const char *  fmt,
  ... 
)

Definition at line 466 of file ffmpeg.c.

Referenced by encode_frame(), and packet_decode().

◆ err_merge()

static int err_merge ( int  err0,
int  err1 
)
inlinestatic

Merge two return codes - return one of the error codes if at least one of them was negative, 0 otherwise.

Currently just picks the first one, eventually we might want to do something more sophisticated, like sorting them by priority.

Definition at line 889 of file ffmpeg.h.

Referenced by check_written(), dec_packet(), ifile_open(), of_write_trailer(), and transcode().

◆ pkt_move()

static void pkt_move ( void *  dst,
void *  src 
)
inlinestatic

Definition at line 945 of file ffmpeg.h.

Referenced by dec_thread_start(), and thread_start().

◆ frame_move()

static void frame_move ( void *  dst,
void *  src 
)
inlinestatic

Definition at line 950 of file ffmpeg.h.

Referenced by dec_thread_start().

Variable Documentation

◆ forced_keyframes_const_names

const char* const forced_keyframes_const_names[]

Definition at line 2399 of file ffmpeg_mux_init.c.

Referenced by process_forced_keyframes().

◆ input_files

InputFile** input_files

◆ nb_input_files

int nb_input_files

◆ output_files

OutputFile** output_files

◆ nb_output_files

int nb_output_files

◆ filtergraphs

FilterGraph** filtergraphs

◆ nb_filtergraphs

int nb_filtergraphs

◆ vstats_filename

char* vstats_filename

Definition at line 65 of file ffmpeg_opt.c.

Referenced by encode_frame(), ffmpeg_cleanup(), opt_vstats_file(), and update_video_stats().

◆ sdp_filename

char* sdp_filename

Definition at line 66 of file ffmpeg_opt.c.

Referenced by mux_check_init(), opt_sdp_file(), and print_sdp().

◆ dts_delta_threshold

float dts_delta_threshold

Definition at line 69 of file ffmpeg_opt.c.

Referenced by ts_discontinuity_detect().

◆ dts_error_threshold

float dts_error_threshold

Definition at line 70 of file ffmpeg_opt.c.

Referenced by ts_discontinuity_detect(), and video_sync_process().

◆ video_sync_method

enum VideoSyncMethod video_sync_method

Definition at line 72 of file ffmpeg_opt.c.

Referenced by new_stream_video(), opt_vsync(), and parse_and_set_vsync().

◆ frame_drop_threshold

float frame_drop_threshold

Definition at line 73 of file ffmpeg_opt.c.

Referenced by video_sync_process().

◆ do_benchmark

int do_benchmark

Definition at line 74 of file ffmpeg_opt.c.

Referenced by ffmpeg_cleanup(), and main().

◆ do_benchmark_all

int do_benchmark_all

Definition at line 75 of file ffmpeg_opt.c.

Referenced by update_benchmark().

◆ do_hex_dump

int do_hex_dump

Definition at line 76 of file ffmpeg_opt.c.

Referenced by input_thread().

◆ do_pkt_dump

int do_pkt_dump

Definition at line 77 of file ffmpeg_opt.c.

Referenced by input_thread().

◆ copy_ts

int copy_ts

◆ start_at_zero

int start_at_zero

◆ copy_tb

int copy_tb

Definition at line 80 of file ffmpeg_opt.c.

Referenced by avformat_transfer_internal_stream_timing_info(), and streamcopy_init().

◆ debug_ts

int debug_ts

◆ exit_on_error

int exit_on_error

◆ abort_on_flags

int abort_on_flags

Definition at line 83 of file ffmpeg_opt.c.

Referenced by check_written(), and opt_abort_on().

◆ print_stats

int print_stats

Definition at line 84 of file ffmpeg_opt.c.

Referenced by print_report().

◆ stats_period

int64_t stats_period

Definition at line 91 of file ffmpeg_opt.c.

Referenced by opt_stats_period(), and print_report().

◆ stdin_interaction

int stdin_interaction

Definition at line 85 of file ffmpeg_opt.c.

Referenced by assert_file_overwrite(), ifile_open(), term_init(), and transcode().

◆ progress_avio

AVIOContext* progress_avio

Definition at line 121 of file ffmpeg.c.

Referenced by print_report().

◆ max_error_rate

float max_error_rate

Definition at line 86 of file ffmpeg_opt.c.

Referenced by transcode().

◆ filter_nbthreads

char* filter_nbthreads

Definition at line 87 of file ffmpeg_opt.c.

Referenced by configure_filtergraph(), ffmpeg_cleanup(), and opt_filter_threads().

◆ filter_complex_nbthreads

int filter_complex_nbthreads

Definition at line 88 of file ffmpeg_opt.c.

Referenced by configure_filtergraph().

◆ vstats_version

int vstats_version

Definition at line 89 of file ffmpeg_opt.c.

Referenced by update_video_stats().

◆ auto_conversion_filters

int auto_conversion_filters

Definition at line 90 of file ffmpeg_opt.c.

Referenced by fg_create().

◆ int_cb

const AVIOInterruptCB int_cb

◆ options

const OptionDef options[]

◆ filter_hw_device

HWDevice* filter_hw_device

Definition at line 63 of file ffmpeg_opt.c.

Referenced by hw_device_for_filter(), and opt_filter_hw_device().

◆ nb_output_dumped

unsigned nb_output_dumped

Definition at line 118 of file ffmpeg.c.

Referenced by mux_check_init(), and print_report().

◆ ignore_unknown_streams

int ignore_unknown_streams

Definition at line 99 of file ffmpeg_opt.c.

Referenced by map_manual().

◆ copy_unknown_streams

int copy_unknown_streams

Definition at line 100 of file ffmpeg_opt.c.

Referenced by map_manual().

◆ recast_media

int recast_media

Definition at line 101 of file ffmpeg_opt.c.

Referenced by choose_decoder(), and find_codec().

◆ vstats_file

FILE* vstats_file

Definition at line 107 of file ffmpeg.c.

Referenced by ffmpeg_cleanup(), and update_video_stats().

◆ do_psnr

int do_psnr

Definition at line 97 of file ffmpeg_opt.c.

Referenced by new_stream_video().

◆ opt_name_codec_names

const char* const opt_name_codec_names[]

Definition at line 56 of file ffmpeg_opt.c.

◆ opt_name_codec_tags

const char* const opt_name_codec_tags[]

Definition at line 58 of file ffmpeg_opt.c.

◆ opt_name_frame_rates

const char* const opt_name_frame_rates[]

Definition at line 57 of file ffmpeg_opt.c.

◆ opt_name_top_field_first

const char* const opt_name_top_field_first[]

Definition at line 60 of file ffmpeg_opt.c.

AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:186
name
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
Definition: writing_filters.txt:88
av_strlcatf
size_t av_strlcatf(char *dst, size_t size, const char *fmt,...)
Definition: avstring.c:103
type
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
Definition: writing_filters.txt:86
check_stream_specifier
int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec)
Check if the given stream matches a stream specifier.
Definition: cmdutils.c:917
NULL
#define NULL
Definition: coverity.c:32
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:255