• 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", NULL, OFFSET(probesize), FF_OPT_TYPE_INT, 32000, 32, INT_MAX, D}, /* 32000 from mpegts.c: 1.0 second at 24Mbit/s */
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 #if LIBAVFORMAT_VERSION_INT < (53<<16)
00050 {"track", " set the track number", OFFSET(track), FF_OPT_TYPE_INT, DEFAULT, 0, INT_MAX, E},
00051 {"year", "set the year", OFFSET(year), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, E},
00052 #endif
00053 {"analyzeduration", "how many microseconds are analyzed to estimate duration", OFFSET(max_analyze_duration), FF_OPT_TYPE_INT, 3*AV_TIME_BASE, 0, INT_MAX, D},
00054 {"cryptokey", "decryption key", OFFSET(key), FF_OPT_TYPE_BINARY, 0, 0, 0, D},
00055 {"indexmem", "max memory used for timestamp index (per stream)", OFFSET(max_index_size), FF_OPT_TYPE_INT, 1<<20, 0, INT_MAX, D},
00056 {"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 */
00057 {"fdebug", "print specific debug info", OFFSET(debug), FF_OPT_TYPE_FLAGS, DEFAULT, 0, INT_MAX, E|D, "fdebug"},
00058 {"ts", NULL, 0, FF_OPT_TYPE_CONST, FF_FDEBUG_TS, INT_MIN, INT_MAX, E|D, "fdebug"},
00059 {NULL},
00060 };
00061 
00062 #undef E
00063 #undef D
00064 #undef DEFAULT
00065 
00066 static const AVClass av_format_context_class = { "AVFormatContext", format_to_name, options };
00067 
00068 static void avformat_get_context_defaults(AVFormatContext *s)
00069 {
00070     memset(s, 0, sizeof(AVFormatContext));
00071 
00072     s->av_class = &av_format_context_class;
00073 
00074     av_opt_set_defaults(s);
00075 }
00076 
00077 AVFormatContext *avformat_alloc_context(void)
00078 {
00079     AVFormatContext *ic;
00080     ic = av_malloc(sizeof(AVFormatContext));
00081     if (!ic) return ic;
00082     avformat_get_context_defaults(ic);
00083     ic->av_class = &av_format_context_class;
00084     return ic;
00085 }
00086 
00087 #if LIBAVFORMAT_VERSION_MAJOR < 53
00088 AVFormatContext *av_alloc_format_context(void)
00089 {
00090     return avformat_alloc_context();
00091 }
00092 #endif

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