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 <inttypes.h>
00026 #include "libavcodec/avcodec.h"
00027 #include "libavformat/avformat.h"
00028 #include "libswscale/swscale.h"
00029
00033 extern const char program_name[];
00034
00038 extern const int program_birth_year;
00039
00040 extern const char **opt_names;
00041 extern AVCodecContext *avcodec_opts[AVMEDIA_TYPE_NB];
00042 extern AVFormatContext *avformat_opts;
00043 extern struct SwsContext *sws_opts;
00044
00049 void init_opts(void);
00054 void uninit_opts(void);
00055
00060 void log_callback_help(void* ptr, int level, const char* fmt, va_list vl);
00061
00066 int opt_default(const char *opt, const char *arg);
00067
00071 int opt_loglevel(const char *opt, const char *arg);
00072
00076 int opt_timelimit(const char *opt, const char *arg);
00077
00091 double parse_number_or_die(const char *context, const char *numstr, int type, double min, double max);
00092
00107 int64_t parse_time_or_die(const char *context, const char *timestr, int is_duration);
00108
00109 typedef struct {
00110 const char *name;
00111 int flags;
00112 #define HAS_ARG 0x0001
00113 #define OPT_BOOL 0x0002
00114 #define OPT_EXPERT 0x0004
00115 #define OPT_STRING 0x0008
00116 #define OPT_VIDEO 0x0010
00117 #define OPT_AUDIO 0x0020
00118 #define OPT_GRAB 0x0040
00119 #define OPT_INT 0x0080
00120 #define OPT_FLOAT 0x0100
00121 #define OPT_SUBTITLE 0x0200
00122 #define OPT_FUNC2 0x0400
00123 #define OPT_INT64 0x0800
00124 #define OPT_EXIT 0x1000
00125 #define OPT_DUMMY 0x2000
00126 union {
00127 void (*func_arg)(const char *);
00128 int *int_arg;
00129 char **str_arg;
00130 float *float_arg;
00131 int (*func2_arg)(const char *, const char *);
00132 int64_t *int64_arg;
00133 } u;
00134 const char *help;
00135 const char *argname;
00136 } OptionDef;
00137
00138 void show_help_options(const OptionDef *options, const char *msg, int mask, int value);
00139
00148 void parse_options(int argc, char **argv, const OptionDef *options,
00149 void (* parse_arg_function)(const char*));
00150
00151 void set_context_opts(void *ctx, void *opts_ctx, int flags, AVCodec *codec);
00152
00162 void print_error(const char *filename, int err);
00163
00164 void list_fmts(void (*get_fmt_string)(char *buf, int buf_size, int fmt), int nb_fmts);
00165
00171 void show_banner(void);
00172
00178 void show_version(void);
00179
00184 void show_license(void);
00185
00190 void show_formats(void);
00191
00196 void show_codecs(void);
00197
00202 void show_filters(void);
00203
00208 void show_bsfs(void);
00209
00214 void show_protocols(void);
00215
00220 void show_pix_fmts(void);
00221
00226 int read_yesno(void);
00227
00237 int read_file(const char *filename, char **bufptr, size_t *size);
00238
00256 FILE *get_preset_file(char *filename, size_t filename_size,
00257 const char *preset_name, int is_path, const char *codec_name);
00258
00259 #if CONFIG_AVFILTER
00260 #include "libavfilter/avfilter.h"
00261
00262 typedef struct {
00263 enum PixelFormat pix_fmt;
00264 } FFSinkContext;
00265
00266 extern AVFilter ffsink;
00267
00274 int get_filtered_video_frame(AVFilterContext *sink, AVFrame *frame,
00275 AVFilterBufferRef **picref, AVRational *pts_tb);
00276
00277 #endif
00278
00279 #endif