World of Might and Magic  0.2.0
Open reimplementation of Might and Magic 6 7 8 game engine
opt.h
См. документацию.
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 
241 };
242 
246 typedef struct AVOption {
247  const char *name;
248 
253  const char *help;
254 
259  int offset;
261 
265  union {
267  double dbl;
268  const char *str;
269  /* TODO those are unused now */
271  } default_val;
272  double min;
273  double max;
274 
275  int flags;
276 #define AV_OPT_FLAG_ENCODING_PARAM 1
277 #define AV_OPT_FLAG_DECODING_PARAM 2
278 #define AV_OPT_FLAG_AUDIO_PARAM 8
279 #define AV_OPT_FLAG_VIDEO_PARAM 16
280 #define AV_OPT_FLAG_SUBTITLE_PARAM 32
281 
284 #define AV_OPT_FLAG_EXPORT 64
285 
289 #define AV_OPT_FLAG_READONLY 128
290 #define AV_OPT_FLAG_BSF_PARAM (1<<8)
291 #define AV_OPT_FLAG_FILTERING_PARAM (1<<16)
292 #define AV_OPT_FLAG_DEPRECATED (1<<17)
293 //FIXME think about enc-audio, ... style flags
294 
300  const char *unit;
301 } AVOption;
302 
306 typedef struct AVOptionRange {
307  const char *str;
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)
565 
570 #define AV_OPT_ALLOW_NULL (1 << 2)
571 
577 #define AV_OPT_MULTI_COMPONENT_RANGE (1 << 12)
578 
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
840 
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 */
av_opt_get_dict_val
int av_opt_get_dict_val(void *obj, const char *name, int search_flags, AVDictionary **out_val)
AVOption::q
AVRational q
Definition: opt.h:270
av_opt_set_image_size
int av_opt_set_image_size(void *obj, const char *name, int w, int h, int search_flags)
AVOption::min
double min
minimum valid value for the option
Definition: opt.h:272
AVPixelFormat
AVPixelFormat
Definition: pixfmt.h:64
s
GLdouble s
Definition: SDL_opengl.h:2063
AV_OPT_TYPE_SAMPLE_FMT
@ AV_OPT_TYPE_SAMPLE_FMT
Definition: opt.h:235
mask
GLenum GLint GLuint mask
Definition: SDL_opengl_glext.h:660
av_opt_set_defaults
void av_opt_set_defaults(void *s)
AVOptionRange::component_min
double component_min
Definition: opt.h:318
AVOptionType
AVOptionType
Definition: opt.h:221
av_opt_ptr
void * av_opt_ptr(const AVClass *avclass, void *obj, const char *name)
AV_OPT_TYPE_VIDEO_RATE
@ AV_OPT_TYPE_VIDEO_RATE
offset must point to AVRational
Definition: opt.h:236
rational.h
av_opt_is_set_to_default_by_name
int av_opt_is_set_to_default_by_name(void *obj, const char *name, int search_flags)
av_opt_set_double
int av_opt_set_double(void *obj, const char *name, double val, int search_flags)
AV_OPT_TYPE_DURATION
@ AV_OPT_TYPE_DURATION
Definition: opt.h:237
av_opt_is_set_to_default
int av_opt_is_set_to_default(void *obj, const AVOption *o)
AV_OPT_TYPE_RATIONAL
@ AV_OPT_TYPE_RATIONAL
Definition: opt.h:228
AVOptionRange::str
const char * str
Definition: opt.h:307
AV_OPT_FLAG_IMPLICIT_KEY
@ AV_OPT_FLAG_IMPLICIT_KEY
Definition: opt.h:529
av_set_options_string
int av_set_options_string(void *ctx, const char *opts, const char *key_val_sep, const char *pairs_sep)
AVOption::str
const char * str
Definition: opt.h:268
int64_t
__int64 int64_t
Definition: alext.h:31
AV_OPT_TYPE_BINARY
@ AV_OPT_TYPE_BINARY
offset must point to a pointer immediately followed by an int for the length
Definition: opt.h:229
w
GLubyte GLubyte GLubyte GLubyte w
Definition: SDL_opengl_glext.h:734
samplefmt.h
AVOptionRange
struct AVOptionRange AVOptionRange
AVOption::default_val
union AVOption::@90 default_val
av_opt_set
int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
h
GLfloat GLfloat GLfloat GLfloat h
Definition: SDL_opengl_glext.h:1949
AVOption::max
double max
maximum valid value for the option
Definition: opt.h:273
AVOption::name
const char * name
Definition: opt.h:247
av_opt_get_channel_layout
int av_opt_get_channel_layout(void *obj, const char *name, int search_flags, int64_t *ch_layout)
av_opt_set_dict
int av_opt_set_dict(void *obj, struct AVDictionary **options)
AVOption::i64
int64_t i64
Definition: opt.h:266
AV_OPT_TYPE_DOUBLE
@ AV_OPT_TYPE_DOUBLE
Definition: opt.h:225
buffer
EGLContext EGLenum EGLClientBuffer buffer
Definition: SDL_egl.h:952
av_opt_set_dict_val
int av_opt_set_dict_val(void *obj, const char *name, const AVDictionary *val, int search_flags)
av_opt_set_pixel_fmt
int av_opt_set_pixel_fmt(void *obj, const char *name, enum AVPixelFormat fmt, int search_flags)
AV_OPT_TYPE_INT64
@ AV_OPT_TYPE_INT64
Definition: opt.h:224
av_opt_eval_int64
int av_opt_eval_int64(void *obj, const AVOption *o, const char *val, int64_t *int64_out)
AVOption
struct AVOption AVOption
AVOption
Definition: opt.h:246
av_opt_get_pixel_fmt
int av_opt_get_pixel_fmt(void *obj, const char *name, int search_flags, enum AVPixelFormat *out_fmt)
av_opt_find
const AVOption * av_opt_find(void *obj, const char *name, const char *unit, int opt_flags, int search_flags)
av_opt_get_video_rate
int av_opt_get_video_rate(void *obj, const char *name, int search_flags, AVRational *out_val)
AVOptionRanges::nb_components
int nb_components
Definition: opt.h:368
av_opt_set_video_rate
int av_opt_set_video_rate(void *obj, const char *name, AVRational val, int search_flags)
av_opt_set_bin
int av_opt_set_bin(void *obj, const char *name, const uint8_t *val, int size, int search_flags)
src
GLenum src
Definition: SDL_opengl_glext.h:1740
av_opt_get_double
int av_opt_get_double(void *obj, const char *name, int search_flags, double *out_val)
AV_OPT_TYPE_COLOR
@ AV_OPT_TYPE_COLOR
Definition: opt.h:238
av_opt_set_from_string
int av_opt_set_from_string(void *ctx, const char *opts, const char *const *shorthand, const char *key_val_sep, const char *pairs_sep)
AV_OPT_TYPE_IMAGE_SIZE
@ AV_OPT_TYPE_IMAGE_SIZE
offset must point to two consecutive integers
Definition: opt.h:233
AV_OPT_TYPE_DICT
@ AV_OPT_TYPE_DICT
Definition: opt.h:230
av_opt_get_sample_fmt
int av_opt_get_sample_fmt(void *obj, const char *name, int search_flags, enum AVSampleFormat *out_fmt)
av_opt_free
void av_opt_free(void *obj)
av_opt_get_int
int av_opt_get_int(void *obj, const char *name, int search_flags, int64_t *out_val)
av_opt_set_int
int av_opt_set_int(void *obj, const char *name, int64_t val, int search_flags)
AVOptionRanges::nb_ranges
int nb_ranges
Definition: opt.h:364
AVOptionRange
Definition: opt.h:306
av_opt_set_channel_layout
int av_opt_set_channel_layout(void *obj, const char *name, int64_t ch_layout, int search_flags)
ctx
EGLContext ctx
Definition: SDL_egl.h:952
AVOption::offset
int offset
Definition: opt.h:259
AVOptionRanges
Definition: opt.h:329
av_opt_set_defaults2
void av_opt_set_defaults2(void *s, int mask, int flags)
AV_OPT_TYPE_CHANNEL_LAYOUT
@ AV_OPT_TYPE_CHANNEL_LAYOUT
Definition: opt.h:239
AVClass
Definition: log.h:67
AVOption::flags
int flags
Definition: opt.h:275
av_opt_eval_q
int av_opt_eval_q(void *obj, const AVOption *o, const char *val, AVRational *q_out)
av_opt_find2
const AVOption * av_opt_find2(void *obj, const char *name, const char *unit, int opt_flags, int search_flags, void **target_obj)
AVOptionRanges
struct AVOptionRanges AVOptionRanges
av_opt_set_dict2
int av_opt_set_dict2(void *obj, struct AVDictionary **options, int search_flags)
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Definition: opt.h:226
AVOptionRanges::range
AVOptionRange ** range
Definition: opt.h:360
AVOptionRange::value_min
double value_min
Definition: opt.h:313
uint8_t
unsigned __int8 uint8_t
Definition: SDL_config.h:35
AVSampleFormat
AVSampleFormat
Definition: samplefmt.h:58
AVOptionRange::component_max
double component_max
Definition: opt.h:318
name
EGLImageKHR EGLint * name
Definition: SDL_egl.h:1497
av_opt_next
const AVOption * av_opt_next(const void *obj, const AVOption *prev)
val
GLuint GLfloat * val
Definition: SDL_opengl_glext.h:1495
av_opt_eval_double
int av_opt_eval_double(void *obj, const AVOption *o, const char *val, double *double_out)
AVOption::help
const char * help
Definition: opt.h:253
av_opt_eval_flags
int av_opt_eval_flags(void *obj, const AVOption *o, const char *val, int *flags_out)
pixfmt.h
av_opt_eval_int
int av_opt_eval_int(void *obj, const AVOption *o, const char *val, int *int_out)
av_opt_get_key_value
int av_opt_get_key_value(const char **ropts, const char *key_val_sep, const char *pairs_sep, unsigned flags, char **rkey, char **rval)
dict.h
av_opt_child_class_next
const AVClass * av_opt_child_class_next(const AVClass *parent, const AVClass *prev)
AVOption::unit
const char * unit
Definition: opt.h:300
flags
EGLSyncKHR EGLint flags
Definition: SDL_egl.h:898
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:223
AVDictionary
struct AVDictionary AVDictionary
Definition: dict.h:86
AVOptionRange::is_range
int is_range
Definition: opt.h:323
AVOption::type
enum AVOptionType type
Definition: opt.h:260
AV_OPT_TYPE_PIXEL_FMT
@ AV_OPT_TYPE_PIXEL_FMT
Definition: opt.h:234
av_opt_serialize
int av_opt_serialize(void *obj, int opt_flags, int flags, char **buffer, const char key_val_sep, const char pairs_sep)
av_opt_flag_is_set
int av_opt_flag_is_set(void *obj, const char *field_name, const char *flag_name)
av_opt_query_ranges_default
int av_opt_query_ranges_default(AVOptionRanges **, void *obj, const char *key, int flags)
av_opt_query_ranges
int av_opt_query_ranges(AVOptionRanges **, void *obj, const char *key, int flags)
av_opt_eval_float
int av_opt_eval_float(void *obj, const AVOption *o, const char *val, float *float_out)
avutil.h
AVRational
Definition: rational.h:58
av_opt_freep_ranges
void av_opt_freep_ranges(AVOptionRanges **ranges)
size
GLsizeiptr size
Definition: SDL_opengl_glext.h:540
av_opt_copy
int av_opt_copy(void *dest, const void *src)
obj
GLhandleARB obj
Definition: SDL_opengl_glext.h:3622
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:240
AVOptionRange::value_max
double value_max
Definition: opt.h:313
AV_OPT_TYPE_FLAGS
@ AV_OPT_TYPE_FLAGS
Definition: opt.h:222
AVOption::dbl
double dbl
Definition: opt.h:267
av_opt_get
int av_opt_get(void *obj, const char *name, int search_flags, uint8_t **out_val)
av_opt_get_image_size
int av_opt_get_image_size(void *obj, const char *name, int search_flags, int *w_out, int *h_out)
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:227
av_opt_set_q
int av_opt_set_q(void *obj, const char *name, AVRational val, int search_flags)
av_opt_set_sample_fmt
int av_opt_set_sample_fmt(void *obj, const char *name, enum AVSampleFormat fmt, int search_flags)
av_opt_show2
int av_opt_show2(void *obj, void *av_log_obj, int req_flags, int rej_flags)
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:232
av_opt_child_next
void * av_opt_child_next(void *obj, void *prev)
AV_OPT_TYPE_UINT64
@ AV_OPT_TYPE_UINT64
Definition: opt.h:231
av_opt_get_q
int av_opt_get_q(void *obj, const char *name, int search_flags, AVRational *out_val)