Go to the documentation of this file.
19 #ifndef FFTOOLS_FFMPEG_H
20 #define FFTOOLS_FFMPEG_H
24 #include <stdatomic.h>
53 #define FFMPEG_OPT_PSNR 1
54 #define FFMPEG_OPT_MAP_CHANNEL 1
55 #define FFMPEG_OPT_MAP_SYNC 1
56 #define FFMPEG_ROTATION_METADATA 1
67 #define MAX_STREAMS 1024
89 #if FFMPEG_OPT_MAP_CHANNEL
148 #if FFMPEG_OPT_MAP_CHANNEL
327 #define DECODING_FOR_OST 1
328 #define DECODING_FOR_FILTER 2
480 #define ABORT_ON_FLAG_EMPTY_OUTPUT (1 << 0)
481 #define ABORT_ON_FLAG_EMPTY_OUTPUT_STREAM (1 << 1)
555 #if FFMPEG_ROTATION_METADATA
561 #if FFMPEG_ROTATION_METADATA
570 #if FFMPEG_OPT_MAP_CHANNEL
785 #define SPECIFIER_OPT_FMT_str "%s"
786 #define SPECIFIER_OPT_FMT_i "%i"
787 #define SPECIFIER_OPT_FMT_i64 "%"PRId64
788 #define SPECIFIER_OPT_FMT_ui64 "%"PRIu64
789 #define SPECIFIER_OPT_FMT_f "%f"
790 #define SPECIFIER_OPT_FMT_dbl "%lf"
792 #define WARN_MULTIPLE_OPT_USAGE(name, type, so, st)\
794 char namestr[128] = "";\
795 const char *spec = so->specifier && so->specifier[0] ? so->specifier : "";\
796 for (int _i = 0; opt_name_##name[_i]; _i++)\
797 av_strlcatf(namestr, sizeof(namestr), "-%s%s", opt_name_##name[_i], opt_name_##name[_i+1] ? (opt_name_##name[_i+2] ? ", " : " or ") : "");\
798 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",\
799 namestr, st->index, opt_name_##name[0], spec[0] ? ":" : "", spec, so->u.type);\
802 #define MATCH_PER_STREAM_OPT(name, type, outvar, fmtctx, st)\
804 int _ret, _matches = 0;\
806 for (int _i = 0; _i < o->nb_ ## name; _i++) {\
807 char *spec = o->name[_i].specifier;\
808 if ((_ret = check_stream_specifier(fmtctx, st, spec)) > 0) {\
809 outvar = o->name[_i].u.type;\
812 } else if (_ret < 0)\
816 WARN_MULTIPLE_OPT_USAGE(name, type, so, st);\
819 #define MATCH_PER_TYPE_OPT(name, type, outvar, fmtctx, mediatype)\
822 for (i = 0; i < o->nb_ ## name; i++) {\
823 char *spec = o->name[i].specifier;\
824 if (!strcmp(spec, mediatype))\
825 outvar = o->name[i].u.type;\
int of_open(const OptionsContext *o, const char *filename)
AVPixelFormat
Pixel format.
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
struct FilterGraph * graph
SpecifierOpt * canvas_sizes
SpecifierOpt * dump_attachment
const char * attachment_filename
const AVChannelLayout * ch_layouts
int configure_filtergraph(FilterGraph *fg)
SpecifierOpt * intra_matrices
@ KF_FORCE_SOURCE_NO_DROP
This struct describes the properties of an encoded stream.
static float sub(float src0, float src1)
float frame_drop_threshold
SpecifierOpt * rc_overrides
atomic_uint_least64_t packets_written
const AVCodec * find_codec_or_die(const char *name, enum AVMediaType type, int encoder)
int parse_and_set_vsync(const char *arg, int *vsync_var, int file_idx, int st_idx, int is_global)
int64_t start_time
start time in microseconds == AV_TIME_BASE units
SpecifierOpt * frame_aspect_ratios
AVIOContext * progress_avio
int ffmpeg_parse_options(int argc, char **argv)
This structure describes decoded (raw) audio or video data.
int64_t of_filesize(OutputFile *of)
int nb_chroma_intra_matrices
SpecifierOpt * inter_matrices
const AVIOInterruptCB int_cb
SpecifierOpt * audio_channels
int hw_device_init_from_string(const char *arg, HWDevice **dev)
double rotate_override_value
Callback for checking whether to abort blocking functions.
int init_simple_filtergraph(InputStream *ist, OutputStream *ost)
SpecifierOpt * display_rotations
enum VideoSyncMethod vsync_method
float dts_delta_threshold
char * filters
filtergraph associated to the -filter option
void assert_file_overwrite(const char *filename)
const char *const opt_name_codec_names[]
int64_t vsync_frame_number
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
int hw_device_setup_for_decode(InputStream *ist)
void assert_avoptions(AVDictionary *m)
SpecifierOpt * time_bases
int nb_audio_channel_maps
int copy_initial_nonkeyframes
SpecifierOpt * copy_initial_nonkeyframes
SpecifierOpt * codec_names
AVRational frame_aspect_ratio
int nb_bits_per_raw_sample
int audio_channels_mapped
SpecifierOpt * audio_ch_layouts
struct OutputStream * ost
int ignore_unknown_streams
float audio_drift_threshold
int nb_copy_initial_nonkeyframes
SpecifierOpt * sample_fmts
int nb_max_muxing_queue_size
double expr_const_values[FKF_NB]
AVDictionary * encoder_opts
SpecifierOpt * reinit_filters
const char *const forced_keyframes_const_names[]
SpecifierOpt * frame_sizes
void of_close(OutputFile **pof)
Rational number (pair of numerator and denominator).
SpecifierOpt * fix_sub_duration
SpecifierOpt * codec_tags
int ifile_get_packet(InputFile *f, AVPacket **pkt)
Get next input packet from the demuxer.
const char *const opt_name_top_field_first[]
SpecifierOpt * max_frames
FilterGraph ** filtergraphs
SpecifierOpt * display_hflips
unsigned nb_output_dumped
const OptionDef options[]
int nb_frame_aspect_ratios
void sub2video_update(InputStream *ist, int64_t heartbeat_pts, AVSubtitle *sub)
An AVChannelLayout holds information about the channel layout of audio data.
SpecifierOpt * filter_scripts
int hwaccel_decode_init(AVCodecContext *avctx)
SpecifierOpt * top_field_first
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
AVDictionary * strip_specifiers(const AVDictionary *dict)
void check_filter_outputs(void)
SpecifierOpt * frame_rates
SpecifierOpt * autorotate
AVRational max_frame_rate
char * filters_script
filtergraph script associated to the -filter_script option
int nb_hwaccel_output_formats
int init_complex_filtergraph(FilterGraph *fg)
SpecifierOpt * forced_key_frames
void of_output_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost, int eof)
SpecifierOpt * metadata_map
SpecifierOpt * audio_sample_rate
float shortest_buf_duration
OutputFile ** output_files
int64_t last_nb0_frames[3]
int hw_device_setup_for_filter(FilterGraph *fg)
SpecifierOpt * bits_per_raw_sample
SpecifierOpt * bitstream_filters
SpecifierOpt * passlogfiles
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
AVChannelLayout ch_layout
AudioChannelMap * audio_channel_maps
void hw_device_free_all(void)
void ifile_close(InputFile **f)
SpecifierOpt * disposition
int ifilter_parameters_from_frame(InputFilter *ifilter, const AVFrame *frame)
int ifile_open(const OptionsContext *o, const char *filename)
HWDevice * filter_hw_device
main external API structure.
int hw_device_setup_for_encode(OutputStream *ost)
SpecifierOpt * guess_layout_max
SpecifierOpt * enc_time_bases
SpecifierOpt * max_frame_rates
SpecifierOpt * frame_pix_fmts
enum VideoSyncMethod video_sync_method
SpecifierOpt * hwaccel_devices
SpecifierOpt * max_muxing_queue_size
void remove_avoptions(AVDictionary **a, AVDictionary *b)
int nb_muxing_queue_data_threshold
SpecifierOpt * muxing_queue_data_threshold
A reference to a data buffer.
SpecifierOpt * copy_prior_start
InputStream * ist_iter(InputStream *prev)
int auto_conversion_filters
const char *const opt_name_frame_rates[]
const char ** attachments
This structure stores compressed data.
SpecifierOpt * chroma_intra_matrices
char * file_read(const char *filename)
float dts_error_threshold
SpecifierOpt * hwaccel_output_formats
const AVOutputFormat * format
const char *const opt_name_codec_tags[]
int64_t recording_time
desired length of the resulting file in microseconds == AV_TIME_BASE units
int of_stream_init(OutputFile *of, OutputStream *ost)
HWDevice * hw_device_get_by_name(const char *name)
A linked-list of the inputs/outputs of the filter chain.
int of_write_trailer(OutputFile *of)
int filtergraph_is_simple(FilterGraph *fg)
SpecifierOpt * display_vflips
intptr_t atomic_uint_least64_t
int filter_complex_nbthreads