FFmpeg
Functions
threadprogress.c File Reference
#include <limits.h>
#include <stdatomic.h>
#include "pthread_internal.h"
#include "threadprogress.h"
#include "libavutil/attributes.h"
#include "libavutil/thread.h"

Go to the source code of this file.

Functions

 DEFINE_OFFSET_ARRAY (ThreadProgress, thread_progress, init,(0x42),(0x42))
 
av_cold int ff_thread_progress_init (ThreadProgress *pro, int init_mode)
 Initialize a ThreadProgress. More...
 
av_cold void ff_thread_progress_destroy (ThreadProgress *pro)
 Destroy a ThreadProgress. More...
 
void ff_thread_progress_report (ThreadProgress *pro, int n)
 This function is a no-op in no-op mode; otherwise it notifies other threads that a certain level of progress has been reached. More...
 
void ff_thread_progress_await (const ThreadProgress *pro_c, int n)
 This function is a no-op in no-op mode; otherwise it waits until other threads have reached a certain level of progress: This function will return after another thread has called ff_thread_progress_report() with the same or higher value for progress. More...
 

Function Documentation

◆ DEFINE_OFFSET_ARRAY()

DEFINE_OFFSET_ARRAY ( ThreadProgress  ,
thread_progress  ,
init  ,
(0x42)  ,
(0x42)   
)

◆ ff_thread_progress_init()

av_cold int ff_thread_progress_init ( ThreadProgress pro,
int  init_mode 
)

Initialize a ThreadProgress.

Parameters
init_modeIf zero, the ThreadProgress will be initialized to be in no-op mode as described above. Otherwise it is initialized to be in ordinary mode.

Definition at line 33 of file threadprogress.c.

Referenced by progress_frame_pool_init_cb().

◆ ff_thread_progress_destroy()

av_cold void ff_thread_progress_destroy ( ThreadProgress pro)

Destroy a ThreadProgress.

Can be called on a ThreadProgress that has never been initialized provided that the ThreadProgress struct has been initially zeroed. Must be called even if ff_thread_progress_init() failed.

Definition at line 44 of file threadprogress.c.

Referenced by progress_frame_pool_free_entry_cb().

◆ ff_thread_progress_report()

void ff_thread_progress_report ( ThreadProgress pro,
int  progress 
)

This function is a no-op in no-op mode; otherwise it notifies other threads that a certain level of progress has been reached.

Later calls with lower values of progress have no effect.

Definition at line 53 of file threadprogress.c.

Referenced by ff_progress_frame_report(), and wavpack_decode_frame().

◆ ff_thread_progress_await()

void ff_thread_progress_await ( const ThreadProgress pro_c,
int  n 
)

This function is a no-op in no-op mode; otherwise it waits until other threads have reached a certain level of progress: This function will return after another thread has called ff_thread_progress_report() with the same or higher value for progress.

Definition at line 65 of file threadprogress.c.

Referenced by ff_progress_frame_await(), and wavpack_decode_frame().