FFmpeg
Loading...
Searching...
No Matches
slicethread.h File Reference
#include "attributes.h"
#include "version.h"

Go to the source code of this file.

Typedefs

typedef struct AVSliceThread AVSliceThread
 

Functions

int avpriv_slicethread_create2 (AVSliceThread **pctx, void *priv, int(*worker_func)(void *priv, int jobnr, int threadnr, int nb_jobs, int nb_threads), int(*main_func)(void *priv), int nb_threads)
 Create slice threading context.
 
int avpriv_slicethread_execute2 (AVSliceThread *ctx, int nb_jobs, int execute_main)
 Execute slice threading.
 
void avpriv_slicethread_free (AVSliceThread **pctx)
 Destroy slice threading context.
 
attribute_deprecated int avpriv_slicethread_create (AVSliceThread **pctx, void *priv, void(*worker_func)(void *priv, int jobnr, int threadnr, int nb_jobs, int nb_threads), void(*main_func)(void *priv), int nb_threads)
 
attribute_deprecated void avpriv_slicethread_execute (AVSliceThread *ctx, int nb_jobs, int execute_main)
 

Typedef Documentation

◆ AVSliceThread

typedef struct AVSliceThread AVSliceThread

Definition at line 25 of file slicethread.h.

Function Documentation

◆ avpriv_slicethread_create2()

int avpriv_slicethread_create2 ( AVSliceThread ** pctx,
void * priv,
int(* worker_func )(void *priv, int jobnr, int threadnr, int nb_jobs, int nb_threads),
int(* main_func )(void *priv),
int nb_threads )

Create slice threading context.

Parameters
pctxslice threading context returned here
privprivate pointer to be passed to callback function
worker_funccallback function to be executed
main_funcspecial callback function, called from main thread, may be NULL
nb_threadsnumber of threads, 0 for automatic, must be >= 0
Returns
return number of threads or negative AVERROR on failure

Definition at line 283 of file slicethread.c.

Referenced by avpriv_slicethread_create(), context_init_threaded(), ff_slice_thread_init(), ff_sws_color_map_generate_dynamic(), ff_sws_graph_init(), ff_sws_thread_exec(), and thread_init_internal().

◆ avpriv_slicethread_execute2()

int avpriv_slicethread_execute2 ( AVSliceThread * ctx,
int nb_jobs,
int execute_main )

Execute slice threading.

If any job returns a nonzero value, all remaining jobs will be aborted and that value returned.

If main_func itself returns a nonzero value, that value is guaranteed to be returned, even if a worker thread returns a nonzero value first.

Parameters
ctxslice threading context
nb_jobsnumber of jobs, must be > 0
execute_mainalso execute main_func
Returns
0 on success, else first seen return value

Definition at line 292 of file slicethread.c.

Referenced by avpriv_slicethread_execute(), ff_sws_color_map_generate_dynamic(), ff_sws_graph_run(), ff_sws_thread_exec(), sws_receive_slice(), thread_execute(), and thread_execute().

◆ avpriv_slicethread_free()

void avpriv_slicethread_free ( AVSliceThread ** pctx)

Destroy slice threading context.

Parameters
pctxpointer to context

Definition at line 297 of file slicethread.c.

Referenced by ff_slice_thread_free(), ff_sws_color_map_generate_dynamic(), ff_sws_thread_exec(), graph_uninit(), slice_thread_uninit(), sws_freeContext(), and thread_init_internal().

◆ avpriv_slicethread_create()

attribute_deprecated int avpriv_slicethread_create ( AVSliceThread ** pctx,
void * priv,
void(* worker_func )(void *priv, int jobnr, int threadnr, int nb_jobs, int nb_threads),
void(* main_func )(void *priv),
int nb_threads )
Deprecated
Wrapper around avpriv_slicethread_create2() for ABI backwards compatibility.

Definition at line 324 of file slicethread.c.

◆ avpriv_slicethread_execute()

attribute_deprecated void avpriv_slicethread_execute ( AVSliceThread * ctx,
int nb_jobs,
int execute_main )
Deprecated
Wrapper around avpriv_slicethread_execute2() for ABI backwards compatibility.

Definition at line 342 of file slicethread.c.