The set value depends on the input link, or on the sample_rate value. Avoids the need to explicitely set the time_base value.
Unified · Split
| @@ -299,12 +299,17 @@ int avfilter_config_links(AVFilterContext *filter) · 298 unmodified lines | ||
| 299 | 299 | if (link->src->input_count) { |
| 300 | 300 | if (!link->sample_rate) |
| 301 | 301 | link->sample_rate = link->src->inputs[0]->sample_rate; |
| 302 | + if (!link->time_base.num && !link->time_base.den) | |
| 303 | + link->time_base = link->src->inputs[0]->time_base; | |
| 302 | 304 | } else if (!link->sample_rate) { |
| 303 | 305 | av_log(link->src, AV_LOG_ERROR, |
| 304 | 306 | "Audio source filters must set their output link's " |
| 305 | 307 | "sample_rate\n"); |
| 306 | 308 | return AVERROR(EINVAL); |
| 307 | 309 | } |
| 310 | + | |
| 311 | + if (!link->time_base.num && !link->time_base.den) | |
| 312 | + link->time_base = (AVRational) {1, link->sample_rate}; | |
| 308 | 313 | } |
| 309 | 314 | |
| 310 | 315 | if ((config_link = link->dstpad->config_props)) |