Libav
opt.h
Go to the documentation of this file.
1 /*
2  * AVOptions
3  * copyright (c) 2005 Michael Niedermayer <michaelni@gmx.at>
4  *
5  * This file is part of Libav.
6  *
7  * Libav is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * Libav is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with Libav; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #ifndef AVUTIL_OPT_H
23 #define AVUTIL_OPT_H
24 
30 #include "rational.h"
31 #include "avutil.h"
32 #include "dict.h"
33 #include "log.h"
34 
228 };
229 
233 typedef struct AVOption {
234  const char *name;
235 
240  const char *help;
241 
246  int offset;
248 
252  union {
253  int64_t i64;
254  double dbl;
255  const char *str;
256  /* TODO those are unused now */
258  } default_val;
259  double min;
260  double max;
261 
262  int flags;
263 #define AV_OPT_FLAG_ENCODING_PARAM 1
264 #define AV_OPT_FLAG_DECODING_PARAM 2
265 #define AV_OPT_FLAG_METADATA 4
266 #define AV_OPT_FLAG_AUDIO_PARAM 8
267 #define AV_OPT_FLAG_VIDEO_PARAM 16
268 #define AV_OPT_FLAG_SUBTITLE_PARAM 32
269 //FIXME think about enc-audio, ... style flags
270 
276  const char *unit;
277 } AVOption;
278 
288 int av_opt_show2(void *obj, void *av_log_obj, int req_flags, int rej_flags);
289 
295 void av_opt_set_defaults(void *s);
296 
313 int av_set_options_string(void *ctx, const char *opts,
314  const char *key_val_sep, const char *pairs_sep);
315 
319 void av_opt_free(void *obj);
320 
329 int av_opt_flag_is_set(void *obj, const char *field_name, const char *flag_name);
330 
331 /*
332  * Set all the options from a given dictionary on an object.
333  *
334  * @param obj a struct whose first element is a pointer to AVClass
335  * @param options options to process. This dictionary will be freed and replaced
336  * by a new one containing all options not found in obj.
337  * Of course this new dictionary needs to be freed by caller
338  * with av_dict_free().
339  *
340  * @return 0 on success, a negative AVERROR if some option was found in obj,
341  * but could not be set.
342  *
343  * @see av_dict_copy()
344  */
345 int av_opt_set_dict(void *obj, struct AVDictionary **options);
346 
361 int av_opt_eval_flags (void *obj, const AVOption *o, const char *val, int *flags_out);
362 int av_opt_eval_int (void *obj, const AVOption *o, const char *val, int *int_out);
363 int av_opt_eval_int64 (void *obj, const AVOption *o, const char *val, int64_t *int64_out);
364 int av_opt_eval_float (void *obj, const AVOption *o, const char *val, float *float_out);
365 int av_opt_eval_double(void *obj, const AVOption *o, const char *val, double *double_out);
366 int av_opt_eval_q (void *obj, const AVOption *o, const char *val, AVRational *q_out);
371 #define AV_OPT_SEARCH_CHILDREN 0x0001
379 #define AV_OPT_SEARCH_FAKE_OBJ 0x0002
380 
403 const AVOption *av_opt_find(void *obj, const char *name, const char *unit,
404  int opt_flags, int search_flags);
405 
427 const AVOption *av_opt_find2(void *obj, const char *name, const char *unit,
428  int opt_flags, int search_flags, void **target_obj);
429 
439 const AVOption *av_opt_next(void *obj, const AVOption *prev);
440 
447 void *av_opt_child_next(void *obj, void *prev);
448 
455 const AVClass *av_opt_child_class_next(const AVClass *parent, const AVClass *prev);
456 
483 int av_opt_set (void *obj, const char *name, const char *val, int search_flags);
484 int av_opt_set_int (void *obj, const char *name, int64_t val, int search_flags);
485 int av_opt_set_double(void *obj, const char *name, double val, int search_flags);
486 int av_opt_set_q (void *obj, const char *name, AVRational val, int search_flags);
487 int av_opt_set_bin (void *obj, const char *name, const uint8_t *val, int size, int search_flags);
507 int av_opt_get (void *obj, const char *name, int search_flags, uint8_t **out_val);
508 int av_opt_get_int (void *obj, const char *name, int search_flags, int64_t *out_val);
509 int av_opt_get_double(void *obj, const char *name, int search_flags, double *out_val);
510 int av_opt_get_q (void *obj, const char *name, int search_flags, AVRational *out_val);
516 #endif /* AVUTIL_OPT_H */