The caller needs to know what valid indices can be passed to avfilter_pad_get_name/type.
Unified · Split
| @@ -23,6 +23,7 @@ API changes, most recent first: · 22 unmodified lines | |||
| 23 | Add avfilter_init_str(), deprecate avfilter_init_filter(). | 23 | Add avfilter_init_str(), deprecate avfilter_init_filter(). |
| 24 | Add avfilter_init_dict(). | 24 | Add avfilter_init_dict(). |
| 25 | Add AVFilter.flags field and AVFILTER_FLAG_DYNAMIC_{INPUTS,OUTPUTS} flags. | 25 | Add AVFilter.flags field and AVFILTER_FLAG_DYNAMIC_{INPUTS,OUTPUTS} flags. |
| 26 | Add avfilter_pad_count() for counting filter inputs/outputs. | ||
| 26 | 27 | ||
| 27 | 2013-xx-xx - lavfi 3.7.0 - avfilter.h | 28 | 2013-xx-xx - lavfi 3.7.0 - avfilter.h |
| 28 | Add AVFilter.priv_class for exporting filter options through the AVOptions API | 29 | Add AVFilter.priv_class for exporting filter options through the AVOptions API |
| @@ -304,7 +304,7 @@ void avfilter_uninit(void) · 303 unmodified lines | |||
| 304 | next_registered_avfilter_idx = 0; | 304 | next_registered_avfilter_idx = 0; |
| 305 | } | 305 | } |
| 306 | 306 | ||
| 307 | static int pad_count(const AVFilterPad *pads) | 307 | int avfilter_pad_count(const AVFilterPad *pads) |
| 308 | { | 308 | { |
| 309 | int count; | 309 | int count; |
| 310 | 310 | ||
| @@ -377,7 +377,7 @@ AVFilterContext *ff_filter_alloc(const AVFilter *filter, const char *inst_name) · 66 unmodified lines | |||
| 377 | av_opt_set_defaults(ret->priv); | 377 | av_opt_set_defaults(ret->priv); |
| 378 | } | 378 | } |
| 379 | 379 | ||
| 380 | ret->nb_inputs = pad_count(filter->inputs); | 380 | ret->nb_inputs = avfilter_pad_count(filter->inputs); |
| 381 | if (ret->nb_inputs ) { | 381 | if (ret->nb_inputs ) { |
| 382 | ret->input_pads = av_malloc(sizeof(AVFilterPad) * ret->nb_inputs); | 382 | ret->input_pads = av_malloc(sizeof(AVFilterPad) * ret->nb_inputs); |
| 383 | if (!ret->input_pads) | 383 | if (!ret->input_pads) |
| @@ -388,7 +388,7 @@ AVFilterContext *ff_filter_alloc(const AVFilter *filter, const char *inst_name) · 4 unmodified lines | |||
| 388 | goto err; | 388 | goto err; |
| 389 | } | 389 | } |
| 390 | 390 | ||
| 391 | ret->nb_outputs = pad_count(filter->outputs); | 391 | ret->nb_outputs = avfilter_pad_count(filter->outputs); |
| 392 | if (ret->nb_outputs) { | 392 | if (ret->nb_outputs) { |
| 393 | ret->output_pads = av_malloc(sizeof(AVFilterPad) * ret->nb_outputs); | 393 | ret->output_pads = av_malloc(sizeof(AVFilterPad) * ret->nb_outputs); |
| 394 | if (!ret->output_pads) | 394 | if (!ret->output_pads) |
| @@ -350,6 +350,12 @@ struct AVFilterPad { · 349 unmodified lines | |||
| 350 | }; | 350 | }; |
| 351 | #endif | 351 | #endif |
| 352 | 352 | ||
| 353 | /** | ||
| 354 | * Get the number of elements in a NULL-terminated array of AVFilterPads (e.g. | ||
| 355 | * AVFilter.inputs/outputs). | ||
| 356 | */ | ||
| 357 | int avfilter_pad_count(const AVFilterPad *pads); | ||
| 358 | |||
| 353 | /** | 359 | /** |
| 354 | * Get the name of an AVFilterPad. | 360 | * Get the name of an AVFilterPad. |
| 355 | * | 361 | * |