Opened 8 years ago
Closed 8 years ago
#5618 closed defect (fixed)
Inconsistent behaviour between av_opt_set, av_opt_set_q and av_opt_set_video_rate
| Reported by: | Muhammad Faiz | Owned by: | |
|---|---|---|---|
| Priority: | normal | Component: | avutil |
| Version: | git-master | Keywords: | |
| Cc: | Blocked By: | ||
| Blocking: | Reproduced by developer: | no | |
| Analyzed by developer: | no |
Description
Summary of the bug:
How to reproduce:
#include <libavutil/opt.h>
#include <libavutil/log.h>
#include <libavfilter/avfilter.h>
int main(int argc, char **argv)
{
AVFilterGraph *graph;
AVFilterContext *showcqt;
avfilter_register_all();
graph = avfilter_graph_alloc();
showcqt = avfilter_graph_alloc_filter(graph, avfilter_get_by_name("showcqt"), "showcqt");
if (av_opt_set(showcqt, "fps", "25", AV_OPT_SEARCH_CHILDREN) < 0)
av_log(NULL, AV_LOG_ERROR, "error calling av_opt_set()\n");
if (av_opt_set_q(showcqt, "fps", av_make_q(25,1), AV_OPT_SEARCH_CHILDREN) < 0)
av_log(NULL, AV_LOG_ERROR, "error calling av_opt_set_q()\n");
if (av_opt_set_video_rate(showcqt, "fps", av_make_q(25,1), AV_OPT_SEARCH_CHILDREN) < 0)
av_log(NULL, AV_LOG_ERROR, "error calling av_opt_set_video_rate()\n");
return 0;
}
av_opt_set_q and av_opt_set_video rate do range checking
but av_opt_set doesn't.
Here is the result:
showcqt @ 0x76b600] Value 25.000000 for parameter 'fps' out of range [0 - 0] error calling av_opt_set_q() [showcqt @ 0x76b600] Value 25.000000 for parameter 'fps' out of range [0 - 0] error calling av_opt_set_video_rate()
Change History (3)
comment:1 by , 8 years ago
comment:2 by , 8 years ago
It seems that all options in libavfilter with type AV_OPT_TYPE_VIDEO_RATE define 0 - 0 range.
Not only showcqt but also other filters.
BTW, sending patch to ML.
comment:3 by , 8 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.



You are correct, the string setters don't do limit checking on some more "complex" types, this would appear to be a bug.
The real bug is that showcqt defines a 0-0 range for those options though.