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


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


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


#define MAGIC   0xdeadc0de

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


#define SPAWN_THREADS (   type)
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)


#define WAIT_THREADS (   type)
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)

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

Referenced by main().

◆ sender_thread()

static void* sender_thread ( void *  arg)

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

◆ receiver_thread()

static void* receiver_thread ( void *  arg)

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

◆ get_workload()

static int get_workload ( int  minv,
int  maxv 

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.

static av_always_inline int pthread_join(pthread_t thread, void **value_ptr)
Definition: os2threads.h:94
#define td
Definition: regdef.h:70
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
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
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
#define s(width, name)
Definition: cbs_vp9.c:198
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
#define NULL
Definition: coverity.c:32
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
Definition: error.h:121
static int get_workload(int minv, int maxv)
Definition: api-threadmessage-test.c:160
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
#define AV_STRINGIFY(s)
Definition: macros.h:66
Definition: filter_design.txt:187