summaryrefslogtreecommitdiff
path: root/libavfilter/avfilter.h
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2013-08-08 16:28:41 +0200
committerAnton Khirnov <anton@khirnov.net>2013-09-28 08:06:19 +0200
commit0767bfd1994c4bf22e167ffadb8f823a950aad18 (patch)
treebdbf92d10ec581bb324cd245dcfc6e888dcaa12c /libavfilter/avfilter.h
parent38e15df1489d86c016515223ee693e7d0326c56a (diff)
lavfi: allow user-provided execute() callbacks
Diffstat (limited to 'libavfilter/avfilter.h')
-rw-r--r--libavfilter/avfilter.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index c5efdb8374..ca11be9bc6 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -899,6 +899,35 @@ const AVClass *avfilter_get_class(void);
typedef struct AVFilterGraphInternal AVFilterGraphInternal;
+/**
+ * A function pointer passed to the @ref AVFilterGraph.execute callback to be
+ * executed multiple times, possibly in parallel.
+ *
+ * @param ctx the filter context the job belongs to
+ * @param arg an opaque parameter passed through from @ref
+ * AVFilterGraph.execute
+ * @param jobnr the index of the job being executed
+ * @param nb_jobs the total number of jobs
+ *
+ * @return 0 on success, a negative AVERROR on error
+ */
+typedef int (avfilter_action_func)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs);
+
+/**
+ * A function executing multiple jobs, possibly in parallel.
+ *
+ * @param ctx the filter context to which the jobs belong
+ * @param func the function to be called multiple times
+ * @param arg the argument to be passed to func
+ * @param ret a nb_jobs-sized array to be filled with return values from each
+ * invocation of func
+ * @param nb_jobs the number of jobs to execute
+ *
+ * @return 0 on success, a negative AVERROR on error
+ */
+typedef int (avfilter_execute_func)(AVFilterContext *ctx, avfilter_action_func *func,
+ void *arg, int *ret, int nb_jobs);
+
typedef struct AVFilterGraph {
const AVClass *av_class;
#if FF_API_FOO_COUNT
@@ -941,6 +970,27 @@ typedef struct AVFilterGraph {
* Opaque object for libavfilter internal use.
*/
AVFilterGraphInternal *internal;
+
+ /**
+ * Opaque user data. May be set by the caller to an arbitrary value, e.g. to
+ * be used from callbacks like @ref AVFilterGraph.execute.
+ * Libavfilter will not touch this field in any way.
+ */
+ void *opaque;
+
+ /**
+ * This callback may be set by the caller immediately after allocating the
+ * graph and before adding any filters to it, to provide a custom
+ * multithreading implementation.
+ *
+ * If set, filters with slice threading capability will call this callback
+ * to execute multiple jobs in parallel.
+ *
+ * If this field is left unset, libavfilter will use its internal
+ * implementation, which may or may not be multithreaded depending on the
+ * platform and build options.
+ */
+ avfilter_execute_func *execute;
} AVFilterGraph;
/**