FFmpeg
Loading...
Searching...
No Matches
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.
 
av_cold void ff_thread_progress_destroy (ThreadProgress *pro)
 Destroy a ThreadProgress.
 
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.
 
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.
 

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 mpv_pic_init(), progress_frame_pool_init_cb(), progress_init(), and wpp_progress_init().

◆ 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 hevc_decode_free(), mpv_pic_free(), progress_frame_pool_free_entry_cb(), and rv60_decode_end().

◆ 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 alloc_dummy_frame(), decode_slice(), ff_mpv_frame_end(), ff_progress_frame_report(), hls_decode_entry_wpp(), report_decode_progress(), rv34_decode_slice(), 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 64 of file threadprogress.c.

Referenced by decode_slice(), ff_er_frame_end(), ff_progress_frame_await(), guess_mv(), hls_decode_entry_wpp(), is_intra_more_likely(), mpeg4_decode_mb(), mpv_reconstruct_mb_internal(), rv34_decode_mv(), rv34_mc(), and wavpack_decode_frame().