00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef FFMPEG_CMDUTILS_H
00023 #define FFMPEG_CMDUTILS_H
00024
00025 #include <stdint.h>
00026
00027 #include "libavcodec/avcodec.h"
00028 #include "libavfilter/avfilter.h"
00029 #include "libavformat/avformat.h"
00030 #include "libswscale/swscale.h"
00031
00032 #ifdef __MINGW32__
00033 #undef main
00034 #endif
00035
00039 extern const char program_name[];
00040
00044 extern const int program_birth_year;
00045
00046 extern AVCodecContext *avcodec_opts[AVMEDIA_TYPE_NB];
00047 extern AVFormatContext *avformat_opts;
00048 extern struct SwsContext *sws_opts;
00049 extern AVDictionary *format_opts, *codec_opts;
00050
00055 void init_opts(void);
00060 void uninit_opts(void);
00061
00066 void log_callback_help(void* ptr, int level, const char* fmt, va_list vl);
00067
00072 int opt_default(const char *opt, const char *arg);
00073
00077 int opt_loglevel(const char *opt, const char *arg);
00078
00079 int opt_report(const char *opt);
00080
00081 int opt_codec_debug(const char *opt, const char *arg);
00082
00086 int opt_timelimit(const char *opt, const char *arg);
00087
00101 double parse_number_or_die(const char *context, const char *numstr, int type, double min, double max);
00102
00117 int64_t parse_time_or_die(const char *context, const char *timestr, int is_duration);
00118
00119 typedef struct SpecifierOpt {
00120 char *specifier;
00121 union {
00122 uint8_t *str;
00123 int i;
00124 int64_t i64;
00125 float f;
00126 double dbl;
00127 } u;
00128 } SpecifierOpt;
00129
00130 typedef struct {
00131 const char *name;
00132 int flags;
00133 #define HAS_ARG 0x0001
00134 #define OPT_BOOL 0x0002
00135 #define OPT_EXPERT 0x0004
00136 #define OPT_STRING 0x0008
00137 #define OPT_VIDEO 0x0010
00138 #define OPT_AUDIO 0x0020
00139 #define OPT_GRAB 0x0040
00140 #define OPT_INT 0x0080
00141 #define OPT_FLOAT 0x0100
00142 #define OPT_SUBTITLE 0x0200
00143 #define OPT_INT64 0x0400
00144 #define OPT_EXIT 0x0800
00145 #define OPT_DATA 0x1000
00146 #define OPT_FUNC2 0x2000
00147 #define OPT_OFFSET 0x4000
00148 #define OPT_SPEC 0x8000
00149
00150
00151 #define OPT_TIME 0x10000
00152 #define OPT_DOUBLE 0x20000
00153 union {
00154 void *dst_ptr;
00155 int (*func_arg)(const char *, const char *);
00156 int (*func2_arg)(void *, const char *, const char *);
00157 size_t off;
00158 } u;
00159 const char *help;
00160 const char *argname;
00161 } OptionDef;
00162
00163 void show_help_options(const OptionDef *options, const char *msg, int mask, int value);
00164
00169 void show_help_children(const AVClass *class, int flags);
00170
00181 void parse_options(void *optctx, int argc, char **argv, const OptionDef *options,
00182 void (* parse_arg_function)(void *optctx, const char*));
00183
00189 int parse_option(void *optctx, const char *opt, const char *arg, const OptionDef *options);
00190
00194 void parse_loglevel(int argc, char **argv, const OptionDef *options);
00195
00205 int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec);
00206
00217 AVDictionary *filter_codec_opts(AVDictionary *opts, AVCodec *codec, AVFormatContext *s, AVStream *st);
00218
00230 AVDictionary **setup_find_stream_info_opts(AVFormatContext *s, AVDictionary *codec_opts);
00231
00241 void print_error(const char *filename, int err);
00242
00248 void show_banner(int argc, char **argv, const OptionDef *options);
00249
00256 int opt_version(const char *opt, const char *arg);
00257
00263 int opt_license(const char *opt, const char *arg);
00264
00270 int opt_formats(const char *opt, const char *arg);
00271
00277 int opt_codecs(const char *opt, const char *arg);
00278
00284 int opt_filters(const char *opt, const char *arg);
00285
00291 int opt_bsfs(const char *opt, const char *arg);
00292
00298 int opt_protocols(const char *opt, const char *arg);
00299
00305 int opt_pix_fmts(const char *opt, const char *arg);
00306
00311 int show_sample_fmts(const char *opt, const char *arg);
00312
00317 int read_yesno(void);
00318
00328 int cmdutils_read_file(const char *filename, char **bufptr, size_t *size);
00329
00348 FILE *get_preset_file(char *filename, size_t filename_size,
00349 const char *preset_name, int is_path, const char *codec_name);
00350
00355 void exit_program(int ret);
00356
00365 void *grow_array(void *array, int elem_size, int *size, int new_size);
00366
00367 #endif