diff options
author | Clément Bœsch <u@pkh.me> | 2018-04-21 21:42:19 +0200 |
---|---|---|
committer | Clément Bœsch <u@pkh.me> | 2018-04-26 19:41:19 +0200 |
commit | 71fa82bed62f812d30aee26f3c6385e2ec890ebb (patch) | |
tree | c31086aa145158b69342c779a9e174dccb741e43 /libavutil/threadmessage.c | |
parent | 02e4970bc9d3215f862a5d64ec48922d98eb17c1 (diff) | |
download | ffmpeg-71fa82bed62f812d30aee26f3c6385e2ec890ebb.tar.gz |
lavu/threadmessage: add av_thread_message_queue_nb_elems()
Diffstat (limited to 'libavutil/threadmessage.c')
-rw-r--r-- | libavutil/threadmessage.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libavutil/threadmessage.c b/libavutil/threadmessage.c index 872e9392b1..764b7fb813 100644 --- a/libavutil/threadmessage.c +++ b/libavutil/threadmessage.c @@ -102,6 +102,19 @@ void av_thread_message_queue_free(AVThreadMessageQueue **mq) #endif } +int av_thread_message_queue_nb_elems(AVThreadMessageQueue *mq) +{ +#if HAVE_THREADS + int ret; + pthread_mutex_lock(&mq->lock); + ret = av_fifo_size(mq->fifo); + pthread_mutex_unlock(&mq->lock); + return ret / mq->elsize; +#else + return AVERROR(ENOSYS); +#endif +} + #if HAVE_THREADS static int av_thread_message_queue_send_locked(AVThreadMessageQueue *mq, |