FFmpeg  1.2.4
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 FFmpeg.
6  *
7  * FFmpeg 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  * FFmpeg 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 FFmpeg; 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 #include "pixfmt.h"
35 #include "samplefmt.h"
36 
230  AV_OPT_TYPE_IMAGE_SIZE = MKBETAG('S','I','Z','E'),
231  AV_OPT_TYPE_PIXEL_FMT = MKBETAG('P','F','M','T'),
232  AV_OPT_TYPE_SAMPLE_FMT = MKBETAG('S','F','M','T'),
233 #if FF_API_OLD_AVOPTIONS
243 #endif
244 };
245 
249 typedef struct AVOption {
250  const char *name;
251 
256  const char *help;
257 
262  int offset;
263  enum AVOptionType type;
264 
268  union {
269  int64_t i64;
270  double dbl;
271  const char *str;
272  /* TODO those are unused now */
273  AVRational q;
274  } default_val;
275  double min;
276  double max;
277 
278  int flags;
279 #define AV_OPT_FLAG_ENCODING_PARAM 1
280 #define AV_OPT_FLAG_DECODING_PARAM 2
281 #define AV_OPT_FLAG_METADATA 4
282 #define AV_OPT_FLAG_AUDIO_PARAM 8
283 #define AV_OPT_FLAG_VIDEO_PARAM 16
284 #define AV_OPT_FLAG_SUBTITLE_PARAM 32
285 #define AV_OPT_FLAG_FILTERING_PARAM (1<<16)
286 //FIXME think about enc-audio, ... style flags
287 
293  const char *unit;
294 } AVOption;
295 
299 typedef struct AVOptionRange {
300  const char *str;
301  double value_min, value_max;
302  double component_min, component_max;
303  int is_range;
304 } AVOptionRange;
305 
309 typedef struct AVOptionRanges {
311  int nb_ranges;
313 
314 
315 #if FF_API_FIND_OPT
316 
331 const AVOption *av_find_opt(void *obj, const char *name, const char *unit, int mask, int flags);
332 #endif
333 
334 #if FF_API_OLD_AVOPTIONS
335 
362 int av_set_string3(void *obj, const char *name, const char *val, int alloc, const AVOption **o_out);
363 
364 attribute_deprecated const AVOption *av_set_double(void *obj, const char *name, double n);
365 attribute_deprecated const AVOption *av_set_q(void *obj, const char *name, AVRational n);
366 attribute_deprecated const AVOption *av_set_int(void *obj, const char *name, int64_t n);
367 
368 double av_get_double(void *obj, const char *name, const AVOption **o_out);
369 AVRational av_get_q(void *obj, const char *name, const AVOption **o_out);
370 int64_t av_get_int(void *obj, const char *name, const AVOption **o_out);
371 attribute_deprecated const char *av_get_string(void *obj, const char *name, const AVOption **o_out, char *buf, int buf_len);
372 attribute_deprecated const AVOption *av_next_option(void *obj, const AVOption *last);
373 #endif
374 
384 int av_opt_show2(void *obj, void *av_log_obj, int req_flags, int rej_flags);
385 
391 void av_opt_set_defaults(void *s);
392 
393 #if FF_API_OLD_AVOPTIONS
395 void av_opt_set_defaults2(void *s, int mask, int flags);
396 #endif
397 
415 int av_set_options_string(void *ctx, const char *opts,
416  const char *key_val_sep, const char *pairs_sep);
417 
445 int av_opt_set_from_string(void *ctx, const char *opts,
446  const char *const *shorthand,
447  const char *key_val_sep, const char *pairs_sep);
451 void av_opt_free(void *obj);
452 
461 int av_opt_flag_is_set(void *obj, const char *field_name, const char *flag_name);
462 
477 int av_opt_set_dict(void *obj, struct AVDictionary **options);
478 
498 int av_opt_get_key_value(const char **ropts,
499  const char *key_val_sep, const char *pairs_sep,
500  unsigned flags,
501  char **rkey, char **rval);
502 
503 enum {
504 
510 };
511 
526 int av_opt_eval_flags (void *obj, const AVOption *o, const char *val, int *flags_out);
527 int av_opt_eval_int (void *obj, const AVOption *o, const char *val, int *int_out);
528 int av_opt_eval_int64 (void *obj, const AVOption *o, const char *val, int64_t *int64_out);
529 int av_opt_eval_float (void *obj, const AVOption *o, const char *val, float *float_out);
530 int av_opt_eval_double(void *obj, const AVOption *o, const char *val, double *double_out);
531 int av_opt_eval_q (void *obj, const AVOption *o, const char *val, AVRational *q_out);
536 #define AV_OPT_SEARCH_CHILDREN 0x0001
544 #define AV_OPT_SEARCH_FAKE_OBJ 0x0002
545 
568 const AVOption *av_opt_find(void *obj, const char *name, const char *unit,
569  int opt_flags, int search_flags);
570 
592 const AVOption *av_opt_find2(void *obj, const char *name, const char *unit,
593  int opt_flags, int search_flags, void **target_obj);
594 
604 const AVOption *av_opt_next(void *obj, const AVOption *prev);
605 
612 void *av_opt_child_next(void *obj, void *prev);
613 
620 const AVClass *av_opt_child_class_next(const AVClass *parent, const AVClass *prev);
621 
648 int av_opt_set (void *obj, const char *name, const char *val, int search_flags);
649 int av_opt_set_int (void *obj, const char *name, int64_t val, int search_flags);
650 int av_opt_set_double(void *obj, const char *name, double val, int search_flags);
651 int av_opt_set_q (void *obj, const char *name, AVRational val, int search_flags);
652 int av_opt_set_bin (void *obj, const char *name, const uint8_t *val, int size, int search_flags);
653 int av_opt_set_image_size(void *obj, const char *name, int w, int h, int search_flags);
654 int av_opt_set_pixel_fmt (void *obj, const char *name, enum AVPixelFormat fmt, int search_flags);
655 int av_opt_set_sample_fmt(void *obj, const char *name, enum AVSampleFormat fmt, int search_flags);
675 int av_opt_get (void *obj, const char *name, int search_flags, uint8_t **out_val);
676 int av_opt_get_int (void *obj, const char *name, int search_flags, int64_t *out_val);
677 int av_opt_get_double(void *obj, const char *name, int search_flags, double *out_val);
678 int av_opt_get_q (void *obj, const char *name, int search_flags, AVRational *out_val);
679 int av_opt_get_image_size(void *obj, const char *name, int search_flags, int *w_out, int *h_out);
680 int av_opt_get_pixel_fmt (void *obj, const char *name, int search_flags, enum AVPixelFormat *out_fmt);
681 int av_opt_get_sample_fmt(void *obj, const char *name, int search_flags, enum AVSampleFormat *out_fmt);
693 void *av_opt_ptr(const AVClass *avclass, void *obj, const char *name);
694 
698 void av_opt_freep_ranges(AVOptionRanges **ranges);
699 
712 int av_opt_query_ranges(AVOptionRanges **, void *obj, const char *key, int flags);
713 
727 int av_opt_query_ranges_default(AVOptionRanges **, void *obj, const char *key, int flags);
728 
733 #endif /* AVUTIL_OPT_H */