Go to the documentation of this file.
22 #ifndef FFTOOLS_CMDUTILS_H
23 #define FFTOOLS_CMDUTILS_H
152 int allow_remainder,
void *logctx);
201 #define OPT_FUNC_ARG (1 << 0)
203 #define OPT_EXIT (1 << 1)
207 #define OPT_EXPERT (1 << 2)
208 #define OPT_VIDEO (1 << 3)
209 #define OPT_AUDIO (1 << 4)
210 #define OPT_SUBTITLE (1 << 5)
211 #define OPT_DATA (1 << 6)
215 #define OPT_PERFILE (1 << 7)
219 #define OPT_FLAG_OFFSET (1 << 8)
220 #define OPT_OFFSET (OPT_FLAG_OFFSET | OPT_PERFILE)
224 #define OPT_FLAG_SPEC (1 << 9)
225 #define OPT_SPEC (OPT_FLAG_SPEC | OPT_OFFSET)
228 #define OPT_FLAG_PERSTREAM (1 << 10)
229 #define OPT_PERSTREAM (OPT_FLAG_PERSTREAM | OPT_SPEC)
233 #define OPT_INPUT (1 << 11)
234 #define OPT_OUTPUT (1 << 12)
238 #define OPT_HAS_ALT (1 << 13)
241 #define OPT_HAS_CANON (1 << 14)
244 #define OPT_DECODER (1 << 15)
248 int (*
func_arg)(
void *,
const char *,
const char *);
300 int (* parse_arg_function)(
void *optctx,
const char*));
413 const char *optname);
505 const char *preset_name,
int is_path,
const char *codec_name);
532 #define GROW_ARRAY(array, nb_elems)\
533 grow_array((void**)&array, sizeof(*array), &nb_elems, nb_elems + 1)
const OptionGroupDef * group_def
void show_help_default(const char *opt, const char *arg)
Per-fftool specific help handler.
enum AVMediaType media_type
void stream_specifier_uninit(StreamSpecifier *ss)
const char program_name[]
program name, defined by the program for show_version().
char * file_read(const char *filename)
AVDictionary * codec_opts
int opt_timelimit(void *optctx, const char *opt, const char *arg)
Limit the execution time.
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.
int filter_codec_opts(const AVDictionary *opts, enum AVCodecID codec_id, AVFormatContext *s, AVStream *st, const AVCodec *codec, AVDictionary **dst, AVDictionary **opts_used)
Filter out options for given codec.
An option extracted from the commandline.
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
int check_avoptions(AVDictionary *m)
#define ss(width, name, subs,...)
enum StreamList stream_list
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
AVDictionary * codec_opts
int flags
Option flags that must be set on each option that is applied to this group.
int setup_find_stream_info_opts(AVFormatContext *s, AVDictionary *codec_opts, AVDictionary ***dst)
Setup AVCodecContext options for avformat_find_stream_info().
int parse_number(const char *context, const char *numstr, enum OptionType type, double min, double max, double *dst)
Parse a string and return its corresponding value as a double.
void uninit_opts(void)
Uninitialize the cmdutils option system, in particular free the *_opts contexts and their contents.
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 show_help_options(const OptionDef *options, const char *msg, int req_flags, int rej_flags)
Print help for all options matching specified flags.
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.
unsigned stream_specifier_match(const StreamSpecifier *ss, const AVFormatContext *s, const AVStream *st, void *logctx)
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
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.
void remove_avoptions(AVDictionary **a, AVDictionary *b)
int grow_array(void **array, int elem_size, int *size, int new_size)
Realloc array to hold new_size elements of elem_size.
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
void show_banner(int argc, char **argv, const OptionDef *options)
Print the program banner to stderr.
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
void uninit_parse_context(OptionParseContext *octx)
Free all allocated memory in an OptionParseContext.
void parse_loglevel(int argc, char **argv, const OptionDef *options)
Find the '-loglevel' option in the command line args and apply it.
int parse_optgroup(void *optctx, OptionGroup *g, const OptionDef *defs)
Parse an options group and write results into optctx.
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
const struct OptionDef * opt_canon
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]
StreamSpecifier stream_spec
int parse_options(void *optctx, int argc, char **argv, const OptionDef *options, int(*parse_arg_function)(void *optctx, const char *))
Parse the command line arguments.
const char *const * names_alt
int stream_specifier_parse(StreamSpecifier *ss, const char *spec, int allow_remainder, void *logctx)
Parse a stream specifier string into a form suitable for matching.
int cmdutils_isalnum(char c)
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.
double get_rotation(const int32_t *displaymatrix)
#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.
static 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...
int(* func_arg)(void *, const char *, const char *)
const int program_birth_year
program birth year, defined by the program for show_banner()