This is more consistent with naming in the rest of Libav.
Showing the changes to libavfilter/avfilter.c (1 of 13 files). Show all
Unified · Split
| @@ -70,8 +70,8 @@ int avfilter_link(AVFilterContext *src, unsigned srcpad, · 69 unmodified lines | ||
| 70 | 70 | { |
| 71 | 71 | AVFilterLink *link; |
| 72 | 72 | |
| 73 | − if (src->output_count <= srcpad || dst->input_count <= dstpad || | |
| 74 | − src->outputs[srcpad] || dst->inputs[dstpad]) | |
| 73 | + if (src->nb_outputs <= srcpad || dst->nb_inputs <= dstpad || | |
| 74 | + src->outputs[srcpad] || dst->inputs[dstpad]) | |
| 75 | 75 | return -1; |
| 76 | 76 | |
| 77 | 77 | if (src->output_pads[srcpad].type != dst->input_pads[dstpad].type) { |
| @@ -138,7 +138,7 @@ int avfilter_config_links(AVFilterContext *filter) · 60 unmodified lines | ||
| 138 | 138 | unsigned i; |
| 139 | 139 | int ret; |
| 140 | 140 | |
| 141 | − for (i = 0; i < filter->input_count; i ++) { | |
| 141 | + for (i = 0; i < filter->nb_inputs; i ++) { | |
| 142 | 142 | AVFilterLink *link = filter->inputs[i]; |
| 143 | 143 | |
| 144 | 144 | if (!link) continue; |
| @@ -156,7 +156,7 @@ int avfilter_config_links(AVFilterContext *filter) · 11 unmodified lines | ||
| 156 | 156 | return ret; |
| 157 | 157 | |
| 158 | 158 | if (!(config_link = link->srcpad->config_props)) { |
| 159 | − if (link->src->input_count != 1) { | |
| 159 | + if (link->src->nb_inputs != 1) { | |
| 160 | 160 | av_log(link->src, AV_LOG_ERROR, "Source filters and filters " |
| 161 | 161 | "with more than one input " |
| 162 | 162 | "must set config_props() " |
| @@ -171,15 +171,15 @@ int avfilter_config_links(AVFilterContext *filter) · 8 unmodified lines | ||
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | if (link->time_base.num == 0 && link->time_base.den == 0) |
| 174 | − link->time_base = link->src && link->src->input_count ? | |
| 174 | + link->time_base = link->src && link->src->nb_inputs ? | |
| 175 | 175 | link->src->inputs[0]->time_base : AV_TIME_BASE_Q; |
| 176 | 176 | |
| 177 | 177 | if (link->type == AVMEDIA_TYPE_VIDEO) { |
| 178 | 178 | if (!link->sample_aspect_ratio.num && !link->sample_aspect_ratio.den) |
| 179 | − link->sample_aspect_ratio = link->src->input_count ? | |
| 179 | + link->sample_aspect_ratio = link->src->nb_inputs ? | |
| 180 | 180 | link->src->inputs[0]->sample_aspect_ratio : (AVRational){1,1}; |
| 181 | 181 | |
| 182 | − if (link->src->input_count) { | |
| 182 | + if (link->src->nb_inputs) { | |
| 183 | 183 | if (!link->w) |
| 184 | 184 | link->w = link->src->inputs[0]->w; |
| 185 | 185 | if (!link->h) |
| @@ -249,7 +249,7 @@ int ff_poll_frame(AVFilterLink *link) · 63 unmodified lines | ||
| 249 | 249 | if (link->srcpad->poll_frame) |
| 250 | 250 | return link->srcpad->poll_frame(link); |
| 251 | 251 | |
| 252 | − for (i = 0; i < link->src->input_count; i++) { | |
| 252 | + for (i = 0; i < link->src->nb_inputs; i++) { | |
| 253 | 253 | int val; |
| 254 | 254 | if (!link->src->inputs[i]) |
| 255 | 255 | return -1; |
| @@ -339,27 +339,31 @@ int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *in · 83 unmodified lines | ||
| 339 | 339 | goto err; |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | − ret->input_count = pad_count(filter->inputs); | |
| 343 | − if (ret->input_count) { | |
| 344 | − ret->input_pads = av_malloc(sizeof(AVFilterPad) * ret->input_count); | |
| 342 | + ret->nb_inputs = pad_count(filter->inputs); | |
| 343 | + if (ret->nb_inputs ) { | |
| 344 | + ret->input_pads = av_malloc(sizeof(AVFilterPad) * ret->nb_inputs); | |
| 345 | 345 | if (!ret->input_pads) |
| 346 | 346 | goto err; |
| 347 | − memcpy(ret->input_pads, filter->inputs, sizeof(AVFilterPad) * ret->input_count); | |
| 348 | − ret->inputs = av_mallocz(sizeof(AVFilterLink*) * ret->input_count); | |
| 347 | + memcpy(ret->input_pads, filter->inputs, sizeof(AVFilterPad) * ret->nb_inputs); | |
| 348 | + ret->inputs = av_mallocz(sizeof(AVFilterLink*) * ret->nb_inputs); | |
| 349 | 349 | if (!ret->inputs) |
| 350 | 350 | goto err; |
| 351 | 351 | } |
| 352 | 352 | |
| 353 | − ret->output_count = pad_count(filter->outputs); | |
| 354 | − if (ret->output_count) { | |
| 355 | − ret->output_pads = av_malloc(sizeof(AVFilterPad) * ret->output_count); | |
| 353 | + ret->nb_outputs = pad_count(filter->outputs); | |
| 354 | + if (ret->nb_outputs) { | |
| 355 | + ret->output_pads = av_malloc(sizeof(AVFilterPad) * ret->nb_outputs); | |
| 356 | 356 | if (!ret->output_pads) |
| 357 | 357 | goto err; |
| 358 | − memcpy(ret->output_pads, filter->outputs, sizeof(AVFilterPad) * ret->output_count); | |
| 359 | − ret->outputs = av_mallocz(sizeof(AVFilterLink*) * ret->output_count); | |
| 358 | + memcpy(ret->output_pads, filter->outputs, sizeof(AVFilterPad) * ret->nb_outputs); | |
| 359 | + ret->outputs = av_mallocz(sizeof(AVFilterLink*) * ret->nb_outputs); | |
| 360 | 360 | if (!ret->outputs) |
| 361 | 361 | goto err; |
| 362 | 362 | } |
| 363 | +#if FF_API_FOO_COUNT | |
| 364 | + ret->output_count = ret->nb_outputs; | |
| 365 | + ret->input_count = ret->nb_inputs; | |
| 366 | +#endif | |
| 363 | 367 | |
| 364 | 368 | *filter_ctx = ret; |
| 365 | 369 | return 0; |
| @@ -367,10 +371,10 @@ int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *in · 1 unmodified line | ||
| 367 | 371 | err: |
| 368 | 372 | av_freep(&ret->inputs); |
| 369 | 373 | av_freep(&ret->input_pads); |
| 370 | − ret->input_count = 0; | |
| 374 | + ret->nb_inputs = 0; | |
| 371 | 375 | av_freep(&ret->outputs); |
| 372 | 376 | av_freep(&ret->output_pads); |
| 373 | − ret->output_count = 0; | |
| 377 | + ret->nb_outputs = 0; | |
| 374 | 378 | av_freep(&ret->priv); |
| 375 | 379 | av_free(ret); |
| 376 | 380 | return AVERROR(ENOMEM); |
| @@ -384,7 +388,7 @@ void avfilter_free(AVFilterContext *filter) · 7 unmodified lines | ||
| 384 | 388 | if (filter->filter->uninit) |
| 385 | 389 | filter->filter->uninit(filter); |
| 386 | 390 | |
| 387 | − for (i = 0; i < filter->input_count; i++) { | |
| 391 | + for (i = 0; i < filter->nb_inputs; i++) { | |
| 388 | 392 | if ((link = filter->inputs[i])) { |
| 389 | 393 | if (link->src) |
| 390 | 394 | link->src->outputs[link->srcpad - link->src->output_pads] = NULL; |
| @@ -397,7 +401,7 @@ void avfilter_free(AVFilterContext *filter) · 6 unmodified lines | ||
| 397 | 401 | } |
| 398 | 402 | av_freep(&link); |
| 399 | 403 | } |
| 400 | − for (i = 0; i < filter->output_count; i++) { | |
| 404 | + for (i = 0; i < filter->nb_outputs; i++) { | |
| 401 | 405 | if ((link = filter->outputs[i])) { |
| 402 | 406 | if (link->dst) |
| 403 | 407 | 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, · 49 unmodified lines | ||
| 453 | 457 | void avfilter_insert_inpad(AVFilterContext *f, unsigned index, |
| 454 | 458 | AVFilterPad *p) |
| 455 | 459 | { |
| 456 | − ff_insert_pad(index, &f->input_count, offsetof(AVFilterLink, dstpad), | |
| 460 | + ff_insert_pad(index, &f->nb_inputs, offsetof(AVFilterLink, dstpad), | |
| 457 | 461 | &f->input_pads, &f->inputs, p); |
| 462 | +#if FF_API_FOO_COUNT | |
| 463 | + f->input_count = f->nb_inputs; | |
| 464 | +#endif | |
| 458 | 465 | } |
| 459 | 466 | void avfilter_insert_outpad(AVFilterContext *f, unsigned index, |
| 460 | 467 | AVFilterPad *p) |
| 461 | 468 | { |
| 462 | − ff_insert_pad(index, &f->output_count, offsetof(AVFilterLink, srcpad), | |
| 469 | + ff_insert_pad(index, &f->nb_outputs, offsetof(AVFilterLink, srcpad), | |
| 463 | 470 | &f->output_pads, &f->outputs, p); |
| 471 | +#if FF_API_FOO_COUNT | |
| 472 | + f->output_count = f->nb_outputs; | |
| 473 | +#endif | |
| 464 | 474 | } |
| 465 | 475 | int avfilter_poll_frame(AVFilterLink *link) |
| 466 | 476 | { |