Stefano Sabatini
b1a2684936
lavu/opt: fix weird align
12 years ago
Stefano Sabatini
7b9a3df5d7
lavu/opt-test: do not explicitly set default value in test_ctx
...
Let av_opt_set_defaults() set the value, which is simpler and more
idiomatic.
12 years ago
Diego Biurrun
bcb8d9eb8f
Drop unnecessary 'l' length modifier when printfing double values.
...
%f denotes a double argument and 'l' does nothing in this case
according to the C spec.
12 years ago
Justin Ruggles
d02202e08a
opt: avoid segfault in av_opt_next() if the class does not have an option list
...
CC: libav-stable@libav.org
12 years ago
Michael Niedermayer
22e4988673
opt: fix memleak on error of range_array
...
Fixes CID747739
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Stefano Sabatini
f494647206
lavu/opt: change the way ranges are printed
12 years ago
Stefano Sabatini
129d737150
lavu/opt: make av_opt_query_ranges_default() return a meaningful error code
12 years ago
Stefano Sabatini
0ad654d4c9
lavu/opt: perform misc cosmetical fixes
12 years ago
Michael Niedermayer
e0a553d526
opt_list: fix vertical alignment of types
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
f4ceca6261
opt: print ranges in opt_list()
...
The formating can and should be improved.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
a8e0d51bb8
opt: Add support to query ranges
...
Reviewed-by: Stefano Sabatini <stefasab@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Justin Ruggles
9d5c62ba5b
lavu/opt: do not filter out the initial sign character except for flags
...
This allows parsing of special-case negative numbers like decibels.
12 years ago
Anton Khirnov
cb45553f57
Remove pointless #undefs of previously forbidden functions.
12 years ago
Stefano Sabatini
c9ff32215b
lavu/opt: allow to set sample and pixel format with av_opt_set_int()
...
This change requires the user to specify min and max value, and makes
possible to prevent the user to set AV_{SAMPLE,PIX}_FMT_NONE if
forbidden.
Add required ifdeffery in case of mixed libraries, when libavutil is
updated but not the other libraries.
This is a followup of 08d0969c14
.
12 years ago
Stefano Sabatini
08d0969c14
lavu/opt: change the way default pixel and sample format value is set
...
Use the i64 field rather than the string value. Using a string to set a
default sample/pixel format is weird, also the new interface is more
consistent with the rest of the API.
This is technically an API break, but hopefully there are no applications
using this feature outside of FFmpeg. In order to save backward
compatibility with mixed libraries in case libavutil is updated but not
the other libraries, some ifdeffery hacks are added.
Note that the version check is only performed when class->version != 0,
since if it is not defined then we assume that no version was defined and
the class is not affected by the change.
We will luckily get rid of the hack at the next major bump.
12 years ago
Stefano Sabatini
51e9f58e1c
lavu/opt: add support for reading pixel and sample format through av_get_int()
...
Simplify backward compatibility, when switching from AV_OPT_TYPE_INT to
AV_OPT_TYPE_SAMPLE/PIXEL_FMT.
12 years ago
Stefano Sabatini
26c531cc22
lavu/opt: fix range shown in set_format() log message
12 years ago
Stefano Sabatini
c70ec631c9
lavu/opt: add av_opt_ accessors for pixel/format/image size options
...
The interface is implemented against the style of the other options
accessors. Possibly simplify programmatic setting of options.
12 years ago
Nicolas George
926481078b
lavu/opt: fix av_opt_get_key_value() API.
...
Do not skip the end delimiter.
Reserve positive return values.
This is an API break, but the function was introduced less than
two weeks ago.
12 years ago
Stefano Sabatini
ef4dc3e55b
lavu/opt: show valid range in case of out-of-range value
...
Improve feedback.
12 years ago
Nicolas George
3bdf4971ba
lavu/opt: implement av_opt_get_key_value().
...
This function does the low-level work of av_opt_set_from_string()
but can be used when there is no option context or when a generic
handling of unknown keys is needed.
av_opt_set_from_string() is changed to make use of it.
12 years ago
Nicolas George
e021eeb9f0
lavu/opt: parse key into a mallocated buffer.
...
It removes the hardcoded limit on the key size without making
the code much more complex, and it makes for a more versatile API.
12 years ago
Stefano Sabatini
b91fa5fcca
lavu/opt: set sample format default value, and accept NULL value
...
Fix commit c9eaa98a3e
.
+10l.
12 years ago
Stefano Sabatini
ca11f6b240
lavu/opt: prefer if(){}else{} over if()else{} construct
...
Improve consistency.
12 years ago
Stefano Sabatini
481fdeeecf
lavu/opt: add AV_OPT_SAMPLE_FMT option
12 years ago
Anton Khirnov
c692957c4e
lavu: remove disabled avoptions cruft
12 years ago
Michael Niedermayer
492b8ec4c5
av_opt_set_from_string: fix memleak
...
Fixes CID733801
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Nicolas George
e4b1fcd474
lavu/opt: cosmetic fixes forgotten in the previous patch.
12 years ago
Nicolas George
438978fb4b
opt: implement av_opt_set_from_string().
...
It is similar to av_set_options_string() but accepts a list
of options that can be in shorthand: if the key is omitted
on the first fields, the keys from the shorthand list are
assumed, in order.
12 years ago
Stefano Sabatini
cf5629c064
lavu/opt: reindent after last commit
12 years ago
Stefano Sabatini
5666a1b270
lavu/opt: support NULL and special "none" values for size and pixel format options
...
Allow to specify NULL values explicitly, thus overriding the default
values set in the context.
12 years ago
Martin Storsjö
21bc440384
avopt: Explicitly store rational option defaults in .dbl
...
Signed-off-by: Martin Storsjö <martin@martin.st>
12 years ago
Martin Storsjö
e6153f173a
avopt: Store defaults for AV_OPT_TYPE_INT in the i64 union member
...
Signed-off-by: Martin Storsjö <martin@martin.st>
12 years ago
Martin Storsjö
d58dd4b5b5
avopt: Store defaults for AV_OPT_TYPE_FLAGS in the i64 union member
...
Signed-off-by: Martin Storsjö <martin@martin.st>
12 years ago
Martin Storsjö
124134e424
avopt: Store defaults for AV_OPT_TYPE_CONST in the i64 union member
...
Signed-off-by: Martin Storsjö <martin@martin.st>
12 years ago
Anton Khirnov
4d7adec8bd
AVOptions: store defaults for INT64 options in int64 union member.
...
Double does not have enough precision to represent all int64 numbers
exactly.
13 years ago
Martin Storsjö
1d9c2dc89a
Don't include common.h from avutil.h
...
Signed-off-by: Martin Storsjö <martin@martin.st>
13 years ago
Stefano Sabatini
a25346e65c
lavu/opt.h: add AV_OPT_FLAG_FILTERING_PARAM macro
13 years ago
Stefano Sabatini
a6d6b8a200
lavu/opt: fix crash in av_opt_next() in case the class has no options
13 years ago
Martin Storsjö
3893feeccd
opt/eval: Include mathematics.h for NAN/INFINITY
...
These files use NAN/INFINITY but didn't include mathematics.h to get
the fallback definitions if the system lacks the macros.
Signed-off-by: Martin Storsjö <martin@martin.st>
13 years ago
Nicolas George
9148ae5b91
opt: add test for IMAGE_SIZE and PIXEL_FMT.
13 years ago
Nicolas George
61c266d72f
opt: free test_ctx.string at the end.
...
Makes valgrind happy.
13 years ago
Nicolas George
42b774ab6f
opt: init test_ctx to 0.
...
Otherwise, setting string will try to free a random address.
13 years ago
Nicolas George
d9b0d75c56
opt: add AV_OPT_TYPE_PIXEL_FMT.
13 years ago
Anton Khirnov
0426c69310
AVOptions: fix the value printed in out of range error message.
13 years ago
Samuel Pitoiset
154486f9ad
opt: Add av_opt_set_bin()
...
Introduce a new function to set binary data through AVOption,
avoiding having to convert the binary data to a string inbetween.
Signed-off-by: Martin Storsjö <martin@martin.st>
13 years ago
Nicolas George
2ec3e5767e
opt: add AV_OPT_TYPE_IMAGE_SIZE.
13 years ago
Stefano Sabatini
d4f8d717ab
lavu/opt: clarify error message in set_key_value_pair()
13 years ago
Michael Niedermayer
2d9e2c6464
opt: Fix "libavutil/opt.c:811:20: warning: initialization discards ‘const’ qualifier from pointer target type [enabled by default]"
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
13 years ago
Michael Niedermayer
dff97be808
av_opt: add av_opt_ptr() to return a pointer to a field of a object based on
...
an AVClass
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
13 years ago