[FFmpeg-cvslog] lavfi: add and use an inlink variable in avfilter_config_links()
Stefano Sabatini
git at videolan.org
Fri Sep 16 21:23:22 CEST 2011
ffmpeg | branch: master | Stefano Sabatini <stefasab at gmail.com> | Fri Sep 16 18:46:09 2011 +0200| [553c5e9f234d062d921a4150b64ffd9b19c05135] | committer: Stefano Sabatini
lavfi: add and use an inlink variable in avfilter_config_links()
Simplify expressions, improve readability.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=553c5e9f234d062d921a4150b64ffd9b19c05135
---
libavfilter/avfilter.c | 21 +++++++++++----------
1 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index df1dd65..783fda5 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -246,6 +246,8 @@ int avfilter_config_links(AVFilterContext *filter)
for (i = 0; i < filter->input_count; i ++) {
AVFilterLink *link = filter->inputs[i];
+ AVFilterLink *inlink = link->src->input_count ?
+ link->src->inputs[0] : NULL;
if (!link) continue;
@@ -275,18 +277,17 @@ int avfilter_config_links(AVFilterContext *filter)
switch (link->type) {
case AVMEDIA_TYPE_VIDEO:
if (!link->time_base.num && !link->time_base.den)
- link->time_base = link->src->input_count ?
- link->src->inputs[0]->time_base : AV_TIME_BASE_Q;
+ link->time_base = inlink ? inlink->time_base : AV_TIME_BASE_Q;
if (!link->sample_aspect_ratio.num && !link->sample_aspect_ratio.den)
- link->sample_aspect_ratio = link->src->input_count ?
- link->src->inputs[0]->sample_aspect_ratio : (AVRational){1,1};
+ link->sample_aspect_ratio = inlink ?
+ inlink->sample_aspect_ratio : (AVRational){1,1};
- if (link->src->input_count) {
+ if (inlink) {
if (!link->w)
- link->w = link->src->inputs[0]->w;
+ link->w = inlink->w;
if (!link->h)
- link->h = link->src->inputs[0]->h;
+ link->h = inlink->h;
} else if (!link->w || !link->h) {
av_log(link->src, AV_LOG_ERROR,
"Video source filters must set their output link's "
@@ -296,11 +297,11 @@ int avfilter_config_links(AVFilterContext *filter)
break;
case AVMEDIA_TYPE_AUDIO:
- if (link->src->input_count) {
+ if (inlink) {
if (!link->sample_rate)
- link->sample_rate = link->src->inputs[0]->sample_rate;
+ link->sample_rate = inlink->sample_rate;
if (!link->time_base.num && !link->time_base.den)
- link->time_base = link->src->inputs[0]->time_base;
+ link->time_base = inlink->time_base;
} else if (!link->sample_rate) {
av_log(link->src, AV_LOG_ERROR,
"Audio source filters must set their output link's "
More information about the ffmpeg-cvslog
mailing list