* commit '129bb238430ec45a3b5f8f1d384df590ddf7b62f': lavfi: add a slice threading infrastructure Conflicts: Changelog cmdutils.c doc/APIchanges libavfilter/Makefile libavfilter/avfilter.c libavfilter/avfilter.h libavfilter/avfiltergraph.c libavfilter/internal.h libavfilter/version.h
Showing the changes to libavfilter/avfilter.h (1 of 11 files). Show all
Unified · Split
| @@ -428,6 +428,11 @@ enum AVMediaType avfilter_pad_get_type(const AVFilterPad *pads, int pad_idx); · 427 unmodified lines | |||
| 428 | * the options supplied to it. | 428 | * the options supplied to it. |
| 429 | */ | 429 | */ |
| 430 | #define AVFILTER_FLAG_DYNAMIC_OUTPUTS (1 << 1) | 430 | #define AVFILTER_FLAG_DYNAMIC_OUTPUTS (1 << 1) |
| 431 | /** | ||
| 432 | * The filter supports multithreading by splitting frames into multiple parts | ||
| 433 | * and processing them concurrently. | ||
| 434 | */ | ||
| 435 | #define AVFILTER_FLAG_SLICE_THREADS (1 << 2) | ||
| 431 | /** | 436 | /** |
| 432 | * Some filters support a generic "enable" expression option that can be used | 437 | * Some filters support a generic "enable" expression option that can be used |
| 433 | * to enable or disable a filter in the timeline. Filters supporting this | 438 | * to enable or disable a filter in the timeline. Filters supporting this |
| @@ -542,6 +547,13 @@ typedef struct AVFilter { · 108 unmodified lines | |||
| 542 | int (*init_opaque)(AVFilterContext *ctx, void *opaque); | 547 | int (*init_opaque)(AVFilterContext *ctx, void *opaque); |
| 543 | } AVFilter; | 548 | } AVFilter; |
| 544 | 549 | ||
| 550 | /** | ||
| 551 | * Process multiple parts of the frame concurrently. | ||
| 552 | */ | ||
| 553 | #define AVFILTER_THREAD_SLICE (1 << 0) | ||
| 554 | |||
| 555 | typedef struct AVFilterInternal AVFilterInternal; | ||
| 556 | |||
| 545 | /** An instance of a filter */ | 557 | /** An instance of a filter */ |
| 546 | struct AVFilterContext { | 558 | struct AVFilterContext { |
| 547 | const AVClass *av_class; ///< needed for av_log() and filters common options | 559 | const AVClass *av_class; ///< needed for av_log() and filters common options |
| @@ -568,6 +580,29 @@ struct AVFilterContext { · 20 unmodified lines | |||
| 568 | 580 | ||
| 569 | struct AVFilterGraph *graph; ///< filtergraph this filter belongs to | 581 | struct AVFilterGraph *graph; ///< filtergraph this filter belongs to |
| 570 | 582 | ||
| 583 | /** | ||
| 584 | * Type of multithreading being allowed/used. A combination of | ||
| 585 | * AVFILTER_THREAD_* flags. | ||
| 586 | * | ||
| 587 | * May be set by the caller before initializing the filter to forbid some | ||
| 588 | * or all kinds of multithreading for this filter. The default is allowing | ||
| 589 | * everything. | ||
| 590 | * | ||
| 591 | * When the filter is initialized, this field is combined using bit AND with | ||
| 592 | * AVFilterGraph.thread_type to get the final mask used for determining | ||
| 593 | * allowed threading types. I.e. a threading type needs to be set in both | ||
| 594 | * to be allowed. | ||
| 595 | * | ||
| 596 | * After the filter is initialzed, libavfilter sets this field to the | ||
| 597 | * threading type that is actually used (0 for no multithreading). | ||
| 598 | */ | ||
| 599 | int thread_type; | ||
| 600 | |||
| 601 | /** | ||
| 602 | * An opaque struct for libavfilter internal use. | ||
| 603 | */ | ||
| 604 | AVFilterInternal *internal; | ||
| 605 | |||
| 571 | struct AVFilterCommand *command_queue; | 606 | struct AVFilterCommand *command_queue; |
| 572 | 607 | ||
| 573 | char *enable_str; ///< enable expression string | 608 | char *enable_str; ///< enable expression string |
| @@ -1020,6 +1055,8 @@ int avfilter_copy_buf_props(AVFrame *dst, const AVFilterBufferRef *src); · 446 unmodified lines | |||
| 1020 | */ | 1055 | */ |
| 1021 | const AVClass *avfilter_get_class(void); | 1056 | const AVClass *avfilter_get_class(void); |
| 1022 | 1057 | ||
| 1058 | typedef struct AVFilterGraphInternal AVFilterGraphInternal; | ||
| 1059 | |||
| 1023 | typedef struct AVFilterGraph { | 1060 | typedef struct AVFilterGraph { |
| 1024 | const AVClass *av_class; | 1061 | const AVClass *av_class; |
| 1025 | #if FF_API_FOO_COUNT | 1062 | #if FF_API_FOO_COUNT |
| @@ -1036,6 +1073,33 @@ typedef struct AVFilterGraph { · 10 unmodified lines | |||
| 1036 | #if FF_API_FOO_COUNT | 1073 | #if FF_API_FOO_COUNT |
| 1037 | unsigned nb_filters; | 1074 | unsigned nb_filters; |
| 1038 | #endif | 1075 | #endif |
| 1076 | |||
| 1077 | /** | ||
| 1078 | * Type of multithreading allowed for filters in this graph. A combination | ||
| 1079 | * of AVFILTER_THREAD_* flags. | ||
| 1080 | * | ||
| 1081 | * May be set by the caller at any point, the setting will apply to all | ||
| 1082 | * filters initialized after that. The default is allowing everything. | ||
| 1083 | * | ||
| 1084 | * When a filter in this graph is initialized, this field is combined using | ||
| 1085 | * bit AND with AVFilterContext.thread_type to get the final mask used for | ||
| 1086 | * determining allowed threading types. I.e. a threading type needs to be | ||
| 1087 | * set in both to be allowed. | ||
| 1088 | */ | ||
| 1089 | int thread_type; | ||
| 1090 | |||
| 1091 | /** | ||
| 1092 | * Maximum number of threads used by filters in this graph. May be set by | ||
| 1093 | * the caller before adding any filters to the filtergraph. Zero (the | ||
| 1094 | * default) means that the number of threads is determined automatically. | ||
| 1095 | */ | ||
| 1096 | int nb_threads; | ||
| 1097 | |||
| 1098 | /** | ||
| 1099 | * Opaque object for libavfilter internal use. | ||
| 1100 | */ | ||
| 1101 | AVFilterGraphInternal *internal; | ||
| 1102 | |||
| 1039 | char *aresample_swr_opts; ///< swr options to use for the auto-inserted aresample filters, Access ONLY through AVOptions | 1103 | char *aresample_swr_opts; ///< swr options to use for the auto-inserted aresample filters, Access ONLY through AVOptions |
| 1040 | 1104 | ||
| 1041 | /** | 1105 | /** |