• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • Examples
  • 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 <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 /* We don't want SDL to override our main() */
00034 #endif
00035 
00039 extern const char program_name[];
00040 
00044 extern const int program_birth_year;
00045 
00046 extern const char **opt_names;
00047 extern AVCodecContext *avcodec_opts[AVMEDIA_TYPE_NB];
00048 extern AVFormatContext *avformat_opts;
00049 extern struct SwsContext *sws_opts;
00050 extern AVDictionary *format_opts, *video_opts, *audio_opts, *sub_opts;
00051 
00056 void init_opts(void);
00061 void uninit_opts(void);
00062 
00067 void log_callback_help(void* ptr, int level, const char* fmt, va_list vl);
00068 
00073 int opt_default(const char *opt, const char *arg);
00074 
00078 int opt_loglevel(const char *opt, const char *arg);
00079 
00083 int opt_timelimit(const char *opt, const char *arg);
00084 
00098 double parse_number_or_die(const char *context, const char *numstr, int type, double min, double max);
00099 
00114 int64_t parse_time_or_die(const char *context, const char *timestr, int is_duration);
00115 
00116 typedef struct {
00117     const char *name;
00118     int flags;
00119 #define HAS_ARG    0x0001
00120 #define OPT_BOOL   0x0002
00121 #define OPT_EXPERT 0x0004
00122 #define OPT_STRING 0x0008
00123 #define OPT_VIDEO  0x0010
00124 #define OPT_AUDIO  0x0020
00125 #define OPT_GRAB   0x0040
00126 #define OPT_INT    0x0080
00127 #define OPT_FLOAT  0x0100
00128 #define OPT_SUBTITLE 0x0200
00129 #define OPT_INT64  0x0400
00130 #define OPT_EXIT   0x0800
00131 #define OPT_DATA   0x1000
00132      union {
00133         int *int_arg;
00134         char **str_arg;
00135         float *float_arg;
00136         int (*func_arg)(const char *, const char *);
00137         int64_t *int64_arg;
00138     } u;
00139     const char *help;
00140     const char *argname;
00141 } OptionDef;
00142 
00143 void show_help_options(const OptionDef *options, const char *msg, int mask, int value);
00144 
00153 void parse_options(int argc, char **argv, const OptionDef *options,
00154                    int (* parse_arg_function)(const char *opt, const char *arg));
00155 
00156 void set_context_opts(void *ctx, void *opts_ctx, int flags, AVCodec *codec);
00157 
00167 void print_error(const char *filename, int err);
00168 
00174 void show_banner(void);
00175 
00182 int opt_version(const char *opt, const char *arg);
00183 
00189 int opt_license(const char *opt, const char *arg);
00190 
00196 int opt_formats(const char *opt, const char *arg);
00197 
00203 int opt_codecs(const char *opt, const char *arg);
00204 
00210 int opt_filters(const char *opt, const char *arg);
00211 
00217 int opt_bsfs(const char *opt, const char *arg);
00218 
00224 int opt_protocols(const char *opt, const char *arg);
00225 
00231 int opt_pix_fmts(const char *opt, const char *arg);
00232 
00237 int read_yesno(void);
00238 
00248 int read_file(const char *filename, char **bufptr, size_t *size);
00249 
00268 FILE *get_preset_file(char *filename, size_t filename_size,
00269                       const char *preset_name, int is_path, const char *codec_name);
00270 
00271 #endif /* FFMPEG_CMDUTILS_H */

Generated on Wed Apr 11 2012 07:31:31 for FFmpeg by  doxygen 1.7.1