Gabriel Dume
4b1f5e5090
cosmetics: Write NULL pointer inequality checks more compactly
...
Signed-off-by: Diego Biurrun <diego@biurrun.de>
10 years ago
Andrew Stone
a8c104a511
AVOption: add support for dictionary types.
...
In order to support metadata being set as an option, it's necessary to be able
to set dictionaries as values.
Signed-off-by: Anton Khirnov <anton@khirnov.net>
10 years ago
Anton Khirnov
c3ecd968f0
AVOptions: add flags for read/read-only options
11 years ago
Anton Khirnov
0b357a8095
AVOptions: do not range check flag options.
...
It does not make sense in the vast majority of use cases, no currently
defined AV_OPT_TYPE_FLAGS options in Libav set the range to anything
nontrivial, and many of those get it wrong (the "correct" range is
INT_MIN to INT_MAX so that the builtin constant "all" works).
11 years ago
Martin Storsjö
c7e921a54f
avopt: Check whether the object actually has got an AVClass
...
AVIOContext has got an av_class member that only gets set if
opening the context using avio_open2, but not if allocating a
custom IO context. A caller that wants to read AVOptions from
an AVIOContext (recursively using AV_OPT_SEARCH_CHILDREN) may
not know if the AVIOContext actually has got a class set or not.
Signed-off-by: Martin Storsjö <martin@martin.st>
11 years ago
Anton Khirnov
bcc9432898
opt: check the return values of av_get_token for ENOMEM.
12 years ago
Anton Khirnov
cf53704c55
AVOptions: make av_set_options_string() forward options to child objects
12 years ago
Anton Khirnov
4d67ff8e8e
AVOptions: fix using named constants with child contexts.
...
The named constant needs to be searched for in the same object on which
the option is set, i.e. target_obj.
12 years ago
Anton Khirnov
9676b9a2cd
AVOption: remove an unused function parameter.
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
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
Anton Khirnov
c692957c4e
lavu: remove disabled avoptions cruft
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.
12 years ago
Martin Storsjö
1d9c2dc89a
Don't include common.h from avutil.h
...
Signed-off-by: Martin Storsjö <martin@martin.st>
12 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
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
Anton Khirnov
e1e22851c1
AVOptions: don't return an invalid option when option list is empty
13 years ago
Martin Storsjö
299234a0a9
avoptions: Fix av_opt_flag_is_set
...
With the changes in 3b3ea34655
,
"Remove all uses of deprecated AVOptions API", av_opt_flag_is_set
was broken, since it now uses av_opt_find, which doesn't return
named constants unless a unit to look for the constant in is given.
This broke enabling LATM encapsulated AAC output in RTP.
Signed-off-by: Martin Storsjö <martin@martin.st>
13 years ago
Anton Khirnov
85afbb1d00
AVOptions: don't segfault on NULL parameter in av_set_options_string()
13 years ago
Anton Khirnov
145f741e11
AVOptions: rename FF_OPT_TYPE_* => AV_OPT_TYPE_*
13 years ago
Anton Khirnov
3b3ea34655
Remove all uses of deprecated AVOptions API.
13 years ago
Anton Khirnov
8c5dcaad13
AVOptions: add av_opt_next, deprecate av_next_option.
...
Just for naming consistency, no functional changes.
13 years ago
Anton Khirnov
dca055be3a
AVOptions: add functions for evaluating option strings.
13 years ago
Anton Khirnov
059a037fbd
AVOptions: split get_number().
...
Split actual writing to read_number() in the same way as write_number().
Allows set_string_number() to write to a caller-provided destination.
13 years ago
Anton Khirnov
41d9d51a72
AVOptions: add av_opt_get*, deprecate av_get*.
...
New functions can get values from child objects, properly report error
codes and have consistent naming and signatures.
13 years ago
Anton Khirnov
dac66da63d
AVOptions: add av_opt_set*().
...
Deprecate av_set_*
New functions support setting values on children, return error codes
instead of options and have consistent naming and signatures.
13 years ago
Anton Khirnov
641c7afe3c
AVOptions: add new API for enumerating children.
...
This will allow the caller to enumerate child contexts in a generic way
and since the API is recursive, it also allows for deeper nesting (e.g.
AVFormatContext->AVIOContext->URLContext)
This will also allow the new setting/reading API to transparently apply
to children contexts.
13 years ago
Anton Khirnov
7bb1807c2d
AVOptions: refactor set_number/write_number
...
write_number() does the actual writing of the supplied
number to destination. Move finding the option and choosing destination
address out of it.
13 years ago
Anton Khirnov
cf10095f0b
AVOptions: cosmetics, rename static av_set_number2() to write_number().
13 years ago
Anton Khirnov
b003d0be5b
AVOptions: cosmetics, move and rename static av_set_number().
13 years ago
Anton Khirnov
c8d787d2ef
AVOptions: split av_set_string3 into opt type-specific functions
...
Also stop attempting to honor the alloc parameter, as things break
horribly in that case.
It will be removed in upcoming successor to av_set_string3.
13 years ago
Anton Khirnov
4dbcdfa86d
AVOptions: remove AVOption.offset <= 0 checks
...
They will only ever be <=0 if the option is broken, in which case this
check is hiding a bug.
13 years ago
Anton Khirnov
79eff91325
AVOptions: deprecate av_opt_set_defaults2
...
It's a hack which was created to allow for multiple options with
different defaults to refer to same field (e.g. 'b' vs 'ab'). There is
no need for it anymore.
13 years ago
Anton Khirnov
a7e2b2ccc9
AVOptions: move doxy for av_opt_set_defaults() from opt.c to opt.h
...
Also change it to be more readable.
13 years ago
Anton Khirnov
bea5670a4f
AVOptions: drop av_ prefix from static av_get_number().
13 years ago
Anton Khirnov
a726d7fd4e
AVOptions: in av_opt_find() don't return named constants unless unit is specified.
...
That is, unless the caller explicitly asks for them.
Prevents conflict between e.g. the 'loop' option in img2 demuxer and
'loop' flag in AVCodecContext.
14 years ago
Mans Rullgard
abc78a5a7c
Do not include log.h in avutil.h
...
Signed-off-by: Mans Rullgard <mans@mansr.com>
14 years ago
Mans Rullgard
add41decd9
Remove return statements following infinite loops without break
...
These statements cannot be reached and are thus not needed.
This removes a number of compiler warnings.
Signed-off-by: Mans Rullgard <mans@mansr.com>
14 years ago
Diego Biurrun
ce1e181b13
opt-test: Add missing braces to silence compiler warnings.
...
libavutil/opt.c:604:1: warning: missing braces around initializer [-Wmissing-braces]
14 years ago
Anton Khirnov
dc59ec5e79
AVOptions: add av_opt_find() as a replacement for av_find_opt.
14 years ago
Anton Khirnov
7e83e1c511
AVOptions: add av_opt_set_dict() mapping a dictionary struct to a context.
...
This way the caller can pass all the options in one nice package.
14 years ago
Martin Storsjö
cb7c11cc9e
avoptions: Add an av_opt_flag_is_set function for inspecting flag fields
...
Signed-off-by: Martin Storsjö <martin@martin.st>
14 years ago
Anton Khirnov
b39b06233d
AVOptions: add av_opt_free convenience function.
14 years ago