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

libavformat/options.c

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
00003  *
00004  * This file is part of FFmpeg.
00005  *
00006  * FFmpeg is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or (at your option) any later version.
00010  *
00011  * FFmpeg is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with FFmpeg; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00019  */
00020 #include "avformat.h"
00021 #include "libavcodec/opt.h"
00022 
00028 static const char* format_to_name(void* ptr)
00029 {
00030     AVFormatContext* fc = (AVFormatContext*) ptr;
00031     if(fc->iformat) return fc->iformat->name;
00032     else if(fc->oformat) return fc->oformat->name;
00033     else return "NULL";
00034 }
00035 
00036 #define OFFSET(x) offsetof(AVFormatContext,x)
00037 #define DEFAULT 0 //should be NAN but it does not work as it is not a constant in glibc as required by ANSI/ISO C
00038 //these names are too long to be readable
00039 #define E AV_OPT_FLAG_ENCODING_PARAM
00040 #define D AV_OPT_FLAG_DECODING_PARAM
00041 
00042 static const AVOption options[]={
00043 {"probesize", "set probing size", OFFSET(probesize), FF_OPT_TYPE_INT, 5000000, 32, INT_MAX, D},
00044 {"muxrate", "set mux rate", OFFSET(mux_rate), FF_OPT_TYPE_INT, DEFAULT, 0, INT_MAX, E},
00045 {"packetsize", "set packet size", OFFSET(packet_size), FF_OPT_TYPE_INT, DEFAULT, 0, INT_MAX, E},
00046 {"fflags", NULL, OFFSET(flags), FF_OPT_TYPE_FLAGS, DEFAULT, INT_MIN, INT_MAX, D|E, "fflags"},
00047 {"ignidx", "ignore index", 0, FF_OPT_TYPE_CONST, AVFMT_FLAG_IGNIDX, INT_MIN, INT_MAX, D, "fflags"},
00048 {"genpts", "generate pts", 0, FF_OPT_TYPE_CONST, AVFMT_FLAG_GENPTS, INT_MIN, INT_MAX, D, "fflags"},
00049 {"nofillin", "do not fill in missing values that can be exactly calculated", 0, FF_OPT_TYPE_CONST, AVFMT_FLAG_NOFILLIN, INT_MIN, INT_MAX, D, "fflags"},
00050 {"noparse", "disable AVParsers, this needs nofillin too", 0, FF_OPT_TYPE_CONST, AVFMT_FLAG_NOPARSE, INT_MIN, INT_MAX, D, "fflags"},
00051 {"igndts", "ingore dts", 0, FF_OPT_TYPE_CONST, AVFMT_FLAG_IGNDTS, INT_MIN, INT_MAX, D, "fflags"},
00052 {"rtphint", "add rtp hinting", 0, FF_OPT_TYPE_CONST, AVFMT_FLAG_RTP_HINT, INT_MIN, INT_MAX, E, "fflags"},
00053 #if LIBAVFORMAT_VERSION_INT < (53<<16)
00054 {"track", " set the track number", OFFSET(track), FF_OPT_TYPE_INT, DEFAULT, 0, INT_MAX, E},
00055 {"year", "set the year", OFFSET(year), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, E},
00056 #endif
00057 {"analyzeduration", "how many microseconds are analyzed to estimate duration", OFFSET(max_analyze_duration), FF_OPT_TYPE_INT, 5*AV_TIME_BASE, 0, INT_MAX, D},
00058 {"cryptokey", "decryption key", OFFSET(key), FF_OPT_TYPE_BINARY, 0, 0, 0, D},
00059 {"indexmem", "max memory used for timestamp index (per stream)", OFFSET(max_index_size), FF_OPT_TYPE_INT, 1<<20, 0, INT_MAX, D},
00060 {"rtbufsize", "max memory used for buffering real-time frames", OFFSET(max_picture_buffer), FF_OPT_TYPE_INT, 3041280, 0, INT_MAX, D}, /* defaults to 1s of 15fps 352x288 YUYV422 video */
00061 {"fdebug", "print specific debug info", OFFSET(debug), FF_OPT_TYPE_FLAGS, DEFAULT, 0, INT_MAX, E|D, "fdebug"},
00062 {"ts", NULL, 0, FF_OPT_TYPE_CONST, FF_FDEBUG_TS, INT_MIN, INT_MAX, E|D, "fdebug"},
00063 {NULL},
00064 };
00065 
00066 #undef E
00067 #undef D
00068 #undef DEFAULT
00069 
00070 static const AVClass av_format_context_class = { "AVFormatContext", format_to_name, options, LIBAVUTIL_VERSION_INT };
00071 
00072 static void avformat_get_context_defaults(AVFormatContext *s)
00073 {
00074     memset(s, 0, sizeof(AVFormatContext));
00075 
00076     s->av_class = &av_format_context_class;
00077 
00078     av_opt_set_defaults(s);
00079 }
00080 
00081 AVFormatContext *avformat_alloc_context(void)
00082 {
00083     AVFormatContext *ic;
00084     ic = av_malloc(sizeof(AVFormatContext));
00085     if (!ic) return ic;
00086     avformat_get_context_defaults(ic);
00087     ic->av_class = &av_format_context_class;
00088     return ic;
00089 }
00090 
00091 #if LIBAVFORMAT_VERSION_MAJOR < 53
00092 AVFormatContext *av_alloc_format_context(void)
00093 {
00094     return avformat_alloc_context();
00095 }
00096 #endif

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