#5618 closed defect (fixed)

Inconsistent behaviour between av_opt_set, av_opt_set_q and av_opt_set_video_rate

Reported by: mfcc64 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 Changed 18 months ago by heleppkes

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.

comment:2 Changed 18 months ago by mfcc64

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 Changed 18 months ago by michael

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.