FFmpeg
Macros | Functions
pthread_internal.h File Reference
#include "avcodec.h"

Go to the source code of this file.

Macros

#define MAX_AUTO_THREADS   16
 
#define THREAD_SENTINEL   0
 
#define OFFSET_ARRAY(...)   __VA_ARGS__, THREAD_SENTINEL
 Macros to help creating the above lists. More...
 
#define DEFINE_OFFSET_ARRAY(type, name, cnt_variable, mutexes, conds)
 

Functions

int ff_slice_thread_init (AVCodecContext *avctx)
 
void ff_slice_thread_free (AVCodecContext *avctx)
 
int ff_frame_thread_init (AVCodecContext *avctx)
 
void ff_frame_thread_free (AVCodecContext *avctx, int thread_count)
 
int ff_pthread_init (void *obj, const unsigned offsets[])
 Initialize/destroy a list of mutexes/conditions contained in a structure. More...
 
void ff_pthread_free (void *obj, const unsigned offsets[])
 

Macro Definition Documentation

◆ MAX_AUTO_THREADS

#define MAX_AUTO_THREADS   16

Definition at line 26 of file pthread_internal.h.

◆ THREAD_SENTINEL

#define THREAD_SENTINEL   0

Definition at line 34 of file pthread_internal.h.

◆ OFFSET_ARRAY

#define OFFSET_ARRAY (   ...)    __VA_ARGS__, THREAD_SENTINEL

Macros to help creating the above lists.

mutexes and conds need to be parentheses-enclosed lists of offsets in the containing structure.

Definition at line 60 of file pthread_internal.h.

◆ DEFINE_OFFSET_ARRAY

#define DEFINE_OFFSET_ARRAY (   type,
  name,
  cnt_variable,
  mutexes,
  conds 
)
Value:
static const unsigned name ## _offsets[] = { offsetof(type, cnt_variable), \
OFFSET_ARRAY mutexes, \
OFFSET_ARRAY conds }

Definition at line 61 of file pthread_internal.h.

Function Documentation

◆ ff_slice_thread_init()

int ff_slice_thread_init ( AVCodecContext avctx)

Definition at line 134 of file pthread_slice.c.

Referenced by ff_thread_init().

◆ ff_slice_thread_free()

void ff_slice_thread_free ( AVCodecContext avctx)

Definition at line 82 of file pthread_slice.c.

Referenced by ff_thread_free().

◆ ff_frame_thread_init()

int ff_frame_thread_init ( AVCodecContext avctx)

Definition at line 879 of file pthread_frame.c.

Referenced by ff_thread_init().

◆ ff_frame_thread_free()

void ff_frame_thread_free ( AVCodecContext avctx,
int  thread_count 
)

Definition at line 739 of file pthread_frame.c.

Referenced by ff_frame_thread_init(), and ff_thread_free().

◆ ff_pthread_init()

int ff_pthread_init ( void *  obj,
const unsigned  offsets[] 
)

Initialize/destroy a list of mutexes/conditions contained in a structure.

The positions of these mutexes/conditions in the structure are given by their offsets. Because it is undefined behaviour to destroy an uninitialized mutex/condition, ff_pthread_init() stores the number of successfully initialized mutexes and conditions in the object itself and ff_pthread_free() uses this number to destroy exactly the mutexes and condition variables that have been successfully initialized.

Parameters
objThe object containing the mutexes/conditions.
[in]offsetsAn array of offsets. Its first member gives the offset of the variable that contains the count of successfully initialized mutexes/condition variables; said variable must be an unsigned int. Two arrays of offsets, each delimited by a THREAD_SENTINEL follow. The first contains the offsets of all the mutexes, the second contains the offsets of all the condition variables.

Definition at line 107 of file pthread.c.

Referenced by ff_frame_thread_encoder_init(), ff_frame_thread_init(), init_thread(), omx_encode_init(), and vp9_decode_init().

◆ ff_pthread_free()

void ff_pthread_free ( void *  obj,
const unsigned  offsets[] 
)
name
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
Definition: writing_filters.txt:88
type
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
Definition: writing_filters.txt:86