Commit 71c644ce authored by Stefano Sabatini's avatar Stefano Sabatini

lavfi: set link audio time_base if not set in avfilter_config_links()

The set value depends on the input link, or on the sample_rate value.
Avoids the need to explicitely set the time_base value.
parent 4460b81f
...@@ -299,12 +299,17 @@ int avfilter_config_links(AVFilterContext *filter) ...@@ -299,12 +299,17 @@ int avfilter_config_links(AVFilterContext *filter)
if (link->src->input_count) { if (link->src->input_count) {
if (!link->sample_rate) if (!link->sample_rate)
link->sample_rate = link->src->inputs[0]->sample_rate; link->sample_rate = link->src->inputs[0]->sample_rate;
if (!link->time_base.num && !link->time_base.den)
link->time_base = link->src->inputs[0]->time_base;
} else if (!link->sample_rate) { } else if (!link->sample_rate) {
av_log(link->src, AV_LOG_ERROR, av_log(link->src, AV_LOG_ERROR,
"Audio source filters must set their output link's " "Audio source filters must set their output link's "
"sample_rate\n"); "sample_rate\n");
return AVERROR(EINVAL); return AVERROR(EINVAL);
} }
if (!link->time_base.num && !link->time_base.den)
link->time_base = (AVRational) {1, link->sample_rate};
} }
if ((config_link = link->dstpad->config_props)) if ((config_link = link->dstpad->config_props))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment