FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
api-threadmessage-test.c File Reference
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
#include "libavutil/frame.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 voidsender_thread (void *arg)
 
static voidreceiver_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 53 of file api-threadmessage-test.c.

Referenced by free_frame(), receiver_thread(), and sender_thread().

#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)
#define NULL
Definition: coverity.c:32
const char * s
Definition: avisynth_c.h:768
static int get_workload(int minv, int maxv)
static av_cold int end(AVCodecContext *avctx)
Definition: avrndec.c:90
#define av_log(a,...)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
#define td
Definition: regdef.h:70
#define AVERROR(e)
Definition: error.h:43
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
Definition: error.h:119
static av_always_inline int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg)
Definition: os2threads.h:74
GLint GLenum type
Definition: opengl_enc.c:105
#define AV_STRINGIFY(s)
Definition: macros.h:36
if(ret< 0)
Definition: vf_mcdeint.c:282
for(j=16;j >0;--j)

Referenced by main().

#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)
#define NULL
Definition: coverity.c:32
const char * s
Definition: avisynth_c.h:768
static av_cold int end(AVCodecContext *avctx)
Definition: avrndec.c:90
#define av_log(a,...)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
#define td
Definition: regdef.h:70
#define AVERROR(e)
Definition: error.h:43
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
Definition: error.h:119
static av_always_inline int pthread_join(pthread_t thread, void **value_ptr)
Definition: os2threads.h:88
GLint GLenum type
Definition: opengl_enc.c:105
#define AV_STRINGIFY(s)
Definition: macros.h:36
if(ret< 0)
Definition: vf_mcdeint.c:282
for(j=16;j >0;--j)

Referenced by main().

Function Documentation

static void free_frame ( void arg)
static

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

Referenced by main().

static void* sender_thread ( void arg)
static

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

static void* receiver_thread ( void arg)
static

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

static int get_workload ( int  minv,
int  maxv 
)
static

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

int main ( int  ac,
char **  av 
)

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