cmdutils.h
Go to the documentation of this file.
1 /*
2  * Various utilities for command line tools
3  * copyright (c) 2003 Fabrice Bellard
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #ifndef FFMPEG_CMDUTILS_H
23 #define FFMPEG_CMDUTILS_H
24 
25 #include <stdint.h>
26 
27 #include "libavcodec/avcodec.h"
28 #include "libavfilter/avfilter.h"
29 #include "libavformat/avformat.h"
30 #include "libswscale/swscale.h"
31 
32 #ifdef __MINGW32__
33 #undef main /* We don't want SDL to override our main() */
34 #endif
35 
36 /**
37  * program name, defined by the program for show_version().
38  */
39 extern const char program_name[];
40 
41 /**
42  * program birth year, defined by the program for show_banner()
43  */
44 extern const int program_birth_year;
45 
46 /**
47  * this year, defined by the program for show_banner()
48  */
49 extern const int this_year;
50 
53 extern struct SwsContext *sws_opts;
54 extern AVDictionary *swr_opts;
56 
57 /**
58  * Initialize the cmdutils option system, in particular
59  * allocate the *_opts contexts.
60  */
61 void init_opts(void);
62 /**
63  * Uninitialize the cmdutils option system, in particular
64  * free the *_opts contexts and their contents.
65  */
66 void uninit_opts(void);
67 
68 /**
69  * Trivial log callback.
70  * Only suitable for opt_help and similar since it lacks prefix handling.
71  */
72 void log_callback_help(void* ptr, int level, const char* fmt, va_list vl);
73 
74 /**
75  * Fallback for options that are not explicitly handled, these will be
76  * parsed through AVOptions.
77  */
78 int opt_default(void *optctx, const char *opt, const char *arg);
79 
80 /**
81  * Set the libav* libraries log level.
82  */
83 int opt_loglevel(void *optctx, const char *opt, const char *arg);
84 
85 int opt_report(const char *opt);
86 
87 int opt_max_alloc(void *optctx, const char *opt, const char *arg);
88 
89 int opt_cpuflags(void *optctx, const char *opt, const char *arg);
90 
91 int opt_codec_debug(void *optctx, const char *opt, const char *arg);
92 
93 int opt_opencl(void *optctx, const char *opt, const char *arg);
94 
95 /**
96  * Limit the execution time.
97  */
98 int opt_timelimit(void *optctx, const char *opt, const char *arg);
99 
100 /**
101  * Parse a string and return its corresponding value as a double.
102  * Exit from the application if the string cannot be correctly
103  * parsed or the corresponding value is invalid.
104  *
105  * @param context the context of the value to be set (e.g. the
106  * corresponding command line option name)
107  * @param numstr the string to be parsed
108  * @param type the type (OPT_INT64 or OPT_FLOAT) as which the
109  * string should be parsed
110  * @param min the minimum valid accepted value
111  * @param max the maximum valid accepted value
112  */
113 double parse_number_or_die(const char *context, const char *numstr, int type,
114  double min, double max);
115 
116 /**
117  * Parse a string specifying a time and return its corresponding
118  * value as a number of microseconds. Exit from the application if
119  * the string cannot be correctly parsed.
120  *
121  * @param context the context of the value to be set (e.g. the
122  * corresponding command line option name)
123  * @param timestr the string to be parsed
124  * @param is_duration a flag which tells how to interpret timestr, if
125  * not zero timestr is interpreted as a duration, otherwise as a
126  * date
127  *
128  * @see av_parse_time()
129  */
130 int64_t parse_time_or_die(const char *context, const char *timestr,
131  int is_duration);
132 
133 typedef struct SpecifierOpt {
134  char *specifier; /**< stream/chapter/program/... specifier */
135  union {
137  int i;
138  int64_t i64;
139  float f;
140  double dbl;
141  } u;
142 } SpecifierOpt;
143 
144 typedef struct OptionDef {
145  const char *name;
146  int flags;
147 #define HAS_ARG 0x0001
148 #define OPT_BOOL 0x0002
149 #define OPT_EXPERT 0x0004
150 #define OPT_STRING 0x0008
151 #define OPT_VIDEO 0x0010
152 #define OPT_AUDIO 0x0020
153 #define OPT_INT 0x0080
154 #define OPT_FLOAT 0x0100
155 #define OPT_SUBTITLE 0x0200
156 #define OPT_INT64 0x0400
157 #define OPT_EXIT 0x0800
158 #define OPT_DATA 0x1000
159 #define OPT_PERFILE 0x2000 /* the option is per-file (currently ffmpeg-only).
160  implied by OPT_OFFSET or OPT_SPEC */
161 #define OPT_OFFSET 0x4000 /* option is specified as an offset in a passed optctx */
162 #define OPT_SPEC 0x8000 /* option is to be stored in an array of SpecifierOpt.
163  Implies OPT_OFFSET. Next element after the offset is
164  an int containing element count in the array. */
165 #define OPT_TIME 0x10000
166 #define OPT_DOUBLE 0x20000
167 #define OPT_INPUT 0x40000
168 #define OPT_OUTPUT 0x80000
169  union {
170  void *dst_ptr;
171  int (*func_arg)(void *, const char *, const char *);
172  size_t off;
173  } u;
174  const char *help;
175  const char *argname;
176 } OptionDef;
177 
178 /**
179  * Print help for all options matching specified flags.
180  *
181  * @param options a list of options
182  * @param msg title of this group. Only printed if at least one option matches.
183  * @param req_flags print only options which have all those flags set.
184  * @param rej_flags don't print options which have any of those flags set.
185  * @param alt_flags print only options that have at least one of those flags set
186  */
187 void show_help_options(const OptionDef *options, const char *msg, int req_flags,
188  int rej_flags, int alt_flags);
189 
190 /**
191  * Show help for all options with given flags in class and all its
192  * children.
193  */
194 void show_help_children(const AVClass *class, int flags);
195 
196 /**
197  * Per-fftool specific help handler. Implemented in each
198  * fftool, called by show_help().
199  */
200 void show_help_default(const char *opt, const char *arg);
201 
202 /**
203  * Generic -h handler common to all fftools.
204  */
205 int show_help(void *optctx, const char *opt, const char *arg);
206 
207 /**
208  * Parse the command line arguments.
209  *
210  * @param optctx an opaque options context
211  * @param argc number of command line arguments
212  * @param argv values of command line arguments
213  * @param options Array with the definitions required to interpret every
214  * option of the form: -option_name [argument]
215  * @param parse_arg_function Name of the function called to process every
216  * argument without a leading option name flag. NULL if such arguments do
217  * not have to be processed.
218  */
219 void parse_options(void *optctx, int argc, char **argv, const OptionDef *options,
220  void (* parse_arg_function)(void *optctx, const char*));
221 
222 /**
223  * Parse one given option.
224  *
225  * @return on success 1 if arg was consumed, 0 otherwise; negative number on error
226  */
227 int parse_option(void *optctx, const char *opt, const char *arg,
228  const OptionDef *options);
229 
230 /**
231  * An option extracted from the commandline.
232  * Cannot use AVDictionary because of options like -map which can be
233  * used multiple times.
234  */
235 typedef struct Option {
236  const OptionDef *opt;
237  const char *key;
238  const char *val;
239 } Option;
240 
241 typedef struct OptionGroupDef {
242  /**< group name */
243  const char *name;
244  /**
245  * Option to be used as group separator. Can be NULL for groups which
246  * are terminated by a non-option argument (e.g. ffmpeg output files)
247  */
248  const char *sep;
249  /**
250  * Option flags that must be set on each option that is
251  * applied to this group
252  */
253  int flags;
255 
256 typedef struct OptionGroup {
258  const char *arg;
259 
261  int nb_opts;
262 
268 } OptionGroup;
269 
270 /**
271  * A list of option groups that all have the same group type
272  * (e.g. input files or output files)
273  */
274 typedef struct OptionGroupList {
276 
280 
281 typedef struct OptionParseContext {
283 
286 
287  /* parsing state */
290 
291 /**
292  * Parse an options group and write results into optctx.
293  *
294  * @param optctx an app-specific options context. NULL for global options group
295  */
296 int parse_optgroup(void *optctx, OptionGroup *g);
297 
298 /**
299  * Split the commandline into an intermediate form convenient for further
300  * processing.
301  *
302  * The commandline is assumed to be composed of options which either belong to a
303  * group (those with OPT_SPEC, OPT_OFFSET or OPT_PERFILE) or are global
304  * (everything else).
305  *
306  * A group (defined by an OptionGroupDef struct) is a sequence of options
307  * terminated by either a group separator option (e.g. -i) or a parameter that
308  * is not an option (doesn't start with -). A group without a separator option
309  * must always be first in the supplied groups list.
310  *
311  * All options within the same group are stored in one OptionGroup struct in an
312  * OptionGroupList, all groups with the same group definition are stored in one
313  * OptionGroupList in OptionParseContext.groups. The order of group lists is the
314  * same as the order of group definitions.
315  */
316 int split_commandline(OptionParseContext *octx, int argc, char *argv[],
317  const OptionDef *options,
318  const OptionGroupDef *groups, int nb_groups);
319 
320 /**
321  * Free all allocated memory in an OptionParseContext.
322  */
324 
325 /**
326  * Find the '-loglevel' option in the command line args and apply it.
327  */
328 void parse_loglevel(int argc, char **argv, const OptionDef *options);
329 
330 /**
331  * Return index of option opt in argv or 0 if not found.
332  */
333 int locate_option(int argc, char **argv, const OptionDef *options,
334  const char *optname);
335 
336 /**
337  * Check if the given stream matches a stream specifier.
338  *
339  * @param s Corresponding format context.
340  * @param st Stream from s to be checked.
341  * @param spec A stream specifier of the [v|a|s|d]:[<stream index>] form.
342  *
343  * @return 1 if the stream matches, 0 if it doesn't, <0 on error
344  */
345 int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec);
346 
347 /**
348  * Filter out options for given codec.
349  *
350  * Create a new options dictionary containing only the options from
351  * opts which apply to the codec with ID codec_id.
352  *
353  * @param opts dictionary to place options in
354  * @param codec_id ID of the codec that should be filtered for
355  * @param s Corresponding format context.
356  * @param st A stream from s for which the options should be filtered.
357  * @param codec The particular codec for which the options should be filtered.
358  * If null, the default one is looked up according to the codec id.
359  * @return a pointer to the created dictionary
360  */
362  AVFormatContext *s, AVStream *st, AVCodec *codec);
363 
364 /**
365  * Setup AVCodecContext options for avformat_find_stream_info().
366  *
367  * Create an array of dictionaries, one dictionary for each stream
368  * contained in s.
369  * Each dictionary will contain the options from codec_opts which can
370  * be applied to the corresponding stream codec context.
371  *
372  * @return pointer to the created array of dictionaries, NULL if it
373  * cannot be created
374  */
376  AVDictionary *codec_opts);
377 
378 /**
379  * Print an error message to stderr, indicating filename and a human
380  * readable description of the error code err.
381  *
382  * If strerror_r() is not available the use of this function in a
383  * multithreaded application may be unsafe.
384  *
385  * @see av_strerror()
386  */
387 void print_error(const char *filename, int err);
388 
389 /**
390  * Print the program banner to stderr. The banner contents depend on the
391  * current version of the repository and of the libav* libraries used by
392  * the program.
393  */
394 void show_banner(int argc, char **argv, const OptionDef *options);
395 
396 /**
397  * Print the version of the program to stdout. The version message
398  * depends on the current versions of the repository and of the libav*
399  * libraries.
400  * This option processing function does not utilize the arguments.
401  */
402 int show_version(void *optctx, const char *opt, const char *arg);
403 
404 /**
405  * Print the license of the program to stdout. The license depends on
406  * the license of the libraries compiled into the program.
407  * This option processing function does not utilize the arguments.
408  */
409 int show_license(void *optctx, const char *opt, const char *arg);
410 
411 /**
412  * Print a listing containing all the formats supported by the
413  * program.
414  * This option processing function does not utilize the arguments.
415  */
416 int show_formats(void *optctx, const char *opt, const char *arg);
417 
418 /**
419  * Print a listing containing all the codecs supported by the
420  * program.
421  * This option processing function does not utilize the arguments.
422  */
423 int show_codecs(void *optctx, const char *opt, const char *arg);
424 
425 /**
426  * Print a listing containing all the decoders supported by the
427  * program.
428  */
429 int show_decoders(void *optctx, const char *opt, const char *arg);
430 
431 /**
432  * Print a listing containing all the encoders supported by the
433  * program.
434  */
435 int show_encoders(void *optctx, const char *opt, const char *arg);
436 
437 /**
438  * Print a listing containing all the filters supported by the
439  * program.
440  * This option processing function does not utilize the arguments.
441  */
442 int show_filters(void *optctx, const char *opt, const char *arg);
443 
444 /**
445  * Print a listing containing all the bit stream filters supported by the
446  * program.
447  * This option processing function does not utilize the arguments.
448  */
449 int show_bsfs(void *optctx, const char *opt, const char *arg);
450 
451 /**
452  * Print a listing containing all the protocols supported by the
453  * program.
454  * This option processing function does not utilize the arguments.
455  */
456 int show_protocols(void *optctx, const char *opt, const char *arg);
457 
458 /**
459  * Print a listing containing all the pixel formats supported by the
460  * program.
461  * This option processing function does not utilize the arguments.
462  */
463 int show_pix_fmts(void *optctx, const char *opt, const char *arg);
464 
465 /**
466  * Print a listing containing all the standard channel layouts supported by
467  * the program.
468  * This option processing function does not utilize the arguments.
469  */
470 int show_layouts(void *optctx, const char *opt, const char *arg);
471 
472 /**
473  * Print a listing containing all the sample formats supported by the
474  * program.
475  */
476 int show_sample_fmts(void *optctx, const char *opt, const char *arg);
477 
478 /**
479  * Return a positive value if a line read from standard input
480  * starts with [yY], otherwise return 0.
481  */
482 int read_yesno(void);
483 
484 /**
485  * Read the file with name filename, and put its content in a newly
486  * allocated 0-terminated buffer.
487  *
488  * @param filename file to read from
489  * @param bufptr location where pointer to buffer is returned
490  * @param size location where size of buffer is returned
491  * @return 0 in case of success, a negative value corresponding to an
492  * AVERROR error code in case of failure.
493  */
494 int cmdutils_read_file(const char *filename, char **bufptr, size_t *size);
495 
496 /**
497  * Get a file corresponding to a preset file.
498  *
499  * If is_path is non-zero, look for the file in the path preset_name.
500  * Otherwise search for a file named arg.ffpreset in the directories
501  * $FFMPEG_DATADIR (if set), $HOME/.ffmpeg, and in the datadir defined
502  * at configuration time or in a "ffpresets" folder along the executable
503  * on win32, in that order. If no such file is found and
504  * codec_name is defined, then search for a file named
505  * codec_name-preset_name.avpreset in the above-mentioned directories.
506  *
507  * @param filename buffer where the name of the found filename is written
508  * @param filename_size size in bytes of the filename buffer
509  * @param preset_name name of the preset to search
510  * @param is_path tell if preset_name is a filename path
511  * @param codec_name name of the codec for which to look for the
512  * preset, may be NULL
513  */
514 FILE *get_preset_file(char *filename, size_t filename_size,
515  const char *preset_name, int is_path, const char *codec_name);
516 
517 /**
518  * Realloc array to hold new_size elements of elem_size.
519  * Calls exit() on failure.
520  *
521  * @param array array to reallocate
522  * @param elem_size size in bytes of each element
523  * @param size new element count will be written here
524  * @param new_size number of elements to place in reallocated array
525  * @return reallocated array
526  */
527 void *grow_array(void *array, int elem_size, int *size, int new_size);
528 
529 #define media_type_string av_get_media_type_string
530 
531 #define GROW_ARRAY(array, nb_elems)\
532  array = grow_array(array, sizeof(*array), &nb_elems, nb_elems + 1)
533 
534 #define GET_PIX_FMT_NAME(pix_fmt)\
535  const char *name = av_get_pix_fmt_name(pix_fmt);
536 
537 #define GET_SAMPLE_FMT_NAME(sample_fmt)\
538  const char *name = av_get_sample_fmt_name(sample_fmt)
539 
540 #define GET_SAMPLE_RATE_NAME(rate)\
541  char name[16];\
542  snprintf(name, sizeof(name), "%d", rate);
543 
544 #define GET_CH_LAYOUT_NAME(ch_layout)\
545  char name[16];\
546  snprintf(name, sizeof(name), "0x%"PRIx64, ch_layout);
547 
548 #define GET_CH_LAYOUT_DESC(ch_layout)\
549  char name[128];\
550  av_get_channel_layout_string(name, sizeof(name), 0, ch_layout);
551 
552 #endif /* CMDUTILS_H */
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.
Definition: cmdutils.c:409
int show_bsfs(void *optctx, const char *opt, const char *arg)
Print a listing containing all the bit stream filters supported by the program.
Definition: cmdutils.c:1423
int opt_codec_debug(void *optctx, const char *opt, const char *arg)
AVDictionary * resample_opts
Definition: cmdutils.h:265
const char * s
Definition: avisynth_c.h:668
struct OptionParseContext OptionParseContext
AVDictionary * swr_opts
Definition: cmdutils.h:267
int show_pix_fmts(void *optctx, const char *opt, const char *arg)
Print a listing containing all the pixel formats supported by the program.
Definition: cmdutils.c:1486
const char * name
< group name
Definition: cmdutils.h:243
int parse_optgroup(void *optctx, OptionGroup *g)
Parse an options group and write results into optctx.
Definition: cmdutils.c:376
int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec)
Check if the given stream matches a stream specifier.
Definition: cmdutils.c:1828
void uninit_parse_context(OptionParseContext *octx)
Free all allocated memory in an OptionParseContext.
Definition: cmdutils.c:651
const char * fmt
Definition: avisynth_c.h:669
external API header
if max(w)>1 w=0.9 *w/max(w)
double dbl
Definition: cmdutils.h:140
struct OptionDef OptionDef
const char * arg
Definition: cmdutils.h:258
AVCodecContext * avcodec_opts[AVMEDIA_TYPE_NB]
const char * sep
Option to be used as group separator.
Definition: cmdutils.h:248
int show_decoders(void *optctx, const char *opt, const char *arg)
Print a listing containing all the decoders supported by the program.
Definition: cmdutils.c:1411
Format I/O context.
Definition: avformat.h:944
int opt_max_alloc(void *optctx, const char *opt, const char *arg)
Definition: cmdutils.c:923
AVDictionary * format_opts
Definition: cmdutils.c:68
uint8_t
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.
Definition: cmdutils.c:114
static const OptionGroupDef groups[]
Definition: ffmpeg_opt.c:2452
int opt_timelimit(void *optctx, const char *opt, const char *arg)
Limit the execution time.
Definition: cmdutils.c:949
int show_protocols(void *optctx, const char *opt, const char *arg)
Print a listing containing all the protocols supported by the program.
Definition: cmdutils.c:1434
int nb_opts
Definition: cmdutils.h:261
void parse_loglevel(int argc, char **argv, const OptionDef *options)
Find the &#39;-loglevel&#39; option in the command line args and apply it.
Definition: cmdutils.c:459
struct OptionGroupDef OptionGroupDef
external API header
const OptionDef options[]
Definition: ffserver.c:4697
void uninit_opts(void)
Uninitialize the cmdutils option system, in particular free the *_opts contexts and their contents...
Definition: cmdutils.c:82
int flags
Option flags that must be set on each option that is applied to this group.
Definition: cmdutils.h:253
int show_license(void *optctx, const char *opt, const char *arg)
Print the license of the program to stdout.
Definition: cmdutils.c:1075
AVCodecID
Identify the syntax and semantics of the bitstream.
AVDictionary * swr_opts
Definition: cmdutils.c:67
struct SwsContext * sws_opts
Definition: cmdutils.c:66
int show_layouts(void *optctx, const char *opt, const char *arg)
Print a listing containing all the standard channel layouts supported by the program.
Definition: cmdutils.c:1519
void init_opts(void)
Initialize the cmdutils option system, in particular allocate the *_opts contexts.
Definition: cmdutils.c:74
const char * arg
const char * name
Definition: cmdutils.h:145
int flags
Definition: cmdutils.h:146
const char * val
Definition: cmdutils.h:238
enum AVCodecID codec_id
Definition: mov_chan.c:433
external API header
int size
const int program_birth_year
program birth year, defined by the program for show_banner()
Definition: ffmpeg.c:107
AVDictionary ** setup_find_stream_info_opts(AVFormatContext *s, AVDictionary *codec_opts)
Setup AVCodecContext options for avformat_find_stream_info().
Definition: cmdutils.c:1892
OptionGroup * groups
Definition: cmdutils.h:277
size_t off
Definition: cmdutils.h:172
FFT buffer for g
Definition: stft_peak.m:17
int opt_opencl(void *optctx, const char *opt, const char *arg)
int64_t i64
Definition: cmdutils.h:138
const OptionGroupDef * group_def
Definition: cmdutils.h:275
A list of option groups that all have the same group type (e.g.
Definition: cmdutils.h:274
void show_help_default(const char *opt, const char *arg)
Per-fftool specific help handler.
Definition: ffmpeg_opt.c:2374
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.
Definition: cmdutils.c:1778
int parse_option(void *optctx, const char *opt, const char *arg, const OptionDef *options)
Parse one given option.
Definition: cmdutils.c:312
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...
Definition: cmdutils.c:483
char * specifier
stream/chapter/program/...
Definition: cmdutils.h:134
struct OptionGroupList OptionGroupList
A list of option groups that all have the same group type (e.g.
FIXME Range Coding of cr are level
Definition: snow.txt:367
void * dst_ptr
Definition: cmdutils.h:170
struct OptionGroup OptionGroup
int opt_loglevel(void *optctx, const char *opt, const char *arg)
Set the libav* libraries log level.
Definition: cmdutils.c:784
uint8_t * str
Definition: cmdutils.h:136
int opt_report(const char *opt)
Definition: cmdutils.c:918
Stream structure.
Definition: avformat.h:643
int show_version(void *optctx, const char *opt, const char *arg)
Print the version of the program to stdout.
Definition: cmdutils.c:1066
void show_banner(int argc, char **argv, const OptionDef *options)
Print the program banner to stderr.
Definition: cmdutils.c:1055
const char * help
Definition: cmdutils.h:174
int show_formats(void *optctx, const char *opt, const char *arg)
Print a listing containing all the formats supported by the program.
Definition: cmdutils.c:1149
main external API structure.
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...
Definition: cmdutils.c:135
AVDictionary * codec_opts
Definition: cmdutils.c:68
AVDictionary * filter_codec_opts(AVDictionary *opts, enum AVCodecID codec_id, AVFormatContext *s, AVStream *st, AVCodec *codec)
Filter out options for given codec.
Definition: cmdutils.c:1836
const OptionGroupDef * group_def
Definition: cmdutils.h:257
Describe the class of an AVClass context structure.
Definition: log.h:50
const char * argname
Definition: cmdutils.h:175
int cmdutils_read_file(const char *filename, char **bufptr, size_t *size)
Read the file with name filename, and put its content in a newly allocated 0-terminated buffer...
Definition: cmdutils.c:1736
int show_codecs(void *optctx, const char *opt, const char *arg)
Print a listing containing all the codecs supported by the program.
Definition: cmdutils.c:1321
struct SpecifierOpt SpecifierOpt
#define type
static int flags
Definition: cpu.c:23
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.
Definition: cmdutils.c:678
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.
An option extracted from the commandline.
Definition: cmdutils.h:235
Main libavformat public API header.
AVDictionary * format_opts
Definition: cmdutils.h:264
OptionGroupList * groups
Definition: cmdutils.h:284
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.
Definition: cmdutils.c:147
OptionGroup global_opts
Definition: cmdutils.h:282
AVFormatContext * avformat_opts
void * grow_array(void *array, int elem_size, int *size, int new_size)
Realloc array to hold new_size elements of elem_size.
Definition: cmdutils.c:1912
const char * key
Definition: cmdutils.h:237
int show_encoders(void *optctx, const char *opt, const char *arg)
Print a listing containing all the encoders supported by the program.
Definition: cmdutils.c:1417
void show_help_children(const AVClass *class, int flags)
Show help for all options with given flags in class and all its children.
Definition: cmdutils.c:176
int show_help(void *optctx, const char *opt, const char *arg)
Generic -h handler common to all fftools.
Definition: cmdutils.c:1693
const OptionDef * opt
Definition: cmdutils.h:236
AVDictionary * resample_opts
Definition: cmdutils.c:68
int show_sample_fmts(void *optctx, const char *opt, const char *arg)
Print a listing containing all the sample formats supported by the program.
Definition: cmdutils.c:1548
union SpecifierOpt::@0 u
OptionGroup cur_group
Definition: cmdutils.h:288
AVDictionary * codec_opts
Definition: cmdutils.h:263
Option * opts
Definition: cmdutils.h:260
void log_callback_help(void *ptr, int level, const char *fmt, va_list vl)
Trivial log callback.
Definition: cmdutils.c:95
struct Option Option
An option extracted from the commandline.
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...
Definition: cmdutils.c:982
const int this_year
this year, defined by the program for show_banner()
Definition: cmdutils.c:70
int show_filters(void *optctx, const char *opt, const char *arg)
Print a listing containing all the filters supported by the program.
Definition: cmdutils.c:1449
int opt_cpuflags(void *optctx, const char *opt, const char *arg)
Definition: cmdutils.c:937
struct SwsContext * sws_opts
Definition: cmdutils.h:266
float min
int read_yesno(void)
Return a positive value if a line read from standard input starts with [yY], otherwise return 0...
Definition: cmdutils.c:1725
const char program_name[]
program name, defined by the program for show_version().
Definition: ffmpeg.c:106