Diego Biurrun
67351924fa
Drop unreachable break and return statements
8 years ago
Diego Biurrun
d12b5b2f13
build: Split test programs off into separate files
...
This avoids spurious library rebuilds when only the test program
code is changed and simplifies the build system.
9 years ago
Diego Biurrun
3b08d9d932
testprogs: K&R formatting cosmetics
9 years ago
Michael Niedermayer
564b4591bb
opt: Add av_opt_copy()
...
This includes documentation and other modifications by
Lukasz Marek and Martin Storsjö.
Signed-off-by: Martin Storsjö <martin@martin.st>
9 years ago
Lukasz Marek
8833f1508b
opt: Add const to av_opt_next
...
Also add const to pointers in static functions within opt.c where
possible/necessary.
Signed-off-by: Martin Storsjö <martin@martin.st>
9 years ago
Diego Biurrun
0d2fcdb1c5
opt-test: Merge struct declaration and initialization
9 years ago
Diego Biurrun
d3044cf37f
opt-test: Move some variable declarations to avoid block braces
9 years ago
Vittorio Giovara
07a0c0f000
opt: check memory allocation
...
CC: libav-stable@libav.org
Bug-Id: CID 1257771
10 years ago
Vittorio Giovara
b1306823d0
check memory errors from av_strdup()
10 years ago
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