X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavutil%2Fthreadmessage.c;h=764b7fb8131e493dcf4d2bd0630cf428f087fd56;hb=9d002d781876a3bc530c54a3f46c3c4ab99c2431;hp=872e9392b19f2dbed7d0e5053b758c25f0c7b1ef;hpb=91bcf0b8cdb3cb8046496d470ade25d1c802ca3d;p=ffmpeg diff --git a/libavutil/threadmessage.c b/libavutil/threadmessage.c index 872e9392b19..764b7fb8131 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,