Michael Niedermayer
8b6cbc3c33
avutil/opt: remove disabled old ABI compatibility code
...
Fixes some unused variable warnings
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
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
Michael Niedermayer
24327706e1
avutil/opt: ensure the right buffer is used in set_string_number()
...
Fixes use of uninitialized memory
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
bbc5adfb94
avutil/opt: Fix parsing regression with constants starting with numbers
...
Fixes parsing "3dnow"
Found-by: jamrial
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
539e72727f
avutil/opt: simplify set_string_number()
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Muhammad Faiz
4852a88dfb
avutil/opt: set_string_number(): remove unneeded copy
...
also remove unused variables
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
265dadbe7d
avutil/opt: Support general expressions involving AVOption constants in set_string_number()
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
88efc013b1
avutil: move QP2LAMBDA constant to eval
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
2c5c7f1089
avutil/opt: remove dead code from set_string_number()
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Muhammad Faiz
4927c0a988
avutil/opt.c: fix bug when parsing option
...
fix these strange behavior:
-af flanger=delay=10 [OK]
-af flanger=delay=1e1 [OK]
-af flanger=delay=1e+1 [Error]
-af flanger=delay=0.1 [OK]
-af flanger=delay=1e-1 [Error]
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
7cd6d61da5
avutil/opt: try to fix the case where src==dst in av_opt_copy()
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
00759d71a2
avutil/opt: add av_opt_copy()
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Michael Niedermayer
f028b7af7b
avutil/opt: add opt_size()
...
If people want, this could be exported as av_opt_size()
11 years ago
Lukasz Marek
ba52fb11dc
lavu/opt: add av_opt_set_dict2() function
...
Existing av_opt_set_dict doesn't accept flags.
It doesn't allow to pass options to nested structs.
New function alllows that.
Signed-off-by: Lukasz Marek <lukasz.m.luki2@gmail.com>
11 years ago
Lukasz Marek
3aac5fcfa9
lavu/opt: validate range before dereference
...
This change make error handling simplier.
av_opt_freep_ranges may be called when some ranges are NULL,
for example after memory allocation fail.
Signed-off-by: Lukasz Marek <lukasz.m.luki@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Lukasz Marek
8c27292373
lavu/opt: dont crash on freeing NULL AVOptionRanges
...
Signed-off-by: Lukasz Marek <lukasz.m.luki2@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Lukasz Marek
eaed4da96a
lavu/opt: extend AVOptionRange by extra values
...
AVOptionRange is not flexible enough to store AV_OPT_TYPE_IMAGE_SIZE
ranges. Current implementation can only store pixel count.
This patch aims to keep backward compatibility and extend
AVOptionRange with possibility to store width/height ranges.
Signed-off-by: Lukasz Marek <lukasz.m.luki@gmail.com>
11 years ago
Michael Niedermayer
d9a3501c33
avutil/opt: dont crash on av_opt_set_dict() with NULL
...
This allows calling the function without the need to check if the
dictionary contains any entries
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Michael Niedermayer
52d928daf9
avutil/opt: allow max=min=0 for pixel formats
...
This is neccessary for maintaining ABI compatibility with FFmpeg 2.1
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Anton Khirnov
c3ecd968f0
AVOptions: add flags for read/read-only options
11 years ago
Michael Niedermayer
8f853159f6
avutil/opt: preserve fractions in set_string_number()
...
This avoids going over a double precission float, which may loose precission
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
João Bernardo
290326711b
avutil/opt: Better print representation of number limits
...
Signed-off-by: João Bernardo Oliveira <jbvsmo@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Stefano Sabatini
334e2e2363
lavu,lavc,lswr: do not hardcode AV_SAMPLE_FMT_NB value when setting sample format max value
...
The constant may change in libavutil but the library may be compiled
against an older version, thus rejecting a value which is otherwise
supported by the new libavutil.
INT_MAX is used here to denote the max allowed value for a sample format.
The opt-test code is changed to provide a valid reference example.
11 years ago
Stefano Sabatini
3b8c7da7a3
lavu,lavfi,lavd: do not hardcode AV_PIX_FMT_NB value when setting pixel format max value
...
The constant may change in libavutil but the library may be compiled
against an older version, thus rejecting a value which is otherwise
supported by the new libavutil.
INT_MAX is used here to denote the max allowed value for a pixel format.
The opt-test code is changed to provide a valid reference example.
11 years ago
Stefano Sabatini
55f046be11
lavu/opt: apply range checks also when setting format string value
...
Previously when setting a pixel/sample format as a string range checks
were not performed. This is consistent with the
av_opt_set_pixel/sample_fmt() interface.
11 years ago
Stefano Sabatini
1575a96b3a
lavu/opt: factorize setting of format values from string
...
Simplify incoming patch.
11 years ago
Stefano Sabatini
e2b54464c6
lavu/opt: fix range check logic in set_format()
...
In particular, allow to reject undefined values. Previously the code
was only accepting values in the range -1 .. NB_FORMATS-1.
11 years ago
Michael Niedermayer
e8ac905dae
avutil/opt: Implement av_opt_set_defaults* in O(N) instead of O(N²) time
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Michael Niedermayer
0aedf90e62
avutil/opt: factor set_string_color() out
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Michael Niedermayer
758d4e4067
avutil/opt: factor set_string_video_rate() out
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Michael Niedermayer
9648c4fe9c
avutil/opt: factor set_string_image_size() out
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Michael Niedermayer
15b1b08874
avutil/opt: fix flags check on non x86
...
This should fix several fate failures
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Michael Niedermayer
162126bb17
avutil/opt: check flags validity in write_number()
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
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
Michael Niedermayer
2d8ccf0adc
avutil/opt: initialize ret
...
Fixes CID1108610
Fixes use of uninitialized variable
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Stefano Sabatini
8696e51baf
lavu/opt: add AV_OPT_TYPE_CHANNEL_LAYOUT and handler functions
...
The new type is compatible with AV_OPT_TYPE_INT64, but allows to specify
channel layouts using the format accepted by av_get_channel_layout().
11 years ago
Stefano Sabatini
98e7c1eed5
lavu/opt-test: use automatic set and free handlers
...
In particular, do not set default string value by hand and use
av_opt_free() to free context.
11 years ago
Michael Niedermayer
5fc5170c55
avutil/opt: make const tables static const
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Michael Niedermayer
18b1381c5f
avutil/opt: fix av_log type
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Michael Niedermayer
0b5d1b88e0
avutil/opt: fix types passed to the format string "%s"
...
Fixes gcc warnings
Fixes CID1061056
Fixes CID1061057
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
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
Paul B Mahol
fd84b6fd33
lavu/opt: show default values for AV_OPT_TYPE_PIXEL_FMT and AV_OPT_TYPE_SAMPLE_FMT too
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
11 years ago
Paul B Mahol
a64248d1ec
lavu/opt: show default values
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
12 years ago
Paul B Mahol
f98dbc7311
lavu/opt: check if class is NULL too
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
12 years ago
Paul B Mahol
3a751eab78
lavu/opt: add AV_OPT_TYPE_COLOR
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
12 years ago
Anton Khirnov
bcc9432898
opt: check the return values of av_get_token for ENOMEM.
12 years ago
Nicolas George
983d04dd40
lavu/opt: make sure av_opt_set_bin() handles NULL/0.
12 years ago
Clément Bœsch
d00dcb8c9f
opt: attempt to improve options dump output.
...
Add some indent and remove the '-' prefix for filters.
12 years ago
Anton Khirnov
cf53704c55
AVOptions: make av_set_options_string() forward options to child objects
12 years ago
Nicolas George
8d928a9d99
lavu/opt: add AV_OPT_TYPE_DURATION.
12 years ago