Libav 0.7.1
|
00001 /* 00002 * AVOptions 00003 * copyright (c) 2005 Michael Niedermayer <michaelni@gmx.at> 00004 * 00005 * This file is part of Libav. 00006 * 00007 * Libav 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 * Libav 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 Libav; if not, write to the Free Software 00019 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00020 */ 00021 00022 #ifndef AVUTIL_OPT_H 00023 #define AVUTIL_OPT_H 00024 00030 #include "rational.h" 00031 #include "avutil.h" 00032 #include "dict.h" 00033 00034 enum AVOptionType{ 00035 FF_OPT_TYPE_FLAGS, 00036 FF_OPT_TYPE_INT, 00037 FF_OPT_TYPE_INT64, 00038 FF_OPT_TYPE_DOUBLE, 00039 FF_OPT_TYPE_FLOAT, 00040 FF_OPT_TYPE_STRING, 00041 FF_OPT_TYPE_RATIONAL, 00042 FF_OPT_TYPE_BINARY, 00043 FF_OPT_TYPE_CONST=128, 00044 }; 00045 00049 typedef struct AVOption { 00050 const char *name; 00051 00056 const char *help; 00057 00062 int offset; 00063 enum AVOptionType type; 00064 00068 union { 00069 double dbl; 00070 const char *str; 00071 /* TODO those are unused now */ 00072 int64_t i64; 00073 AVRational q; 00074 } default_val; 00075 double min; 00076 double max; 00077 00078 int flags; 00079 #define AV_OPT_FLAG_ENCODING_PARAM 1 ///< a generic parameter which can be set by the user for muxing or encoding 00080 #define AV_OPT_FLAG_DECODING_PARAM 2 ///< a generic parameter which can be set by the user for demuxing or decoding 00081 #define AV_OPT_FLAG_METADATA 4 ///< some data extracted or inserted into the file like title, comment, ... 00082 #define AV_OPT_FLAG_AUDIO_PARAM 8 00083 #define AV_OPT_FLAG_VIDEO_PARAM 16 00084 #define AV_OPT_FLAG_SUBTITLE_PARAM 32 00085 //FIXME think about enc-audio, ... style flags 00086 00092 const char *unit; 00093 } AVOption; 00094 00095 #if FF_API_FIND_OPT 00096 00110 attribute_deprecated 00111 const AVOption *av_find_opt(void *obj, const char *name, const char *unit, int mask, int flags); 00112 #endif 00113 00141 int av_set_string3(void *obj, const char *name, const char *val, int alloc, const AVOption **o_out); 00142 00143 const AVOption *av_set_double(void *obj, const char *name, double n); 00144 const AVOption *av_set_q(void *obj, const char *name, AVRational n); 00145 const AVOption *av_set_int(void *obj, const char *name, int64_t n); 00146 double av_get_double(void *obj, const char *name, const AVOption **o_out); 00147 AVRational av_get_q(void *obj, const char *name, const AVOption **o_out); 00148 int64_t av_get_int(void *obj, const char *name, const AVOption **o_out); 00149 const char *av_get_string(void *obj, const char *name, const AVOption **o_out, char *buf, int buf_len); 00150 const AVOption *av_next_option(void *obj, const AVOption *last); 00151 00161 int av_opt_show2(void *obj, void *av_log_obj, int req_flags, int rej_flags); 00162 00163 void av_opt_set_defaults(void *s); 00164 void av_opt_set_defaults2(void *s, int mask, int flags); 00165 00182 int av_set_options_string(void *ctx, const char *opts, 00183 const char *key_val_sep, const char *pairs_sep); 00184 00188 void av_opt_free(void *obj); 00189 00198 int av_opt_flag_is_set(void *obj, const char *field_name, const char *flag_name); 00199 00200 /* 00201 * Set all the options from a given dictionary on an object. 00202 * 00203 * @param obj a struct whose first element is a pointer to AVClass 00204 * @param options options to process. This dictionary will be freed and replaced 00205 * by a new one containing all options not found in obj. 00206 * Of course this new dictionary needs to be freed by caller 00207 * with av_dict_free(). 00208 * 00209 * @return 0 on success, a negative AVERROR if some option was found in obj, 00210 * but could not be set. 00211 * 00212 * @see av_dict_copy() 00213 */ 00214 int av_opt_set_dict(void *obj, struct AVDictionary **options); 00215 00216 #define AV_OPT_SEARCH_CHILDREN 0x0001 00239 const AVOption *av_opt_find(void *obj, const char *name, const char *unit, 00240 int opt_flags, int search_flags); 00241 00242 #endif /* AVUTIL_OPT_H */