Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
0767bfd1
Commit
0767bfd1
authored
Aug 08, 2013
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavfi: allow user-provided execute() callbacks
parent
38e15df1
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
69 additions
and
15 deletions
+69
-15
APIchanges
doc/APIchanges
+4
-0
avfilter.c
libavfilter/avfilter.c
+1
-1
avfilter.h
libavfilter/avfilter.h
+50
-0
avfiltergraph.c
libavfilter/avfiltergraph.c
+9
-5
internal.h
libavfilter/internal.h
+2
-4
pthread.c
libavfilter/pthread.c
+2
-2
thread.h
libavfilter/thread.h
+0
-2
version.h
libavfilter/version.h
+1
-1
No files found.
doc/APIchanges
View file @
0767bfd1
...
@@ -13,6 +13,10 @@ libavutil: 2012-10-22
...
@@ -13,6 +13,10 @@ libavutil: 2012-10-22
API changes, most recent first:
API changes, most recent first:
2013-08-xx - xxxxxxx - lavfi 3.11.0 - avfilter.h
Add AVFilterGraph.execute and AVFilterGraph.opaque for custom slice threading
implementations.
2013-09-21 - xxxxxxx - lavu 52.16.0 - pixfmt.h
2013-09-21 - xxxxxxx - lavu 52.16.0 - pixfmt.h
Add interleaved 4:2:2 8/10-bit formats AV_PIX_FMT_NV16 and
Add interleaved 4:2:2 8/10-bit formats AV_PIX_FMT_NV16 and
AV_PIX_FMT_NV20.
AV_PIX_FMT_NV20.
...
...
libavfilter/avfilter.c
View file @
0767bfd1
...
@@ -371,7 +371,7 @@ static const AVClass avfilter_class = {
...
@@ -371,7 +371,7 @@ static const AVClass avfilter_class = {
.
option
=
avfilter_options
,
.
option
=
avfilter_options
,
};
};
static
int
default_execute
(
AVFilterContext
*
ctx
,
action_func
*
func
,
void
*
arg
,
static
int
default_execute
(
AVFilterContext
*
ctx
,
a
vfilter_a
ction_func
*
func
,
void
*
arg
,
int
*
ret
,
int
nb_jobs
)
int
*
ret
,
int
nb_jobs
)
{
{
int
i
;
int
i
;
...
...
libavfilter/avfilter.h
View file @
0767bfd1
...
@@ -899,6 +899,35 @@ const AVClass *avfilter_get_class(void);
...
@@ -899,6 +899,35 @@ const AVClass *avfilter_get_class(void);
typedef
struct
AVFilterGraphInternal
AVFilterGraphInternal
;
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
{
typedef
struct
AVFilterGraph
{
const
AVClass
*
av_class
;
const
AVClass
*
av_class
;
#if FF_API_FOO_COUNT
#if FF_API_FOO_COUNT
...
@@ -941,6 +970,27 @@ typedef struct AVFilterGraph {
...
@@ -941,6 +970,27 @@ typedef struct AVFilterGraph {
* Opaque object for libavfilter internal use.
* Opaque object for libavfilter internal use.
*/
*/
AVFilterGraphInternal
*
internal
;
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
;
}
AVFilterGraph
;
/**
/**
...
...
libavfilter/avfiltergraph.c
View file @
0767bfd1
...
@@ -168,11 +168,15 @@ AVFilterContext *avfilter_graph_alloc_filter(AVFilterGraph *graph,
...
@@ -168,11 +168,15 @@ AVFilterContext *avfilter_graph_alloc_filter(AVFilterGraph *graph,
{
{
AVFilterContext
**
filters
,
*
s
;
AVFilterContext
**
filters
,
*
s
;
if
(
graph
->
thread_type
&&
!
graph
->
internal
->
thread
)
{
if
(
graph
->
thread_type
&&
!
graph
->
internal
->
thread_execute
)
{
int
ret
=
ff_graph_thread_init
(
graph
);
if
(
graph
->
execute
)
{
if
(
ret
<
0
)
{
graph
->
internal
->
thread_execute
=
graph
->
execute
;
av_log
(
graph
,
AV_LOG_ERROR
,
"Error initializing threading.
\n
"
);
}
else
{
return
NULL
;
int
ret
=
ff_graph_thread_init
(
graph
);
if
(
ret
<
0
)
{
av_log
(
graph
,
AV_LOG_ERROR
,
"Error initializing threading.
\n
"
);
return
NULL
;
}
}
}
}
}
...
...
libavfilter/internal.h
View file @
0767bfd1
...
@@ -122,13 +122,11 @@ struct AVFilterPad {
...
@@ -122,13 +122,11 @@ struct AVFilterPad {
struct
AVFilterGraphInternal
{
struct
AVFilterGraphInternal
{
void
*
thread
;
void
*
thread
;
int
(
*
thread_execute
)(
AVFilterContext
*
ctx
,
action_func
*
func
,
void
*
arg
,
avfilter_execute_func
*
thread_execute
;
int
*
ret
,
int
nb_jobs
);
};
};
struct
AVFilterInternal
{
struct
AVFilterInternal
{
int
(
*
execute
)(
AVFilterContext
*
ctx
,
action_func
*
func
,
void
*
arg
,
avfilter_execute_func
*
execute
;
int
*
ret
,
int
nb_jobs
);
};
};
#if FF_API_AVFILTERBUFFER
#if FF_API_AVFILTERBUFFER
...
...
libavfilter/pthread.c
View file @
0767bfd1
...
@@ -43,7 +43,7 @@ typedef struct ThreadContext {
...
@@ -43,7 +43,7 @@ typedef struct ThreadContext {
int
nb_threads
;
int
nb_threads
;
pthread_t
*
workers
;
pthread_t
*
workers
;
action_func
*
func
;
a
vfilter_a
ction_func
*
func
;
/* per-execute perameters */
/* per-execute perameters */
AVFilterContext
*
ctx
;
AVFilterContext
*
ctx
;
...
@@ -114,7 +114,7 @@ static void slice_thread_park_workers(ThreadContext *c)
...
@@ -114,7 +114,7 @@ static void slice_thread_park_workers(ThreadContext *c)
pthread_mutex_unlock
(
&
c
->
current_job_lock
);
pthread_mutex_unlock
(
&
c
->
current_job_lock
);
}
}
static
int
thread_execute
(
AVFilterContext
*
ctx
,
action_func
*
func
,
static
int
thread_execute
(
AVFilterContext
*
ctx
,
a
vfilter_a
ction_func
*
func
,
void
*
arg
,
int
*
ret
,
int
nb_jobs
)
void
*
arg
,
int
*
ret
,
int
nb_jobs
)
{
{
ThreadContext
*
c
=
ctx
->
graph
->
internal
->
thread
;
ThreadContext
*
c
=
ctx
->
graph
->
internal
->
thread
;
...
...
libavfilter/thread.h
View file @
0767bfd1
...
@@ -22,8 +22,6 @@
...
@@ -22,8 +22,6 @@
#include "avfilter.h"
#include "avfilter.h"
typedef
int
(
action_func
)(
AVFilterContext
*
ctx
,
void
*
arg
,
int
jobnr
,
int
nb_jobs
);
int
ff_graph_thread_init
(
AVFilterGraph
*
graph
);
int
ff_graph_thread_init
(
AVFilterGraph
*
graph
);
void
ff_graph_thread_free
(
AVFilterGraph
*
graph
);
void
ff_graph_thread_free
(
AVFilterGraph
*
graph
);
...
...
libavfilter/version.h
View file @
0767bfd1
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
#include "libavutil/avutil.h"
#include "libavutil/avutil.h"
#define LIBAVFILTER_VERSION_MAJOR 3
#define LIBAVFILTER_VERSION_MAJOR 3
#define LIBAVFILTER_VERSION_MINOR 1
0
#define LIBAVFILTER_VERSION_MINOR 1
1
#define LIBAVFILTER_VERSION_MICRO 0
#define LIBAVFILTER_VERSION_MICRO 0
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment