Allow iteration over filter options.
Unified · Split
| @@ -15,6 +15,10 @@ libavutil: 2011-04-18 · 14 unmodified lines | ||
| 15 | 15 | |
| 16 | 16 | API changes, most recent first: |
| 17 | 17 | |
| 18 | +2012-08-13 - xxxxxxx - lavfi 3.8.100 - avfilter.h | |
| 19 | + Add avfilter_get_class() function, and priv_class field to AVFilter | |
| 20 | + struct. | |
| 21 | + | |
| 18 | 22 | 2012-08-13 - xxxxxxx - lavu 51.69.100 - opt.h |
| 19 | 23 | Add AV_OPT_FLAG_FILTERING_PARAM symbol in opt.h. |
| 20 | 24 | |
| @@ -432,13 +432,48 @@ static const char *default_filter_name(void *filter_ctx) · 431 unmodified lines | ||
| 432 | 432 | return ctx->name ? ctx->name : ctx->filter->name; |
| 433 | 433 | } |
| 434 | 434 | |
| 435 | +static void *filter_child_next(void *obj, void *prev) | |
| 436 | +{ | |
| 437 | + AVFilterContext *ctx = obj; | |
| 438 | + if (!prev && ctx->filter && ctx->filter->priv_class) | |
| 439 | + return ctx->priv; | |
| 440 | + return NULL; | |
| 441 | +} | |
| 442 | + | |
| 443 | +static const AVClass *filter_child_class_next(const AVClass *prev) | |
| 444 | +{ | |
| 445 | + AVFilter **filter_ptr = NULL; | |
| 446 | + | |
| 447 | + /* find the filter that corresponds to prev */ | |
| 448 | + while (prev && *(filter_ptr = av_filter_next(filter_ptr))) | |
| 449 | + if ((*filter_ptr)->priv_class == prev) | |
| 450 | + break; | |
| 451 | + | |
| 452 | + /* could not find filter corresponding to prev */ | |
| 453 | + if (prev && !(*filter_ptr)) | |
| 454 | + return NULL; | |
| 455 | + | |
| 456 | + /* find next filter with specific options */ | |
| 457 | + while (*(filter_ptr = av_filter_next(filter_ptr))) | |
| 458 | + if ((*filter_ptr)->priv_class) | |
| 459 | + return (*filter_ptr)->priv_class; | |
| 460 | + return NULL; | |
| 461 | +} | |
| 462 | + | |
| 435 | 463 | static const AVClass avfilter_class = { |
| 436 | 464 | .class_name = "AVFilter", |
| 437 | 465 | .item_name = default_filter_name, |
| 438 | 466 | .version = LIBAVUTIL_VERSION_INT, |
| 439 | 467 | .category = AV_CLASS_CATEGORY_FILTER, |
| 468 | + .child_next = filter_child_next, | |
| 469 | + .child_class_next = filter_child_class_next, | |
| 440 | 470 | }; |
| 441 | 471 | |
| 472 | +const AVClass *avfilter_get_class(void) | |
| 473 | +{ | |
| 474 | + return &avfilter_class; | |
| 475 | +} | |
| 476 | + | |
| 442 | 477 | int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *inst_name) |
| 443 | 478 | { |
| 444 | 479 | AVFilterContext *ret; |
| @@ -47,6 +47,10 @@ const char *avfilter_configuration(void); · 46 unmodified lines | ||
| 47 | 47 | */ |
| 48 | 48 | const char *avfilter_license(void); |
| 49 | 49 | |
| 50 | +/** | |
| 51 | + * Get the class for the AVFilterContext struct. | |
| 52 | + */ | |
| 53 | +const AVClass *avfilter_get_class(void); | |
| 50 | 54 | |
| 51 | 55 | typedef struct AVFilterContext AVFilterContext; |
| 52 | 56 | typedef struct AVFilterLink AVFilterLink; |
| @@ -469,6 +473,8 @@ typedef struct AVFilter { · 416 unmodified lines | ||
| 469 | 473 | * used for providing binary data. |
| 470 | 474 | */ |
| 471 | 475 | int (*init_opaque)(AVFilterContext *ctx, const char *args, void *opaque); |
| 476 | + | |
| 477 | + const AVClass *priv_class; ///< private class, containing filter specific options | |
| 472 | 478 | } AVFilter; |
| 473 | 479 | |
| 474 | 480 | /** An instance of a filter */ |
| @@ -29,7 +29,7 @@ · 28 unmodified lines | ||
| 29 | 29 | #include "libavutil/avutil.h" |
| 30 | 30 | |
| 31 | 31 | #define LIBAVFILTER_VERSION_MAJOR 3 |
| 32 | −#define LIBAVFILTER_VERSION_MINOR 7 | |
| 32 | +#define LIBAVFILTER_VERSION_MINOR 8 | |
| 33 | 33 | #define LIBAVFILTER_VERSION_MICRO 100 |
| 34 | 34 | |
| 35 | 35 | #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ |