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

Pierre Lamot pierre at videolabs.io
Mon Mar 1 09:08:19 UTC 2021


Hi,

you can replace the std::lock_guard by a QMutexLocker.

On 2021-02-27 10:52, Steve Lhomme wrote:
> And this doesn't build
> https://code.videolan.org/robUx4/vlc/-/jobs/582203
> 
> On 2021-02-26 16:15, Steve Lhomme wrote:
>> 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
>> 
>> _______________________________________________
>> vlc-devel mailing list
>> To unsubscribe or modify your subscription options:
>> https://mailman.videolan.org/listinfo/vlc-devel
>> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list