diff options
author | Anton Khirnov <anton@khirnov.net> | 2012-06-12 23:25:10 +0400 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2012-06-13 13:13:22 +0400 |
commit | 9baeff9506a890c8f9f27c08cf331f827c24726a (patch) | |
tree | c8d52b9e57f52cdfff694c7488e25e5a33e72fb7 /libavfilter/avfilter.c | |
parent | 9d0bfc5052fa73ac8df89ec9992d77b07840fdf0 (diff) |
lavfi: replace AVFilterContext.input/output_count with nb_inputs/outputs
This is more consistent with naming in the rest of Libav.
Diffstat (limited to 'libavfilter/avfilter.c')
-rw-r--r-- | libavfilter/avfilter.c | 58 |
1 files changed, 34 insertions, 24 deletions
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 0507b2acbd..bf76997aae 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -70,8 +70,8 @@ int avfilter_link(AVFilterContext *src, unsigned srcpad, { AVFilterLink *link; - if (src->output_count <= srcpad || dst->input_count <= dstpad || - src->outputs[srcpad] || dst->inputs[dstpad]) + if (src->nb_outputs <= srcpad || dst->nb_inputs <= dstpad || + src->outputs[srcpad] || dst->inputs[dstpad]) return -1; if (src->output_pads[srcpad].type != dst->input_pads[dstpad].type) { @@ -138,7 +138,7 @@ int avfilter_config_links(AVFilterContext *filter) unsigned i; int ret; - for (i = 0; i < filter->input_count; i ++) { + for (i = 0; i < filter->nb_inputs; i ++) { AVFilterLink *link = filter->inputs[i]; if (!link) continue; @@ -156,7 +156,7 @@ int avfilter_config_links(AVFilterContext *filter) return ret; if (!(config_link = link->srcpad->config_props)) { - if (link->src->input_count != 1) { + if (link->src->nb_inputs != 1) { av_log(link->src, AV_LOG_ERROR, "Source filters and filters " "with more than one input " "must set config_props() " @@ -171,15 +171,15 @@ int avfilter_config_links(AVFilterContext *filter) } if (link->time_base.num == 0 && link->time_base.den == 0) - link->time_base = link->src && link->src->input_count ? + link->time_base = link->src && link->src->nb_inputs ? link->src->inputs[0]->time_base : AV_TIME_BASE_Q; 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->sample_aspect_ratio = link->src->nb_inputs ? link->src->inputs[0]->sample_aspect_ratio : (AVRational){1,1}; - if (link->src->input_count) { + if (link->src->nb_inputs) { if (!link->w) link->w = link->src->inputs[0]->w; if (!link->h) @@ -249,7 +249,7 @@ int ff_poll_frame(AVFilterLink *link) if (link->srcpad->poll_frame) return link->srcpad->poll_frame(link); - for (i = 0; i < link->src->input_count; i++) { + for (i = 0; i < link->src->nb_inputs; i++) { int val; if (!link->src->inputs[i]) return -1; @@ -339,27 +339,31 @@ int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *in goto err; } - ret->input_count = pad_count(filter->inputs); - if (ret->input_count) { - ret->input_pads = av_malloc(sizeof(AVFilterPad) * ret->input_count); + ret->nb_inputs = pad_count(filter->inputs); + if (ret->nb_inputs ) { + ret->input_pads = av_malloc(sizeof(AVFilterPad) * ret->nb_inputs); if (!ret->input_pads) goto err; - memcpy(ret->input_pads, filter->inputs, sizeof(AVFilterPad) * ret->input_count); - ret->inputs = av_mallocz(sizeof(AVFilterLink*) * ret->input_count); + memcpy(ret->input_pads, filter->inputs, sizeof(AVFilterPad) * ret->nb_inputs); + ret->inputs = av_mallocz(sizeof(AVFilterLink*) * ret->nb_inputs); if (!ret->inputs) goto err; } - ret->output_count = pad_count(filter->outputs); - if (ret->output_count) { - ret->output_pads = av_malloc(sizeof(AVFilterPad) * ret->output_count); + ret->nb_outputs = pad_count(filter->outputs); + if (ret->nb_outputs) { + ret->output_pads = av_malloc(sizeof(AVFilterPad) * ret->nb_outputs); if (!ret->output_pads) goto err; - memcpy(ret->output_pads, filter->outputs, sizeof(AVFilterPad) * ret->output_count); - ret->outputs = av_mallocz(sizeof(AVFilterLink*) * ret->output_count); + memcpy(ret->output_pads, filter->outputs, sizeof(AVFilterPad) * ret->nb_outputs); + ret->outputs = av_mallocz(sizeof(AVFilterLink*) * ret->nb_outputs); if (!ret->outputs) goto err; } +#if FF_API_FOO_COUNT + ret->output_count = ret->nb_outputs; + ret->input_count = ret->nb_inputs; +#endif *filter_ctx = ret; return 0; @@ -367,10 +371,10 @@ int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *in err: av_freep(&ret->inputs); av_freep(&ret->input_pads); - ret->input_count = 0; + ret->nb_inputs = 0; av_freep(&ret->outputs); av_freep(&ret->output_pads); - ret->output_count = 0; + ret->nb_outputs = 0; av_freep(&ret->priv); av_free(ret); return AVERROR(ENOMEM); @@ -384,7 +388,7 @@ void avfilter_free(AVFilterContext *filter) if (filter->filter->uninit) filter->filter->uninit(filter); - for (i = 0; i < filter->input_count; i++) { + for (i = 0; i < filter->nb_inputs; i++) { if ((link = filter->inputs[i])) { if (link->src) link->src->outputs[link->srcpad - link->src->output_pads] = NULL; @@ -397,7 +401,7 @@ void avfilter_free(AVFilterContext *filter) } av_freep(&link); } - for (i = 0; i < filter->output_count; i++) { + for (i = 0; i < filter->nb_outputs; i++) { if ((link = filter->outputs[i])) { if (link->dst) link->dst->inputs[link->dstpad - link->dst->input_pads] = NULL; @@ -453,14 +457,20 @@ void avfilter_insert_pad(unsigned idx, unsigned *count, size_t padidx_off, void avfilter_insert_inpad(AVFilterContext *f, unsigned index, AVFilterPad *p) { - ff_insert_pad(index, &f->input_count, offsetof(AVFilterLink, dstpad), + ff_insert_pad(index, &f->nb_inputs, offsetof(AVFilterLink, dstpad), &f->input_pads, &f->inputs, p); +#if FF_API_FOO_COUNT + f->input_count = f->nb_inputs; +#endif } void avfilter_insert_outpad(AVFilterContext *f, unsigned index, AVFilterPad *p) { - ff_insert_pad(index, &f->output_count, offsetof(AVFilterLink, srcpad), + ff_insert_pad(index, &f->nb_outputs, offsetof(AVFilterLink, srcpad), &f->output_pads, &f->outputs, p); +#if FF_API_FOO_COUNT + f->output_count = f->nb_outputs; +#endif } int avfilter_poll_frame(AVFilterLink *link) { |