[vlc-devel] [PATCH 4/5] doc: QtGl: replace std::mutex with QMutex

Steve Lhomme robux4 at ycbcr.xyz
Fri Feb 26 15:15:06 UTC 2021


std::mutex is not available on some platforms (mingw64 with gcc for example).
---
 doc/libvlc/QtGL/qtvlcwidget.cpp | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/doc/libvlc/QtGL/qtvlcwidget.cpp b/doc/libvlc/QtGL/qtvlcwidget.cpp
index de4101bbbce..4da1a2c5f90 100644
--- a/doc/libvlc/QtGL/qtvlcwidget.cpp
+++ b/doc/libvlc/QtGL/qtvlcwidget.cpp
@@ -7,10 +7,9 @@
 #include <QOffscreenSurface>
 #include <QThread>
 #include <QSemaphore>
+#include <QMutex>
 #include <cmath>
 
-#include <mutex>
-
 #include <vlc/vlc.h>
 
 class VLCVideo
@@ -58,7 +57,7 @@ public:
     /// return the texture to be displayed
     QOpenGLFramebufferObject *getVideoFrame()
     {
-        std::lock_guard<std::mutex> lock(m_text_lock);
+        std::lock_guard<QMutex> lock(m_text_lock);
         if (m_updated) {
             std::swap(m_idx_swap, m_idx_display);
             m_updated = false;
@@ -134,7 +133,7 @@ public:
     static void swap(void* data)
     {
         VLCVideo* that = static_cast<VLCVideo*>(data);
-        std::lock_guard<std::mutex> lock(that->m_text_lock);
+        std::lock_guard<QMutex> lock(that->m_text_lock);
         that->m_updated = true;
         that->mWidget->update();
         std::swap(that->m_idx_swap, that->m_idx_render);
@@ -176,7 +175,7 @@ private:
     //FBO data
     unsigned m_width = 0;
     unsigned m_height = 0;
-    std::mutex m_text_lock;
+    QMutex m_text_lock;
     QOpenGLFramebufferObject *mBuffers[3];
     GLuint m_tex[3];
     GLuint m_fbo[3];
-- 
2.29.2



More information about the vlc-devel mailing list