Miam-Player  0.8.0
A nice music player
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 #include "version.h"
37 
232  AV_OPT_TYPE_IMAGE_SIZE = MKBETAG('S','I','Z','E'),
233  AV_OPT_TYPE_PIXEL_FMT = MKBETAG('P','F','M','T'),
234  AV_OPT_TYPE_SAMPLE_FMT = MKBETAG('S','F','M','T'),
235  AV_OPT_TYPE_VIDEO_RATE = MKBETAG('V','R','A','T'),
236  AV_OPT_TYPE_DURATION = MKBETAG('D','U','R',' '),
237  AV_OPT_TYPE_COLOR = MKBETAG('C','O','L','R'),
239  AV_OPT_TYPE_BOOL = MKBETAG('B','O','O','L'),
240 };
241 
245 typedef struct AVOption {
246  const char *name;
247 
252  const char *help;
253 
258  int offset;
260 
264  union {
265  int64_t i64;
266  double dbl;
267  const char *str;
268  /* TODO those are unused now */
270  } default_val;
271  double min;
272  double max;
273 
274  int flags;
275 #define AV_OPT_FLAG_ENCODING_PARAM 1
276 #define AV_OPT_FLAG_DECODING_PARAM 2
277 #if FF_API_OPT_TYPE_METADATA
278 #define AV_OPT_FLAG_METADATA 4
279 #endif
280 #define AV_OPT_FLAG_AUDIO_PARAM 8
281 #define AV_OPT_FLAG_VIDEO_PARAM 16
282 #define AV_OPT_FLAG_SUBTITLE_PARAM 32
283 
286 #define AV_OPT_FLAG_EXPORT 64
287 
291 #define AV_OPT_FLAG_READONLY 128
292 #define AV_OPT_FLAG_FILTERING_PARAM (1<<16)
293 //FIXME think about enc-audio, ... style flags
294 
300  const char *unit;
301 } AVOption;
302 
306 typedef struct AVOptionRange {
307  const char *str;
313  double value_min, value_max;
318  double component_min, component_max;
323  int is_range;
324 } AVOptionRange;
325 
329 typedef struct AVOptionRanges {
370 
380 int av_opt_show2(void *obj, void *av_log_obj, int req_flags, int rej_flags);
381 
387 void av_opt_set_defaults(void *s);
388 
398 void av_opt_set_defaults2(void *s, int mask, int flags);
399 
417 int av_set_options_string(void *ctx, const char *opts,
418  const char *key_val_sep, const char *pairs_sep);
419 
447 int av_opt_set_from_string(void *ctx, const char *opts,
448  const char *const *shorthand,
449  const char *key_val_sep, const char *pairs_sep);
453 void av_opt_free(void *obj);
454 
463 int av_opt_flag_is_set(void *obj, const char *field_name, const char *flag_name);
464 
479 int av_opt_set_dict(void *obj, struct AVDictionary **options);
480 
481 
497 int av_opt_set_dict2(void *obj, struct AVDictionary **options, int search_flags);
498 
518 int av_opt_get_key_value(const char **ropts,
519  const char *key_val_sep, const char *pairs_sep,
520  unsigned flags,
521  char **rkey, char **rval);
522 
523 enum {
524 
530 };
531 
546 int av_opt_eval_flags (void *obj, const AVOption *o, const char *val, int *flags_out);
547 int av_opt_eval_int (void *obj, const AVOption *o, const char *val, int *int_out);
548 int av_opt_eval_int64 (void *obj, const AVOption *o, const char *val, int64_t *int64_out);
549 int av_opt_eval_float (void *obj, const AVOption *o, const char *val, float *float_out);
550 int av_opt_eval_double(void *obj, const AVOption *o, const char *val, double *double_out);
551 int av_opt_eval_q (void *obj, const AVOption *o, const char *val, AVRational *q_out);
556 #define AV_OPT_SEARCH_CHILDREN (1 << 0)
564 #define AV_OPT_SEARCH_FAKE_OBJ (1 << 1)
570 #define AV_OPT_ALLOW_NULL (1 << 2)
577 #define AV_OPT_MULTI_COMPONENT_RANGE (1 << 12)
601 const AVOption *av_opt_find(void *obj, const char *name, const char *unit,
602  int opt_flags, int search_flags);
603 
625 const AVOption *av_opt_find2(void *obj, const char *name, const char *unit,
626  int opt_flags, int search_flags, void **target_obj);
627 
637 const AVOption *av_opt_next(const void *obj, const AVOption *prev);
638 
645 void *av_opt_child_next(void *obj, void *prev);
646 
653 const AVClass *av_opt_child_class_next(const AVClass *parent, const AVClass *prev);
654 
681 int av_opt_set (void *obj, const char *name, const char *val, int search_flags);
682 int av_opt_set_int (void *obj, const char *name, int64_t val, int search_flags);
683 int av_opt_set_double (void *obj, const char *name, double val, int search_flags);
684 int av_opt_set_q (void *obj, const char *name, AVRational val, int search_flags);
685 int av_opt_set_bin (void *obj, const char *name, const uint8_t *val, int size, int search_flags);
686 int av_opt_set_image_size(void *obj, const char *name, int w, int h, int search_flags);
687 int av_opt_set_pixel_fmt (void *obj, const char *name, enum AVPixelFormat fmt, int search_flags);
688 int av_opt_set_sample_fmt(void *obj, const char *name, enum AVSampleFormat fmt, int search_flags);
689 int av_opt_set_video_rate(void *obj, const char *name, AVRational val, int search_flags);
690 int av_opt_set_channel_layout(void *obj, const char *name, int64_t ch_layout, int search_flags);
695 int av_opt_set_dict_val(void *obj, const char *name, const AVDictionary *val, int search_flags);
696 
707 #define av_opt_set_int_list(obj, name, val, term, flags) \
708  (av_int_list_length(val, term) > INT_MAX / sizeof(*(val)) ? \
709  AVERROR(EINVAL) : \
710  av_opt_set_bin(obj, name, (const uint8_t *)(val), \
711  av_int_list_length(val, term) * sizeof(*(val)), flags))
712 
736 int av_opt_get (void *obj, const char *name, int search_flags, uint8_t **out_val);
737 int av_opt_get_int (void *obj, const char *name, int search_flags, int64_t *out_val);
738 int av_opt_get_double (void *obj, const char *name, int search_flags, double *out_val);
739 int av_opt_get_q (void *obj, const char *name, int search_flags, AVRational *out_val);
740 int av_opt_get_image_size(void *obj, const char *name, int search_flags, int *w_out, int *h_out);
741 int av_opt_get_pixel_fmt (void *obj, const char *name, int search_flags, enum AVPixelFormat *out_fmt);
742 int av_opt_get_sample_fmt(void *obj, const char *name, int search_flags, enum AVSampleFormat *out_fmt);
743 int av_opt_get_video_rate(void *obj, const char *name, int search_flags, AVRational *out_val);
744 int av_opt_get_channel_layout(void *obj, const char *name, int search_flags, int64_t *ch_layout);
749 int av_opt_get_dict_val(void *obj, const char *name, int search_flags, AVDictionary **out_val);
761 void *av_opt_ptr(const AVClass *avclass, void *obj, const char *name);
762 
766 void av_opt_freep_ranges(AVOptionRanges **ranges);
767 
781 int av_opt_query_ranges(AVOptionRanges **, void *obj, const char *key, int flags);
782 
793 int av_opt_copy(void *dest, const void *src);
794 
809 int av_opt_query_ranges_default(AVOptionRanges **, void *obj, const char *key, int flags);
810 
823 int av_opt_is_set_to_default(void *obj, const AVOption *o);
824 
835 int av_opt_is_set_to_default_by_name(void *obj, const char *name, int search_flags);
836 
837 
838 #define AV_OPT_SERIALIZE_SKIP_DEFAULTS 0x00000001
839 #define AV_OPT_SERIALIZE_OPT_FLAGS_EXACT 0x00000002
841 
859 int av_opt_serialize(void *obj, int opt_flags, int flags, char **buffer,
860  const char key_val_sep, const char pairs_sep);
865 #endif /* AVUTIL_OPT_H */
int av_opt_get_dict_val(void *obj, const char *name, int search_flags, AVDictionary **out_val)
Definition: opt.h:224
int av_opt_eval_float(void *obj, const AVOption *o, const char *val, float *float_out)
double component_min
Definition: opt.h:318
int av_opt_set_q(void *obj, const char *name, AVRational val, int search_flags)
int flags
Definition: opt.h:274
void * av_opt_child_next(void *obj, void *prev)
Definition: opt.h:223
const AVClass * av_opt_child_class_next(const AVClass *parent, const AVClass *prev)
void av_opt_set_defaults(void *s)
Definition: opt.h:233
AVRational q
Definition: opt.h:269
int av_set_options_string(void *ctx, const char *opts, const char *key_val_sep, const char *pairs_sep)
int av_opt_set_bin(void *obj, const char *name, const uint8_t *val, int size, int search_flags)
int av_opt_get_q(void *obj, const char *name, int search_flags, AVRational *out_val)
int av_opt_serialize(void *obj, int opt_flags, int flags, char **buffer, const char key_val_sep, const char pairs_sep)
int av_opt_set_dict_val(void *obj, const char *name, const AVDictionary *val, int search_flags)
AVOptionType
Definition: opt.h:221
int av_opt_is_set_to_default_by_name(void *obj, const char *name, int search_flags)
Definition: opt.h:222
double max
maximum valid value for the option
Definition: opt.h:272
const char * str
Definition: opt.h:307
int av_opt_is_set_to_default(void *obj, const AVOption *o)
Definition: opt.h:237
size_t size
Definition: mem.h:207
int av_opt_get_video_rate(void *obj, const char *name, int search_flags, AVRational *out_val)
int av_opt_set_from_string(void *ctx, const char *opts, const char *const *shorthand, const char *key_val_sep, const char *pairs_sep)
Definition: opt.h:231
Definition: opt.h:529
int av_opt_eval_int64(void *obj, const AVOption *o, const char *val, int64_t *int64_out)
int av_opt_set_double(void *obj, const char *name, double val, int search_flags)
Definition: opt.h:227
Definition: opt.h:329
int av_opt_set_video_rate(void *obj, const char *name, AVRational val, int search_flags)
double value_min
Definition: opt.h:313
Definition: opt.h:238
Definition: opt.h:245
int av_opt_get_pixel_fmt(void *obj, const char *name, int search_flags, enum AVPixelFormat *out_fmt)
int av_opt_set_pixel_fmt(void *obj, const char *name, enum AVPixelFormat fmt, int search_flags)
void * av_opt_ptr(const AVClass *avclass, void *obj, const char *name)
struct AVOptionRanges AVOptionRanges
int av_opt_eval_flags(void *obj, const AVOption *o, const char *val, int *flags_out)
Definition: opt.h:226
int nb_ranges
Definition: opt.h:364
struct AVDictionary AVDictionary
Definition: dict.h:90
int av_opt_set_int(void *obj, const char *name, int64_t val, int search_flags)
const AVOption * av_opt_next(const void *obj, const AVOption *prev)
union AVOption::@6 default_val
const AVOption * av_opt_find(void *obj, const char *name, const char *unit, int opt_flags, int search_flags)
int av_opt_eval_double(void *obj, const AVOption *o, const char *val, double *double_out)
int nb_components
Definition: opt.h:368
int av_opt_get_sample_fmt(void *obj, const char *name, int search_flags, enum AVSampleFormat *out_fmt)
struct AVOptionRange AVOptionRange
Definition: opt.h:306
Definition: opt.h:239
enum AVOptionType type
Definition: opt.h:259
int av_opt_eval_q(void *obj, const AVOption *o, const char *val, AVRational *q_out)
int av_opt_set_channel_layout(void *obj, const char *name, int64_t ch_layout, int search_flags)
const char * help
Definition: opt.h:252
void av_opt_set_defaults2(void *s, int mask, int flags)
Definition: log.h:67
int av_opt_set_dict2(void *obj, struct AVDictionary **options, int search_flags)
offset must point to a pointer immediately followed by an int for the length
Definition: opt.h:229
int av_opt_query_ranges_default(AVOptionRanges **, void *obj, const char *key, int flags)
int av_opt_get_int(void *obj, const char *name, int search_flags, int64_t *out_val)
Definition: opt.h:225
void av_opt_freep_ranges(AVOptionRanges **ranges)
double dbl
Definition: opt.h:266
AVSampleFormat
Definition: samplefmt.h:58
int av_opt_set_dict(void *obj, struct AVDictionary **options)
int av_opt_show2(void *obj, void *av_log_obj, int req_flags, int rej_flags)
const char * unit
Definition: opt.h:300
int av_opt_get_channel_layout(void *obj, const char *name, int search_flags, int64_t *ch_layout)
AVOptionRange ** range
Definition: opt.h:360
offset must point to AVRational
Definition: opt.h:235
int offset
Definition: opt.h:258
Definition: opt.h:230
int av_opt_eval_int(void *obj, const AVOption *o, const char *val, int *int_out)
offset must point to two consecutive integers
Definition: opt.h:232
int is_range
Definition: opt.h:323
const char * name
Definition: opt.h:246
Definition: rational.h:58
Definition: opt.h:234
Definition: opt.h:236
struct AVOption AVOption
void av_opt_free(void *obj)
int av_opt_query_ranges(AVOptionRanges **, void *obj, const char *key, int flags)
int64_t i64
Definition: opt.h:265
int av_opt_get_double(void *obj, const char *name, int search_flags, double *out_val)
int av_opt_copy(void *dest, const void *src)
#define MKBETAG(a, b, c, d)
Definition: common.h:343
int av_opt_get(void *obj, const char *name, int search_flags, uint8_t **out_val)
int av_opt_get_key_value(const char **ropts, const char *key_val_sep, const char *pairs_sep, unsigned flags, char **rkey, char **rval)
const char * str
Definition: opt.h:267
int av_opt_flag_is_set(void *obj, const char *field_name, const char *flag_name)
Definition: opt.h:228
const AVOption * av_opt_find2(void *obj, const char *name, const char *unit, int opt_flags, int search_flags, void **target_obj)
double min
minimum valid value for the option
Definition: opt.h:271
int av_opt_set_sample_fmt(void *obj, const char *name, enum AVSampleFormat fmt, int search_flags)
AVPixelFormat
Definition: pixfmt.h:60
int av_opt_set_image_size(void *obj, const char *name, int w, int h, int search_flags)
int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
int av_opt_get_image_size(void *obj, const char *name, int search_flags, int *w_out, int *h_out)