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 struct SwrContext *swr_opts;
00055 extern AVDictionary *format_opts, *codec_opts;
00056
00061 void init_opts(void);
00066 void uninit_opts(void);
00067
00072 void log_callback_help(void* ptr, int level, const char* fmt, va_list vl);
00073
00078 int opt_default(const char *opt, const char *arg);
00079
00083 int opt_loglevel(const char *opt, const char *arg);
00084
00085 int opt_report(const char *opt);
00086
00087 int opt_max_alloc(const char *opt, const char *arg);
00088
00089 int opt_cpuflags(const char *opt, const char *arg);
00090
00091 int opt_codec_debug(const char *opt, const char *arg);
00092
00096 int opt_timelimit(const char *opt, const char *arg);
00097
00111 double parse_number_or_die(const char *context, const char *numstr, int type,
00112 double min, double max);
00113
00128 int64_t parse_time_or_die(const char *context, const char *timestr,
00129 int is_duration);
00130
00131 typedef struct SpecifierOpt {
00132 char *specifier;
00133 union {
00134 uint8_t *str;
00135 int i;
00136 int64_t i64;
00137 float f;
00138 double dbl;
00139 } u;
00140 } SpecifierOpt;
00141
00142 typedef struct {
00143 const char *name;
00144 int flags;
00145 #define HAS_ARG 0x0001
00146 #define OPT_BOOL 0x0002
00147 #define OPT_EXPERT 0x0004
00148 #define OPT_STRING 0x0008
00149 #define OPT_VIDEO 0x0010
00150 #define OPT_AUDIO 0x0020
00151 #define OPT_GRAB 0x0040
00152 #define OPT_INT 0x0080
00153 #define OPT_FLOAT 0x0100
00154 #define OPT_SUBTITLE 0x0200
00155 #define OPT_INT64 0x0400
00156 #define OPT_EXIT 0x0800
00157 #define OPT_DATA 0x1000
00158 #define OPT_FUNC2 0x2000
00159 #define OPT_OFFSET 0x4000
00160 #define OPT_SPEC 0x8000
00161
00162
00163 #define OPT_TIME 0x10000
00164 #define OPT_DOUBLE 0x20000
00165 union {
00166 void *dst_ptr;
00167 int (*func_arg)(const char *, const char *);
00168 int (*func2_arg)(void *, const char *, const char *);
00169 size_t off;
00170 } u;
00171 const char *help;
00172 const char *argname;
00173 } OptionDef;
00174
00175 void show_help_options(const OptionDef *options, const char *msg, int mask,
00176 int value);
00177
00182 void show_help_children(const AVClass *class, int flags);
00183
00194 void parse_options(void *optctx, int argc, char **argv, const OptionDef *options,
00195 void (* parse_arg_function)(void *optctx, const char*));
00196
00202 int parse_option(void *optctx, const char *opt, const char *arg,
00203 const OptionDef *options);
00204
00208 void parse_loglevel(int argc, char **argv, const OptionDef *options);
00209
00213 int locate_option(int argc, char **argv, const OptionDef *options,
00214 const char *optname);
00215
00225 int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec);
00226
00237 AVDictionary *filter_codec_opts(AVDictionary *opts, AVCodec *codec,
00238 AVFormatContext *s, AVStream *st);
00239
00251 AVDictionary **setup_find_stream_info_opts(AVFormatContext *s,
00252 AVDictionary *codec_opts);
00253
00263 void print_error(const char *filename, int err);
00264
00270 void show_banner(int argc, char **argv, const OptionDef *options);
00271
00278 int opt_version(const char *opt, const char *arg);
00279
00285 int opt_license(const char *opt, const char *arg);
00286
00292 int opt_formats(const char *opt, const char *arg);
00293
00299 int opt_codecs(const char *opt, const char *arg);
00300
00306 int opt_filters(const char *opt, const char *arg);
00307
00313 int opt_bsfs(const char *opt, const char *arg);
00314
00320 int opt_protocols(const char *opt, const char *arg);
00321
00327 int opt_pix_fmts(const char *opt, const char *arg);
00328
00333 int show_sample_fmts(const char *opt, const char *arg);
00334
00339 int read_yesno(void);
00340
00350 int cmdutils_read_file(const char *filename, char **bufptr, size_t *size);
00351
00370 FILE *get_preset_file(char *filename, size_t filename_size,
00371 const char *preset_name, int is_path, const char *codec_name);
00372
00377 void exit_program(int ret);
00378
00387 void *grow_array(void *array, int elem_size, int *size, int new_size);
00388
00389 #endif