Vittorio Giovara
07a0c0f000
opt: check memory allocation
...
CC: libav-stable@libav.org
Bug-Id: CID 1257771
2015-01-05 14:58:20 +01:00
Vittorio Giovara
b1306823d0
check memory errors from av_strdup()
2014-12-18 23:27:14 +01:00
Gabriel Dume
4b1f5e5090
cosmetics: Write NULL pointer inequality checks more compactly
...
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-08-15 05:34:13 -07:00
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>
2014-08-13 16:07:40 +00:00
Anton Khirnov
c3ecd968f0
AVOptions: add flags for read/read-only options
2014-02-19 21:52:17 +01:00
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).
2013-10-27 21:40:33 +01:00
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>
2013-07-31 21:31:14 +03:00
Anton Khirnov
bcc9432898
opt: check the return values of av_get_token for ENOMEM.
2013-04-04 07:51:53 +02:00
Anton Khirnov
cf53704c55
AVOptions: make av_set_options_string() forward options to child objects
2013-03-28 07:55:38 +01:00
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.
2013-03-16 05:35:33 +01:00
Anton Khirnov
9676b9a2cd
AVOption: remove an unused function parameter.
2013-03-16 05:35:20 +01:00
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.
2012-12-31 11:20:45 +01:00
Justin Ruggles
d02202e08a
opt: avoid segfault in av_opt_next() if the class does not have an option list
...
CC: libav-stable@libav.org
2012-12-22 15:43:27 -05:00
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.
2012-12-05 11:23:36 -05:00
Anton Khirnov
cb45553f57
Remove pointless #undefs of previously forbidden functions.
2012-12-04 21:40:22 +01:00
Anton Khirnov
c692957c4e
lavu: remove disabled avoptions cruft
2012-10-23 07:33:05 +02:00
Martin Storsjö
21bc440384
avopt: Explicitly store rational option defaults in .dbl
...
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-09-04 23:13:55 +03:00
Martin Storsjö
e6153f173a
avopt: Store defaults for AV_OPT_TYPE_INT in the i64 union member
...
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-09-04 23:13:44 +03:00
Martin Storsjö
d58dd4b5b5
avopt: Store defaults for AV_OPT_TYPE_FLAGS in the i64 union member
...
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-09-04 23:13:38 +03:00
Martin Storsjö
124134e424
avopt: Store defaults for AV_OPT_TYPE_CONST in the i64 union member
...
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-09-04 23:13:32 +03:00
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.
2012-08-24 11:25:06 +02:00
Martin Storsjö
1d9c2dc89a
Don't include common.h from avutil.h
...
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-08-15 22:32:06 +03:00
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>
2012-07-01 19:20:11 +03:00
Anton Khirnov
0426c69310
AVOptions: fix the value printed in out of range error message.
2012-05-28 12:55:41 +02:00
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>
2012-05-26 14:31:44 +03:00
Anton Khirnov
e1e22851c1
AVOptions: don't return an invalid option when option list is empty
2011-11-11 08:27:16 +01:00
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>
2011-10-17 21:35:41 +03:00
Anton Khirnov
85afbb1d00
AVOptions: don't segfault on NULL parameter in av_set_options_string()
2011-10-17 10:42:21 +02:00
Anton Khirnov
145f741e11
AVOptions: rename FF_OPT_TYPE_* => AV_OPT_TYPE_*
2011-10-12 16:51:16 +02:00
Anton Khirnov
3b3ea34655
Remove all uses of deprecated AVOptions API.
2011-10-12 16:51:16 +02:00
Anton Khirnov
8c5dcaad13
AVOptions: add av_opt_next, deprecate av_next_option.
...
Just for naming consistency, no functional changes.
2011-10-12 16:51:16 +02:00
Anton Khirnov
dca055be3a
AVOptions: add functions for evaluating option strings.
2011-10-12 16:51:16 +02:00
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.
2011-10-12 16:51:16 +02:00
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.
2011-10-12 16:51:16 +02:00
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.
2011-10-12 16:51:16 +02:00
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.
2011-10-12 16:51:16 +02:00
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.
2011-10-10 20:27:31 +02:00
Anton Khirnov
cf10095f0b
AVOptions: cosmetics, rename static av_set_number2() to write_number().
2011-10-10 20:27:31 +02:00
Anton Khirnov
b003d0be5b
AVOptions: cosmetics, move and rename static av_set_number().
2011-10-10 20:27:31 +02:00
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.
2011-10-10 20:27:30 +02:00
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.
2011-09-07 11:20:29 +02:00
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.
2011-09-07 11:19:43 +02:00
Anton Khirnov
a7e2b2ccc9
AVOptions: move doxy for av_opt_set_defaults() from opt.c to opt.h
...
Also change it to be more readable.
2011-09-07 11:16:52 +02:00
Anton Khirnov
bea5670a4f
AVOptions: drop av_ prefix from static av_get_number().
2011-09-01 10:37:04 +02:00
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.
2011-07-08 18:34:18 +02:00
Mans Rullgard
abc78a5a7c
Do not include log.h in avutil.h
...
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-07-03 21:42:07 +01:00
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>
2011-07-03 21:39:07 +01:00
Diego Biurrun
ce1e181b13
opt-test: Add missing braces to silence compiler warnings.
...
libavutil/opt.c:604:1: warning: missing braces around initializer [-Wmissing-braces]
2011-06-30 13:34:38 +02:00
Anton Khirnov
dc59ec5e79
AVOptions: add av_opt_find() as a replacement for av_find_opt.
2011-06-16 20:24:56 +02:00
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.
2011-06-16 20:24:56 +02:00