22 #ifndef FFTOOLS_CMDUTILS_H 23 #define FFTOOLS_CMDUTILS_H 51 extern AVDictionary *format_opts, *codec_opts, *resample_opts;
52 extern int hide_banner;
57 void register_exit(
void (*cb)(
int ret));
62 void exit_program(
int ret) av_noreturn;
67 void init_dynload(
void);
78 void uninit_opts(
void);
84 void log_callback_help(
void* ptr,
int level,
const char* fmt, va_list vl);
89 int opt_cpuflags(
void *optctx,
const char *opt,
const char *arg);
95 int opt_default(
void *optctx,
const char *opt,
const char *arg);
100 int opt_loglevel(
void *optctx,
const char *opt,
const char *arg);
102 int opt_report(
const char *opt);
104 int opt_max_alloc(
void *optctx,
const char *opt,
const char *arg);
106 int opt_codec_debug(
void *optctx,
const char *opt,
const char *arg);
111 int opt_timelimit(
void *optctx,
const char *opt,
const char *arg);
126 double parse_number_or_die(
const char *context,
const char *numstr,
int type,
127 double min,
double max);
143 int64_t parse_time_or_die(
const char *context,
const char *timestr,
161 #define HAS_ARG 0x0001 162 #define OPT_BOOL 0x0002 163 #define OPT_EXPERT 0x0004 164 #define OPT_STRING 0x0008 165 #define OPT_VIDEO 0x0010 166 #define OPT_AUDIO 0x0020 167 #define OPT_INT 0x0080 168 #define OPT_FLOAT 0x0100 169 #define OPT_SUBTITLE 0x0200 170 #define OPT_INT64 0x0400 171 #define OPT_EXIT 0x0800 172 #define OPT_DATA 0x1000 173 #define OPT_PERFILE 0x2000 175 #define OPT_OFFSET 0x4000 176 #define OPT_SPEC 0x8000 179 #define OPT_TIME 0x10000 180 #define OPT_DOUBLE 0x20000 181 #define OPT_INPUT 0x40000 182 #define OPT_OUTPUT 0x80000 185 int (*func_arg)(
void *,
const char *,
const char *);
201 void show_help_options(
const OptionDef *options,
const char *msg,
int req_flags,
202 int rej_flags,
int alt_flags);
205 #define CMDUTILS_COMMON_OPTIONS_AVDEVICE \ 206 { "sources" , OPT_EXIT | HAS_ARG, { .func_arg = show_sources }, \ 207 "list sources of the input device", "device" }, \ 208 { "sinks" , OPT_EXIT | HAS_ARG, { .func_arg = show_sinks }, \ 209 "list sinks of the output device", "device" }, \ 212 #define CMDUTILS_COMMON_OPTIONS_AVDEVICE 215 #define CMDUTILS_COMMON_OPTIONS \ 216 { "L", OPT_EXIT, { .func_arg = show_license }, "show license" }, \ 217 { "h", OPT_EXIT, { .func_arg = show_help }, "show help", "topic" }, \ 218 { "?", OPT_EXIT, { .func_arg = show_help }, "show help", "topic" }, \ 219 { "help", OPT_EXIT, { .func_arg = show_help }, "show help", "topic" }, \ 220 { "-help", OPT_EXIT, { .func_arg = show_help }, "show help", "topic" }, \ 221 { "version", OPT_EXIT, { .func_arg = show_version }, "show version" }, \ 222 { "buildconf", OPT_EXIT, { .func_arg = show_buildconf }, "show build configuration" }, \ 223 { "formats", OPT_EXIT, { .func_arg = show_formats }, "show available formats" }, \ 224 { "muxers", OPT_EXIT, { .func_arg = show_muxers }, "show available muxers" }, \ 225 { "demuxers", OPT_EXIT, { .func_arg = show_demuxers }, "show available demuxers" }, \ 226 { "devices", OPT_EXIT, { .func_arg = show_devices }, "show available devices" }, \ 227 { "codecs", OPT_EXIT, { .func_arg = show_codecs }, "show available codecs" }, \ 228 { "decoders", OPT_EXIT, { .func_arg = show_decoders }, "show available decoders" }, \ 229 { "encoders", OPT_EXIT, { .func_arg = show_encoders }, "show available encoders" }, \ 230 { "bsfs", OPT_EXIT, { .func_arg = show_bsfs }, "show available bit stream filters" }, \ 231 { "protocols", OPT_EXIT, { .func_arg = show_protocols }, "show available protocols" }, \ 232 { "filters", OPT_EXIT, { .func_arg = show_filters }, "show available filters" }, \ 233 { "pix_fmts", OPT_EXIT, { .func_arg = show_pix_fmts }, "show available pixel formats" }, \ 234 { "layouts", OPT_EXIT, { .func_arg = show_layouts }, "show standard channel layouts" }, \ 235 { "sample_fmts", OPT_EXIT, { .func_arg = show_sample_fmts }, "show available audio sample formats" }, \ 236 { "colors", OPT_EXIT, { .func_arg = show_colors }, "show available color names" }, \ 237 { "loglevel", HAS_ARG, { .func_arg = opt_loglevel }, "set logging level", "loglevel" }, \ 238 { "v", HAS_ARG, { .func_arg = opt_loglevel }, "set logging level", "loglevel" }, \ 239 { "report", 0, { (void*)opt_report }, "generate a report" }, \ 240 { "max_alloc", HAS_ARG, { .func_arg = opt_max_alloc }, "set maximum size of a single allocated block", "bytes" }, \ 241 { "cpuflags", HAS_ARG | OPT_EXPERT, { .func_arg = opt_cpuflags }, "force specific cpu flags", "flags" }, \ 242 { "hide_banner", OPT_BOOL | OPT_EXPERT, {&hide_banner}, "do not show program banner", "hide_banner" }, \ 243 CMDUTILS_COMMON_OPTIONS_AVDEVICE \ 249 void show_help_children(
const AVClass *
class,
int flags);
260 int show_help(
void *optctx,
const char *opt,
const char *arg);
274 void parse_options(
void *optctx,
int argc,
char **argv,
const OptionDef *options,
275 void (* parse_arg_function)(
void *optctx,
const char*));
282 int parse_option(
void *optctx,
const char *opt,
const char *arg,
383 void parse_loglevel(
int argc,
char **argv,
const OptionDef *options);
388 int locate_option(
int argc,
char **argv,
const OptionDef *options,
389 const char *optname);
442 void print_error(
const char *filename,
int err);
449 void show_banner(
int argc,
char **argv,
const OptionDef *options);
457 int show_version(
void *optctx,
const char *opt,
const char *arg);
464 int show_buildconf(
void *optctx,
const char *opt,
const char *arg);
471 int show_license(
void *optctx,
const char *opt,
const char *arg);
478 int show_formats(
void *optctx,
const char *opt,
const char *arg);
485 int show_muxers(
void *optctx,
const char *opt,
const char *arg);
492 int show_demuxers(
void *optctx,
const char *opt,
const char *arg);
499 int show_devices(
void *optctx,
const char *opt,
const char *arg);
506 int show_sinks(
void *optctx,
const char *opt,
const char *arg);
512 int show_sources(
void *optctx,
const char *opt,
const char *arg);
520 int show_codecs(
void *optctx,
const char *opt,
const char *arg);
526 int show_decoders(
void *optctx,
const char *opt,
const char *arg);
532 int show_encoders(
void *optctx,
const char *opt,
const char *arg);
539 int show_filters(
void *optctx,
const char *opt,
const char *arg);
546 int show_bsfs(
void *optctx,
const char *opt,
const char *arg);
553 int show_protocols(
void *optctx,
const char *opt,
const char *arg);
560 int show_pix_fmts(
void *optctx,
const char *opt,
const char *arg);
567 int show_layouts(
void *optctx,
const char *opt,
const char *arg);
573 int show_sample_fmts(
void *optctx,
const char *opt,
const char *arg);
579 int show_colors(
void *optctx,
const char *opt,
const char *arg);
585 int read_yesno(
void);
605 FILE *get_preset_file(
char *filename,
size_t filename_size,
606 const char *preset_name,
int is_path,
const char *codec_name);
618 void *grow_array(
void *array,
int elem_size,
int *size,
int new_size);
620 #define media_type_string av_get_media_type_string 622 #define GROW_ARRAY(array, nb_elems)\ 623 array = grow_array(array, sizeof(*array), &nb_elems, nb_elems + 1) 625 #define GET_PIX_FMT_NAME(pix_fmt)\ 626 const char *name = av_get_pix_fmt_name(pix_fmt); 628 #define GET_CODEC_NAME(id)\ 629 const char *name = avcodec_descriptor_get(id)->name; 631 #define GET_SAMPLE_FMT_NAME(sample_fmt)\ 632 const char *name = av_get_sample_fmt_name(sample_fmt) 634 #define GET_SAMPLE_RATE_NAME(rate)\ 636 snprintf(name, sizeof(name), "%d", rate); 638 #define GET_CH_LAYOUT_NAME(ch_layout)\ 640 snprintf(name, sizeof(name), "0x%"PRIx64, ch_layout); 642 #define GET_CH_LAYOUT_DESC(ch_layout)\ 644 av_get_channel_layout_string(name, sizeof(name), 0, ch_layout); const char * name
< group name
Definition: cmdutils.h:298
Main libavfilter public API header.
Definition: cmdutils.h:158
const char * sep
Option to be used as group separator.
Definition: cmdutils.h:303
Definition: cmdutils.h:311
Definition: cmdutils.h:146
AVCodec.
Definition: avcodec.h:3408
Format I/O context.
Definition: avformat.h:1342
Definition: cmdutils.h:296
int flags
Option flags that must be set on each option that is applied to this group.
Definition: cmdutils.h:308
AVCodecID
Identify the syntax and semantics of the bitstream.
Definition: avcodec.h:215
Definition: cmdutils.h:336
A list of option groups that all have the same group type (e.g.
Definition: cmdutils.h:329
char * specifier
stream/chapter/program/...
Definition: cmdutils.h:147
const char program_name[]
program name, defined by the program for show_version().
Definition: ffmpeg.c:109
void show_help_default(const char *opt, const char *arg)
Per-fftool specific help handler.
Definition: ffplay.c:3608
Stream structure.
Definition: avformat.h:873
Libavcodec external API header.
main external API structure.
Definition: avcodec.h:1518
Describe the class of an AVClass context structure.
Definition: log.h:67
An option extracted from the commandline.
Definition: cmdutils.h:290
const int program_birth_year
program birth year, defined by the program for show_banner()
Definition: ffmpeg.c:110