Mercurial > libavcodec.hg
annotate opt.h @ 8537:93a3020d9636 libavcodec
Fix float_to_int16_altivec prototype to match float_to_int16's in dsputil.h
(parameter 'len' is a long not an int).
Patch by David Conrad % lessen42 A gmail P com %
author | gpoirier |
---|---|
date | Tue, 06 Jan 2009 12:51:35 +0000 |
parents | 8903ad65c412 |
children | dc7bfff68156 |
rev | line source |
---|---|
3699
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
2967
diff
changeset
|
1 /* |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
2967
diff
changeset
|
2 * AVOptions |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
2967
diff
changeset
|
3 * copyright (c) 2005 Michael Niedermayer <michaelni@gmx.at> |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
2967
diff
changeset
|
4 * |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3702
diff
changeset
|
5 * This file is part of FFmpeg. |
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3702
diff
changeset
|
6 * |
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3702
diff
changeset
|
7 * FFmpeg is free software; you can redistribute it and/or |
3699
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
2967
diff
changeset
|
8 * modify it under the terms of the GNU Lesser General Public |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
2967
diff
changeset
|
9 * License as published by the Free Software Foundation; either |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3702
diff
changeset
|
10 * version 2.1 of the License, or (at your option) any later version. |
3699
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
2967
diff
changeset
|
11 * |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3702
diff
changeset
|
12 * FFmpeg is distributed in the hope that it will be useful, |
3699
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
2967
diff
changeset
|
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
2967
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
2967
diff
changeset
|
15 * Lesser General Public License for more details. |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
2967
diff
changeset
|
16 * |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
2967
diff
changeset
|
17 * You should have received a copy of the GNU Lesser General Public |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3702
diff
changeset
|
18 * License along with FFmpeg; if not, write to the Free Software |
3699
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
2967
diff
changeset
|
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
2967
diff
changeset
|
20 */ |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
2967
diff
changeset
|
21 |
7760 | 22 #ifndef AVCODEC_OPT_H |
23 #define AVCODEC_OPT_H | |
2874
b6def74f5811
flags and named constants with type checking of course for AVOption
michael
parents:
diff
changeset
|
24 |
b6def74f5811
flags and named constants with type checking of course for AVOption
michael
parents:
diff
changeset
|
25 /** |
b6def74f5811
flags and named constants with type checking of course for AVOption
michael
parents:
diff
changeset
|
26 * @file opt.h |
b6def74f5811
flags and named constants with type checking of course for AVOption
michael
parents:
diff
changeset
|
27 * AVOptions |
b6def74f5811
flags and named constants with type checking of course for AVOption
michael
parents:
diff
changeset
|
28 */ |
b6def74f5811
flags and named constants with type checking of course for AVOption
michael
parents:
diff
changeset
|
29 |
6395 | 30 #include "libavutil/rational.h" |
5162 | 31 |
2874
b6def74f5811
flags and named constants with type checking of course for AVOption
michael
parents:
diff
changeset
|
32 enum AVOptionType{ |
b6def74f5811
flags and named constants with type checking of course for AVOption
michael
parents:
diff
changeset
|
33 FF_OPT_TYPE_FLAGS, |
b6def74f5811
flags and named constants with type checking of course for AVOption
michael
parents:
diff
changeset
|
34 FF_OPT_TYPE_INT, |
b6def74f5811
flags and named constants with type checking of course for AVOption
michael
parents:
diff
changeset
|
35 FF_OPT_TYPE_INT64, |
b6def74f5811
flags and named constants with type checking of course for AVOption
michael
parents:
diff
changeset
|
36 FF_OPT_TYPE_DOUBLE, |
b6def74f5811
flags and named constants with type checking of course for AVOption
michael
parents:
diff
changeset
|
37 FF_OPT_TYPE_FLOAT, |
b6def74f5811
flags and named constants with type checking of course for AVOption
michael
parents:
diff
changeset
|
38 FF_OPT_TYPE_STRING, |
b6def74f5811
flags and named constants with type checking of course for AVOption
michael
parents:
diff
changeset
|
39 FF_OPT_TYPE_RATIONAL, |
6034
72bb141d9c05
Add FF_OPT_TYPE_BINARY and use it to add a cryptokey option
reimar
parents:
5830
diff
changeset
|
40 FF_OPT_TYPE_BINARY, ///< offset must point to a pointer immediately followed by an int for the length |
2874
b6def74f5811
flags and named constants with type checking of course for AVOption
michael
parents:
diff
changeset
|
41 FF_OPT_TYPE_CONST=128, |
b6def74f5811
flags and named constants with type checking of course for AVOption
michael
parents:
diff
changeset
|
42 }; |
b6def74f5811
flags and named constants with type checking of course for AVOption
michael
parents:
diff
changeset
|
43 |
b6def74f5811
flags and named constants with type checking of course for AVOption
michael
parents:
diff
changeset
|
44 /** |
7007 | 45 * AVOption |
2874
b6def74f5811
flags and named constants with type checking of course for AVOption
michael
parents:
diff
changeset
|
46 */ |
b6def74f5811
flags and named constants with type checking of course for AVOption
michael
parents:
diff
changeset
|
47 typedef struct AVOption { |
b6def74f5811
flags and named constants with type checking of course for AVOption
michael
parents:
diff
changeset
|
48 const char *name; |
b6def74f5811
flags and named constants with type checking of course for AVOption
michael
parents:
diff
changeset
|
49 |
b6def74f5811
flags and named constants with type checking of course for AVOption
michael
parents:
diff
changeset
|
50 /** |
7007 | 51 * short English help text |
52 * @todo What about other languages? | |
2874
b6def74f5811
flags and named constants with type checking of course for AVOption
michael
parents:
diff
changeset
|
53 */ |
b6def74f5811
flags and named constants with type checking of course for AVOption
michael
parents:
diff
changeset
|
54 const char *help; |
7086 | 55 |
56 /** | |
57 * The offset relative to the context structure where the option | |
7099 | 58 * value is stored. It should be 0 for named constants. |
7086 | 59 */ |
60 int offset; | |
2874
b6def74f5811
flags and named constants with type checking of course for AVOption
michael
parents:
diff
changeset
|
61 enum AVOptionType type; |
2967 | 62 |
7086 | 63 /** |
7175
4a635a1859f0
Clarify/simplify documentation for the default_val field in AVOption.
stefano
parents:
7099
diff
changeset
|
64 * the default value for scalar options |
7086 | 65 */ |
2874
b6def74f5811
flags and named constants with type checking of course for AVOption
michael
parents:
diff
changeset
|
66 double default_val; |
7086 | 67 double min; ///< minimum valid value for the option |
68 double max; ///< maximum valid value for the option | |
2967 | 69 |
2874
b6def74f5811
flags and named constants with type checking of course for AVOption
michael
parents:
diff
changeset
|
70 int flags; |
b6def74f5811
flags and named constants with type checking of course for AVOption
michael
parents:
diff
changeset
|
71 #define AV_OPT_FLAG_ENCODING_PARAM 1 ///< a generic parameter which can be set by the user for muxing or encoding |
b6def74f5811
flags and named constants with type checking of course for AVOption
michael
parents:
diff
changeset
|
72 #define AV_OPT_FLAG_DECODING_PARAM 2 ///< a generic parameter which can be set by the user for demuxing or decoding |
b6def74f5811
flags and named constants with type checking of course for AVOption
michael
parents:
diff
changeset
|
73 #define AV_OPT_FLAG_METADATA 4 ///< some data extracted or inserted into the file like title, comment, ... |
b6def74f5811
flags and named constants with type checking of course for AVOption
michael
parents:
diff
changeset
|
74 #define AV_OPT_FLAG_AUDIO_PARAM 8 |
b6def74f5811
flags and named constants with type checking of course for AVOption
michael
parents:
diff
changeset
|
75 #define AV_OPT_FLAG_VIDEO_PARAM 16 |
b6def74f5811
flags and named constants with type checking of course for AVOption
michael
parents:
diff
changeset
|
76 #define AV_OPT_FLAG_SUBTITLE_PARAM 32 |
b6def74f5811
flags and named constants with type checking of course for AVOption
michael
parents:
diff
changeset
|
77 //FIXME think about enc-audio, ... style flags |
7086 | 78 |
79 /** | |
80 * The logical unit to which the option belongs. Non-constant | |
81 * options and corresponding named constants share the same | |
82 * unit. May be NULL. | |
83 */ | |
2874
b6def74f5811
flags and named constants with type checking of course for AVOption
michael
parents:
diff
changeset
|
84 const char *unit; |
b6def74f5811
flags and named constants with type checking of course for AVOption
michael
parents:
diff
changeset
|
85 } AVOption; |
b6def74f5811
flags and named constants with type checking of course for AVOption
michael
parents:
diff
changeset
|
86 |
b6def74f5811
flags and named constants with type checking of course for AVOption
michael
parents:
diff
changeset
|
87 |
7205 | 88 /** |
89 * Looks for an option in \p obj. Looks only for the options which | |
90 * have the flags set as specified in \p mask and \p flags (that is, | |
91 * for which it is the case that opt->flags & mask == flags). | |
92 * | |
93 * @param[in] obj a pointer to a struct whose first element is a | |
8309
f73e7117bf67
s/#AVClass/AVClass/, consistent with the rest of the doxy.
stefano
parents:
7760
diff
changeset
|
94 * pointer to an AVClass |
7205 | 95 * @param[in] name the name of the option to look for |
96 * @param[in] unit the unit of the option to look for, or any if NULL | |
97 * @return a pointer to the option found, or NULL if no option | |
98 * has been found | |
99 */ | |
4628
b0016ed89048
make av_find_opt() available to the public and add a mask+flags parameter to search for specific AVOptions
michael
parents:
4369
diff
changeset
|
100 const AVOption *av_find_opt(void *obj, const char *name, const char *unit, int mask, int flags); |
7224 | 101 |
8407
8903ad65c412
Put under #if LIBAVCODEC_VERSION_MAJOR < 53 the deprecated functions
stefano
parents:
8356
diff
changeset
|
102 #if LIBAVCODEC_VERSION_MAJOR < 53 |
7427 | 103 /** |
104 * @see av_set_string2() | |
105 */ | |
7224 | 106 attribute_deprecated const AVOption *av_set_string(void *obj, const char *name, const char *val); |
107 | |
108 /** | |
8356 | 109 * @return a pointer to the AVOption corresponding to the field set or |
110 * NULL if no matching AVOption exists, or if the value \p val is not | |
111 * valid | |
112 * @see av_set_string3() | |
113 */ | |
114 attribute_deprecated const AVOption *av_set_string2(void *obj, const char *name, const char *val, int alloc); | |
8407
8903ad65c412
Put under #if LIBAVCODEC_VERSION_MAJOR < 53 the deprecated functions
stefano
parents:
8356
diff
changeset
|
115 #endif |
8356 | 116 |
117 /** | |
7224 | 118 * Sets the field of obj with the given name to value. |
7427 | 119 * |
120 * @param[in] obj A struct whose first element is a pointer to an | |
121 * AVClass. | |
122 * @param[in] name the name of the field to set | |
123 * @param[in] val The value to set. If the field is not of a string | |
124 * type, then the given string is parsed. | |
125 * SI postfixes and some named scalars are supported. | |
126 * If the field is of a numeric type, it has to be a numeric or named | |
127 * scalar. Behavior with more than one scalar and +- infix operators | |
128 * is undefined. | |
129 * If the field is of a flags type, it has to be a sequence of numeric | |
130 * scalars or named flags separated by '+' or '-'. Prefixing a flag | |
131 * with '+' causes it to be set without affecting the other flags; | |
132 * similarly, '-' unsets a flag. | |
8356 | 133 * @param[out] o_out if non-NULL put here a pointer to the AVOption |
134 * found | |
7224 | 135 * @param alloc when 1 then the old value will be av_freed() and the |
136 * new av_strduped() | |
137 * when 0 then no av_free() nor av_strdup() will be used | |
8356 | 138 * @return 0 if the value has been set, an AVERROR* error code if no |
139 * matching option exists, or if the value \p val is not valid | |
7224 | 140 */ |
8356 | 141 int av_set_string3(void *obj, const char *name, const char *val, int alloc, const AVOption **o_out); |
7224 | 142 |
4369
e10acab2322a
Constantize AVOption, solve few warnings, patch from flameeyes@gentoo.org aka "the other Diego"
lu_zero
parents:
3947
diff
changeset
|
143 const AVOption *av_set_double(void *obj, const char *name, double n); |
e10acab2322a
Constantize AVOption, solve few warnings, patch from flameeyes@gentoo.org aka "the other Diego"
lu_zero
parents:
3947
diff
changeset
|
144 const AVOption *av_set_q(void *obj, const char *name, AVRational n); |
e10acab2322a
Constantize AVOption, solve few warnings, patch from flameeyes@gentoo.org aka "the other Diego"
lu_zero
parents:
3947
diff
changeset
|
145 const AVOption *av_set_int(void *obj, const char *name, int64_t n); |
e10acab2322a
Constantize AVOption, solve few warnings, patch from flameeyes@gentoo.org aka "the other Diego"
lu_zero
parents:
3947
diff
changeset
|
146 double av_get_double(void *obj, const char *name, const AVOption **o_out); |
e10acab2322a
Constantize AVOption, solve few warnings, patch from flameeyes@gentoo.org aka "the other Diego"
lu_zero
parents:
3947
diff
changeset
|
147 AVRational av_get_q(void *obj, const char *name, const AVOption **o_out); |
e10acab2322a
Constantize AVOption, solve few warnings, patch from flameeyes@gentoo.org aka "the other Diego"
lu_zero
parents:
3947
diff
changeset
|
148 int64_t av_get_int(void *obj, const char *name, const AVOption **o_out); |
e10acab2322a
Constantize AVOption, solve few warnings, patch from flameeyes@gentoo.org aka "the other Diego"
lu_zero
parents:
3947
diff
changeset
|
149 const char *av_get_string(void *obj, const char *name, const AVOption **o_out, char *buf, int buf_len); |
e10acab2322a
Constantize AVOption, solve few warnings, patch from flameeyes@gentoo.org aka "the other Diego"
lu_zero
parents:
3947
diff
changeset
|
150 const AVOption *av_next_option(void *obj, const AVOption *last); |
2876 | 151 int av_opt_show(void *obj, void *av_log_obj); |
3702 | 152 void av_opt_set_defaults(void *s); |
4629
2faa1399dd68
add av_opt_set_defaults2() which sets just defaults from AVOptions whos flags match a user specified & mask = flags
michael
parents:
4628
diff
changeset
|
153 void av_opt_set_defaults2(void *s, int mask, int flags); |
2874
b6def74f5811
flags and named constants with type checking of course for AVOption
michael
parents:
diff
changeset
|
154 |
7760 | 155 #endif /* AVCODEC_OPT_H */ |