FFmpeg
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Public Types | Data Fields
PerThreadContext Struct Reference

Context used by codec threads and stored in their AVCodecContext thread_opaque. More...

Public Types

enum  { STATE_INPUT_READY, STATE_SETTING_UP, STATE_GET_BUFFER, STATE_SETUP_FINISHED }
 

Data Fields

struct FrameThreadContextparent
 
pthread_t thread
 
int thread_init
 
pthread_cond_t input_cond
 Used to wait for a new packet from the main thread.
 
pthread_cond_t progress_cond
 Used by child threads to wait for progress to change.
 
pthread_cond_t output_cond
 Used by the main thread to wait for frames to finish.
 
pthread_mutex_t mutex
 Mutex used to protect the contents of the PerThreadContext.
 
pthread_mutex_t progress_mutex
 Mutex used to protect frame progress values and progress_cond.
 
AVCodecContextavctx
 Context used to decode packets passed to this thread.
 
AVPacket avpkt
 Input packet (for decoding) or output (for encoding).
 
int allocated_buf_size
 Size allocated for avpkt.data.
 
AVFrame frame
 Output frame (for decoding) or input (for encoding).
 
int got_frame
 The output of got_picture_ptr from the last avcodec_decode_video() call.
 
int result
 The result of the last codec decode/encode() call.
 
enum PerThreadContext:: { ... }  state
 
AVFrame released_buffers [MAX_BUFFERS]
 Array of frames passed to ff_thread_release_buffer().
 
int num_released_buffers
 
volatile int progress [MAX_BUFFERS][2]
 Array of progress values used by ff_thread_get_buffer().
 
volatile uint8_t progress_used [MAX_BUFFERS]
 
AVFramerequested_frame
 AVFrame the codec passed to get_buffer()
 

Detailed Description

Context used by codec threads and stored in their AVCodecContext thread_opaque.

Definition at line 95 of file pthread.c.

Member Enumeration Documentation

anonymous enum
Enumerator:
STATE_INPUT_READY 

Set when the thread is awaiting a packet.

STATE_SETTING_UP 

Set before the codec has called ff_thread_finish_setup().

STATE_GET_BUFFER 

Set when the codec calls get_buffer().

State is returned to STATE_SETTING_UP afterwards.

STATE_SETUP_FINISHED 

Set after the codec has called ff_thread_finish_setup().

Definition at line 116 of file pthread.c.

Field Documentation

struct FrameThreadContext* PerThreadContext::parent
pthread_t PerThreadContext::thread

Definition at line 98 of file pthread.c.

Referenced by frame_thread_free(), and frame_thread_init().

int PerThreadContext::thread_init

Definition at line 99 of file pthread.c.

Referenced by frame_thread_free(), and frame_thread_init().

pthread_cond_t PerThreadContext::input_cond

Used to wait for a new packet from the main thread.

Definition at line 100 of file pthread.c.

Referenced by frame_thread_free(), frame_thread_init(), frame_worker_thread(), and submit_packet().

pthread_cond_t PerThreadContext::progress_cond
pthread_cond_t PerThreadContext::output_cond

Used by the main thread to wait for frames to finish.

Definition at line 102 of file pthread.c.

Referenced by ff_thread_decode_frame(), frame_thread_free(), frame_thread_init(), frame_worker_thread(), and park_frame_worker_threads().

pthread_mutex_t PerThreadContext::mutex

Mutex used to protect the contents of the PerThreadContext.

Definition at line 104 of file pthread.c.

Referenced by frame_thread_free(), frame_thread_init(), frame_worker_thread(), and submit_packet().

pthread_mutex_t PerThreadContext::progress_mutex
AVCodecContext* PerThreadContext::avctx
AVPacket PerThreadContext::avpkt

Input packet (for decoding) or output (for encoding).

Definition at line 109 of file pthread.c.

Referenced by ff_thread_decode_frame(), frame_thread_free(), frame_thread_init(), frame_worker_thread(), and submit_packet().

int PerThreadContext::allocated_buf_size

Size allocated for avpkt.data.

Definition at line 110 of file pthread.c.

Referenced by submit_packet().

AVFrame PerThreadContext::frame

Output frame (for decoding) or input (for encoding).

Definition at line 112 of file pthread.c.

Referenced by ff_thread_decode_frame(), and frame_worker_thread().

int PerThreadContext::got_frame

The output of got_picture_ptr from the last avcodec_decode_video() call.

Definition at line 113 of file pthread.c.

Referenced by ff_thread_decode_frame(), ff_thread_flush(), frame_worker_thread(), and park_frame_worker_threads().

int PerThreadContext::result

The result of the last codec decode/encode() call.

Definition at line 114 of file pthread.c.

Referenced by ff_thread_decode_frame(), ff_thread_get_buffer(), frame_worker_thread(), and submit_packet().

enum { ... } PerThreadContext::state
AVFrame PerThreadContext::released_buffers[MAX_BUFFERS]

Array of frames passed to ff_thread_release_buffer().

Frames are released after all threads referencing them are finished.

Definition at line 130 of file pthread.c.

Referenced by ff_thread_release_buffer(), and release_delayed_buffers().

int PerThreadContext::num_released_buffers

Definition at line 131 of file pthread.c.

Referenced by ff_thread_release_buffer(), and release_delayed_buffers().

volatile int PerThreadContext::progress[MAX_BUFFERS][2]

Array of progress values used by ff_thread_get_buffer().

Definition at line 136 of file pthread.c.

Referenced by allocate_progress(), frame_worker_thread(), and free_progress().

volatile uint8_t PerThreadContext::progress_used[MAX_BUFFERS]

Definition at line 137 of file pthread.c.

Referenced by allocate_progress(), frame_worker_thread(), and free_progress().

AVFrame* PerThreadContext::requested_frame

AVFrame the codec passed to get_buffer()

Definition at line 139 of file pthread.c.

Referenced by ff_thread_get_buffer(), and submit_packet().


The documentation for this struct was generated from the following file: