• 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 *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 *); //FIXME passing error code as int return would be nicer then exit() in the func
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 /* FFMPEG_CMDUTILS_H */

Generated on Sat Feb 16 2013 09:23:11 for ffmpeg by  doxygen 1.7.1