FFmpeg
Data Structures | Macros | Functions
api-threadmessage-test.c File Reference
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
#include "libavutil/frame.h"
#include "libavutil/mem.h"
#include "libavutil/threadmessage.h"
#include "libavutil/thread.h"

Go to the source code of this file.

Data Structures

struct  sender_data
 Thread message API test. More...
 
struct  receiver_data
 
struct  message
 

Macros

#define MAGIC   0xdeadc0de
 
#define SPAWN_THREADS(type)
 
#define WAIT_THREADS(type)
 

Functions

static void free_frame (void *arg)
 
static void * sender_thread (void *arg)
 
static void * receiver_thread (void *arg)
 
static int get_workload (int minv, int maxv)
 
int main (int ac, char **av)
 

Macro Definition Documentation

◆ MAGIC

#define MAGIC   0xdeadc0de

Definition at line 54 of file api-threadmessage-test.c.

◆ SPAWN_THREADS

#define SPAWN_THREADS (   type)
Value:
do { \
for (i = 0; i < nb_##type##s; i++) { \
struct type##_data *td = &type##s[i]; \
\
td->id = i; \
td->queue = queue; \
td->workload = get_workload(type##_min_load, type##_max_load); \
\
ret = pthread_create(&td->tid, NULL, type##_thread, td); \
if (ret) { \
const int err = AVERROR(ret); \
av_log(NULL, AV_LOG_ERROR, "Unable to start " AV_STRINGIFY(type) \
" thread: %s\n", av_err2str(err)); \
goto end; \
} \
} \
} while (0)

◆ WAIT_THREADS

#define WAIT_THREADS (   type)
Value:
do { \
for (i = 0; i < nb_##type##s; i++) { \
struct type##_data *td = &type##s[i]; \
\
ret = pthread_join(td->tid, NULL); \
if (ret) { \
const int err = AVERROR(ret); \
av_log(NULL, AV_LOG_ERROR, "Unable to join " AV_STRINGIFY(type) \
" thread: %s\n", av_err2str(err)); \
goto end; \
} \
} \
} while (0)

Function Documentation

◆ free_frame()

static void free_frame ( void *  arg)
static

Definition at line 56 of file api-threadmessage-test.c.

Referenced by main().

◆ sender_thread()

static void* sender_thread ( void *  arg)
static

Definition at line 63 of file api-threadmessage-test.c.

◆ receiver_thread()

static void* receiver_thread ( void *  arg)
static

Definition at line 127 of file api-threadmessage-test.c.

◆ get_workload()

static int get_workload ( int  minv,
int  maxv 
)
static

Definition at line 160 of file api-threadmessage-test.c.

◆ main()

int main ( int  ac,
char **  av 
)

Definition at line 165 of file api-threadmessage-test.c.

pthread_join
static av_always_inline int pthread_join(pthread_t thread, void **value_ptr)
Definition: os2threads.h:94
AVERROR
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
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
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:209
s
#define s(width, name)
Definition: cbs_vp9.c:198
pthread_create
static av_always_inline int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg)
Definition: os2threads.h:80
NULL
#define NULL
Definition: coverity.c:32
av_err2str
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
Definition: error.h:122
get_workload
static int get_workload(int minv, int maxv)
Definition: api-threadmessage-test.c:160
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
AV_STRINGIFY
#define AV_STRINGIFY(s)
Definition: macros.h:66
ret
ret
Definition: filter_design.txt:187