FFmpeg
Enumerations | Functions
thread.h File Reference
#include "libavutil/buffer.h"
#include "avcodec.h"

Go to the source code of this file.

Enumerations

enum  ThreadingStatus { FF_THREAD_IS_COPY, FF_THREAD_IS_FIRST_THREAD, FF_THREAD_NO_FRAME_THREADING }
 

Functions

int ff_thread_can_start_frame (AVCodecContext *avctx)
 
void ff_thread_finish_setup (AVCodecContext *avctx)
 If the codec defines update_thread_context(), call this when they are ready for the next thread to start decoding the next frame. More...
 
int ff_thread_get_buffer (AVCodecContext *avctx, AVFrame *f, int flags)
 Wrapper around get_buffer() for frame-multithreaded codecs. More...
 
int ff_slice_thread_execute_with_mainfunc (AVCodecContext *avctx, int(*action_func2)(AVCodecContext *c, void *arg, int jobnr, int threadnr), int(*main_func)(AVCodecContext *c), void *arg, int *ret, int job_count)
 
enum ThreadingStatus ff_thread_sync_ref (AVCodecContext *avctx, size_t offset)
 Allows to synchronize objects whose lifetime is the whole decoding process among all frame threads. More...
 

Detailed Description

Multithreading API for decoders

Author
Alexander Strange astra.nosp@m.nge@.nosp@m.ithin.nosp@m.ksw..nosp@m.com

Definition in file thread.h.

Enumeration Type Documentation

◆ ThreadingStatus

Enumerator
FF_THREAD_IS_COPY 
FF_THREAD_IS_FIRST_THREAD 
FF_THREAD_NO_FRAME_THREADING 

Definition at line 60 of file thread.h.

Function Documentation

◆ ff_thread_can_start_frame()

int ff_thread_can_start_frame ( AVCodecContext avctx)

Definition at line 1013 of file pthread_frame.c.

Referenced by ff_mpv_frame_start(), and h264_frame_start().

◆ ff_thread_finish_setup()

void ff_thread_finish_setup ( AVCodecContext avctx)

If the codec defines update_thread_context(), call this when they are ready for the next thread to start decoding the next frame.

After calling it, do not change any variables read by the update_thread_context() method, or call ff_thread_get_buffer().

Parameters
avctxThe context.

Definition at line 671 of file pthread_frame.c.

Referenced by frame_worker_thread().

◆ ff_thread_get_buffer()

int ff_thread_get_buffer ( AVCodecContext avctx,
AVFrame f,
int  flags 
)

◆ ff_slice_thread_execute_with_mainfunc()

int ff_slice_thread_execute_with_mainfunc ( AVCodecContext avctx,
int(*)(AVCodecContext *c, void *arg, int jobnr, int threadnr)  action_func2,
int(*)(AVCodecContext *c main_func,
void *  arg,
int *  ret,
int  job_count 
)

◆ ff_thread_sync_ref()

enum ThreadingStatus ff_thread_sync_ref ( AVCodecContext avctx,
size_t  offset 
)

Allows to synchronize objects whose lifetime is the whole decoding process among all frame threads.

When called from a non-copy thread, do nothing. When called from another thread, place a new RefStruct reference at the given offset in the calling thread's private data from the RefStruct reference in the private data of the first decoding thread. The first thread must have a valid RefStruct reference at the given offset in its private data; the calling thread must not have a reference at this offset in its private data (must be NULL).

Parameters
avctxan AVCodecContext
offsetoffset of the RefStruct reference in avctx's private data
Return values
FF_THREAD_IS_COPYif frame-threading is in use and the calling thread is a copy; in this case, the RefStruct reference will be set.
FF_THREAD_IS_MAIN_THREADif frame-threading is in use and the calling thread is the main thread.
FF_THREAD_NO_FRAME_THREADINGif frame-threading is not in use.

Definition at line 1904 of file decode.c.

Referenced by ff_mpv_decode_init(), and wavpack_decode_init().