From: "Ronald S. Bultje" <rsbul...@gmail.com> This way, the code looks less like spaghetti, and is easier to parse for external preprocessors. --- libavfilter/avfilter.c | 10 +++++++--- libavfilter/vsrc_testsrc.c | 7 +++++-- 2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index d302264..0df26d4 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -170,9 +170,13 @@ int avfilter_config_links(AVFilterContext *filter) return ret; } - if (link->time_base.num == 0 && link->time_base.den == 0) - link->time_base = link->src && link->src->nb_inputs ? - link->src->inputs[0]->time_base : AV_TIME_BASE_Q; + if (link->time_base.num == 0 && link->time_base.den == 0) { + if (link->src && link->src->nb_inputs) { + link->time_base = link->src->inputs[0]->time_base; + } else { + link->time_base = AV_TIME_BASE_Q; + } + } if (link->type == AVMEDIA_TYPE_VIDEO) { if (!link->sample_aspect_ratio.num && !link->sample_aspect_ratio.den) diff --git a/libavfilter/vsrc_testsrc.c b/libavfilter/vsrc_testsrc.c index 42cd58e..12d4985 100644 --- a/libavfilter/vsrc_testsrc.c +++ b/libavfilter/vsrc_testsrc.c @@ -102,8 +102,11 @@ static av_cold int init_common(AVFilterContext *ctx, const char *args) test->time_base.num = frame_rate_q.den; test->time_base.den = frame_rate_q.num; - test->max_pts = duration >= 0 ? - av_rescale_q(duration, AV_TIME_BASE_Q, test->time_base) : -1; + if (duration >= 0) { + test->max_pts = av_rescale_q(duration, AV_TIME_BASE_Q, test->time_base); + } else { + test->max_pts = -1; + } test->nb_frame = 0; test->pts = 0; -- 1.7.9.5 _______________________________________________ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel