Go to the documentation of this file.
22 #ifndef FFTOOLS_CMDUTILS_H
23 #define FFTOOLS_CMDUTILS_H
138 #define HAS_ARG 0x0001
139 #define OPT_BOOL 0x0002
140 #define OPT_EXPERT 0x0004
141 #define OPT_STRING 0x0008
142 #define OPT_VIDEO 0x0010
143 #define OPT_AUDIO 0x0020
144 #define OPT_INT 0x0080
145 #define OPT_FLOAT 0x0100
146 #define OPT_SUBTITLE 0x0200
147 #define OPT_INT64 0x0400
148 #define OPT_EXIT 0x0800
149 #define OPT_DATA 0x1000
150 #define OPT_PERFILE 0x2000
152 #define OPT_OFFSET 0x4000
153 #define OPT_SPEC 0x8000
156 #define OPT_TIME 0x10000
157 #define OPT_DOUBLE 0x20000
158 #define OPT_INPUT 0x40000
159 #define OPT_OUTPUT 0x80000
179 int rej_flags,
int alt_flags);
206 void (* parse_arg_function)(
void *optctx,
const char*));
319 const char *optname);
406 const char *preset_name,
int is_path,
const char *codec_name);
434 #define GROW_ARRAY(array, nb_elems)\
435 array = grow_array(array, sizeof(*array), &nb_elems, nb_elems + 1)
437 #define ALLOC_ARRAY_ELEM(array, nb_elems)\
438 allocate_array_elem(&array, sizeof(*array[0]), &nb_elems)
440 #define GET_PIX_FMT_NAME(pix_fmt)\
441 const char *name = av_get_pix_fmt_name(pix_fmt);
443 #define GET_CODEC_NAME(id)\
444 const char *name = avcodec_descriptor_get(id)->name;
446 #define GET_SAMPLE_FMT_NAME(sample_fmt)\
447 const char *name = av_get_sample_fmt_name(sample_fmt)
449 #define GET_SAMPLE_RATE_NAME(rate)\
451 snprintf(name, sizeof(name), "%d", rate);
const OptionGroupDef * group_def
AVDictionary ** setup_find_stream_info_opts(AVFormatContext *s, AVDictionary *codec_opts)
Setup AVCodecContext options for avformat_find_stream_info().
void show_help_default(const char *opt, const char *arg)
Per-fftool specific help handler.
static double cb(void *priv, double x, double y)
double get_rotation(int32_t *displaymatrix)
const char program_name[]
program name, defined by the program for show_version().
AVDictionary * codec_opts
int opt_timelimit(void *optctx, const char *opt, const char *arg)
Limit the execution time.
int64_t parse_time_or_die(const char *context, const char *timestr, int is_duration)
Parse a string specifying a time and return its corresponding value as a number of microseconds.
FILE * get_preset_file(char *filename, size_t filename_size, const char *preset_name, int is_path, const char *codec_name)
Get a file corresponding to a preset file.
A list of option groups that all have the same group type (e.g.
An option extracted from the commandline.
double parse_number_or_die(const char *context, const char *numstr, int type, double min, double max)
Parse a string and return its corresponding value as a double.
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
const OptionGroupDef * group_def
AVDictionary * codec_opts
int flags
Option flags that must be set on each option that is applied to this group.
void * grow_array(void *array, int elem_size, int *size, int new_size)
Realloc array to hold new_size elements of elem_size.
char * specifier
stream/chapter/program/...
void uninit_opts(void)
Uninitialize the cmdutils option system, in particular free the *_opts contexts and their contents.
void print_error(const char *filename, int err)
Print an error message to stderr, indicating filename and a human readable description of the error c...
void * allocate_array_elem(void *array, size_t elem_size, int *nb_elems)
Atomically add a new element to an array of pointers, i.e.
void init_dynload(void)
Initialize dynamic library loading.
void show_help_children(const AVClass *class, int flags)
Show help for all options with given flags in class and all its children.
void parse_options(void *optctx, int argc, char **argv, const OptionDef *options, void(*parse_arg_function)(void *optctx, const char *))
Parse the command line arguments.
const char * name
< group 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 keep it simple and lowercase description are in without and describe what they for example set the foo of the bar offset is the offset of the field in your context
AVDictionary * format_opts
Describe the class of an AVClass context structure.
AVDictionary * filter_codec_opts(AVDictionary *opts, enum AVCodecID codec_id, AVFormatContext *s, AVStream *st, const AVCodec *codec)
Filter out options for given codec.
int parse_optgroup(void *optctx, OptionGroup *g)
Parse an options group and write results into optctx.
AVCodecID
Identify the syntax and semantics of the bitstream.
int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec)
Check if the given stream matches a stream specifier.
int read_yesno(void)
Return a positive value if a line read from standard input starts with [yY], otherwise return 0.
const OptionDef options[]
void show_banner(int argc, char **argv, const OptionDef *options)
Print the program banner to stderr.
void register_exit(void(*cb)(int ret))
Register a program-specific cleanup routine.
void uninit_parse_context(OptionParseContext *octx)
Free all allocated memory in an OptionParseContext.
void exit_program(int ret) av_noreturn
Wraps exit with a program-specific cleanup routine.
void parse_loglevel(int argc, char **argv, const OptionDef *options)
Find the '-loglevel' option in the command line args and apply it.
int opt_default(void *optctx, const char *opt, const char *arg)
Fallback for options that are not explicitly handled, these will be parsed through AVOptions.
AVDictionary * format_opts
int split_commandline(OptionParseContext *octx, int argc, char *argv[], const OptionDef *options, const OptionGroupDef *groups, int nb_groups)
Split the commandline into an intermediate form convenient for further processing.
static int array[MAX_W *MAX_W]
const char * sep
Option to be used as group separator.
void log_callback_help(void *ptr, int level, const char *fmt, va_list vl)
Trivial log callback.
#define flags(name, subs,...)
int parse_option(void *optctx, const char *opt, const char *arg, const OptionDef *options)
Parse one given option.
int locate_option(int argc, char **argv, const OptionDef *options, const char *optname)
Return index of option opt in argv or 0 if not found.
int(* func_arg)(void *, const char *, const char *)
void show_help_options(const OptionDef *options, const char *msg, int req_flags, int rej_flags, int alt_flags)
Print help for all options matching specified flags.
const int program_birth_year
program birth year, defined by the program for show_banner()