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 int this_year;
00041 
00042 extern const char **opt_names;
00043 extern AVCodecContext *avctx_opts[CODEC_TYPE_NB];
00044 extern AVFormatContext *avformat_opts;
00045 extern struct SwsContext *sws_opts;
00046 
00051 int opt_default(const char *opt, const char *arg);
00052 
00066 double parse_number_or_die(const char *context, const char *numstr, int type, double min, double max);
00067 
00082 int64_t parse_time_or_die(const char *context, const char *timestr, int is_duration);
00083 
00084 typedef struct {
00085     const char *name;
00086     int flags;
00087 #define HAS_ARG    0x0001
00088 #define OPT_BOOL   0x0002
00089 #define OPT_EXPERT 0x0004
00090 #define OPT_STRING 0x0008
00091 #define OPT_VIDEO  0x0010
00092 #define OPT_AUDIO  0x0020
00093 #define OPT_GRAB   0x0040
00094 #define OPT_INT    0x0080
00095 #define OPT_FLOAT  0x0100
00096 #define OPT_SUBTITLE 0x0200
00097 #define OPT_FUNC2  0x0400
00098 #define OPT_INT64  0x0800
00099 #define OPT_EXIT   0x1000
00100      union {
00101         void (*func_arg)(const char *); 
00102         int *int_arg;
00103         char **str_arg;
00104         float *float_arg;
00105         int (*func2_arg)(const char *, const char *);
00106         int64_t *int64_arg;
00107     } u;
00108     const char *help;
00109     const char *argname;
00110 } OptionDef;
00111 
00112 void show_help_options(const OptionDef *options, const char *msg, int mask, int value);
00113 
00122 void parse_options(int argc, char **argv, const OptionDef *options,
00123                    void (* parse_arg_function)(const char*));
00124 
00125 void set_context_opts(void *ctx, void *opts_ctx, int flags);
00126 
00127 void print_error(const char *filename, int err);
00128 
00134 void show_banner(void);
00135 
00141 void show_version(void);
00142 
00147 void show_license(void);
00148 
00153 void show_formats(void);
00154 
00155 #endif