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
00049 extern const int this_year;
00050
00051 extern AVCodecContext *avcodec_opts[AVMEDIA_TYPE_NB];
00052 extern AVFormatContext *avformat_opts;
00053 extern struct SwsContext *sws_opts;
00054 extern AVDictionary *format_opts, *codec_opts;
00055
00060 void init_opts(void);
00065 void uninit_opts(void);
00066
00071 void log_callback_help(void* ptr, int level, const char* fmt, va_list vl);
00072
00077 int opt_default(const char *opt, const char *arg);
00078
00082 int opt_loglevel(const char *opt, const char *arg);
00083
00084 int opt_report(const char *opt);
00085
00086 int opt_max_alloc(const char *opt, const char *arg);
00087
00088 int opt_codec_debug(const char *opt, const char *arg);
00089
00093 int opt_timelimit(const char *opt, const char *arg);
00094
00108 double parse_number_or_die(const char *context, const char *numstr, int type,
00109 double min, double max);
00110
00125 int64_t parse_time_or_die(const char *context, const char *timestr,
00126 int is_duration);
00127
00128 typedef struct SpecifierOpt {
00129 char *specifier;
00130 union {
00131 uint8_t *str;
00132 int i;
00133 int64_t i64;
00134 float f;
00135 double dbl;
00136 } u;
00137 } SpecifierOpt;
00138
00139 typedef struct {
00140 const char *name;
00141 int flags;
00142 #define HAS_ARG 0x0001
00143 #define OPT_BOOL 0x0002
00144 #define OPT_EXPERT 0x0004
00145 #define OPT_STRING 0x0008
00146 #define OPT_VIDEO 0x0010
00147 #define OPT_AUDIO 0x0020
00148 #define OPT_GRAB 0x0040
00149 #define OPT_INT 0x0080
00150 #define OPT_FLOAT 0x0100
00151 #define OPT_SUBTITLE 0x0200
00152 #define OPT_INT64 0x0400
00153 #define OPT_EXIT 0x0800
00154 #define OPT_DATA 0x1000
00155 #define OPT_FUNC2 0x2000
00156 #define OPT_OFFSET 0x4000
00157 #define OPT_SPEC 0x8000
00158
00159
00160 #define OPT_TIME 0x10000
00161 #define OPT_DOUBLE 0x20000
00162 union {
00163 void *dst_ptr;
00164 int (*func_arg)(const char *, const char *);
00165 int (*func2_arg)(void *, const char *, const char *);
00166 size_t off;
00167 } u;
00168 const char *help;
00169 const char *argname;
00170 } OptionDef;
00171
00172 void show_help_options(const OptionDef *options, const char *msg, int mask,
00173 int value);
00174
00179 void show_help_children(const AVClass *class, int flags);
00180
00191 void parse_options(void *optctx, int argc, char **argv, const OptionDef *options,
00192 void (* parse_arg_function)(void *optctx, const char*));
00193
00199 int parse_option(void *optctx, const char *opt, const char *arg,
00200 const OptionDef *options);
00201
00205 void parse_loglevel(int argc, char **argv, const OptionDef *options);
00206
00216 int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec);
00217
00228 AVDictionary *filter_codec_opts(AVDictionary *opts, AVCodec *codec,
00229 AVFormatContext *s, AVStream *st);
00230
00242 AVDictionary **setup_find_stream_info_opts(AVFormatContext *s,
00243 AVDictionary *codec_opts);
00244
00254 void print_error(const char *filename, int err);
00255
00261 void show_banner(int argc, char **argv, const OptionDef *options);
00262
00269 int opt_version(const char *opt, const char *arg);
00270
00276 int opt_license(const char *opt, const char *arg);
00277
00283 int opt_formats(const char *opt, const char *arg);
00284
00290 int opt_codecs(const char *opt, const char *arg);
00291
00297 int opt_filters(const char *opt, const char *arg);
00298
00304 int opt_bsfs(const char *opt, const char *arg);
00305
00311 int opt_protocols(const char *opt, const char *arg);
00312
00318 int opt_pix_fmts(const char *opt, const char *arg);
00319
00324 int show_sample_fmts(const char *opt, const char *arg);
00325
00330 int read_yesno(void);
00331
00341 int cmdutils_read_file(const char *filename, char **bufptr, size_t *size);
00342
00361 FILE *get_preset_file(char *filename, size_t filename_size,
00362 const char *preset_name, int is_path, const char *codec_name);
00363
00368 void exit_program(int ret);
00369
00378 void *grow_array(void *array, int elem_size, int *size, int new_size);
00379
00380 #endif