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

libavutil/opt.h

Go to the documentation of this file.
00001 /*
00002  * AVOptions
00003  * copyright (c) 2005 Michael Niedermayer <michaelni@gmx.at>
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 AVUTIL_OPT_H
00023 #define AVUTIL_OPT_H
00024 
00030 #include "rational.h"
00031 #include "avutil.h"
00032 #include "dict.h"
00033 #include "log.h"
00034 
00218 enum AVOptionType{
00219     AV_OPT_TYPE_FLAGS,
00220     AV_OPT_TYPE_INT,
00221     AV_OPT_TYPE_INT64,
00222     AV_OPT_TYPE_DOUBLE,
00223     AV_OPT_TYPE_FLOAT,
00224     AV_OPT_TYPE_STRING,
00225     AV_OPT_TYPE_RATIONAL,
00226     AV_OPT_TYPE_BINARY,  
00227     AV_OPT_TYPE_CONST = 128,
00228 #if FF_API_OLD_AVOPTIONS
00229     FF_OPT_TYPE_FLAGS = 0,
00230     FF_OPT_TYPE_INT,
00231     FF_OPT_TYPE_INT64,
00232     FF_OPT_TYPE_DOUBLE,
00233     FF_OPT_TYPE_FLOAT,
00234     FF_OPT_TYPE_STRING,
00235     FF_OPT_TYPE_RATIONAL,
00236     FF_OPT_TYPE_BINARY,  
00237     FF_OPT_TYPE_CONST=128,
00238 #endif
00239 };
00240 
00244 typedef struct AVOption {
00245     const char *name;
00246 
00251     const char *help;
00252 
00257     int offset;
00258     enum AVOptionType type;
00259 
00263     union {
00264         double dbl;
00265         const char *str;
00266         /* TODO those are unused now */
00267         int64_t i64;
00268         AVRational q;
00269     } default_val;
00270     double min;                 
00271     double max;                 
00272 
00273     int flags;
00274 #define AV_OPT_FLAG_ENCODING_PARAM  1   ///< a generic parameter which can be set by the user for muxing or encoding
00275 #define AV_OPT_FLAG_DECODING_PARAM  2   ///< a generic parameter which can be set by the user for demuxing or decoding
00276 #define AV_OPT_FLAG_METADATA        4   ///< some data extracted or inserted into the file like title, comment, ...
00277 #define AV_OPT_FLAG_AUDIO_PARAM     8
00278 #define AV_OPT_FLAG_VIDEO_PARAM     16
00279 #define AV_OPT_FLAG_SUBTITLE_PARAM  32
00280 //FIXME think about enc-audio, ... style flags
00281 
00287     const char *unit;
00288 } AVOption;
00289 
00290 #if FF_API_FIND_OPT
00291 
00305 attribute_deprecated
00306 const AVOption *av_find_opt(void *obj, const char *name, const char *unit, int mask, int flags);
00307 #endif
00308 
00309 #if FF_API_OLD_AVOPTIONS
00310 
00336 attribute_deprecated
00337 int av_set_string3(void *obj, const char *name, const char *val, int alloc, const AVOption **o_out);
00338 
00339 attribute_deprecated const AVOption *av_set_double(void *obj, const char *name, double n);
00340 attribute_deprecated const AVOption *av_set_q(void *obj, const char *name, AVRational n);
00341 attribute_deprecated const AVOption *av_set_int(void *obj, const char *name, int64_t n);
00342 
00343 double av_get_double(void *obj, const char *name, const AVOption **o_out);
00344 AVRational av_get_q(void *obj, const char *name, const AVOption **o_out);
00345 int64_t av_get_int(void *obj, const char *name, const AVOption **o_out);
00346 attribute_deprecated const char *av_get_string(void *obj, const char *name, const AVOption **o_out, char *buf, int buf_len);
00347 attribute_deprecated const AVOption *av_next_option(void *obj, const AVOption *last);
00348 #endif
00349 
00359 int av_opt_show2(void *obj, void *av_log_obj, int req_flags, int rej_flags);
00360 
00366 void av_opt_set_defaults(void *s);
00367 
00368 #if FF_API_OLD_AVOPTIONS
00369 attribute_deprecated
00370 void av_opt_set_defaults2(void *s, int mask, int flags);
00371 #endif
00372 
00390 int av_set_options_string(void *ctx, const char *opts,
00391                           const char *key_val_sep, const char *pairs_sep);
00392 
00396 void av_opt_free(void *obj);
00397 
00406 int av_opt_flag_is_set(void *obj, const char *field_name, const char *flag_name);
00407 
00408 /*
00409  * Set all the options from a given dictionary on an object.
00410  *
00411  * @param obj a struct whose first element is a pointer to AVClass
00412  * @param options options to process. This dictionary will be freed and replaced
00413  *                by a new one containing all options not found in obj.
00414  *                Of course this new dictionary needs to be freed by caller
00415  *                with av_dict_free().
00416  *
00417  * @return 0 on success, a negative AVERROR if some option was found in obj,
00418  *         but could not be set.
00419  *
00420  * @see av_dict_copy()
00421  */
00422 int av_opt_set_dict(void *obj, struct AVDictionary **options);
00423 
00438 int av_opt_eval_flags (void *obj, const AVOption *o, const char *val, int        *flags_out);
00439 int av_opt_eval_int   (void *obj, const AVOption *o, const char *val, int        *int_out);
00440 int av_opt_eval_int64 (void *obj, const AVOption *o, const char *val, int64_t    *int64_out);
00441 int av_opt_eval_float (void *obj, const AVOption *o, const char *val, float      *float_out);
00442 int av_opt_eval_double(void *obj, const AVOption *o, const char *val, double     *double_out);
00443 int av_opt_eval_q     (void *obj, const AVOption *o, const char *val, AVRational *q_out);
00448 #define AV_OPT_SEARCH_CHILDREN   0x0001 
00456 #define AV_OPT_SEARCH_FAKE_OBJ   0x0002
00457 
00480 const AVOption *av_opt_find(void *obj, const char *name, const char *unit,
00481                             int opt_flags, int search_flags);
00482 
00504 const AVOption *av_opt_find2(void *obj, const char *name, const char *unit,
00505                              int opt_flags, int search_flags, void **target_obj);
00506 
00516 const AVOption *av_opt_next(void *obj, const AVOption *prev);
00517 
00524 void *av_opt_child_next(void *obj, void *prev);
00525 
00532 const AVClass *av_opt_child_class_next(const AVClass *parent, const AVClass *prev);
00533 
00560 int av_opt_set       (void *obj, const char *name, const char *val, int search_flags);
00561 int av_opt_set_int   (void *obj, const char *name, int64_t     val, int search_flags);
00562 int av_opt_set_double(void *obj, const char *name, double      val, int search_flags);
00563 int av_opt_set_q     (void *obj, const char *name, AVRational  val, int search_flags);
00583 int av_opt_get       (void *obj, const char *name, int search_flags, uint8_t   **out_val);
00584 int av_opt_get_int   (void *obj, const char *name, int search_flags, int64_t    *out_val);
00585 int av_opt_get_double(void *obj, const char *name, int search_flags, double     *out_val);
00586 int av_opt_get_q     (void *obj, const char *name, int search_flags, AVRational *out_val);
00598 void *av_opt_ptr(const AVClass *avclass, void *obj, const char *name);
00603 #endif /* AVUTIL_OPT_H */
Generated on Fri Feb 1 2013 14:34:26 for FFmpeg by doxygen 1.7.1