• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

cmdutils.h

Go to the documentation of this file.
00001 /*
00002  * Various utilities for command line tools
00003  * copyright (c) 2003 Fabrice Bellard
00004  *
00005  * This file is part of FFmpeg.
00006  *
00007  * FFmpeg is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2.1 of the License, or (at your option) any later version.
00011  *
00012  * FFmpeg is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with FFmpeg; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
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 *avcodec_opts[AVMEDIA_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 
00056 int opt_loglevel(const char *opt, const char *arg);
00057 
00061 int opt_timelimit(const char *opt, const char *arg);
00062 
00076 double parse_number_or_die(const char *context, const char *numstr, int type, double min, double max);
00077 
00092 int64_t parse_time_or_die(const char *context, const char *timestr, int is_duration);
00093 
00094 typedef struct {
00095     const char *name;
00096     int flags;
00097 #define HAS_ARG    0x0001
00098 #define OPT_BOOL   0x0002
00099 #define OPT_EXPERT 0x0004
00100 #define OPT_STRING 0x0008
00101 #define OPT_VIDEO  0x0010
00102 #define OPT_AUDIO  0x0020
00103 #define OPT_GRAB   0x0040
00104 #define OPT_INT    0x0080
00105 #define OPT_FLOAT  0x0100
00106 #define OPT_SUBTITLE 0x0200
00107 #define OPT_FUNC2  0x0400
00108 #define OPT_INT64  0x0800
00109 #define OPT_EXIT   0x1000
00110      union {
00111         void (*func_arg)(const char *); //FIXME passing error code as int return would be nicer then exit() in the func
00112         int *int_arg;
00113         char **str_arg;
00114         float *float_arg;
00115         int (*func2_arg)(const char *, const char *);
00116         int64_t *int64_arg;
00117     } u;
00118     const char *help;
00119     const char *argname;
00120 } OptionDef;
00121 
00122 void show_help_options(const OptionDef *options, const char *msg, int mask, int value);
00123 
00132 void parse_options(int argc, char **argv, const OptionDef *options,
00133                    void (* parse_arg_function)(const char*));
00134 
00135 void set_context_opts(void *ctx, void *opts_ctx, int flags);
00136 
00146 void print_error(const char *filename, int err);
00147 
00148 void list_fmts(void (*get_fmt_string)(char *buf, int buf_size, int fmt), int nb_fmts);
00149 
00155 void show_banner(void);
00156 
00162 void show_version(void);
00163 
00168 void show_license(void);
00169 
00174 void show_formats(void);
00175 
00180 void show_codecs(void);
00181 
00186 void show_filters(void);
00187 
00192 void show_bsfs(void);
00193 
00198 void show_protocols(void);
00199 
00204 void show_pix_fmts(void);
00205 
00210 int read_yesno(void);
00211 
00221 int read_file(const char *filename, char **bufptr, size_t *size);
00222 
00223 #endif /* FFMPEG_CMDUTILS_H */

Generated on Fri Sep 16 2011 17:17:31 for FFmpeg by  doxygen 1.7.1