diff options
author | Mina Nagy Zaki <mnzaki@gmail.com> | 2011-08-04 15:47:00 +0300 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2012-05-22 21:32:57 +0200 |
commit | 88c3b87bd81829d1b7171cb26e5ef5a564dbd96a (patch) | |
tree | 5285cf29a2be26bf25dc7d10fa5187e4f677f93c /libavfilter/avfilter.c | |
parent | ccefa89f398a30dcd24044621ec7013387aeb455 (diff) | |
download | ffmpeg-88c3b87bd81829d1b7171cb26e5ef5a564dbd96a.tar.gz |
lavfi: deprecate default config_props() callback and refactor avfilter_config_links()
Link properties have to be checked after config_props() is called to
make sure everything is sane, so the default config_props() for output
links was redundant.
Remove now empty defaults.c
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'libavfilter/avfilter.c')
-rw-r--r-- | libavfilter/avfilter.c | 39 |
1 files changed, 33 insertions, 6 deletions
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 231c875131..2f5c37d3af 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -155,18 +155,38 @@ int avfilter_config_links(AVFilterContext *filter) if ((ret = avfilter_config_links(link->src)) < 0) return ret; - if (!(config_link = link->srcpad->config_props)) - config_link = avfilter_default_config_output_link; - if ((ret = config_link(link)) < 0) + if (!(config_link = link->srcpad->config_props)) { + if (link->src->input_count != 1) { + av_log(link->src, AV_LOG_ERROR, "Source filters and filters " + "with more than one input " + "must set config_props() " + "callbacks on all outputs\n"); + return AVERROR(EINVAL); + } + } else if ((ret = config_link(link)) < 0) return ret; if (link->time_base.num == 0 && link->time_base.den == 0) link->time_base = link->src && link->src->input_count ? link->src->inputs[0]->time_base : AV_TIME_BASE_Q; - if (link->sample_aspect_ratio.num == 0 && link->sample_aspect_ratio.den == 0) - link->sample_aspect_ratio = link->src->input_count ? - link->src->inputs[0]->sample_aspect_ratio : (AVRational){1,1}; + if (link->type == AVMEDIA_TYPE_VIDEO) { + 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}; + + if (link->src->input_count) { + if (!link->w) + link->w = link->src->inputs[0]->w; + if (!link->h) + link->h = link->src->inputs[0]->h; + } else if (!link->w || !link->h) { + av_log(link->src, AV_LOG_ERROR, + "Video source filters must set their output link's " + "width and height\n"); + return AVERROR(EINVAL); + } + } if ((config_link = link->dstpad->config_props)) if ((ret = config_link(link)) < 0) @@ -400,3 +420,10 @@ int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque ret = filter->filter->init(filter, args, opaque); return ret; } + +#if FF_API_DEFAULT_CONFIG_OUTPUT_LINK +int avfilter_default_config_output_link(AVFilterLink *link) +{ + return 0; +} +#endif |