]> git.vomp.tv Git - vompclient.git/commitdiff
Convert all uses of Mutex to std::mutex
authorChris Tallon <chris@vomp.tv>
Sun, 23 Feb 2020 16:14:43 +0000 (16:14 +0000)
committerChris Tallon <chris@vomp.tv>
Sun, 23 Feb 2020 16:14:43 +0000 (16:14 +0000)
30 files changed:
audioomx.cc
audioomx.h
boxstack.cc
boxstack.h
demuxermedia.h
demuxerts.cc
demuxerts.h
demuxervdr.cc
demuxervdr.h
dsallocator.cc
dsallocator.h
imageomx.cc
imageomx.h
mutex.cc [deleted file]
mutex.h [deleted file]
objects.mk
osdopengl.cc
osdopengl.h
osdopenvg.cc
osdopenvg.h
osdvector.cc
osdvector.h
osdwinvector.cc
osdwinvector.h
surfaceopengl.cc
surfaceopengl.h
surfacevector.cc
surfacevector.h
videoomx.cc
videoomx.h

index f948e765db68a802f500e73b6ad3c1f56cf41a50..d331d37e1ee9a00df52b1e5a823b93e2057bc9a7 100644 (file)
@@ -14,8 +14,7 @@
     GNU General Public License for more details.
 
     You should have received a copy of the GNU General Public License
-    along with VOMP; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+    along with VOMP.  If not, see <https://www.gnu.org/licenses/>.
 */
 
 #include "audioomx.h"
@@ -513,11 +512,11 @@ OMX_ERRORTYPE AudioOMX::EmptyBufferDone_OMX(OMX_IN OMX_HANDLETYPE hcomp,OMX_IN O
 }
 
 void AudioOMX::ReturnEmptyOMXBuffer(OMX_BUFFERHEADERTYPE* buffer){
-       input_bufs_omx_mutex.Lock();
+       input_bufs_omx_mutex.lock();
        //Log::getInstance()->log("Audio", Log::NOTICE, "ReturnEmptyOMXBuffer %d",input_bufs_omx_free.size());
        input_bufs_omx_free.push_back(buffer);
        //Log::getInstance()->log("Audio", Log::NOTICE, "ReturnEmptyOMXBuffer %d",input_bufs_omx_free.size());
-       input_bufs_omx_mutex.Unlock();
+       input_bufs_omx_mutex.unlock();
        VideoOMX *video=(VideoOMX*)Video::getInstance();
        video->signalOmx();
 }
@@ -813,7 +812,7 @@ int AudioOMX::ChangeAudioPortConfig(bool disport) //clock aka omx mutex needs to
 }
 int AudioOMX::InitDecoderLibAV()
 {
-       libav_mutex.Lock();
+       libav_mutex.lock();
        ac3codec_context_libav = avcodec_alloc_context3(ac3codec_libav);
        if (!ac3codec_context_libav) {
                Log::getInstance()->log("Audio", Log::DEBUG, "Alloc avcodec for ac3 decoding context failed!");
@@ -835,7 +834,7 @@ int AudioOMX::InitDecoderLibAV()
        int avc_ret = avcodec_open2(ac3codec_context_libav, ac3codec_libav, NULL);
        if (avc_ret < 0) {
                Log::getInstance()->log("Audio", Log::DEBUG, "Opening libav codec  failed \n");
-               libav_mutex.Unlock();
+               libav_mutex.unlock();
                return 0;
        }
 
@@ -860,7 +859,7 @@ int AudioOMX::InitDecoderLibAV()
        avc_ret = avcodec_open2(aaclatmcodec_context_libav, aaclatmcodec_libav, NULL);
        if (avc_ret < 0) {
                Log::getInstance()->log("Audio", Log::DEBUG, "Opening libav codec  failed \n");
-               libav_mutex.Unlock();
+               libav_mutex.unlock();
                return 0;
        }
 
@@ -868,7 +867,7 @@ int AudioOMX::InitDecoderLibAV()
        mp23codec_context_libav = avcodec_alloc_context3(mp23codec_libav);
        if (!ac3codec_context_libav) {
                Log::getInstance()->log("Audio", Log::DEBUG, "Alloc avcodec for mp23 decoding context failed!");
-               libav_mutex.Unlock();
+               libav_mutex.unlock();
                return 0;
        }
 
@@ -887,7 +886,7 @@ int AudioOMX::InitDecoderLibAV()
        avc_ret = avcodec_open2(mp23codec_context_libav, mp23codec_libav, NULL);
        if (avc_ret < 0) {
                Log::getInstance()->log("Audio", Log::DEBUG, "Opening libav codec  failed \n");
-               libav_mutex.Unlock();
+               libav_mutex.unlock();
                return 0;
        }
 
@@ -914,7 +913,7 @@ int AudioOMX::InitDecoderLibAV()
 #else
         decode_frame_libav=avcodec_alloc_frame();
 #endif
-        libav_mutex.Unlock();
+        libav_mutex.unlock();
         decompress_buffer_filled=0;
 
 
@@ -925,7 +924,7 @@ int AudioOMX::InitDecoderLibAV()
 void AudioOMX::DeinitDecoderLibAV() {
 
 
-       libav_mutex.Lock();
+       libav_mutex.lock();
        if (ac3codec_context_libav) {
                avcodec_close(ac3codec_context_libav);
                av_free(ac3codec_context_libav);
@@ -946,7 +945,7 @@ void AudioOMX::DeinitDecoderLibAV() {
 
 
        }
-       libav_mutex.Unlock();
+       libav_mutex.unlock();
 
 }
 
@@ -1220,13 +1219,13 @@ int AudioOMX::PrepareInputBufsOMX(bool setportdef) //needs to be called with loc
                return 0;
        }
 
-       input_bufs_omx_mutex.Lock();
+       input_bufs_omx_mutex.lock();
        for (unsigned int i=0; i< port_def_type.nBufferCountActual;i++) {
                OMX_BUFFERHEADERTYPE *buf_head=NULL;
                error=OMX_AllocateBuffer(omx_aud_rend/*dec*/,&buf_head,omx_rend_input_port/*codec*/,NULL,port_def_type.nBufferSize);
                if (error!=OMX_ErrorNone){
                        Log::getInstance()->log("Audio", Log::DEBUG, "Use OMX_AllocateBuffer failed %x", error);
-                               input_bufs_omx_mutex.Unlock();
+                               input_bufs_omx_mutex.unlock();
                        return 0;
                }
                input_bufs_omx_all.push_back(buf_head);
@@ -1236,7 +1235,7 @@ int AudioOMX::PrepareInputBufsOMX(bool setportdef) //needs to be called with loc
 
        firstsynched=false;
        cur_input_buf_omx=NULL;
-       input_bufs_omx_mutex.Unlock();
+       input_bufs_omx_mutex.unlock();
 
        if (!video->CommandFinished(omx_aud_rend/*dec*/,OMX_CommandPortEnable,omx_rend_input_port /*codec*/)) {
                return 0;
@@ -1250,19 +1249,19 @@ int AudioOMX::DestroyInputBufsOMX() //call with clock mutex locked
        OMX_ERRORTYPE error;
 
        cur_input_buf_omx=NULL;
-       input_bufs_omx_mutex.Lock();
+       input_bufs_omx_mutex.lock();
        for (UINT i=0; i< input_bufs_omx_all.size();i++) {
                error=OMX_FreeBuffer(omx_aud_rend/*dec*/,omx_rend_input_port/*codec*/,input_bufs_omx_all[i]);
                if (error!=OMX_ErrorNone){
                        Log::getInstance()->log("Audio", Log::DEBUG, "Use OMX_FreeBuffer failed %x", error);
-                       input_bufs_omx_mutex.Unlock();
+                       input_bufs_omx_mutex.unlock();
                        return 0;
                }
 
        }
        input_bufs_omx_all.clear();
        input_bufs_omx_free.clear();
-       input_bufs_omx_mutex.Unlock();
+       input_bufs_omx_mutex.unlock();
 
        return 1;
 }
@@ -1272,7 +1271,7 @@ int AudioOMX::DestroyInputBufsOMXwhilePlaying() //call with clock mutex locked
        //OMX_ERRORTYPE error;
 
        cur_input_buf_omx=NULL;
-       input_bufs_omx_mutex.Lock();
+       input_bufs_omx_mutex.lock();
        while (input_bufs_omx_all.size()>0) {
                if (input_bufs_omx_free.size()>0) {
                        // Destroy one buffer
@@ -1286,14 +1285,14 @@ int AudioOMX::DestroyInputBufsOMXwhilePlaying() //call with clock mutex locked
                                }
                        }
                } else {
-                       input_bufs_omx_mutex.Unlock();
+                       input_bufs_omx_mutex.unlock();
                        MILLISLEEP(5);
-                       input_bufs_omx_mutex.Lock();
+                       input_bufs_omx_mutex.lock();
                }
        }
 
        Log::getInstance()->log("Audio", Log::DEBUG, "DestroyInputBufsOMXwhilePlaying %d %d", input_bufs_omx_all.size(),input_bufs_omx_free.size());
-       input_bufs_omx_mutex.Unlock();
+       input_bufs_omx_mutex.unlock();
        return 1;
 }
 
@@ -1793,9 +1792,9 @@ bool AudioOMX::DrainTargetBufferFull()
 {
        //Check, if we have OMX output buffers
        bool full;
-       input_bufs_omx_mutex.Lock();
+       input_bufs_omx_mutex.lock();
        full=(input_bufs_omx_free.size()==0);
-       input_bufs_omx_mutex.Unlock();
+       input_bufs_omx_mutex.unlock();
        return full;
 
 }
@@ -1913,9 +1912,9 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket mpacket, const UCHAR* buffer,
                }
        }
        if (!cur_input_buf_omx) {
-               input_bufs_omx_mutex.Lock();
+               input_bufs_omx_mutex.lock();
                if (input_bufs_omx_free.size()==0) {
-                       input_bufs_omx_mutex.Unlock();
+                       input_bufs_omx_mutex.unlock();
                        //Log::getInstance()->log("Audio", Log::DEBUG, "DMP mark 6");
                        //Log::getInstance()->log("Audio", Log::DEBUG, "Deliver MediaPacket no free sample");
                        return 0; // we do not have a free media sample
@@ -1926,7 +1925,7 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket mpacket, const UCHAR* buffer,
                cur_input_buf_omx->nOffset=0;
                cur_input_buf_omx->nTimeStamp=VideoOMX::intToOMXTicks(0);
                input_bufs_omx_free.pop_front();
-               input_bufs_omx_mutex.Unlock();
+               input_bufs_omx_mutex.unlock();
        }
        //Log::getInstance()->log("Audio", Log::DEBUG, "DMP mark 7");
 
@@ -2020,9 +2019,9 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket mpacket, const UCHAR* buffer,
                        cur_input_buf_omx=NULL;
                        if (haveToCopy>0) {
                                // get5 new buffer
-                               input_bufs_omx_mutex.Lock();
+                               input_bufs_omx_mutex.lock();
                                if (input_bufs_omx_free.size()==0) {
-                                       input_bufs_omx_mutex.Unlock();
+                                       input_bufs_omx_mutex.unlock();
                                        //      Log::getInstance()->log("Audio", Log::DEBUG, "Deliver MediaPacket no free sample2");
                                        return *samplepos; // we do not have a free media sample
                                }
@@ -2032,7 +2031,7 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket mpacket, const UCHAR* buffer,
                                cur_input_buf_omx->nFlags=OMX_BUFFERFLAG_TIME_UNKNOWN;
                                cur_input_buf_omx->nTimeStamp=VideoOMX::intToOMXTicks(0);
                                input_bufs_omx_free.pop_front();
-                               input_bufs_omx_mutex.Unlock();
+                               input_bufs_omx_mutex.unlock();
                        }
                        //Log::getInstance()->log("Audio", Log::DEBUG, "DMP mark 12");
 
@@ -2135,13 +2134,13 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket mpacket, const UCHAR* buffer,
                                pthread_testcancel();
                                pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &oldcancelstate);
                                pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &oldcanceltype);
-                               libav_mutex.Lock();
+                               libav_mutex.lock();
                                if (!omx_running || !mp23codec_context_libav
                                                || !ac3codec_context_libav) {
-                                       libav_mutex.Unlock();
+                                       libav_mutex.unlock();
                                        return *samplepos;
                                }
-                               libav_mutex.Unlock();
+                               libav_mutex.unlock();
                                //      Log::getInstance()->log("Audio", Log::DEBUG,"libav out");
                                int save_size=incoming_paket_libav.size;
 
@@ -2168,7 +2167,7 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket mpacket, const UCHAR* buffer,
                        //Log::getInstance()->log("Audio", Log::DEBUG, "libav out2");
                        //Log::getInstance()->log("Audio", Log::DEBUG, "DMP mark 20");
                        if (!omx_running) {
-                               libav_mutex.Unlock();
+                               libav_mutex.unlock();
                                return *samplepos;
                        }
 
@@ -2230,9 +2229,9 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket mpacket, const UCHAR* buffer,
                                                int count = 0;
                                                while (count < 10 && omx_running) {
                                                        count++;
-                                                       input_bufs_omx_mutex.Lock();
+                                                       input_bufs_omx_mutex.lock();
                                                        if (input_bufs_omx_free.size() == 0) {
-                                                               input_bufs_omx_mutex.Unlock();
+                                                               input_bufs_omx_mutex.unlock();
                                                        //      Log::getInstance()->log("Audio", Log::DEBUG,
                                                                //              "Deliver MediaPacket no free sample");
                                                                MILLISLEEP(5);
@@ -2247,7 +2246,7 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket mpacket, const UCHAR* buffer,
                                                        cur_input_buf_omx->nTimeStamp = VideoOMX::intToOMXTicks(0);
                                                        cur_input_buf_omx->nFlags=OMX_BUFFERFLAG_TIME_UNKNOWN;
                                                        input_bufs_omx_free.pop_front();
-                                                       input_bufs_omx_mutex.Unlock();
+                                                       input_bufs_omx_mutex.unlock();
                                                        break;
                                                }
                                                if (!cur_input_buf_omx) return *samplepos;
index c1a31a5f624b79330b258c11925649c348739975..ae3c2b820f1876ccde70274f8ac55e595b0b6f17 100644 (file)
@@ -14,8 +14,7 @@
     GNU General Public License for more details.
 
     You should have received a copy of the GNU General Public License
-    along with VOMP; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+    along with VOMP.  If not, see <https://www.gnu.org/licenses/>.
 */
 
 #ifndef AUDIOOMX_H
 #include <unistd.h>
 #include <fcntl.h>
 #include <sys/ioctl.h>
-
-#include "defines.h"
-#include "audio.h"
-#include "videoomx.h"
-
+#include <mutex>
 
 extern "C" {
 #include <libavcodec/avcodec.h>
@@ -37,8 +32,9 @@ extern "C" {
 #include <libavresample/avresample.h>
 }
 
-
-
+#include "defines.h"
+#include "audio.h"
+#include "videoomx.h"
 
 class AudioOMX : public Audio
 {
@@ -169,12 +165,12 @@ class AudioOMX : public Audio
 
        std::vector<OMX_BUFFERHEADERTYPE*> input_bufs_omx_all;
        std::list<OMX_BUFFERHEADERTYPE*> input_bufs_omx_free;
-       Mutex input_bufs_omx_mutex;
+       std::mutex input_bufs_omx_mutex;
        OMX_BUFFERHEADERTYPE* cur_input_buf_omx;
 
     bool omx_running;
     bool omx_first_frame;
-    Mutex libav_mutex;
+    std::mutex libav_mutex;
 
     AVCodec *aaclatmcodec_libav;
     AVCodecContext *aaclatmcodec_context_libav;
index 9813615bb9e69856f1fe35eaeda9325b7857b627..abfbb91ba7352141132541932c2def53c62f331b 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright 2004-2005 Chris Tallon
+    Copyright 2004-2020 Chris Tallon
 
     This file is part of VOMP.
 
@@ -68,9 +68,9 @@ void BoxStack::removeAll()
 
 int BoxStack::addVideoDisplay(Boxx* box,VideoDisplay vd)
 {
-         boxLock.Lock();
+         boxLock.lock();
          videoStack.push(std::pair<Boxx*,VideoDisplay>(box,vd));
-         boxLock.Unlock();
+         boxLock.unlock();
          Video::getInstance()->setVideoDisplay(vd);
          return 1;
 }
@@ -79,17 +79,17 @@ int BoxStack::add(Boxx* v)
 {
   if (!initted) return 0;
   Log::getInstance()->log("BoxStack", Log::DEBUG, "add called"); 
-  boxLock.Lock();
+  boxLock.lock();
   Log::getInstance()->log("BoxStack", Log::DEBUG, "Locked for add");  
   
   if (numBoxes == 16)
   { //Error
     Log::getInstance()->log("BoxStack", Log::ERR, "More than 16 boxes! Unlocked for add"); 
-    boxLock.Unlock();
+    boxLock.unlock();
     return 0;
   }
   boxes[numBoxes++] = v;
-  boxLock.Unlock();
+  boxLock.unlock();
   VideoDisplay vd;
   if (v->getVideoDisplay(vd)) {
          Log::getInstance()->log("BoxStack", Log::DEBUG, "Add video display");
@@ -110,12 +110,12 @@ int BoxStack::remove(Boxx* toDelete)
   if (!initted) return 0;
   VideoDisplay *display = NULL;
 
-  boxLock.Lock();
+  boxLock.lock();
   Log::getInstance()->log("BoxStack", Log::DEBUG, "Locked for remove");  
   
   if (numBoxes == 0)
   {
-    boxLock.Unlock();
+    boxLock.unlock();
     Log::getInstance()->log("BoxStack", Log::ERR, "Unlocked for remove numBoxes == 0");  
     return 0;
   }
@@ -142,17 +142,17 @@ int BoxStack::remove(Boxx* toDelete)
     {
       // not a Box we have!
       // FIXME
-      boxLock.Unlock();
+      boxLock.unlock();
       Log::getInstance()->log("BoxStack", Log::ERR, "Unlocked for remove - no boxx deleted");  
       return 0;
     }
   }
 
-  boxLock.Unlock();
+  boxLock.unlock();
 
   toDelete->preDelete();
 
-  boxLock.Lock();
+  boxLock.lock();
 
 //  Log::getInstance()->log("BoxStack", Log::DEBUG, "Starting deleteBox");
   deleteBox(i);
@@ -175,7 +175,7 @@ int BoxStack::remove(Boxx* toDelete)
        videoStack.pop();
     if (!videoStack.empty()) display=&videoStack.top().second;
   }
-  boxLock.Unlock();
+  boxLock.unlock();
   Log::getInstance()->log("BoxStack", Log::DEBUG, "Unlocked for remove");  
  
   // Delete the box
@@ -210,7 +210,7 @@ void BoxStack::deleteBox(int z)
 
 void BoxStack::redrawAllBoxes()
 {
-  boxLock.Lock();
+  boxLock.lock();
 
   for (int z = 0; z < numBoxes; z++)
   {
@@ -218,7 +218,7 @@ void BoxStack::redrawAllBoxes()
   }
 
 
-  boxLock.Unlock();
+  boxLock.unlock();
   update(NULL,NULL); // should blt all
 }
 
@@ -226,7 +226,7 @@ void BoxStack::update(Boxx* toUpdate, Region* regionToUpdate)
 {
   Log::getInstance()->log("BoxStack", Log::DEBUG, "Update called");
   if (!initted) return; // it is allowed to call this before init
-  boxLock.Lock();
+  boxLock.lock();
   Log::getInstance()->log("BoxStack", Log::DEBUG, "Locked for update");
 
   // Get the z index of the box
@@ -241,7 +241,7 @@ void BoxStack::update(Boxx* toUpdate, Region* regionToUpdate)
     if (z == numBoxes)
     {
       // not a Box we have!
-      boxLock.Unlock();
+      boxLock.unlock();
       Log::getInstance()->log("BoxStack", Log::ERR, "Unlocked for update! box not inside boxstack");
       return;
     }
@@ -252,7 +252,7 @@ void BoxStack::update(Boxx* toUpdate, Region* regionToUpdate)
   }
 
   if (!toUpdate) {
-      boxLock.Unlock();
+      boxLock.unlock();
          Log::getInstance()->log("BoxStack", Log::DEBUG, "Unlocked for update, no box present");
          return ;
   }
@@ -285,7 +285,7 @@ void BoxStack::update(Boxx* toUpdate, Region* regionToUpdate)
     rl.pop_front();
   }
 
-  boxLock.Unlock();
+  boxLock.unlock();
   Log::getInstance()->log("BoxStack", Log::DEBUG, "Unlocked for update");
 }
 
@@ -463,21 +463,21 @@ void BoxStack::removeAllExceptWallpaper()
   
   while(numBoxes > 1)
   {
-    boxLock.Lock(); 
+    boxLock.lock();
 
     if (numBoxes == 1)
     {
-      boxLock.Unlock();
+      boxLock.unlock();
       break;
     }    
   
     toDel = boxes[numBoxes - 1];
 
-    boxLock.Unlock();
+    boxLock.unlock();
 
     toDel->preDelete();
     
-    boxLock.Lock();
+    boxLock.lock();
 
     // If boxes[numBoxes - 1] isn't toDel then there's a problem
     if (boxes[numBoxes - 1] == toDel)
@@ -494,7 +494,7 @@ void BoxStack::removeAllExceptWallpaper()
        videoStack.pop();
        if (!videoStack.empty()) display=&videoStack.top().second;
     }
-    boxLock.Unlock();
+    boxLock.unlock();
 
     //AVO: do the delete outside the lock to allow for recursive deletes
     Log::getInstance()->log("BoxStack", Log::DEBUG, "going to delete boxx %p, num=%d", toDel, numBoxes);
index 733d371ca42e9a88755f49cc7faad8f03d66487e..41232f3a2ca28d8031407e5c7f435090a34cfca7 100644 (file)
@@ -14,8 +14,7 @@
     GNU General Public License for more details.
 
     You should have received a copy of the GNU General Public License
-    along with VOMP; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+    along with VOMP.  If not, see <https://www.gnu.org/licenses/>.
 */
 
 #ifndef BOXSTACK_H
 #include <signal.h>
 #include <list>
 #include <stack>
-
-#ifndef WIN32
-#include <pthread.h>
-#endif
-
-#include "mutex.h"
+#include <mutex>
 
 #include "boxx.h"
 #include "region.h"
@@ -74,8 +68,7 @@ class BoxStack
 
     VideoDisplayStack videoStack;
 
-    Mutex boxLock;
-
+    std::mutex boxLock;
 
     void deleteBox(int z);
     void repaintRevealed(int x, Region r);
index 7ead15ff3f717ad6d28bdc44a2cc3cfe7f2679b2..2e224338dfe7fb60bcc883fd6861c93646bc57bb 100644 (file)
@@ -21,7 +21,6 @@
 #ifndef DEMUXERMEDIA_H
 #define DEMUXERMEDIA_H
 
-#include "mutex.h"
 #include <deque>
 #include "demuxer.h"
 #include "defines.h"
@@ -54,7 +53,6 @@ class DemuxerMedia : public Demuxer
     typedef struct { ULLONG pts; ULONG frame; } PTSMapEntry;
     typedef std::deque<PTSMapEntry> PTSMap;
     PTSMap pts_map;
-    Mutex pts_map_mutex;
     ULLONG firstPTS;
     ULLONG currentPTS;
     ULLONG lastPTS;
index 26401f70cd84c46ae6d951446f90a8f98997aee7..1466fffd8763d5031657b0d39b23ed062005a02a 100644 (file)
@@ -14,8 +14,7 @@
     GNU General Public License for more details.
 
     You should have received a copy of the GNU General Public License
-    along with VOMP; if not, write to the Free Software Foundation, Inc.,
-    51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+    along with VOMP.  If not, see <https://www.gnu.org/licenses/>.
 */
 
 #include "demuxerts.h"
@@ -752,7 +751,7 @@ ULONG DemuxerTS::getFrameNumFromPTS(ULLONG pts)
   ULONG ref_frame = 0;
   int total = 0, actual = 0;
   if (pts==0) return 0; //we are in startup
-  pts_map_mutex.Lock();
+  pts_map_mutex.lock();
   PTSMap::iterator iter = pts_map.begin();
   while (iter != pts_map.end())
   {
@@ -779,7 +778,7 @@ ULONG DemuxerTS::getFrameNumFromPTS(ULLONG pts)
     iter = pts_map.begin(); iter++;
     pts_map.erase(iter, pts_map.end());
   }
-  pts_map_mutex.Unlock();
+  pts_map_mutex.unlock();
   
  //Log::getInstance()->log("DemuxerTS", Log::DEBUG, "getFrameNumfromPTS pts %lld deleted %d difference %lld", pts, total,difference);
 
@@ -821,17 +820,17 @@ void DemuxerTS::parseTSPacketDetails(PESPacket &packet) // Only important stuff
     if ((h264 || packet.findSeqHeader(h264) > 1) && packet.hasPTS())
     {
       PTSMapEntry me;
-      pts_map_mutex.Lock();
+      pts_map_mutex.lock();
       if (pts_map.empty())
       {
         me.pts = packet.getPTS();
         me.frame = frame_num;
-        pts_map_mutex.Unlock();
-        pts_map_mutex.Lock();
+        pts_map_mutex.unlock();
+        pts_map_mutex.lock();
         pts_map.push_front(me);
       }
       me = pts_map.front();
-      pts_map_mutex.Unlock();
+      pts_map_mutex.unlock();
 
       //UINT fps = Video::getInstance()->getFPS();
       double tfps=fps;
@@ -854,9 +853,9 @@ void DemuxerTS::parseTSPacketDetails(PESPacket &packet) // Only important stuff
       {
         me.pts = packet.getPTS();
         me.frame = frame_num;
-        pts_map_mutex.Lock();
+        pts_map_mutex.lock();
         pts_map.push_front(me);
-        pts_map_mutex.Unlock();
+        pts_map_mutex.unlock();
       }
     }
   }
index 2ce62fbb86b82407947d629d58d4a290c068a9fa..dbfe7f3ab2cef6425d157a85c537f0dd47426a09 100644 (file)
     GNU General Public License for more details.
 
     You should have received a copy of the GNU General Public License
-    along with VOMP; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+    along with VOMP.  If not, see <https://www.gnu.org/licenses/>.
 */
 
 #ifndef DEMUXERTS_H
 #define DEMUXERTS_H
 
-#include "mutex.h"
+#include <mutex>
 #include <deque>
 
 #include "demuxer.h"
@@ -87,7 +86,7 @@ class DemuxerTS : public Demuxer
     typedef struct { ULLONG pts; ULONG frame; } PTSMapEntry;
     typedef std::deque<PTSMapEntry> PTSMap;
     PTSMap pts_map;
-    Mutex pts_map_mutex;
+    std::mutex pts_map_mutex;
     void parseTSPacketDetails(PESPacket &packet);
 
     struct PictCountInfo pinfo;
index c5bd28d71e5208c375c11b3502f87fe43a93d58f..f1a2a3deaeeebdca9c7da1948afc2b1fcb528609 100644 (file)
@@ -14,8 +14,7 @@
     GNU General Public License for more details.
 
     You should have received a copy of the GNU General Public License
-    along with VOMP; if not, write to the Free Software Foundation, Inc.,
-    51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+    along with VOMP.  If not, see <https://www.gnu.org/licenses/>.
 */
 
 #include "demuxervdr.h"
@@ -254,7 +253,7 @@ ULONG DemuxerVDR::getFrameNumFromPTS(ULLONG pts)
   ULLONG difference = (1LL<<33);
   ULONG ref_frame = 0;
   int total = 0, actual = 0;
-  pts_map_mutex.Lock();
+  pts_map_mutex.lock();
   PTSMap::iterator iter = pts_map.begin();
   while (iter != pts_map.end())
   {
@@ -280,7 +279,7 @@ ULONG DemuxerVDR::getFrameNumFromPTS(ULLONG pts)
     iter = pts_map.begin(); iter++;
     pts_map.erase(iter, pts_map.end());
   }
-  pts_map_mutex.Unlock();
+  pts_map_mutex.unlock();
 
   if (difference == (1LL<<33))
     return 0; // We cannot make sense of the pts
@@ -365,18 +364,18 @@ void DemuxerVDR::parseVDRPacketDetails()
     if (packet.findSeqHeader(h264) > 1 && packet.hasPTS())
     {
       PTSMapEntry me;
-      pts_map_mutex.Lock();
+      pts_map_mutex.lock();
       if (pts_map.empty())
       {
         me.pts = packet.getPTS();
         me.frame = frame_num;
-        pts_map_mutex.Unlock();
+        pts_map_mutex.unlock();
 Log::getInstance()->log("Demuxer", Log::DEBUG, "+* PTS INIT *+ %llu %u", me.pts, me.frame);
-        pts_map_mutex.Lock();
+        pts_map_mutex.lock();
         pts_map.push_front(me);
       }
       me = pts_map.front();
-      pts_map_mutex.Unlock();
+      pts_map_mutex.unlock();
 
 //      UINT fps = Video::getInstance()->getFPS();
       ULLONG pts_expected = me.pts + 90000*((ULONG)((double)(frame_num - me.frame)) / fps);
@@ -387,9 +386,9 @@ Log::getInstance()->log("Demuxer", Log::DEBUG, "+* PTS INIT *+ %llu %u", me.pts,
 Log::getInstance()->log("Demuxer", Log::DEBUG, "+* PTS JUMP *+ %llu %u", packet.getPTS(), frame_num);
         me.pts = packet.getPTS();
         me.frame = frame_num;
-        pts_map_mutex.Lock();
+        pts_map_mutex.lock();
         pts_map.push_front(me);
-        pts_map_mutex.Unlock();
+        pts_map_mutex.unlock();
       }
     }
   }
index 5efa71a480224c870cc08282f7fc2faf2efbc289..863022456066ac60ca52b3e666ec408c1c6380a1 100644 (file)
     GNU General Public License for more details.
 
     You should have received a copy of the GNU General Public License
-    along with VOMP; if not, write to the Free Software Foundation, Inc.,
-    51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+    along with VOMP.  If not, see <https://www.gnu.org/licenses/>.
 */
 
 #ifndef DEMUXERVDR_H
 #define DEMUXERVDR_H
 
-#include "mutex.h"
+#include <mutex>
 #include <deque>
 #include "demuxer.h"
 #include "defines.h"
@@ -53,7 +52,7 @@ class DemuxerVDR : public Demuxer
     typedef struct { ULLONG pts; ULONG frame; } PTSMapEntry;
     typedef std::deque<PTSMapEntry> PTSMap;
     PTSMap pts_map;
-    Mutex pts_map_mutex;
+    std::mutex pts_map_mutex;
 
     void parseVDRPacketDetails();
     void dealWithSubtitlePacket();
index c41d90d58e8332e154f97b1d6db553f16e53c516..80f2298cd38e310991e3e06939098bcbabe0b72d 100644 (file)
@@ -14,8 +14,7 @@
     GNU General Public License for more details.
 
     You should have received a copy of the GNU General Public License
-    along with VOMP; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+    along with VOMP.  If not, see <https://www.gnu.org/licenses/>.
 */
 
 #define INITGUID
@@ -60,7 +59,7 @@ DsAllocator::~DsAllocator() {
 }
 
 void DsAllocator::CleanupSurfaces() {
-    Lock();
+    dsaLock.lock();
     while(fullevrsamples.size()>0)
     {
         IMFSample *sample=fullevrsamples.front();
@@ -79,20 +78,20 @@ void DsAllocator::CleanupSurfaces() {
         surfaces[i]=NULL;
     }
     start_get_evr_samples=false;
-    Unlock();
+    dsaLock.unlock();
 }
 
 HRESULT STDMETHODCALLTYPE DsAllocator::InitializeDevice(DWORD_PTR userid,VMR9AllocationInfo* allocinf,DWORD*numbuf){
     if (!surfallocnotify) return S_FALSE;
 
     CleanupSurfaces();
-    Lock();
+    dsaLock.lock();
     surfaces.resize(*numbuf);
     HRESULT hres= surfallocnotify->AllocateSurfaceHelper(allocinf,numbuf,&surfaces.at(0));
     vheight=allocinf->dwHeight;
     vwidth=allocinf->dwWidth;
     start_get_evr_samples=false;
-    Unlock();
+    dsaLock.unlock();
     /* char buffer[1024];
     sprintf(buffer,"%d * %d",allocinf->dwWidth,allocinf->dwHeight);
     MessageBox(0,"hi",buffer,0);*/
@@ -102,11 +101,11 @@ HRESULT STDMETHODCALLTYPE DsAllocator::InitializeDevice(DWORD_PTR userid,VMR9All
 void DsAllocator::LostDevice(IDirect3DDevice9 *d3ddev, IDirect3D9* d3d) {
     if (!surfallocnotify) return ;
     CleanupSurfaces();
-    Lock();
+    dsaLock.lock();
     // d3ddev=((OsdWin*)Osd::getInstance())->getD3dDev();
     HMONITOR hmon=d3d->GetAdapterMonitor(D3DADAPTER_DEFAULT);
     surfallocnotify->ChangeD3DDevice(d3ddev,hmon);
-    Unlock();
+    dsaLock.unlock();
 
 }
 
@@ -120,21 +119,21 @@ HRESULT STDMETHODCALLTYPE DsAllocator::GetSurface(DWORD_PTR userid,DWORD surfind
     if (surfindex>=surfaces.size()) return E_FAIL;
     if (surf==NULL) return E_POINTER;
 
-    Lock();
+    dsaLock.lock();
     surfaces[surfindex]->AddRef();
     *surf=surfaces[surfindex];
-    Unlock();
+    dsaLock.unlock();
     return S_OK;
 }
 HRESULT STDMETHODCALLTYPE DsAllocator::AdviseNotify(IVMRSurfaceAllocatorNotify9* allnoty){
-    Lock();
+    dsaLock.lock();
     surfallocnotify=allnoty;
     IDirect3DDevice9 *d3ddev;
     //OK lets set the direct3d object from the osd
     d3ddev=dynamic_cast<WindowsOsd*>(Osd::getInstance())->getD3dDev();
     HMONITOR hmon=dynamic_cast<WindowsOsd*>(Osd::getInstance())->getD3d()->GetAdapterMonitor(D3DADAPTER_DEFAULT);
     HRESULT hres=surfallocnotify->SetD3DDevice(d3ddev,hmon);
-    Unlock();
+    dsaLock.unlock();
     return hres;
 }
 
@@ -225,7 +224,7 @@ HRESULT STDMETHODCALLTYPE  DsAllocator::GetDeviceID(IID *pDid)
 HRESULT STDMETHODCALLTYPE DsAllocator::InitServicePointers(IMFTopologyServiceLookup *plooky)
 {
     if (!plooky) return E_POINTER;
-    Lock();
+    dsaLock.lock();
     inevrmode=true;
     /* get all interfaces we need*/
 
@@ -238,13 +237,13 @@ HRESULT STDMETHODCALLTYPE DsAllocator::InitServicePointers(IMFTopologyServiceLoo
         __uuidof(IMFClock),(void**)&mfclock,&dwobjcts);
 
 
-    Unlock();
+    dsaLock.unlock();
     return S_OK;
 }
 
 HRESULT STDMETHODCALLTYPE DsAllocator::ReleaseServicePointers()
 {
-    Lock();
+    dsaLock.lock();
     inevrmode=false;
     /* TODO Set RenderState , sample type etc.*/
 
@@ -261,7 +260,7 @@ HRESULT STDMETHODCALLTYPE DsAllocator::ReleaseServicePointers()
     if (mfmediatype) mfmediatype->Release();
     mfmediatype=NULL;
 
-    Unlock();
+    dsaLock.unlock();
     return S_OK;
 }
 
@@ -293,14 +292,14 @@ HRESULT STDMETHODCALLTYPE DsAllocator::GetService(const GUID &guid,const IID &ii
 
 void DsAllocator::GetEVRSamples()
 {
-    Lock();
+    dsaLock.lock();
     MFCLOCK_STATE clockstate;
     if (mfclock) mfclock->GetState(0,&clockstate);
     //MessageBox(0,"get samples","samples",0);
     
     if (mfclock && clockstate==MFCLOCK_STATE_STOPPED && fullevrsamples.size()>0)
     {
-        Unlock();
+        dsaLock.unlock();
         return;
     }
 
@@ -386,7 +385,7 @@ void DsAllocator::GetEVRSamples()
         } else break;
 
     }
-    Unlock();
+    dsaLock.unlock();
 }
 
 HRESULT STDMETHODCALLTYPE DsAllocator::ProcessMessage(MFVP_MESSAGE_TYPE mess,ULONG_PTR mess_para)
@@ -502,15 +501,15 @@ HRESULT STDMETHODCALLTYPE DsAllocator::OnClockSetRate(MFTIME systime,float rate)
 HRESULT STDMETHODCALLTYPE DsAllocator::GetCurrentMediaType(IMFVideoMediaType **mtype)
 {// MessageBox(0,"mediatype","mediatype",0);
 if (mtype==NULL) return E_POINTER;
-Lock();
+dsaLock.lock();
 if (mfmediatype==NULL)
 {
-    Unlock();
+    dsaLock.unlock();
     *mtype=NULL;
     return MF_E_NOT_INITIALIZED;
 }
 HRESULT hres=mfmediatype->QueryInterface(IID_IMFVideoMediaType,(void**)mtype);
-Unlock();
+dsaLock.unlock();
 return hres;
 }
 
@@ -565,13 +564,13 @@ void DsAllocator::RenegotiateEVRMediaType()
 
         gotcha=true;
 
-        Lock();
+        dsaLock.lock();
         if (mfmediatype) mfmediatype->Release();
         mfmediatype=NULL;
 
         mfmediatype=mixtype;
         AllocateEVRSurfaces();
-        Unlock();
+        dsaLock.unlock();
 
         hres=mftransform->SetOutputType(0,mixtype,0);
 
@@ -579,12 +578,12 @@ void DsAllocator::RenegotiateEVRMediaType()
 
         if (hres!=S_OK) 
         {
-            Lock();
+            dsaLock.lock();
             if (mfmediatype) mfmediatype->Release();
             mfmediatype=NULL;
             gotcha=false;
 
-            Unlock();
+            dsaLock.unlock();
         }
 
 
@@ -611,7 +610,7 @@ void DsAllocator::AllocateEVRSurfaces()
     format=D3DFMT_X8R8G8B8;
 
     CleanupSurfaces();
-    Lock();
+    dsaLock.lock();
        WindowsOsd* osdwin = dynamic_cast<WindowsOsd*>(Osd::getInstance());
     LPDIRECT3DDEVICE9 d3ddev=osdwin->getD3dDev();
     osdwin->BeginPainting();
@@ -644,20 +643,20 @@ void DsAllocator::AllocateEVRSurfaces()
             if (sample) emptyevrsamples.push(sample);
         }
     }
-    Unlock();
+    dsaLock.unlock();
 
 }
 
 void DsAllocator::FlushEVRSamples()
 {
-    Lock();
+    dsaLock.lock();
     while(fullevrsamples.size()>0)
     {
         IMFSample *sample=fullevrsamples.front();
         fullevrsamples.pop();
         emptyevrsamples.push(sample);
     }
-    Unlock();
+    dsaLock.unlock();
 }
 #define FAC 1
 
@@ -666,7 +665,7 @@ void DsAllocator::GetNextSurface(LPDIRECT3DSURFACE9* surf,DWORD *waittime)
     
     *surf=NULL;
     *waittime=10;
-    Lock();
+    dsaLock.lock();
     if (fullevrsamples.size()==0) {
         *waittime=1;
         if (start_get_evr_samples) GetEVRSamples();
@@ -746,7 +745,7 @@ void DsAllocator::GetNextSurface(LPDIRECT3DSURFACE9* surf,DWORD *waittime)
         }       
     }
 
-    Unlock();
+    dsaLock.unlock();
 
 }
 
@@ -755,10 +754,10 @@ void DsAllocator::DiscardSurfaceandgetWait(DWORD *waittime)
     //Log::getInstance()->log("DsAllocator", Log::DEBUG , "Discard surface and get Wait");
     if (start_get_evr_samples) GetEVRSamples();
     //Log::getInstance()->log("DsAllocator", Log::DEBUG , "Discard surface and get Wait2");
-    Lock();
+    dsaLock.lock();
     if (fullevrsamples.size()==0) {
         *waittime=0;
-        Unlock();
+        dsaLock.unlock();
         return;
     }
     IMFSample *sample=fullevrsamples.front();
@@ -800,7 +799,7 @@ void DsAllocator::DiscardSurfaceandgetWait(DWORD *waittime)
 
         break;
     }
-    Unlock();
+    dsaLock.unlock();
 
 }
 void DsAllocator::ResetSyncOffsets()
index acc73f84dee1fd133159f18e0dba1ddfd819414d..32211c9cab9a8b171c53a8ee236064570886d3e4 100644 (file)
@@ -21,6 +21,7 @@
 
 #include <queue>
 #include <vector>
+#include <mutex>
 
 #include <winsock2.h>
 
 #include <dshow.h> 
 #include <vmr9.h>
 #include <evr.h>
-#include "mutex.h"
 
 
 //The Allocator and Presenter for VMR9 is also a Presnter for EVR
 
-class DsAllocator: public IVMRSurfaceAllocator9, IVMRImagePresenter9, Mutex,IMFVideoDeviceID, 
+class DsAllocator: public IVMRSurfaceAllocator9, IVMRImagePresenter9, IMFVideoDeviceID,
     IMFTopologyServiceLookupClient,public IMFVideoPresenter,IMFGetService, IQualProp {
   public:
     DsAllocator();
@@ -122,6 +122,8 @@ protected:
     int jitter;
     int avgfps;
     LONGLONG lastdelframe;
+
+    std::mutex dsaLock;
 };
 
 #endif
index 93489012228a27390ac1d2c7d562ad161b7851ca..f3a25e2deddb8c35d2112e6b37af0f6ba0520716 100644 (file)
@@ -14,8 +14,7 @@
     GNU General Public License for more details.
 
     You should have received a copy of the GNU General Public License
-    along with VOMP; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+    along with VOMP.  If not, see <https://www.gnu.org/licenses/>.
 */
 
 #include "imageomx.h"
@@ -73,7 +72,7 @@ OMX_ERRORTYPE ImageOMX::EmptyBufferDone_OMX(OMX_IN OMX_HANDLETYPE /*hcomp*/,OMX_
 }
 
 void ImageOMX::ReturnEmptyOMXBuffer(OMX_BUFFERHEADERTYPE* buffer){
-       input_bufs_omx_mutex.Lock();
+       input_bufs_omx_mutex.lock();
        /*if (buffer->pBuffer) {
                free(buffer->pBuffer);
                buffer->pBuffer = NULL;
@@ -82,7 +81,7 @@ void ImageOMX::ReturnEmptyOMXBuffer(OMX_BUFFERHEADERTYPE* buffer){
        //Log::getInstance()->log("Image", Log::NOTICE, "ReturnEmptyOMXBuffer %d",input_bufs_omx_free.size());
        input_bufs_omx_free.push_back(buffer);
        //Log::getInstance()->log("Image", Log::NOTICE, "ReturnEmptyOMXBuffer %d",input_bufs_omx_free.size());
-       input_bufs_omx_mutex.Unlock();
+       input_bufs_omx_mutex.unlock();
        VideoOMX* video = static_cast<VideoOMX*>(Video::getInstance());
 
        video->signalOmx();
@@ -97,10 +96,10 @@ OMX_ERRORTYPE ImageOMX::FillBufferDone_OMX(OMX_IN OMX_HANDLETYPE /*hcomp*/, OMX_
 
 void ImageOMX::ReturnFillOMXBuffer(OMX_BUFFERHEADERTYPE* /*buffer*/)
  {
-        //input_bufs_omx_mutex.Lock();
+        //input_bufs_omx_mutex.lock();
         omx_egl_filled = true;
        //output_bufs_omx_full.push_back(buffer);
-       //input_bufs_omx_mutex.Unlock();
+       //input_bufs_omx_mutex.unlock();
     VideoOMX* video = static_cast<VideoOMX*>(Video::getInstance());
         video->signalOmx();
  }
@@ -300,10 +299,10 @@ bool ImageOMX::intDecodePicture(LoadIndex index, unsigned char* /* buffer */, un
        // Use Buffer
        OMX_BUFFERHEADERTYPE * bufhead;
 
-       input_bufs_omx_mutex.Lock();
+       input_bufs_omx_mutex.lock();
        int count =0;
        while (input_bufs_omx_free.size()==0) {
-               input_bufs_omx_mutex.Unlock();
+               input_bufs_omx_mutex.unlock();
                //Log::getInstance()->log("Image", Log::DEBUG, "DMP mark 6");
                //Log::getInstance()->log("Image", Log::DEBUG, "Deliver MediaPacket no free sample");
                //return 0; // we do not have a free media sample
@@ -312,7 +311,7 @@ bool ImageOMX::intDecodePicture(LoadIndex index, unsigned char* /* buffer */, un
                if (count>100) return false;
                MILLISLEEP(10);
 
-               input_bufs_omx_mutex.Lock();
+               input_bufs_omx_mutex.lock();
 
        }
        bufhead=input_bufs_omx_free.front();
@@ -323,7 +322,7 @@ bool ImageOMX::intDecodePicture(LoadIndex index, unsigned char* /* buffer */, un
        //bufhead->pBuffer=buffer;
        bufhead->pAppPrivate=this;
        input_bufs_omx_free.pop_front();
-       input_bufs_omx_mutex.Unlock();
+       input_bufs_omx_mutex.unlock();
 
 
        bufhead->nFilledLen=length;//bufhead->nAllocLen;
@@ -687,13 +686,13 @@ int ImageOMX::PrepareInputBufsOMX(bool setportdef, unsigned char * buffer, unsig
                return 0;
        }
 
-       input_bufs_omx_mutex.Lock();
+       input_bufs_omx_mutex.lock();
        for (unsigned int i=0; i< port_def_type.nBufferCountActual;i++) {
                OMX_BUFFERHEADERTYPE *buf_head=NULL;
                error=OMX_UseBuffer(omx_imag_decode/*dec*/,&buf_head,omx_image_input_port/*codec*/,this,port_def_type.nBufferSize, buffer);
                if (error!=OMX_ErrorNone){
                        Log::getInstance()->log("Image", Log::DEBUG, "Use OMX_UseBuffer failed %x", error);
-                       input_bufs_omx_mutex.Unlock();
+                       input_bufs_omx_mutex.unlock();
                        return 0;
                }
                input_bufs_omx_all.push_back(buf_head);
@@ -702,7 +701,7 @@ int ImageOMX::PrepareInputBufsOMX(bool setportdef, unsigned char * buffer, unsig
        omx_first_frame=true;
 
 
-       input_bufs_omx_mutex.Unlock();
+       input_bufs_omx_mutex.unlock();
 
        if (!video->CommandFinished(omx_imag_decode/*dec*/,OMX_CommandPortEnable, omx_image_input_port /*codec*/)) {
                return 0;
@@ -715,7 +714,7 @@ int ImageOMX::DestroyInputBufsOMX() //call with clock mutex locked
 {
        OMX_ERRORTYPE error;
 
-       input_bufs_omx_mutex.Lock();
+       input_bufs_omx_mutex.lock();
        for (UINT i=0; i< input_bufs_omx_all.size();i++) {
                Log::getInstance()->log("Image", Log::DEBUG, "OMX_FreeBuffer mark");
                //if (input_bufs_omx_all[i]->pBuffer) free(input_bufs_omx_all[i]->pBuffer);
@@ -723,14 +722,14 @@ int ImageOMX::DestroyInputBufsOMX() //call with clock mutex locked
                error=OMX_FreeBuffer(omx_imag_decode/*dec*/,omx_image_input_port/*codec*/,input_bufs_omx_all[i]);
                if (error!=OMX_ErrorNone){
                        Log::getInstance()->log("Image", Log::DEBUG, "Use OMX_FreeBuffer failed %x", error);
-                       input_bufs_omx_mutex.Unlock();
+                       input_bufs_omx_mutex.unlock();
                        return 0;
                }
 
        }
        input_bufs_omx_all.clear();
        input_bufs_omx_free.clear();
-       input_bufs_omx_mutex.Unlock();
+       input_bufs_omx_mutex.unlock();
 
        return 1;
 }
@@ -739,7 +738,7 @@ int ImageOMX::DestroyInputBufsOMXwhilePlaying() //call with clock mutex locked
 {
        //OMX_ERRORTYPE error;
 
-       input_bufs_omx_mutex.Lock();
+       input_bufs_omx_mutex.lock();
        while (input_bufs_omx_all.size()>0) {
                if (input_bufs_omx_free.size()>0) {
                        // Destroy one buffer
@@ -753,14 +752,14 @@ int ImageOMX::DestroyInputBufsOMXwhilePlaying() //call with clock mutex locked
                                }
                        }
                } else {
-                       input_bufs_omx_mutex.Unlock();
+                       input_bufs_omx_mutex.unlock();
                        MILLISLEEP(5);
-                       input_bufs_omx_mutex.Lock();
+                       input_bufs_omx_mutex.lock();
                }
        }
 
        Log::getInstance()->log("Image", Log::DEBUG, "DestroyInputBufsOMXwhilePlaying %d %d", input_bufs_omx_all.size(),input_bufs_omx_free.size());
-       input_bufs_omx_mutex.Unlock();
+       input_bufs_omx_mutex.unlock();
        return 1;
 }
 
index 5a204e7fac49b1140a0381b3ee5f78176cd3ce28..96442ba8b749275dbb4f355e61cbf73ac8757641 100644 (file)
@@ -14,8 +14,7 @@
     GNU General Public License for more details.
 
     You should have received a copy of the GNU General Public License
-    along with VOMP; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+    along with VOMP.  If not, see <https://www.gnu.org/licenses/>.
 */
 
 #ifndef IMAGEOMX_H
@@ -25,6 +24,7 @@
 #include <unistd.h>
 #include <fcntl.h>
 #include <sys/ioctl.h>
+#include <mutex>
 
 #include <EGL/egl.h>
 #include <EGL/eglext.h>
@@ -97,7 +97,7 @@ class ImageOMX : public OsdVector::PictureDecoder
     std::vector<OMX_BUFFERHEADERTYPE*> input_bufs_omx_all;
     std::list<OMX_BUFFERHEADERTYPE*> input_bufs_omx_free;
     //list<OMX_BUFFERHEADERTYPE*> output_bufs_omx_full;
-    Mutex input_bufs_omx_mutex;
+    std::mutex input_bufs_omx_mutex;
 
     bool omx_running;
     bool omx_first_frame;
diff --git a/mutex.cc b/mutex.cc
deleted file mode 100644 (file)
index 42478c6..0000000
--- a/mutex.cc
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
-    Copyright 2004-2005 Chris Tallon
-
-    This file is part of VOMP.
-
-    VOMP is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    VOMP is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with VOMP; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
-*/
-#include "mutex.h"
-
-// FIXME - delete me.
-
-
-
-#ifndef WIN32
-#include <unistd.h>
-#include <sys/syscall.h>
-#endif
-
-Mutex::Mutex() {
-#ifndef WIN32
-       pthread_mutex_init(&my_mutex, NULL);
-#else
-        my_mutex=CreateMutex(NULL,FALSE,NULL);
-#endif
-}
-
-Mutex::~Mutex() {
-#ifdef WIN32
-  CloseHandle(my_mutex);
-#endif
-}
-
-void Mutex::Lock() {
-#ifndef WIN32
-  pthread_mutex_lock(&my_mutex);
-#else
-   WaitForSingleObject(my_mutex, INFINITE );
-#endif
-}
-
-void Mutex::Unlock() {
-#ifndef WIN32
-               pthread_mutex_unlock(&my_mutex);
-#else
-               ReleaseMutex(my_mutex);
-#endif
-}
-
diff --git a/mutex.h b/mutex.h
deleted file mode 100644 (file)
index 21b04b7..0000000
--- a/mutex.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
-    Copyright 2004-2005 Chris Tallon
-
-    This file is part of VOMP.
-
-    VOMP is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    VOMP is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with VOMP; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
-*/
-
-#ifndef MUTEX_H
-#define MUTEX_H
-
-#ifndef WIN32
-#include <pthread.h>
-#else
-#include <winsock2.h>
-#include <windows.h>
-#endif
-
-
-
-class Mutex
-{
-public:
-       Mutex();
-       ~Mutex();
-       void Lock();
-       void Unlock();
-protected:
-#ifndef WIN32
-        pthread_mutex_t my_mutex;
-#else
-       HANDLE my_mutex;
-#endif
-};
-#endif
index a209ca1568ea8e0fbb7939d68442a8f402e2c121..d87d0efff270f24fb15956bc3d43bfabc9ee948c 100644 (file)
@@ -1,5 +1,5 @@
 OBJ_COMMON = command.o tcp.o dsock.o thread.o timers.o i18n.o vdp6.o               \
-             message.o messagequeue.o wol.o audio.o video.o log.o mutex.o          \
+             message.o messagequeue.o wol.o audio.o video.o log.o                  \
              vdr.o recman.o recording.o recinfo.o channel.o rectimer.o event.o     \
              directory.o mark.o option.o player.o playerradio.o vfeed.o afeed.o    \
              demuxer.o demuxervdr.o demuxerts.o stream.o osd.o surface.o           \
index 7cd1fcdc61ea5852fc30b8d962712c3db2f05e53..e1986cbed1325973da833b606d27b6e3650bb6a0 100644 (file)
     GNU General Public License for more details.
 
     You should have received a copy of the GNU General Public License
-    along with VOMP; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+    along with VOMP.  If not, see <https://www.gnu.org/licenses/>.
 */
 
-#include "osdopengl.h"
 #include "videoomx.h"
 #include "surfaceopengl.h"
-
 #include "message.h"
 #include "command.h"
 
+#include "osdopengl.h"
+
 #define  BACKBUFFER_WIDTH 1280
 #define  BACKBUFFER_HEIGHT 720
 
 OsdOpenGL::OsdOpenGL()
 {
-  glmutex.Lock();
+  glmutex.lock();
 
   external_driving=false;
 
@@ -57,7 +56,7 @@ OsdOpenGL::~OsdOpenGL()
   }
 
 
-  glmutex.Unlock();
+  glmutex.unlock();
 }
 
 int OsdOpenGL::getFD()
@@ -83,7 +82,7 @@ int OsdOpenGL::init()
 
    if (egl_display==EGL_NO_DISPLAY) {
           Log::getInstance()->log("OSD", Log::WARN, "Could not get egl display! %x",eglGetError());
-          glmutex.Unlock();
+          glmutex.unlock();
           return 0;
    }
 
@@ -91,7 +90,7 @@ int OsdOpenGL::init()
 
    if (eglInitialize(egl_display, NULL, NULL)==EGL_FALSE) {
           Log::getInstance()->log("OSD", Log::WARN, "Initialising display failed! %x",eglGetError());
-          glmutex.Unlock();
+          glmutex.unlock();
           return 0;
    }
 
@@ -114,7 +113,7 @@ int OsdOpenGL::init()
 
    if (eglChooseConfig(egl_display, attributs, &egl_ourconfig, 1, &number)==EGL_FALSE) {
           Log::getInstance()->log("OSD", Log::WARN, "Choosing egl config failed! %x",eglGetError());
-          glmutex.Unlock();
+          glmutex.unlock();
           return 0;
    }
 
@@ -126,7 +125,7 @@ int OsdOpenGL::init()
    egl_context=eglCreateContext(egl_display,egl_ourconfig,EGL_NO_CONTEXT,attr_context);
    if (egl_context==EGL_NO_CONTEXT) {
           Log::getInstance()->log("OSD", Log::WARN, "Creating egl context failed! %x",eglGetError());
-          glmutex.Unlock();
+          glmutex.unlock();
           return 0;
    }
 
@@ -134,7 +133,7 @@ int OsdOpenGL::init()
    display_width=display_height=0;
    if (graphics_get_display_size(0, &display_width, &display_height)<0) {
           Log::getInstance()->log("OSD", Log::WARN, "Getting display size failed! (BCM API) ");
-          glmutex.Unlock();
+          glmutex.unlock();
           return 0;
    }
    Log::getInstance()->log("OSD", Log::NOTICE, "Displaysize is %d x %d ",display_width, display_height);
@@ -158,13 +157,13 @@ int OsdOpenGL::init()
    egl_surface = eglCreateWindowSurface(egl_display,egl_ourconfig, &nativewindow,NULL );
    if (egl_surface==EGL_NO_SURFACE) {
           Log::getInstance()->log("OSD", Log::WARN, "Creating egl window surface failed!");
-          glmutex.Unlock();
+          glmutex.unlock();
           return 0;
    }
 
    if (eglMakeCurrent(egl_display, egl_surface, egl_surface, egl_context)== EGL_FALSE) {
           Log::getInstance()->log("OSD", Log::WARN, "Making egl Current failed");
-          glmutex.Unlock();
+          glmutex.unlock();
                   return 0;
    }
    // Test stuff
@@ -202,7 +201,7 @@ int OsdOpenGL::init()
 
   if (!osd_shader.init()) {
          Log::getInstance()->log("OSD", Log::WARN, "Init Osd Shader failed");
-         glmutex.Unlock();
+         glmutex.unlock();
          return 0;
   }
 
@@ -219,7 +218,7 @@ int OsdOpenGL::init()
   }
 
 
-  glmutex.Unlock();
+  glmutex.unlock();
   threadStart();
 
   return 1;
@@ -270,7 +269,7 @@ void OsdOpenGL::InitVertexBuffer(float  scalex,float scaley)
 int OsdOpenGL::shutdown()
 {
   if (!initted) return 0;
-  glmutex.Lock();
+  glmutex.lock();
   initted = 0;
   threadStop();
   delete screen;
@@ -309,9 +308,9 @@ void OsdOpenGL::screenShot(const char* fileName)
 void OsdOpenGL::threadMethod()
 {
        // We have to claim the gl context for this thread
-       //glmutex.Lock();
+       //glmutex.lock();
 
-       //glmutex.Unlock();
+       //glmutex.unlock();
        int ts=0;
        while (true)
        {
@@ -403,7 +402,7 @@ void OsdOpenGL::InternalRendering(){
 
 
 void OsdOpenGL::BeginPainting() {//We synchronize calls to d3d between different threads
-       glmutex.Lock();
+       glmutex.lock();
        if (initted) {
                if (eglMakeCurrent(egl_display, egl_surface, egl_surface, egl_context)== EGL_FALSE) {
                        Log::getInstance()->log("OSD", Log::WARN, "Making egl Current failed in thread %d",eglGetError());
@@ -414,7 +413,7 @@ void OsdOpenGL::BeginPainting() {//We synchronize calls to d3d between different
 
 void OsdOpenGL::EndPainting() {
        eglMakeCurrent(egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT );
-       glmutex.Unlock();
+       glmutex.unlock();
 }
 
 
index 61ca7eee8dbd55d4c0492ecb9b8c022600c71c9f..82abbae2e4d5e0a162a404df6c05f7a9667b09d7 100644 (file)
     GNU General Public License for more details.
 
     You should have received a copy of the GNU General Public License
-    along with VOMP; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+    along with VOMP.  If not, see <https://www.gnu.org/licenses/>.
 */
 
 #ifndef OSDOPENGL_H
 #define OSDOPENGL_H
 
 #include <stdio.h>
-
-
+#include <mutex>
 
 #include <GLES2/gl2.h>
 #include <EGL/egl.h>
 #include "defines.h"
 #include "log.h"
 #include "threadp.h"
-#include "mutex.h"
 #include "videoomx.h"
 
 #include "glosdshader.h"
 
-
-
-
-
-
 struct OSDCOLOR{
        GLfloat r;
        GLfloat g;
@@ -60,11 +52,6 @@ struct OSDVERTEX {
        GLfloat v;
 };
 
-
-
-
-
-
 class OsdOpenGL : public Osd, public Thread_TYPE
 {
   public:
@@ -110,7 +97,7 @@ private:
 
        // This indicates, that currently a video is played, thus the osd updates are driven by the Videosystem
        bool external_driving;
-       Mutex glmutex;
+       std::mutex glmutex;
        long long  lastrendertime;
        void InternalRendering();
        void InitVertexBuffer(float  scalex,float scaley);
@@ -119,9 +106,6 @@ private:
 
        GLOsdShader osd_shader;
 
-
-
-
         /* BCM specific */
 
     uint32_t display_height;
@@ -131,7 +115,6 @@ private:
 
        uint32_t mode;
 
-
        EGLDisplay egl_display;
        EGLSurface egl_surface;
        EGLContext egl_context;
index 7e68201e299331e179ecb708beb1d85c25f8f7d0..64417883fb3234a85d1f703823476f2d2b726298 100644 (file)
@@ -48,8 +48,8 @@ EXTERNAL_PICTS
 
 OsdOpenVG::OsdOpenVG()
 {
-  vgmutex.Lock();
-  taskmutex.Lock();
+  vgmutex.lock();
+  taskmutex.lock();
   lastrendertime=getTimeMS();
   display_height=0;
   display_width=0;
@@ -111,8 +111,8 @@ OsdOpenVG::~OsdOpenVG()
          }
     }
 
-  vgmutex.Unlock();
-  taskmutex.Unlock();
+  vgmutex.unlock();
+  taskmutex.unlock();
 }
 
 
@@ -130,7 +130,7 @@ int OsdOpenVG::init()
 
    if (egl_display==EGL_NO_DISPLAY) {
           Log::getInstance()->log("OSD", Log::WARN, "Could not get egl display! %x",eglGetError());
-          vgmutex.Unlock();
+          vgmutex.unlock();
           return 0;
    }
 
@@ -138,7 +138,7 @@ int OsdOpenVG::init()
 
    if (eglInitialize(egl_display, NULL, NULL)==EGL_FALSE) {
           Log::getInstance()->log("OSD", Log::WARN, "Initialising display failed! %x",eglGetError());
-          vgmutex.Unlock();
+          vgmutex.unlock();
           return 0;
    }
 
@@ -152,7 +152,7 @@ int OsdOpenVG::init()
 
    if (eglBindAPI(EGL_OPENVG_API)==EGL_FALSE) {
           Log::getInstance()->log("OSD", Log::WARN, "Binding openvg api failed! %x",eglGetError());
-          vgmutex.Unlock();
+          vgmutex.unlock();
           return 0;
    }
 
@@ -168,7 +168,7 @@ int OsdOpenVG::init()
 
    if (eglChooseConfig(egl_display, attributs, &egl_ourconfig, 1, &number)==EGL_FALSE) {
           Log::getInstance()->log("OSD", Log::WARN, "Choosing egl config failed! %x",eglGetError());
-          vgmutex.Unlock();
+          vgmutex.unlock();
           return 0;
    }
 
@@ -177,7 +177,7 @@ int OsdOpenVG::init()
    egl_context=eglCreateContext(egl_display,egl_ourconfig,NULL,NULL);
    if (egl_context==EGL_NO_CONTEXT) {
           Log::getInstance()->log("OSD", Log::WARN, "Creating egl context failed! %x",eglGetError());
-          vgmutex.Unlock();
+          vgmutex.unlock();
           return 0;
    }
 
@@ -185,7 +185,7 @@ int OsdOpenVG::init()
    display_width=display_height=0;
    if (graphics_get_display_size(0, &display_width, &display_height)<0) {
           Log::getInstance()->log("OSD", Log::WARN, "Getting display size failed! (BCM API) ");
-          vgmutex.Unlock();
+          vgmutex.unlock();
           return 0;
    }
    Log::getInstance()->log("OSD", Log::NOTICE, "Displaysize is %d x %d ",display_width, display_height);
@@ -226,13 +226,13 @@ int OsdOpenVG::init()
    egl_surface = eglCreateWindowSurface(egl_display,egl_ourconfig, &nativewindow,NULL );
    if (egl_surface==EGL_NO_SURFACE) {
           Log::getInstance()->log("OSD", Log::WARN, "Creating egl window surface failed!");
-          vgmutex.Unlock();
+          vgmutex.unlock();
           return 0;
    }
    Log::getInstance()->log("OSD", Log::DEBUG, "Making egl current in1%d",syscall(SYS_gettid));
    if (eglMakeCurrent(egl_display, egl_surface, egl_surface, egl_context)== EGL_FALSE) {
           Log::getInstance()->log("OSD", Log::WARN, "Making egl Current failed");
-          vgmutex.Unlock();
+          vgmutex.unlock();
                   return 0;
    }
    // Test stuff
@@ -313,8 +313,8 @@ int OsdOpenVG::init()
 
 
   threadStart();
-  taskmutex.Unlock();
-  vgmutex.Unlock();
+  taskmutex.unlock();
+  vgmutex.unlock();
 
 #ifdef PICTURE_DECODER_OMX
     imageomx=new ImageOMX(&reader);
@@ -505,8 +505,8 @@ int OsdOpenVG::shutdown()
   processTasks();
   Log::getInstance()->log("OSD", Log::DEBUG, "shutdown mark3");
 
-  taskmutex.Lock();
-  vgmutex.Lock();
+  taskmutex.lock();
+  vgmutex.lock();
 
 
 
@@ -607,7 +607,7 @@ void OsdOpenVG::threadMethod()
 }
 
 void OsdOpenVG::InternalRendering(){
-       vgmutex.Lock();
+       vgmutex.lock();
        Colour bg=DrawStyle::WALLPAPER;
     float colclear[]={1.f,1.0f,1.f,1.f};
     if (bg.alpha==0) colclear[3]=0.f;
@@ -620,7 +620,7 @@ void OsdOpenVG::InternalRendering(){
 
        //Show it to the user!
        eglSwapBuffers(egl_display, egl_surface);
-       vgmutex.Unlock();
+       vgmutex.unlock();
 
 }
 
@@ -1344,38 +1344,38 @@ unsigned int OsdOpenVG::handleTask(OpenVGCommand& command)
 bool OsdOpenVG::processTasks()
 {
        bool worked=false;
-       taskmutex.Lock();
-       vgmutex.Lock();
+       taskmutex.lock();
+       vgmutex.lock();
        while (vgcommands.size()>0)
        {
                OpenVGCommand comm=vgcommands.front();
                vgcommands.pop_front();
-               taskmutex.Unlock();
+               taskmutex.unlock();
 
                OpenVGResponse resp;
                resp.result=handleTask(comm);
                resp.id=comm.id;
-               taskmutex.Lock();
+               taskmutex.lock();
                if (comm.id) {
                        vgresponses.push_back(resp);
                }
-               taskmutex.Unlock();
-               vgmutex.Unlock();
+               taskmutex.unlock();
+               vgmutex.unlock();
                //threadCheckExit();
                vgtaskSignal.signal();
-               taskmutex.Lock();
-               vgmutex.Lock();
+               taskmutex.lock();
+               vgmutex.lock();
                worked=true;
        }
-       taskmutex.Unlock();
-       vgmutex.Unlock();
+       taskmutex.unlock();
+       vgmutex.unlock();
 
        return worked;
 }
 
 bool OsdOpenVG::haveOpenVGResponse(unsigned int id,unsigned int * resp)
 {
-       taskmutex.Lock();
+       taskmutex.lock();
        if (vgresponses.size()>0)
        {
                std::deque<OpenVGResponse>::iterator itty=vgresponses.begin();
@@ -1383,20 +1383,20 @@ bool OsdOpenVG::haveOpenVGResponse(unsigned int id,unsigned int * resp)
                {
                        if ((*itty).id==id) {
                                *resp=(*itty).result;
-                               taskmutex.Unlock();
+                               taskmutex.unlock();
                                return true;
                        }
                        itty++;
                }
        }
-       taskmutex.Unlock();
+       taskmutex.unlock();
        return false;
 }
 
 
 unsigned int  OsdOpenVG::putOpenVGCommand(OpenVGCommand& comm,bool wait)
 {
-       taskmutex.Lock();
+       taskmutex.lock();
        if (wait){
                comm.id=wait_id;
                wait_id++;
@@ -1404,7 +1404,7 @@ unsigned int  OsdOpenVG::putOpenVGCommand(OpenVGCommand& comm,bool wait)
                comm.id=0; // we are not waiting
        }
        vgcommands.push_back(comm);
-       taskmutex.Unlock();
+       taskmutex.unlock();
        threadSignal();
        while (wait) {
                unsigned int resp;
index 4a293ab27d742998aba82fae7cab8fb0b0e39f96..07428219a96413c8967222813d366506b7690584 100644 (file)
     GNU General Public License for more details.
 
     You should have received a copy of the GNU General Public License
-    along with VOMP; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+    along with VOMP.  If not, see <https://www.gnu.org/licenses/>.
 */
 
 #ifndef OSDOPENVG_H
 #define OSDOPENVG_H
 
 #include <stdio.h>
-
+#include <mutex>
 
 #include <EGL/egl.h>
 #include <EGL/eglext.h>
@@ -35,7 +34,6 @@
 #include "defines.h"
 #include "log.h"
 #include "threadp.h"
-#include "mutex.h"
 #include "signal.h"
 #include "videoomx.h"
 #include "staticartwork.h"
@@ -134,8 +132,8 @@ protected:
 
 
 
-    Mutex vgmutex;
-    Mutex taskmutex;
+    std::mutex vgmutex;
+    std::mutex taskmutex;
     Signal vgtaskSignal;
     std::deque<OpenVGCommand> vgcommands;
     std::deque<OpenVGResponse> vgresponses;
index a0b44b6479ac13f2a2f612d87b73e4c0677755f3..b0bd6e14c31e9c4e458b4dccda27d68c4f6906cf 100644 (file)
@@ -14,8 +14,7 @@
     GNU General Public License for more details.
 
     You should have received a copy of the GNU General Public License
-    along with VOMP; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+    along with VOMP.  If not, see <https://www.gnu.org/licenses/>.
 */
 
 #include "osdvector.h"
@@ -169,7 +168,7 @@ void OsdVector::Blank()
 int OsdVector::restore()
 {
        // First clear the contents of all registered surfaces
-       surfaces_mutex.Lock();
+       surfaces_mutex.lock();
 
        //Now go through all surfaces and draw them
        std::list<SurfaceCommands>::iterator curdraw=scommands.begin();
@@ -193,13 +192,13 @@ int OsdVector::restore()
        tvmedias_load_inv.clear();
        tvmedias_loaded.clear();
 
-       surfaces_mutex.Unlock();
+       surfaces_mutex.unlock();
        return 1;
 }
 
 void OsdVector::drawSurfaces()
 {
-       surfaces_mutex.Lock();
+       surfaces_mutex.lock();
        std::list<SurfaceCommands*> todraw; //First figure out if a surfaces is below another surface
        std::list<SurfaceCommands>::iterator itty1=scommands.begin();
        while (itty1!=scommands.end()) {
@@ -251,13 +250,13 @@ void OsdVector::drawSurfaces()
                curdraw++;
        }
 
-       surfaces_mutex.Unlock();
+       surfaces_mutex.unlock();
 }
 
 void OsdVector::updateOrAddSurface(const SurfaceVector *surf,float x,float y,float height,float width,
                        std::vector<SVGCommand>& commands)
 {
-       surfaces_mutex.Lock();
+       surfaces_mutex.lock();
        //First determine it is already in our system
        std::list<SurfaceCommands>::iterator itty=scommands.begin();
        while (itty!=scommands.end()) {
@@ -304,12 +303,12 @@ void OsdVector::updateOrAddSurface(const SurfaceVector *surf,float x,float y,flo
        referenceSVGCommand((*itty).commands);
        cleanupOrphanedRefs();
 
-       surfaces_mutex.Unlock();
+       surfaces_mutex.unlock();
 }
 
 void OsdVector::removeSurface(const SurfaceVector *surf)
 {
-       surfaces_mutex.Lock();
+       surfaces_mutex.lock();
        //First determine it is already in our system
        std::list<SurfaceCommands>::iterator itty=scommands.begin();
        while (itty!=scommands.end()) {
@@ -321,7 +320,7 @@ void OsdVector::removeSurface(const SurfaceVector *surf)
                }
                itty++;
        }
-       surfaces_mutex.Unlock();
+       surfaces_mutex.unlock();
 
 }
 
@@ -370,13 +369,13 @@ void OsdVector::removeImageRef(const ImageIndex ref)
 
 int OsdVector::getLoadIndexRef(LoadIndex index)
 {
-       surfaces_mutex.Lock();
+       surfaces_mutex.lock();
        if (loadindex_ref.find(index)==loadindex_ref.end()) {
                return -1;
        } else {
                return loadindex_ref[index];
        }
-       surfaces_mutex.Unlock();
+       surfaces_mutex.unlock();
 }
 
 void OsdVector::incLoadIndexRef(LoadIndex index)
@@ -503,13 +502,13 @@ void OsdVector::cleanupOrphanedRefs()
 
 int OsdVector::getImageRef(ImageIndex index)
 {
-       surfaces_mutex.Lock();
+       surfaces_mutex.lock();
        if (images_ref.find(index)==images_ref.end()) {
                return -1;
        } else {
                return images_ref[index];
        }
-       surfaces_mutex.Unlock();
+       surfaces_mutex.unlock();
 }
 
 void OsdVector::incStyleRef(VectorHandle index)
@@ -540,7 +539,7 @@ void OsdVector::removeStyleRef(VectorHandle index)
 
 VectorHandle OsdVector::getStyleRef(const DrawStyle &c)
 {
-       surfaces_mutex.Lock();
+       surfaces_mutex.lock();
        VectorHandle style_handle = 0;
        if (!styles_lastit_valid || (*styles_lastit).first!=c) {
                styles_lastit_valid=false;
@@ -549,9 +548,9 @@ VectorHandle OsdVector::getStyleRef(const DrawStyle &c)
 
        if (styles_lastit==styles.end())
        {
-               surfaces_mutex.Unlock();
+               surfaces_mutex.unlock();
                style_handle=createStyleRef(c);
-               surfaces_mutex.Lock();
+               surfaces_mutex.lock();
                styles_lastit = styles.insert(std::pair<DrawStyle, VectorHandle>(c, style_handle)).first;
        } else {
 
@@ -564,15 +563,15 @@ VectorHandle OsdVector::getStyleRef(const DrawStyle &c)
 
                if (styles_ref_lastit==styles_ref.end()) {
                        //invalid handle recreate
-                       surfaces_mutex.Unlock();
+                       surfaces_mutex.unlock();
                        style_handle=createStyleRef(c);
-                       surfaces_mutex.Lock();
+                       surfaces_mutex.lock();
                        (*styles_lastit).second=style_handle;
                } else styles_ref_lastit_valid=true;
        }
        styles_lastit_valid=true;
        incStyleRef(style_handle);
-       surfaces_mutex.Unlock();
+       surfaces_mutex.unlock();
        return style_handle;
 }
 
@@ -596,7 +595,7 @@ LoadIndex OsdVector::getTVMediaRef(TVMediaInfo& tvmedia, ImageIndex& image)
 {
        ImageIndex image_handle=0;
        LoadIndex loadindex=0;
-       surfaces_mutex.Lock();
+       surfaces_mutex.lock();
        if (tvmedias.find(tvmedia)==tvmedias.end())
        {
                loadindex=loadTVMedia(tvmedia);
@@ -613,7 +612,7 @@ LoadIndex OsdVector::getTVMediaRef(TVMediaInfo& tvmedia, ImageIndex& image)
        /*tvmedias[tvmedia]=createTVMedia(tvmedia,width,height);
        incImageRef(image_handle);*/
        image=image_handle;
-       surfaces_mutex.Unlock();
+       surfaces_mutex.unlock();
        return loadindex;
 }
 
@@ -664,7 +663,7 @@ void OsdVector::informPicture(LoadIndex index, ImageIndex imageIndex)
        ImageIndex image_index=0;
 
        Log::getInstance()->log("OsdVector", Log::DEBUG, "TVMedia Picture for request id %llx arrived %x",index, imageIndex);
-       surfaces_mutex.Lock();
+       surfaces_mutex.lock();
        TVMediaInfo tvmedia=tvmedias_load_inv[index];
        if (imageIndex) {
                std::map<LoadIndex,int>::iterator itty=loadindex_ref.find(index);
@@ -681,7 +680,7 @@ void OsdVector::informPicture(LoadIndex index, ImageIndex imageIndex)
                        incImageRef(image_index); // hold one index until all loadings refs are gone;
                }
        }
-       surfaces_mutex.Unlock();
+       surfaces_mutex.unlock();
 
 
 }
@@ -713,25 +712,25 @@ ImageIndex OsdVector::getJpegRef(const char* fileName, int *width,int *height)
 ImageIndex OsdVector::getMonoBitmapRef(void *base,int width,int height)
 {
        ImageIndex image_handle;
-       surfaces_mutex.Lock();
+       surfaces_mutex.lock();
        if (monobitmaps.find(base)==monobitmaps.end())
        {
-               surfaces_mutex.Unlock();
+               surfaces_mutex.unlock();
                image_handle=createMonoBitmap(base,width,height);
-               surfaces_mutex.Lock();
+               surfaces_mutex.lock();
                monobitmaps[base]=image_handle;
        } else {
                image_handle=monobitmaps[base];
                if (images_ref.find(image_handle)==images_ref.end()) {
                        //invalid handle recreate
-                       surfaces_mutex.Unlock();
+                       surfaces_mutex.unlock();
                        image_handle=createMonoBitmap(base,width,height);
-                       surfaces_mutex.Lock();
+                       surfaces_mutex.lock();
                        monobitmaps[base]=image_handle;
                }
        }
        incImageRef(image_handle);
-       surfaces_mutex.Unlock();
+       surfaces_mutex.unlock();
        return image_handle;
 }
 
@@ -739,23 +738,23 @@ ImageIndex  OsdVector::getImagePalette(int width,int height,const unsigned char
 {
        ImageIndex image_handle;
        image_handle=createImagePalette(width,height,image_data,palette_data);
-       surfaces_mutex.Lock();
+       surfaces_mutex.lock();
        palettepics.push_back(image_handle);
        incImageRef(image_handle);
-       surfaces_mutex.Unlock();
+       surfaces_mutex.unlock();
        return image_handle;
 }
 
 OsdVector::PictureReader::~PictureReader()
 {
-       decoders_lock.Lock();
+       decoders_lock.lock();
        while ( decoders.size()) {
                PictureDecoder* dec=decoders.front();
                decoders.pop_front();
                delete dec;
        }
 
-       decoders_lock.Unlock();
+       decoders_lock.unlock();
 }
 
 void OsdVector::PictureReader::init()
@@ -772,15 +771,15 @@ void OsdVector::PictureReader::shutdown()
 
 void OsdVector::PictureReader::addDecoder(PictureDecoder* decoder)
 {
-       decoders_lock.Lock();
+       decoders_lock.lock();
        decoder->init();
        decoders.push_front(decoder);
-       decoders_lock.Unlock();
+       decoders_lock.unlock();
 }
 
 void OsdVector::PictureReader::removeDecoder(PictureDecoder* decoder)
 {
-       decoders_lock.Lock();
+       decoders_lock.lock();
        std::list<PictureDecoder*>::iterator itty=decoders.begin();
        while (itty!=decoders.end()) {
                if ((*itty) == decoder)
@@ -793,7 +792,7 @@ void OsdVector::PictureReader::removeDecoder(PictureDecoder* decoder)
        Log::getInstance()->log("OsdVector", Log::DEBUG, "removeDecoder");
        decoder->shutdown();
        delete decoder;
-       decoders_lock.Unlock();
+       decoders_lock.unlock();
 }
 
 void OsdVector::PictureReader::threadMethod()
@@ -811,7 +810,7 @@ void OsdVector::PictureReader::threadMethod()
                {
                        todos=false;
                        PictureInfo pictinf;
-                       decoders_lock.Lock();
+                       decoders_lock.lock();
                        std::list<PictureDecoder*>::iterator itty=decoders.begin();
 
                        while (itty!=decoders.end()) {
@@ -827,7 +826,7 @@ void OsdVector::PictureReader::threadMethod()
                                todos = true;
                        }
 
-                       decoders_lock.Unlock();
+                       decoders_lock.unlock();
                }
                //Log::getInstance()->log("OsdVector", Log::DEBUG, "TVMedia Sleep Picture Reader");
 
@@ -848,33 +847,33 @@ void OsdVector::PictureReader::threadMethod()
 
 void OsdVector::PictureReader::invalidateLoadIndex(LoadIndex index)
 {
-       pict_lock_incoming.Lock();
+       pict_lock_incoming.lock();
        invalid_loadindex.insert(index);
-       pict_lock_incoming.Unlock();
+       pict_lock_incoming.unlock();
 }
 
 void OsdVector::PictureReader::informFallback(LoadIndex index, int fallback)
 {
-       pict_lock_incoming.Lock();
+       pict_lock_incoming.lock();
        inform_fallback[index]=fallback;
-       pict_lock_incoming.Unlock();
+       pict_lock_incoming.unlock();
 }
 
 void OsdVector::PictureReader::receivePicture(VDR_ResponsePacket *vresp)
 {
-       pict_lock_incoming.Lock();
+       pict_lock_incoming.lock();
        pict_incoming.push(vresp);
-       pict_lock_incoming.Unlock();
+       pict_lock_incoming.unlock();
        threadSignal();
 }
 
 
 void OsdVector::PictureReader::addStaticImage(unsigned int id)
 {
-       pict_lock_incoming.Lock();
+       pict_lock_incoming.lock();
        pict_incoming_static.push(id);
        invalid_loadindex.erase(((long long) id) << 32LL);
-       pict_lock_incoming.Unlock();
+       pict_lock_incoming.unlock();
        threadSignal();
 }
 
@@ -887,7 +886,7 @@ bool OsdVector::PictureReader::processReceivedPictures()
 {
        bool decoded = false;
        bool valid = true;
-       pict_lock_incoming.Lock();
+       pict_lock_incoming.lock();
     if (pict_incoming.size()) {
                VDR_ResponsePacket *vresp=pict_incoming.front();
                pict_incoming.pop();
@@ -896,7 +895,7 @@ bool OsdVector::PictureReader::processReceivedPictures()
                        valid = false;
                        invalid_loadindex.erase(setpos);
                }
-               pict_lock_incoming.Unlock();
+               pict_lock_incoming.unlock();
                if (!valid) { // we do not want it anymore skip it;
                        delete vresp;
                        return true;
@@ -915,11 +914,11 @@ bool OsdVector::PictureReader::processReceivedPictures()
                        freed = true;
                } else {
                        int fallback=-1;
-                       pict_lock_incoming.Lock();
+                       pict_lock_incoming.lock();
                        if (inform_fallback.find(vresp->getStreamID())!=inform_fallback.end()) {
                                fallback=inform_fallback[vresp->getStreamID()];
                        }
-                       pict_lock_incoming.Unlock();
+                       pict_lock_incoming.unlock();
                        if (fallback >= 0 && ((OsdVector*)Osd::getInstance())->getStaticImageData(fallback, &userdata, &length))
                        {
                                decode = true;
@@ -941,9 +940,9 @@ bool OsdVector::PictureReader::processReceivedPictures()
                                free(userdata);
                        }
                }
-               pict_lock_incoming.Lock();
+               pict_lock_incoming.lock();
                inform_fallback.erase(vresp->getStreamID());
-               pict_lock_incoming.Unlock();
+               pict_lock_incoming.unlock();
                //else  osd->informPicture(vresp->getStreamID(), 0);
                delete vresp;
        } else if (pict_incoming_static.size()){
@@ -954,7 +953,7 @@ bool OsdVector::PictureReader::processReceivedPictures()
                        valid = false;
                        invalid_loadindex.erase(setpos);
                }
-               pict_lock_incoming.Unlock();
+               pict_lock_incoming.unlock();
                if (!valid) { // we do not want it anymore skip it;
                        return true;
                }
@@ -973,7 +972,7 @@ bool OsdVector::PictureReader::processReceivedPictures()
                        }
                }
        } else {
-               pict_lock_incoming.Unlock();
+               pict_lock_incoming.unlock();
        }
 
 
index 411203e6b7d92ecbd83790d9751bce53800dc438..a4c165b259847071c775c7b07134351db95e2882 100644 (file)
 
 #ifndef OSDVECTOR_H
 #define OSDVECTOR_H
-#include "osd.h"
-#include "mutex.h"
-#include "colour.h"
 #include <set>
 #include <list>
 #include <vector>
 #include <map>
 #include <queue>
 #include <string>
+#include <mutex>
+
+#include "osd.h"
+#include "colour.h"
 #include "tvmedia.h"
 #include "vdr.h"
 
@@ -325,8 +326,8 @@ class OsdVector : public Osd
 
        void threadMethod();
 
-       Mutex pict_lock_incoming; //locks
-       Mutex decoders_lock;
+       std::mutex pict_lock_incoming; //locks
+       std::mutex decoders_lock;
        std::queue<VDR_ResponsePacket*> pict_incoming;
        std::queue<unsigned int> pict_incoming_static;
        std::list<PictureDecoder*> decoders;
@@ -402,7 +403,7 @@ protected:
 
        std::list<SurfaceCommands> scommands;
 
-       Mutex surfaces_mutex;
+       std::mutex surfaces_mutex;
 
        float byte_char_width[256];
 
index f7aab50375d2735558771fdfa1e45a644ca2aa45..f9ef386788696286d13464b20c86180e2e330b14 100644 (file)
@@ -291,7 +291,7 @@ int OsdWinVector::init()
 
 
 
-  queuemutex.Lock();
+  queuemutex.lock();
 
   HRESULT hres;
   DXGI_SURFACE_DESC  surf_desc;
@@ -325,14 +325,14 @@ int OsdWinVector::init()
                  D3DPOOL_DEFAULT, &surfinfo.surf9, &surfinfo.sharedhandle);
          if (hres != S_OK) {
                  Log::getInstance()->log("OSD", Log::WARN, "Could not create Texture for Direct3D9 !");
-                 queuemutex.Unlock();
+                 queuemutex.unlock();
                  return 0;
          }
 
          hres = d3ddevice->CreateQuery(D3DQUERYTYPE_EVENT, &surfinfo.query9);
          if (hres != S_OK) {
                  Log::getInstance()->log("OSD", Log::WARN, "Could not create Query for Direct3D9 !");
-                 queuemutex.Unlock();
+                 queuemutex.unlock();
                  return 0;
          }
 
@@ -343,14 +343,14 @@ int OsdWinVector::init()
          hres = d3ddevice10->OpenSharedResource(surfinfo.sharedhandle, __uuidof(ID3D10Resource), (void**)&tempres);
          if (hres != S_OK) {
                  Log::getInstance()->log("OSD", Log::WARN, "Could not open resourcee for Direct3D10 !");
-                 queuemutex.Unlock();
+                 queuemutex.unlock();
                  return 0;
          }
 
          hres = tempres->QueryInterface(__uuidof(ID3D10Texture2D), (void**)&surfinfo.surf10);
          if (hres != S_OK) {
                  Log::getInstance()->log("OSD", Log::WARN, "Could not query surface for Direct3D10 !");
-                 queuemutex.Unlock();
+                 queuemutex.unlock();
                  return 0;
          }
          tempres->Release();
@@ -359,14 +359,14 @@ int OsdWinVector::init()
          hres = surfinfo.surf10->QueryInterface(__uuidof(IDXGISurface), (void**)&surfinfo.surfdxgi);
          if (hres != S_OK) {
                  Log::getInstance()->log("OSD", Log::WARN, "Could not query surface for DXGI !");
-                 queuemutex.Unlock();
+                 queuemutex.unlock();
                  return 0;
          }
 
          hres = d2dfactory->CreateDxgiSurfaceRenderTarget(surfinfo.surfdxgi, &rt_prop, &surfinfo.rendtarget2D);
          if (hres != S_OK) {
                  Log::getInstance()->log("OSD", Log::WARN, "Could not create render target!");
-                 queuemutex.Unlock();
+                 queuemutex.unlock();
                  return 0;
          }
 
@@ -383,7 +383,7 @@ int OsdWinVector::init()
          hres = d3ddevice10->CreateQuery(&qdesc, &surfinfo.query10);
          if (hres != S_OK) {
                  Log::getInstance()->log("OSD", Log::WARN, "Could not create Query for Direct2D Direct3D10 !");
-                 queuemutex.Unlock();
+                 queuemutex.unlock();
                  return 0;
          }
          allsurfs.push_back(surfinfo);
@@ -392,7 +392,7 @@ int OsdWinVector::init()
   aspect_correction = ((float)OSD_BUFFER_HEIGHT) / 576.f / (((float)OSD_BUFFER_WIDTH) / 720.f);
 
   
-  queuemutex.Unlock();
+  queuemutex.unlock();
 
   initPaths();
 
@@ -415,7 +415,7 @@ int OsdWinVector::shutdown()
   destroyPaths();
 
 
-  queuemutex.Lock();
+  queuemutex.lock();
   if (currentosd_render.surf9) {
          currentosd_render.surf9 = NULL;
   }
@@ -477,7 +477,7 @@ int OsdWinVector::shutdown()
   while (d3dtod2d.size()) d3dtod2d.pop();
   while (d2dtod3d.size()) d2dtod3d.pop();
 
-  queuemutex.Unlock();
+  queuemutex.unlock();
 
 
 
@@ -1088,7 +1088,7 @@ bool OsdWinVector::screenShot(void *buffer, int width, int height, bool osd /*in
 
 LPDIRECT3DTEXTURE9 OsdWinVector::getNextOsdTexture()
 {
-       queuemutex.Lock();
+       queuemutex.lock();
        if (d2dtod3d.size())
        {
                SurfaceInfo surfinfo = d2dtod3d.front();
@@ -1103,7 +1103,7 @@ LPDIRECT3DTEXTURE9 OsdWinVector::getNextOsdTexture()
                        d2dtod3d.pop();
                //}
        }
-       queuemutex.Unlock();
+       queuemutex.unlock();
        
        return currentosd_render.surf9;
 }
@@ -1111,7 +1111,7 @@ LPDIRECT3DTEXTURE9 OsdWinVector::getNextOsdTexture()
 void  OsdWinVector::updateOsd()
 {
 
-       queuemutex.Lock();      
+       queuemutex.lock();
        if (d3dtod2d.size())
        {
                currentosd_backbuffer = d3dtod2d.front();
@@ -1119,7 +1119,7 @@ void  OsdWinVector::updateOsd()
                if (currentosd_backbuffer.query9->GetData(NULL, 0, 0) == S_OK) {
                        
 
-                       //queuemutex.Unlock();
+                       //queuemutex.unlock();
                        currentosd_backbuffer.query10->Begin();
                
                        currentosd_backbuffer.rendtarget2D->BeginDraw();
@@ -1139,7 +1139,7 @@ void  OsdWinVector::updateOsd()
                        d3ddevice10->Flush();
                        currentosd_backbuffer.query10->End();
 
-                       //queuemutex.Lock();
+                       //queuemutex.lock();
                        d3dtod2d.pop();
                        d2dtod3d.push(currentosd_backbuffer);
                                
@@ -1147,29 +1147,29 @@ void  OsdWinVector::updateOsd()
 
        }
        
-       queuemutex.Unlock();
+       queuemutex.unlock();
 
 }
 
 ID2D1RenderTarget * OsdWinVector::LockOsdDrawing()
 {
-       queuemutex.Lock();
+       queuemutex.lock();
        if (d3dtod2d.size())
        {
                currentosd_backbuffer=d3dtod2d.front();
                return currentosd_backbuffer.rendtarget2D;
        }
-       queuemutex.Unlock();
+       queuemutex.unlock();
 
        int loop = 0;
        while (loop < 100) {
-               queuemutex.Lock();
+               queuemutex.lock();
                if (d3dtod2d.size())
                {
                        currentosd_backbuffer = d3dtod2d.front();
                        return currentosd_backbuffer.rendtarget2D;
                }
-               queuemutex.Unlock();
+               queuemutex.unlock();
 
                MILLISLEEP(100);
                loop++;
@@ -1182,7 +1182,7 @@ ID2D1RenderTarget * OsdWinVector::LockOsdDrawing()
 }
 void OsdWinVector::UnlockOsdDrawing()
 {
-       queuemutex.Unlock();
+       queuemutex.unlock();
 }
 
 void OsdWinVector::lostDestroyObjects()
index b04621462d3c1869339325ac3f054435ca4dfee9..9a72ca938c50cb297edc7fca231a4472ee7bba5e 100644 (file)
     GNU General Public License for more details.
 
     You should have received a copy of the GNU General Public License
-    along with VOMP; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+    along with VOMP.  If not, see <https://www.gnu.org/licenses/>.
 */
 
 #ifndef OSDWINVECTOR_H
 #define OSDWINVECTOR_H
 
 #include <stdio.h>
-
-#include "osdvector.h"
-#include "defines.h"
-#include "log.h"
-#include "windowsosd.h"
-#include "mutex.h"
 #include <d3d10_1.h>
 #include <d2d1.h>
 #include <dwrite.h>
 #include <queue>
 #include <list>
+#include <mutex>
+
+#include "osdvector.h"
+#include "defines.h"
+#include "log.h"
+#include "windowsosd.h"
 
 
 
@@ -128,7 +127,7 @@ protected:
        ID2D1RenderTarget * LockOsdDrawing();
        void UnlockOsdDrawing();
 
-       Mutex queuemutex;
+       std::mutex queuemutex;
 
        void initPaths();
        void destroyPaths();
index c1745c03fcbb942a8bb54efa84cd8d642f62dfff..ed8fb3c76eea27e557e1a7c7f7d85e11a12d6408 100644 (file)
@@ -14,8 +14,7 @@
     GNU General Public License for more details.
 
     You should have received a copy of the GNU General Public License
-    along with VOMP; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+    along with VOMP.  If not, see <https://www.gnu.org/licenses/>.
 */
 
 #include <stdlib.h>
@@ -40,19 +39,19 @@ SurfaceOpenGL::SurfaceOpenGL(int id)
   data=NULL;
   sheight=swidth=0;
 //  fastdraw=false;
-  srf_mutex.Lock();
+  srf_mutex.lock();
 }
 
 SurfaceOpenGL::~SurfaceOpenGL()
 {
-       srf_mutex.Lock();
+       srf_mutex.lock();
        if (data) {
                free(data);
                data=NULL;
        } else {
                glDeleteTextures(1,&gltexture);
        }
-       srf_mutex.Unlock();
+       srf_mutex.unlock();
 }
 
 int SurfaceOpenGL::create(UINT width, UINT height)
@@ -85,7 +84,7 @@ int SurfaceOpenGL::create(UINT width, UINT height)
 
 
        //osd->EndPainting();
-       srf_mutex.Unlock();
+       srf_mutex.unlock();
        return 1;
 }
 
@@ -94,12 +93,12 @@ void SurfaceOpenGL::display()
 }
 
 int SurfaceOpenGL::fillblt(int x, int y, int width, int height, const DrawStyle& c) {
-       srf_mutex.Lock();
+       srf_mutex.lock();
        //since this might be called before surface
        //allocation we will wait in this case, hopefully without deadlocks
        if (screen == this || !data ) {
                //This should not happen!
-               srf_mutex.Unlock();
+               srf_mutex.unlock();
                return 0;
 
        }
@@ -110,7 +109,7 @@ int SurfaceOpenGL::fillblt(int x, int y, int width, int height, const DrawStyle&
         glViewport(0,0,swidth,sheight);*/
 
        //osd->EndPainting();
-       srf_mutex.Unlock();
+       srf_mutex.unlock();
 
        unsigned int my_c=InternalColour(c.rgba());
 
@@ -140,11 +139,11 @@ int SurfaceOpenGL::fillblt(int x, int y, int width, int height, const DrawStyle&
 
 
 void SurfaceOpenGL::startFastDraw(){
-       srf_mutex.Lock();
+       srf_mutex.lock();
 
 }
 void SurfaceOpenGL::endFastDraw(){
-       srf_mutex.Unlock();
+       srf_mutex.unlock();
  }
 
 void SurfaceOpenGL::drawPixel(int x, int y, Colour & colour, bool fastdraw) {
@@ -167,7 +166,7 @@ void SurfaceOpenGL::drawPixel(int x, int y, unsigned int c, bool fastdraw) {
        }
        //OsdWin* osd;
        if (!fastdraw) {
-               srf_mutex.Lock(); //since this might be called before surface
+               srf_mutex.lock(); //since this might be called before surface
        }
        //allocation we will wait in this case, hopefully without deadlocks
 
@@ -183,7 +182,7 @@ void SurfaceOpenGL::drawPixel(int x, int y, unsigned int c, bool fastdraw) {
        row[0] = my_c;
 
        if (!fastdraw) {
-               srf_mutex.Unlock(); //since this might be called before surface
+               srf_mutex.unlock(); //since this might be called before surface
        }
 
 }
@@ -211,7 +210,7 @@ void SurfaceOpenGL::drawBitmap(int x, int y, const Bitmap& bm,const DisplayRegio
 int SurfaceOpenGL::updateToScreen(int sx, int sy, int w, int h, int dx, int dy) // FIXME new, replace others with this FIXME
 {
 //     Log::getInstance()->log("Surface", Log::WARN, "UTS Mark1");
-       srf_mutex.Lock();//since this might be called before surface
+       srf_mutex.lock();//since this might be called before surface
   //allocation we will wait in this case, hopefully without deadlocks
 
   OsdOpenGL* osd=((OsdOpenGL*)(Osd::getInstance()));
@@ -233,7 +232,7 @@ int SurfaceOpenGL::updateToScreen(int sx, int sy, int w, int h, int dx, int dy)
 
   osd->EndPainting();
 
-  srf_mutex.Unlock();
+  srf_mutex.unlock();
 
   return 0;
 }
index 88ba56a4004dcf953ac6876ab0201d7e75115c39..a3bec72be8532e95b5daf60eb35cc177928453ad 100644 (file)
     GNU General Public License for more details.
 
     You should have received a copy of the GNU General Public License
-    along with VOMP; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+    along with VOMP.  If not, see <https://www.gnu.org/licenses/>.
 */
 
 #ifndef SURFACEOPENGL_H
 #define SURFACEOPENGL_H
 
+#include <GLES2/gl2.h>
+#include <mutex>
+
 #include "defines.h"
 #include "surface.h"
-#include "mutex.h"
-#include <GLES2/gl2.h>
 
 class SurfaceOpenGL : public Surface
 {
@@ -62,7 +62,7 @@ class SurfaceOpenGL : public Surface
 
 
 
-    Mutex srf_mutex;
+    std::mutex srf_mutex;
   protected:
     void drawPixel(int x, int y, Colour& c, bool fastdraw=false);
     void drawPixel(int x, int y, unsigned int c, bool fastdraw=false);
index 52b19ecb44d5e8de3dac88794105054301ca35cb..a4c544c1043331f398ec357aaa10e25418a2c9ac 100644 (file)
     GNU General Public License for more details.
 
     You should have received a copy of the GNU General Public License
-    along with VOMP; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+    along with VOMP.  If not, see <https://www.gnu.org/licenses/>.
 */
 
-#include "surfacevector.h"
-#include "bitmap.h"
-#include "staticartwork.h"
 #include <wchar.h>
 #include <stdlib.h>
 #include <math.h>
+#include "bitmap.h"
+#include "staticartwork.h"
+#include "surfacevector.h"
 
 SurfaceVector::SurfaceVector(OsdVector* vosd)
 {
@@ -72,7 +71,7 @@ int SurfaceVector::drawText(const char* text, int x, int y, int width, const Dra
        size_t length=strlen(text);
 
        
-       command_mutex.Lock();
+       command_mutex.lock();
        
        VectorHandle ref=osd->getStyleRef(c);
        float *charwidtharray=osd->getCharWidthArray();
@@ -97,7 +96,7 @@ int SurfaceVector::drawText(const char* text, int x, int y, int width, const Dra
                length -= num_bytes;
                run += num_bytes;
                if (shift>width && width >0) {
-                       command_mutex.Unlock();
+                       command_mutex.unlock();
                        return 1;
                }
                num_bytes=mbrtowc(&tempo, run, length, &state);
@@ -119,7 +118,7 @@ int SurfaceVector::drawText(const char* text, int x, int y, int width, const Dra
 #endif
 
        commands.resize(commands_size+chars);
-       command_mutex.Unlock();
+       command_mutex.unlock();
        return 1;
 
 }
@@ -208,16 +207,16 @@ void SurfaceVector::drawJpeg(const char *fileName,int x, int y,int *width, int *
 /*
 void SurfaceVector::drawJpeg(const char *fileName,int x, int y,int *width, int *height)
 {
-       command_mutex.Lock();
+       command_mutex.lock();
        ImageIndex image=osd->getJpegRef(fileName,width,height);
        commands.push_back(SVGCommand::PaintImage(x,y,*width,*height,image,0));
-       command_mutex.Unlock();
+       command_mutex.unlock();
 }
 */
 
 void SurfaceVector::drawTVMedia(TVMediaInfo & tvmedia,float x, float y, float  width, float height, Corner corner)
 {
-       command_mutex.Lock();
+       command_mutex.lock();
        ImageIndex image=0;
        LoadIndex load_index=osd->getTVMediaRef(tvmedia,image);
        if (width!=0 && height!=0) {
@@ -231,14 +230,14 @@ void SurfaceVector::drawTVMedia(TVMediaInfo & tvmedia,float x, float y, float  w
                commands.push_back(SVGCommand::PaintImageLoading(load_index,x,y,width,height,0,corner));
                //Log::getInstance()->log("SurfaceVector", Log::DEBUG, "TVMedia Add instru image loading %d %d", load_index,image);
        }
-       command_mutex.Unlock();
+       command_mutex.unlock();
 }
 
 void SurfaceVector::drawClippingRectangle(float x, float y, float w, float h)
 {
-       command_mutex.Lock();
+       command_mutex.lock();
        commands.push_back(SVGCommand::PaintClipping((float)x,(float)y,(float)w,(float)h));
-       command_mutex.Unlock();
+       command_mutex.unlock();
 }
 
 int SurfaceVector::create(UINT width, UINT height)
@@ -254,33 +253,33 @@ void SurfaceVector::display()
 
 int SurfaceVector::fillblt(int x, int y, int width, int height, const DrawStyle& c)
 {
-       command_mutex.Lock();
+       command_mutex.lock();
        removeCommands(x,y,width,height); // remove commands below the box
        VectorHandle ref=osd->getStyleRef(c);
        commands.push_back(SVGCommand::PaintPath(x,y,width,height,PIRectangle,ref));
-       command_mutex.Unlock();
+       command_mutex.unlock();
        return 1;
 
 }
 void SurfaceVector::drawHorzLine(int x1, int x2, int y, const DrawStyle& c)
 {
-       command_mutex.Lock();
+       command_mutex.lock();
        VectorHandle ref = osd->getStyleRef(c);
        commands.push_back(SVGCommand::PaintPath(x1,y,x2-x1,1,PIHorzLine,ref));
-       command_mutex.Unlock();
+       command_mutex.unlock();
 }
 
 void SurfaceVector::drawVertLine(int x, int y1, int y2, const DrawStyle& c){
-       command_mutex.Lock();
+       command_mutex.lock();
        VectorHandle ref = osd->getStyleRef(c);
        commands.push_back(SVGCommand::PaintPath(x,y1,1,y2-y1,PIVertLine,ref));
-       command_mutex.Unlock();
+       command_mutex.unlock();
 }
 
 void SurfaceVector::drawBitmap(int x, int y, const Bitmap& bm,const DisplayRegion & region)
 {
        //this is complicated
-       command_mutex.Lock();
+       command_mutex.lock();
 /*
        unsigned int * data=(unsigned int*)malloc(sizeof(unsigned int)*bm.getWidth()*bm.getHeight());
        for (UINT j = 0; j < bm.getHeight(); ++j){
@@ -306,23 +305,23 @@ void SurfaceVector::drawBitmap(int x, int y, const Bitmap& bm,const DisplayRegio
        SVGCommand temp=SVGCommand::PaintImage(tx,ty,tw,th,image,0);
        removeCommands(tx,ty,tw,th);
        commands.push_back(temp);
-       command_mutex.Unlock();
+       command_mutex.unlock();
 }
 
 void SurfaceVector::drawPoint(int x, int y, DrawStyle& c, bool fastdraw){
-       if (!fastdraw) command_mutex.Lock();
+       if (!fastdraw) command_mutex.lock();
        VectorHandle ref = osd->getStyleRef(c);
        commands.push_back(SVGCommand::PaintPath(x,y,1,1,PIPoint,ref));
-       if (!fastdraw)  command_mutex.Unlock();
+       if (!fastdraw)  command_mutex.unlock();
 }
 void SurfaceVector::drawMonoBitmap(UCHAR* base, int dx, int dy, unsigned int height,unsigned int width, DrawStyle& nextColour)
 {
-       command_mutex.Lock();
+       command_mutex.lock();
        ImageIndex image=osd->getMonoBitmapRef(base,width,height);
        VectorHandle ref = osd->getStyleRef(nextColour);
        removeCommands(dx,dy,width,height);
        commands.push_back(SVGCommand::PaintImage(dx,dy,height,width,image,ref));
-       command_mutex.Unlock();
+       command_mutex.unlock();
 }
 
 
@@ -385,25 +384,25 @@ int SurfaceVector::removeCommands(float x,float y,float width,float height)
 int SurfaceVector::updateToScreen(int sx, int sy, int w, int h, int dx, int dy)
 {
        // ok this method really works in a pixel oriented way
-       command_mutex.Lock();
+       command_mutex.lock();
        osd->updateOrAddSurface(this,dx-sx,dy-sy,swidth,sheight,commands);
-       command_mutex.Unlock();
+       command_mutex.unlock();
        return 1;
 }
 
 
 /* This is for systems which need a locking of the drawing surface to speed up drawing */
 void SurfaceVector::startFastDraw() {
-       command_mutex.Lock();
+       command_mutex.lock();
 }
 void SurfaceVector::endFastDraw() {
-       command_mutex.Unlock();
+       command_mutex.unlock();
 }
 
 
 void SurfaceVector::drawTTChar(int ox, int oy,int x, int y, cTeletextChar c)
 {
-       command_mutex.Lock();
+       command_mutex.lock();
        std::vector<SVGCommand>::iterator itty=commands.begin();
        while (itty!=commands.end())
        {
@@ -415,5 +414,5 @@ void SurfaceVector::drawTTChar(int ox, int oy,int x, int y, cTeletextChar c)
                }
        }
        commands.push_back(SVGCommand::PaintTTchar(ox,oy,x,y,c.getInternal()));
-       command_mutex.Unlock();
+       command_mutex.unlock();
 }
index 903df7a70d3ed64cb75c4e1467609aae4583c314..a6b29c60f0fcdbac80a8337173642f770bdf32e8 100644 (file)
@@ -20,6 +20,7 @@
 #ifndef SURFACEVECTOR_H
 #define SURFACEVECTOR_H
 
+#include <mutex>
 #include <vector>
 
 #include "surface.h"
@@ -72,7 +73,7 @@ class SurfaceVector : public Surface
 
     std::vector<SVGCommand> commands;
     int swidth, sheight;
-    Mutex command_mutex;
+    std::mutex command_mutex;
     OsdVector* osd;
 
     void drawPixel(int /* x */, int /* y */, unsigned int /* c */, bool /* fastdraw */){}; // these are not supported!
index 8072910af2f2574768a5306cf6700f8a78050e21..ed52061db54071d8b0b18c325f2c679c781f3466 100644 (file)
@@ -14,8 +14,7 @@
     GNU General Public License for more details.
 
     You should have received a copy of the GNU General Public License
-    along with VOMP; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+    along with VOMP.  If not, see <https://www.gnu.org/licenses/>.
 */
 
 #include "videoomx.h"
@@ -170,9 +169,9 @@ OMX_ERRORTYPE VideoOMX::EventHandler_OMX(OMX_IN OMX_HANDLETYPE handle,OMX_IN OMX
 
 void VideoOMX::AddOmxEvent(VPE_OMX_EVENT  new_event)
 {
-       omx_event_mutex.Lock();
+       omx_event_mutex.lock();
     omx_events.push_back(new_event);
-       omx_event_mutex.Unlock();
+       omx_event_mutex.unlock();
        omx_event_ready_signal.signal();
 }
 
@@ -190,11 +189,11 @@ OMX_ERRORTYPE VideoOMX::EmptyBufferDone_OMX(OMX_IN OMX_HANDLETYPE hcomp,OMX_IN O
 }
 
 void VideoOMX::ReturnEmptyOMXBuffer(OMX_BUFFERHEADERTYPE* buffer){
-       input_bufs_omx_mutex.Lock();
+       input_bufs_omx_mutex.lock();
        //Log::getInstance()->log("Video", Log::NOTICE, "ReturnEmptyOMXBuffer %d %d",input_bufs_omx_free.size(),input_bufs_omx_all.size());
        input_bufs_omx_free.push_back(buffer);
        //Log::getInstance()->log("Video", Log::NOTICE, "ReturnEmptyOMXBuffer %d",input_bufs_omx_free.size());
-       input_bufs_omx_mutex.Unlock();
+       input_bufs_omx_mutex.unlock();
        omx_event_ready_signal.signal();
 }
 
@@ -603,7 +602,7 @@ bool VideoOMX::setVideoDisplay(VideoDisplay display)
 
 void VideoOMX::updateMode()
 {
-       clock_mutex.Lock();
+       clock_mutex.lock();
        if (omx_running) {
                int oldcancelstate;
                int oldcanceltype;
@@ -624,7 +623,7 @@ void VideoOMX::updateMode()
                                        "Set OMX_IndexConfigDisplayRegion1 failed %x", error);
                        pthread_setcancelstate(oldcancelstate, NULL);
                        pthread_setcanceltype(oldcanceltype, NULL);
-                       clock_mutex.Unlock();
+                       clock_mutex.unlock();
                        return;
                }
 
@@ -639,7 +638,7 @@ void VideoOMX::updateMode()
                                        "Set OMX_IndexConfigDisplayRegion5 failed %x", error);
                        pthread_setcancelstate(oldcancelstate, NULL);
                        pthread_setcanceltype(oldcanceltype, NULL);
-                       clock_mutex.Unlock();
+                       clock_mutex.unlock();
                        return;
                }
 
@@ -659,7 +658,7 @@ void VideoOMX::updateMode()
                                        "Set OMX_IndexConfigDisplayRegion2 failed %x", error);
                        pthread_setcancelstate(oldcancelstate, NULL);
                        pthread_setcanceltype(oldcanceltype, NULL);
-                       clock_mutex.Unlock();
+                       clock_mutex.unlock();
                        return;
                }
 
@@ -677,7 +676,7 @@ void VideoOMX::updateMode()
                                        "Set OMX_IndexConfigDisplayRegion3 failed %x", error);
                        pthread_setcancelstate(oldcancelstate, NULL);
                        pthread_setcanceltype(oldcanceltype, NULL);
-                       clock_mutex.Unlock();
+                       clock_mutex.unlock();
                        return;
                }
 
@@ -690,7 +689,7 @@ void VideoOMX::updateMode()
                                                "Getting display size failed! (BCM API) ");
                                pthread_setcancelstate(oldcancelstate, NULL);
                                pthread_setcanceltype(oldcanceltype, NULL);
-                               clock_mutex.Unlock();
+                               clock_mutex.unlock();
                                return;
                        }
                        //UnSetFullscreen with window
@@ -712,7 +711,7 @@ void VideoOMX::updateMode()
                                                "Set OMX_IndexConfigDisplayRegion failed %x", error);
                                pthread_setcancelstate(oldcancelstate, NULL);
                                pthread_setcanceltype(oldcanceltype, NULL);
-                               clock_mutex.Unlock();
+                               clock_mutex.unlock();
                                return;
                        }
                }
@@ -720,7 +719,7 @@ void VideoOMX::updateMode()
                pthread_setcanceltype(oldcanceltype, NULL);
 
        }
-       clock_mutex.Unlock();
+       clock_mutex.unlock();
 }
 
 int VideoOMX::signalOff()
@@ -838,20 +837,20 @@ int VideoOMX::play() {
 int VideoOMX::initClock()
 {
        OMX_ERRORTYPE error;
-       clock_mutex.Lock();
+       clock_mutex.lock();
        if (clock_references==0)
        {
 
                static OMX_CALLBACKTYPE callbacks= {&EventHandler_OMX,&EmptyBufferDone_OMX,&FillBufferDone_OMX};
-               omx_event_mutex.Lock();
+               omx_event_mutex.lock();
                omx_events.clear();
-               omx_event_mutex.Unlock();
+               omx_event_mutex.unlock();
 
                error=OMX_GetHandle(&omx_clock,L_VPE_OMX_CLOCK,NULL,&callbacks);
 
                if (error!=OMX_ErrorNone) {
                        Log::getInstance()->log("Video", Log::DEBUG, "Init OMX clock failed %x", error);
-                       clock_mutex.Unlock();
+                       clock_mutex.unlock();
                        DeAllocateCodecsOMX();
                        return 0;
                }
@@ -864,7 +863,7 @@ int VideoOMX::initClock()
                error=OMX_GetParameter(omx_clock,OMX_IndexParamOtherInit,&p_param);
                if (error!=OMX_ErrorNone) {
                        Log::getInstance()->log("Video", Log::DEBUG, "Init clock OMX_GetParameter failed %x", error);
-                       clock_mutex.Unlock();
+                       clock_mutex.unlock();
                        DeAllocateCodecsOMX();
                        return 0;
                }
@@ -873,7 +872,7 @@ int VideoOMX::initClock()
                for (unsigned int i=0;i<p_param.nPorts;i++) {
                        if (!DisablePort(omx_clock,p_param.nStartPortNumber+i,true) ) {
                                Log::getInstance()->log("Video", Log::DEBUG, "Disable Ports OMX clock failed %d",i);
-                               clock_mutex.Unlock();
+                               clock_mutex.unlock();
                                DeAllocateCodecsOMX();
                                return 0;
                        }
@@ -885,7 +884,7 @@ int VideoOMX::initClock()
        }
        Log::getInstance()->log("Video", Log::DEBUG, "init omx clock %x %x",this,omx_clock);
        clock_references++;
-       clock_mutex.Unlock();
+       clock_mutex.unlock();
        return 1;
 }
 
@@ -898,7 +897,7 @@ int VideoOMX::getClockAudioandInit(OMX_HANDLETYPE *p_omx_clock,OMX_U32 *p_omx_cl
        if (!initClock()) {
                return 0;
        }
-       clock_mutex.Lock();
+       clock_mutex.lock();
 
        OMX_TIME_CONFIG_ACTIVEREFCLOCKTYPE refclock;
        memset(&refclock,0,sizeof(refclock));
@@ -911,7 +910,7 @@ int VideoOMX::getClockAudioandInit(OMX_HANDLETYPE *p_omx_clock,OMX_U32 *p_omx_cl
        error=OMX_SetConfig(omx_clock,OMX_IndexConfigTimeActiveRefClock,&refclock);
        if (error!=OMX_ErrorNone){
                Log::getInstance()->log("Video", Log::DEBUG, "Clock OMX_IndexConfigTimeActiveRefClock failed %x", error);
-               clock_mutex.Unlock();
+               clock_mutex.unlock();
                DeAllocateCodecsOMX();
                return 0;
        }
@@ -923,7 +922,7 @@ int VideoOMX::getClockAudioandInit(OMX_HANDLETYPE *p_omx_clock,OMX_U32 *p_omx_cl
        error=OMX_GetParameter(omx_clock,OMX_IndexParamOtherInit,&p_param);
        if (error!=OMX_ErrorNone){
                Log::getInstance()->log("Video", Log::DEBUG, "Init clock OMX_GetParameter failed %x", error);
-               clock_mutex.Unlock();
+               clock_mutex.unlock();
                DeAllocateCodecsOMX();
                return 0;
        }
@@ -945,7 +944,7 @@ int VideoOMX::getClockAudioandInit(OMX_HANDLETYPE *p_omx_clock,OMX_U32 *p_omx_cl
 
        *p_omx_clock_output_port=p_param.nStartPortNumber+1;
        *p_omx_clock=omx_clock;
-       clock_mutex.Unlock();
+       clock_mutex.unlock();
        return 1;
 }
 
@@ -956,7 +955,7 @@ int VideoOMX::getClockVideoandInit()
        if (!initClock()) {
                return 0;
        }
-       clock_mutex.Lock();
+       clock_mutex.lock();
 
        if (clock_references==1) { // only if no audio is attached to this clock!
                OMX_TIME_CONFIG_ACTIVEREFCLOCKTYPE refclock;
@@ -970,7 +969,7 @@ int VideoOMX::getClockVideoandInit()
                error=OMX_SetConfig(omx_clock,OMX_IndexConfigTimeActiveRefClock,&refclock);
                if (error!=OMX_ErrorNone) {
                        Log::getInstance()->log("Video", Log::DEBUG, "Clock OMX_IndexConfigTimeActiveRefClock failed %x", error);
-                       clock_mutex.Unlock();
+                       clock_mutex.unlock();
                        DeAllocateCodecsOMX();
                        return 0;
                }
@@ -983,7 +982,7 @@ int VideoOMX::getClockVideoandInit()
        error=OMX_GetParameter(omx_clock,OMX_IndexParamOtherInit,&p_param);
        if (error!=OMX_ErrorNone){
                Log::getInstance()->log("Video", Log::DEBUG, "Init clock OMX_GetParameter failed %x", error);
-               clock_mutex.Unlock();
+               clock_mutex.unlock();
                DeAllocateCodecsOMX();
                return 0;
        }
@@ -1016,7 +1015,7 @@ int VideoOMX::getClockVideoandInit()
        }
 
        omx_clock_output_port=p_param.nStartPortNumber;
-       clock_mutex.Unlock();
+       clock_mutex.unlock();
 
        return 1;
 }
@@ -1025,7 +1024,7 @@ void VideoOMX::clockUnpause()
 {
        OMX_ERRORTYPE error;
        Log::getInstance()->log("Video", Log::NOTICE, "enter Clockunpause");
-       clock_mutex.Lock();
+       clock_mutex.lock();
        if (clock_references>0 && clockpaused) {
                OMX_TIME_CONFIG_SCALETYPE scale_type;
                memset(&scale_type,0,sizeof(scale_type));
@@ -1039,7 +1038,7 @@ void VideoOMX::clockUnpause()
                Log::getInstance()->log("Video", Log::NOTICE, "set playback speed ClockUnpause");
                clockpaused=false;
        }
-       clock_mutex.Unlock();
+       clock_mutex.unlock();
 }
 
 
@@ -1047,7 +1046,7 @@ void VideoOMX::clockPause()
 {
        OMX_ERRORTYPE error;
        Log::getInstance()->log("Video", Log::NOTICE, "enter ClockPause");
-       clock_mutex.Lock();
+       clock_mutex.lock();
        if (clock_references>0 && !clockpaused) {
                OMX_TIME_CONFIG_SCALETYPE scale_type;
                memset(&scale_type,0,sizeof(scale_type));
@@ -1061,7 +1060,7 @@ void VideoOMX::clockPause()
                Log::getInstance()->log("Video", Log::NOTICE, "set playback speed ClockPause");
                clockpaused=true;
        }
-       clock_mutex.Unlock();
+       clock_mutex.unlock();
 }
 
 
@@ -1100,7 +1099,7 @@ int VideoOMX::AllocateCodecsOMX()
        }
        /* TODO end */
 
-       clock_mutex.Lock();
+       clock_mutex.lock();
        if (h264) {
                error=OMX_GetHandle(&omx_vid_dec,L_VPE_OMX_H264_DECODER,NULL,&callbacks);
        } else {
@@ -1109,7 +1108,7 @@ int VideoOMX::AllocateCodecsOMX()
 
        if (error!=OMX_ErrorNone){
                Log::getInstance()->log("Video", Log::DEBUG, "Init OMX video decoder failed %x", error);
-               clock_mutex.Unlock();
+               clock_mutex.unlock();
                DeAllocateCodecsOMX();
                return 0;
        }
@@ -1123,7 +1122,7 @@ int VideoOMX::AllocateCodecsOMX()
        error=OMX_GetParameter(omx_vid_dec,OMX_IndexParamVideoInit,&p_param);
        if (error!=OMX_ErrorNone){
                Log::getInstance()->log("Video", Log::DEBUG, "Init OMX h264 decoder OMX_GetParameter failed %x", error);
-               clock_mutex.Unlock();
+               clock_mutex.unlock();
                DeAllocateCodecsOMX();
            return 0;
        }
@@ -1132,7 +1131,7 @@ int VideoOMX::AllocateCodecsOMX()
 
        if (!DisablePort(omx_vid_dec,omx_codec_input_port) || !DisablePort(omx_vid_dec,omx_codec_output_port)) {
                Log::getInstance()->log("Video", Log::DEBUG, "Disable Ports OMX video decoder failed");
-               clock_mutex.Unlock();
+               clock_mutex.unlock();
                DeAllocateCodecsOMX();
                return 0;
        }
@@ -1148,7 +1147,7 @@ int VideoOMX::AllocateCodecsOMX()
        error=OMX_SetParameter(omx_vid_dec,OMX_IndexParamBrcmVideoDecodeErrorConcealment,&conceal);
        if (error!=OMX_ErrorNone){
                Log::getInstance()->log("Video", Log::DEBUG, "OMX_IndexParamBrcmVideoDecodeErrorConcealment failed %x", error);
-               clock_mutex.Unlock();
+               clock_mutex.unlock();
                DeAllocateCodecsOMX();
                return 0;
        }
@@ -1159,7 +1158,7 @@ int VideoOMX::AllocateCodecsOMX()
                if (error != OMX_ErrorNone) {
                        Log::getInstance()->log("Video", Log::DEBUG,
                                        "Init OMX video deinterlacer failed %x", error);
-                       clock_mutex.Unlock();
+                       clock_mutex.unlock();
                        DeAllocateCodecsOMX();
                        return 0;
                }
@@ -1170,7 +1169,7 @@ int VideoOMX::AllocateCodecsOMX()
                        Log::getInstance()->log("Video", Log::DEBUG,
                                        "Init OMX video deinterlacer OMX_GetParameter failed %x",
                                        error);
-                       clock_mutex.Unlock();
+                       clock_mutex.unlock();
                        DeAllocateCodecsOMX();
                        return 0;
                }
@@ -1181,7 +1180,7 @@ int VideoOMX::AllocateCodecsOMX()
                                || !DisablePort(omx_vid_deint, omx_deint_output_port, true)) {
                        Log::getInstance()->log("Video", Log::DEBUG,
                                        "Disable Ports OMX video deint failed");
-                       clock_mutex.Unlock();
+                       clock_mutex.unlock();
                        DeAllocateCodecsOMX();
                        return 0;
                }
@@ -1192,7 +1191,7 @@ int VideoOMX::AllocateCodecsOMX()
        error=OMX_GetHandle(&omx_vid_sched,L_VPE_OMX_VIDEO_SCHED,NULL,&callbacks);
        if (error!=OMX_ErrorNone){
                Log::getInstance()->log("Video", Log::DEBUG, "Init OMX video scheduler failed %x", error);
-               clock_mutex.Unlock();
+               clock_mutex.unlock();
                DeAllocateCodecsOMX();
                return 0;
        }
@@ -1202,7 +1201,7 @@ int VideoOMX::AllocateCodecsOMX()
        error=OMX_GetParameter(omx_vid_sched,OMX_IndexParamVideoInit,&p_param);
        if (error!=OMX_ErrorNone){
                Log::getInstance()->log("Video", Log::DEBUG, "Init OMX video scheduler OMX_GetParameter failed %x", error);
-               clock_mutex.Unlock();
+               clock_mutex.unlock();
                DeAllocateCodecsOMX();
                return 0;
        }
@@ -1213,7 +1212,7 @@ int VideoOMX::AllocateCodecsOMX()
        error=OMX_GetParameter(omx_vid_sched,OMX_IndexParamOtherInit,&p_param);
        if (error!=OMX_ErrorNone){
                Log::getInstance()->log("Video", Log::DEBUG, "Init OMX video scheduler OMX_GetParameter failed %x", error);
-               clock_mutex.Unlock();
+               clock_mutex.unlock();
                DeAllocateCodecsOMX();
                return 0;
        }
@@ -1224,7 +1223,7 @@ int VideoOMX::AllocateCodecsOMX()
        if (!DisablePort(omx_vid_sched,omx_shed_input_port,true) || !DisablePort(omx_vid_sched,omx_shed_output_port,true)
                        || !DisablePort(omx_vid_sched,omx_shed_clock_port,true)) {
                Log::getInstance()->log("Video", Log::DEBUG, "Disable Ports OMX video shed failed");
-               clock_mutex.Unlock();
+               clock_mutex.unlock();
                DeAllocateCodecsOMX();
                return 0;
        }
@@ -1233,7 +1232,7 @@ int VideoOMX::AllocateCodecsOMX()
        error=OMX_GetHandle(&omx_vid_rend,L_VPE_OMX_VIDEO_REND,NULL,&callbacks);
        if (error!=OMX_ErrorNone){
                Log::getInstance()->log("Video", Log::DEBUG, "Init OMX video rend failed %x", error);
-               clock_mutex.Unlock();
+               clock_mutex.unlock();
                DeAllocateCodecsOMX();
                return 0;
        }
@@ -1241,7 +1240,7 @@ int VideoOMX::AllocateCodecsOMX()
        error=OMX_GetParameter(omx_vid_rend,OMX_IndexParamVideoInit,&p_param);
        if (error!=OMX_ErrorNone){
                Log::getInstance()->log("Video", Log::DEBUG, "Init OMX video rend OMX_GetParameter failed %x", error);
-               clock_mutex.Unlock();
+               clock_mutex.unlock();
                DeAllocateCodecsOMX();
                return 0;
        }
@@ -1252,7 +1251,7 @@ int VideoOMX::AllocateCodecsOMX()
        if (!DisablePort(omx_vid_rend,omx_rend_input_port,true) /*|| !DisablePort(omx_vid_rend,omx_rend_output_port)*/
                                ) {
                Log::getInstance()->log("Video", Log::DEBUG, "Disable Ports OMX video rend failed");
-               clock_mutex.Unlock();
+               clock_mutex.unlock();
                DeAllocateCodecsOMX();
                return 0;
        }
@@ -1264,7 +1263,7 @@ int VideoOMX::AllocateCodecsOMX()
        error=OMX_SetupTunnel(omx_clock,omx_clock_output_port,omx_vid_sched,omx_shed_clock_port);
        if (error!=OMX_ErrorNone){
                Log::getInstance()->log("Video", Log::DEBUG, "OMX_Setup tunnel clock to sched failed %x %d %d", error,omx_clock_output_port,omx_shed_clock_port);
-               clock_mutex.Unlock();
+               clock_mutex.unlock();
                DeAllocateCodecsOMX();
                return 0;
        }
@@ -1272,7 +1271,7 @@ int VideoOMX::AllocateCodecsOMX()
        if (!EnablePort(omx_clock,omx_clock_output_port,false) || !EnablePort(omx_vid_sched,omx_shed_clock_port,false)
                                        ) {
                Log::getInstance()->log("Video", Log::DEBUG, "Enable Ports OMX clock shed failed");
-               clock_mutex.Unlock();
+               clock_mutex.unlock();
                DeAllocateCodecsOMX();
                return 0;
        }
@@ -1281,7 +1280,7 @@ int VideoOMX::AllocateCodecsOMX()
 
        if (!ChangeComponentState(omx_vid_sched,OMX_StateIdle)) {
                Log::getInstance()->log("Video", Log::DEBUG, "vid_sched idle ChangeComponentState");
-               clock_mutex.Unlock();
+               clock_mutex.unlock();
                DeAllocateCodecsOMX();
                return 0;
        }
@@ -1290,7 +1289,7 @@ int VideoOMX::AllocateCodecsOMX()
 
 
        if ( !CommandFinished(omx_vid_sched,OMX_CommandPortEnable,omx_shed_clock_port)) {
-               clock_mutex.Unlock();
+               clock_mutex.unlock();
                DeAllocateCodecsOMX();
                return 0;
        }
@@ -1300,7 +1299,7 @@ int VideoOMX::AllocateCodecsOMX()
 
 
        if ( !CommandFinished(omx_clock,OMX_CommandPortEnable,omx_clock_output_port)) {
-               clock_mutex.Unlock();
+               clock_mutex.unlock();
                DeAllocateCodecsOMX();
                return 0;
        }
@@ -1332,7 +1331,7 @@ int VideoOMX::AllocateCodecsOMX()
        error=OMX_SetParameter(omx_vid_dec,OMX_IndexParamVideoPortFormat,&ft_type);
        if (error!=OMX_ErrorNone){
                Log::getInstance()->log("Video", Log::DEBUG, "Init OMX_IndexParamVideoPortFormat failed %x", error);
-               clock_mutex.Unlock();
+               clock_mutex.unlock();
                DeAllocateCodecsOMX();
                return 0;
        }
@@ -1340,7 +1339,7 @@ int VideoOMX::AllocateCodecsOMX()
 
        if (!ChangeComponentState(omx_vid_dec,OMX_StateIdle)) {
                Log::getInstance()->log("Video", Log::DEBUG, "vid_dec ChangeComponentState");
-               clock_mutex.Unlock();
+               clock_mutex.unlock();
                DeAllocateCodecsOMX();
                return 0;
        }
@@ -1354,7 +1353,7 @@ int VideoOMX::AllocateCodecsOMX()
        error=OMX_SetConfig(omx_vid_dec,OMX_IndexConfigBufferStall,&stall_conf);
        if (error!=OMX_ErrorNone){
                Log::getInstance()->log("Video", Log::DEBUG, "Init OMX_IndexConfigBufferStall failed %x", error);
-               clock_mutex.Unlock();
+               clock_mutex.unlock();
                DeAllocateCodecsOMX();
                return 0;
        }
@@ -1370,7 +1369,7 @@ int VideoOMX::AllocateCodecsOMX()
        error=OMX_SetConfig(omx_vid_dec,OMX_IndexConfigRequestCallback,&req_callback);
        if (error!=OMX_ErrorNone){
                Log::getInstance()->log("Video", Log::DEBUG, "Init OMX_IndexConfigRequestCallback  failed %x", error);
-               clock_mutex.Unlock();
+               clock_mutex.unlock();
                DeAllocateCodecsOMX();
                return 0;
        }
@@ -1378,7 +1377,7 @@ int VideoOMX::AllocateCodecsOMX()
 
 
        if (!PrepareInputBufsOMX()) {
-               clock_mutex.Unlock();
+               clock_mutex.unlock();
                DeAllocateCodecsOMX();
                return 0;
        }
@@ -1387,7 +1386,7 @@ int VideoOMX::AllocateCodecsOMX()
                error=OMX_SetupTunnel(omx_vid_dec,omx_codec_output_port,omx_vid_sched,omx_shed_input_port);
                if (error!=OMX_ErrorNone){
                        Log::getInstance()->log("Video", Log::DEBUG, "OMX_Setup tunnel dec to sched failed %x", error);
-                       clock_mutex.Unlock();
+                       clock_mutex.unlock();
                        DeAllocateCodecsOMX();
                        return 0;
                }
@@ -1397,13 +1396,13 @@ int VideoOMX::AllocateCodecsOMX()
                if (!EnablePort(omx_vid_dec,omx_codec_output_port,false) || !EnablePort(omx_vid_sched,omx_shed_input_port,false)
                ) {
                        Log::getInstance()->log("Video", Log::DEBUG, "Enable Ports OMX codec shed failed");
-                       clock_mutex.Unlock();
+                       clock_mutex.unlock();
                        DeAllocateCodecsOMX();
                        return 0;
                }
 
                if ( !CommandFinished(omx_vid_dec,OMX_CommandPortEnable,omx_codec_output_port) || !CommandFinished(omx_vid_sched,OMX_CommandPortEnable,omx_shed_input_port)) {
-                       clock_mutex.Unlock();
+                       clock_mutex.unlock();
                        DeAllocateCodecsOMX();
                        return 0;
                }
@@ -1413,7 +1412,7 @@ int VideoOMX::AllocateCodecsOMX()
                error=OMX_SetupTunnel(omx_vid_dec,omx_codec_output_port,omx_vid_deint,omx_deint_input_port);
                if (error!=OMX_ErrorNone){
                        Log::getInstance()->log("Video", Log::DEBUG, "OMX_Setup tunnel dec to deint failed %x", error);
-                       clock_mutex.Unlock();
+                       clock_mutex.unlock();
                        DeAllocateCodecsOMX();
                        return 0;
                }
@@ -1423,20 +1422,20 @@ int VideoOMX::AllocateCodecsOMX()
                if (!EnablePort(omx_vid_dec,omx_codec_output_port,false) || !EnablePort(omx_vid_deint,omx_deint_input_port,false)
                ) {
                        Log::getInstance()->log("Video", Log::DEBUG, "Enable Ports OMX codec deint failed");
-                       clock_mutex.Unlock();
+                       clock_mutex.unlock();
                        DeAllocateCodecsOMX();
                        return 0;
                }
 
                if ( !CommandFinished(omx_vid_dec,OMX_CommandPortEnable,omx_codec_output_port) || !CommandFinished(omx_vid_deint,OMX_CommandPortEnable,omx_deint_input_port)) {
-                       clock_mutex.Unlock();
+                       clock_mutex.unlock();
                        DeAllocateCodecsOMX();
                        return 0;
                }
 
                if (!ChangeComponentState(omx_vid_deint,OMX_StateIdle)) {
                        Log::getInstance()->log("Video", Log::DEBUG, "vid_deint ChangeComponentState");
-                       clock_mutex.Unlock();
+                       clock_mutex.unlock();
                        DeAllocateCodecsOMX();
                        return 0;
                }
@@ -1474,7 +1473,7 @@ int VideoOMX::AllocateCodecsOMX()
                error=OMX_SetConfig(omx_vid_deint,OMX_IndexConfigCommonImageFilterParameters,&imagefilter);
                if (error!=OMX_ErrorNone){
                        Log::getInstance()->log("Video", Log::DEBUG, "Init OMX_IndexConfigCommonImageFilterParameters failed %x", error);
-                       clock_mutex.Unlock();
+                       clock_mutex.unlock();
                        DeAllocateCodecsOMX();
                        return 0;
                }
@@ -1483,7 +1482,7 @@ int VideoOMX::AllocateCodecsOMX()
                error=OMX_SetupTunnel(omx_vid_deint,omx_deint_output_port,omx_vid_sched,omx_shed_input_port);
                if (error!=OMX_ErrorNone){
                        Log::getInstance()->log("Video", Log::DEBUG, "OMX_Setup tunnel deint to sched failed %x", error);
-                       clock_mutex.Unlock();
+                       clock_mutex.unlock();
                        DeAllocateCodecsOMX();
                        return 0;
                }
@@ -1491,13 +1490,13 @@ int VideoOMX::AllocateCodecsOMX()
                if (!EnablePort(omx_vid_deint,omx_deint_output_port,false) || !EnablePort(omx_vid_sched,omx_shed_input_port,false)
                ) {
                        Log::getInstance()->log("Video", Log::DEBUG, "Enable Ports OMX deint shed failed");
-                       clock_mutex.Unlock();
+                       clock_mutex.unlock();
                        DeAllocateCodecsOMX();
                        return 0;
                }
 
                if ( !CommandFinished(omx_vid_deint,OMX_CommandPortEnable,omx_deint_output_port) || !CommandFinished(omx_vid_sched,OMX_CommandPortEnable,omx_shed_input_port)) {
-                       clock_mutex.Unlock();
+                       clock_mutex.unlock();
                        DeAllocateCodecsOMX();
                        return 0;
                }
@@ -1506,7 +1505,7 @@ int VideoOMX::AllocateCodecsOMX()
 
        if (!ChangeComponentState(omx_vid_dec,OMX_StateExecuting)) {
                Log::getInstance()->log("Video", Log::DEBUG, "omx_vid_dec ChangeComponentState Execute");
-               clock_mutex.Unlock();
+               clock_mutex.unlock();
                DeAllocateCodecsOMX();
                return 0;
        }
@@ -1514,7 +1513,7 @@ int VideoOMX::AllocateCodecsOMX()
        error=OMX_SetupTunnel(omx_vid_sched,omx_shed_output_port,omx_vid_rend,omx_rend_input_port);
        if (error!=OMX_ErrorNone){
                Log::getInstance()->log("Video", Log::DEBUG, "OMX_Setup tunnel  sched to rend failed %x", error);
-               clock_mutex.Unlock();
+               clock_mutex.unlock();
                DeAllocateCodecsOMX();
                return 0;
        }
@@ -1522,21 +1521,21 @@ int VideoOMX::AllocateCodecsOMX()
        if (!EnablePort(omx_vid_sched,omx_shed_output_port,false) || !EnablePort(omx_vid_rend,omx_rend_input_port,false)
                                                        ) {
                Log::getInstance()->log("Video", Log::DEBUG, "Enable Ports OMX  shed rend failed");
-               clock_mutex.Unlock();
+               clock_mutex.unlock();
                DeAllocateCodecsOMX();
                return 0;
        }
 
        if (!CommandFinished(omx_vid_sched,OMX_CommandPortEnable,omx_shed_output_port)
                                        || !CommandFinished(omx_vid_rend,OMX_CommandPortEnable,omx_rend_input_port)) {
-               clock_mutex.Unlock();
+               clock_mutex.unlock();
                DeAllocateCodecsOMX();
                return 0;
        }
 
        if (!ChangeComponentState(omx_vid_rend,OMX_StateIdle)) {
                Log::getInstance()->log("Video", Log::DEBUG, "vid_rend ChangeComponentState");
-               clock_mutex.Unlock();
+               clock_mutex.unlock();
                DeAllocateCodecsOMX();
                return 0;
        }
@@ -1544,7 +1543,7 @@ int VideoOMX::AllocateCodecsOMX()
        if (dodeint) {
                if (!ChangeComponentState(omx_vid_deint,OMX_StateExecuting)) {
                        Log::getInstance()->log("Video", Log::DEBUG, "vid_vid_deint ChangeComponentState");
-                       clock_mutex.Unlock();
+                       clock_mutex.unlock();
                        DeAllocateCodecsOMX();
                        return 0;
                }
@@ -1554,14 +1553,14 @@ int VideoOMX::AllocateCodecsOMX()
 
        if (!ChangeComponentState(omx_vid_sched,OMX_StateExecuting)) {
                Log::getInstance()->log("Video", Log::DEBUG, "omx_vid_sched ChangeComponentState Execute");
-               clock_mutex.Unlock();
+               clock_mutex.unlock();
                DeAllocateCodecsOMX();
                return 0;
        }
 
        if (!ChangeComponentState(omx_vid_rend,OMX_StateExecuting)) {
                Log::getInstance()->log("Video", Log::DEBUG, "omx_vid_rend ChangeComponentState Execute");
-               clock_mutex.Unlock();
+               clock_mutex.unlock();
                DeAllocateCodecsOMX();
                return 0;
        }
@@ -1579,7 +1578,7 @@ int VideoOMX::AllocateCodecsOMX()
        error=OMX_SetConfig(omx_vid_rend,OMX_IndexConfigDisplayRegion,&dispconf);
        if (error!=OMX_ErrorNone){
                Log::getInstance()->log("Video", Log::DEBUG, "Init OMX_IndexConfigDisplayRegion failed %x", error);
-               clock_mutex.Unlock();
+               clock_mutex.unlock();
                DeAllocateCodecsOMX();
                return 0;
        }*/
@@ -1589,7 +1588,7 @@ int VideoOMX::AllocateCodecsOMX()
        error=OMX_SetParameter(omx_vid_rend,OMX_IndexConfigDisplayRegion,&dispconf);
        if (error!=OMX_ErrorNone){
                Log::getInstance()->log("Video", Log::DEBUG, "Init OMX_IndexConfigDisplayRegion failed %x", error);
-               clock_mutex.Unlock();
+               clock_mutex.unlock();
                DeAllocateCodecsOMX();
                return 0;
        }
@@ -1602,7 +1601,7 @@ int VideoOMX::AllocateCodecsOMX()
        error=OMX_SetParameter(omx_vid_rend,OMX_IndexConfigDisplayRegion,&dispconf);
        if (error!=OMX_ErrorNone){
                Log::getInstance()->log("Video", Log::DEBUG, "Init OMX_IndexConfigDisplayRegion failed %x", error);
-               clock_mutex.Unlock();
+               clock_mutex.unlock();
                DeAllocateCodecsOMX();
                return 0;
        }*/
@@ -1612,7 +1611,7 @@ int VideoOMX::AllocateCodecsOMX()
 
        iframemode=false;
        omx_running=true;
-       clock_mutex.Unlock();
+       clock_mutex.unlock();
        clockUnpause();
        updateMode();
 
@@ -1629,17 +1628,17 @@ int VideoOMX::idleClock()
 {
        //OMX_ERRORTYPE error;
        OMX_STATETYPE temp_state;
-       clock_mutex.Lock();
+       clock_mutex.lock();
        OMX_GetState(omx_clock,&temp_state);
 
        if (temp_state!=OMX_StateIdle) {
                if (!ChangeComponentState(omx_clock,OMX_StateIdle)) {
                        Log::getInstance()->log("Video", Log::DEBUG, "omx_clock ChangeComponentState Idle failed");
-                       clock_mutex.Unlock();
+                       clock_mutex.unlock();
                        return 0;
                }
        }
-       clock_mutex.Unlock();
+       clock_mutex.unlock();
        return 1;
 }
 
@@ -1647,13 +1646,13 @@ int VideoOMX::setClockExecutingandRunning()
 {
        OMX_ERRORTYPE error;
        OMX_STATETYPE temp_state;
-       clock_mutex.Lock();
+       clock_mutex.lock();
        OMX_GetState(omx_clock,&temp_state);
 
        if (temp_state!=OMX_StateExecuting) {
                if (!ChangeComponentState(omx_clock,OMX_StateExecuting)) {
                        Log::getInstance()->log("Video", Log::DEBUG, "omx_clock ChangeComponentState Execute failed");
-                       clock_mutex.Unlock();
+                       clock_mutex.unlock();
                        DeAllocateCodecsOMX();
                        return 0;
                }
@@ -1667,11 +1666,11 @@ int VideoOMX::setClockExecutingandRunning()
        error=OMX_SetConfig(omx_clock,OMX_IndexConfigTimeClockState,&clock_conf);
        if (error!=OMX_ErrorNone) {
                Log::getInstance()->log("Video", Log::DEBUG, "Clock IndexConfigTimeClockState failed %x", error);
-               clock_mutex.Unlock();
+               clock_mutex.unlock();
                DeAllocateCodecsOMX();
                return 0;
        }
-       clock_mutex.Unlock();
+       clock_mutex.unlock();
        return 1;
 
 }
@@ -1771,7 +1770,7 @@ int VideoOMX::WaitForEvent(OMX_HANDLETYPE handle,OMX_U32 event, int wait) //need
        int i=0;
        int iend=(wait/5+1);
        while (i<iend) {
-               omx_event_mutex.Lock();
+               omx_event_mutex.lock();
                std::list<VPE_OMX_EVENT>::iterator itty=omx_events.begin();
                while (itty!=omx_events.end()) {
 
@@ -1779,13 +1778,13 @@ int VideoOMX::WaitForEvent(OMX_HANDLETYPE handle,OMX_U32 event, int wait) //need
                        if (current.handle==handle) { //this is ours
                                if (current.event_type==OMX_EventError) {
                                        omx_events.erase(itty);
-                                       omx_event_mutex.Unlock();
+                                       omx_event_mutex.unlock();
                                        Log::getInstance()->log("Video", Log::DEBUG, "WaitForEvent Finished on Error");
                                        return 0;
 
                                } else if (current.event_type==event) {
                                        omx_events.erase(itty);
-                                       omx_event_mutex.Unlock();
+                                       omx_event_mutex.unlock();
                                        Log::getInstance()->log("Video", Log::DEBUG, "WaitForEvent Finished Completed");
                                        return 1;
                                }
@@ -1793,7 +1792,7 @@ int VideoOMX::WaitForEvent(OMX_HANDLETYPE handle,OMX_U32 event, int wait) //need
                        itty++;
 
                }
-               omx_event_mutex.Unlock();
+               omx_event_mutex.unlock();
                omx_event_ready_signal.waitForSignalTimed(10);
                //MILLISLEEP(2);
                i++;
@@ -1806,16 +1805,16 @@ int VideoOMX::WaitForEvent(OMX_HANDLETYPE handle,OMX_U32 event, int wait) //need
 
 int VideoOMX::clearEvents()
 {
-       omx_event_mutex.Lock();
+       omx_event_mutex.lock();
        omx_events.clear();
-       omx_event_mutex.Unlock();
+       omx_event_mutex.unlock();
 
        return 1;
 }
 
 int VideoOMX::clearEventsForComponent(OMX_HANDLETYPE handle)
 {
-       omx_event_mutex.Lock();
+       omx_event_mutex.lock();
        std::list<VPE_OMX_EVENT>::iterator itty=omx_events.begin();
        while (itty!=omx_events.end()) {
                VPE_OMX_EVENT current=*itty;
@@ -1826,15 +1825,15 @@ int VideoOMX::clearEventsForComponent(OMX_HANDLETYPE handle)
                itty++;
 
        }
-       omx_event_mutex.Unlock();
+       omx_event_mutex.unlock();
        return 1;
 }
 
 void VideoOMX::checkForStalledBuffers()
 {
        //Log::getInstance()->log("Video", Log::DEBUG, "Check stalled");
-       clock_mutex.Lock();
-       omx_event_mutex.Lock();
+       clock_mutex.lock();
+       omx_event_mutex.lock();
        std::list<VPE_OMX_EVENT>::iterator itty=omx_events.begin();
        while (itty!=omx_events.end()) {
                VPE_OMX_EVENT current=*itty;
@@ -1851,8 +1850,8 @@ void VideoOMX::checkForStalledBuffers()
                        error=OMX_GetConfig(omx_vid_dec,OMX_IndexConfigBufferStall,&stall_conf);
                        if (error!=OMX_ErrorNone){
                                        Log::getInstance()->log("Video", Log::DEBUG, "Get OMX_IndexConfigBufferStall failed %x", error);
-                                       clock_mutex.Unlock();
-                                       omx_event_mutex.Unlock();
+                                       clock_mutex.unlock();
+                                       omx_event_mutex.unlock();
                                        return ;
                                }
                        if (stall_conf.bStalled==OMX_TRUE) {
@@ -1867,8 +1866,8 @@ void VideoOMX::checkForStalledBuffers()
                }
                itty++;
        }
-       omx_event_mutex.Unlock();
-       clock_mutex.Unlock();
+       omx_event_mutex.unlock();
+       clock_mutex.unlock();
 }
 
 
@@ -1878,7 +1877,7 @@ int VideoOMX::CommandFinished(OMX_HANDLETYPE handle,OMX_U32 command,OMX_U32 data
 {
        int i=0;
        while (i<200/*1000*/) {
-               omx_event_mutex.Lock();
+               omx_event_mutex.lock();
                std::list<VPE_OMX_EVENT>::iterator itty=omx_events.begin();
                while (itty!=omx_events.end()) {
 
@@ -1886,13 +1885,13 @@ int VideoOMX::CommandFinished(OMX_HANDLETYPE handle,OMX_U32 command,OMX_U32 data
                        if (current.handle==handle) { //this is ours
                                if (current.event_type==OMX_EventError) {
                                        omx_events.erase(itty);
-                                       omx_event_mutex.Unlock();
+                                       omx_event_mutex.unlock();
                                        Log::getInstance()->log("Video", Log::DEBUG, "Command Finished on Error %x",current.data1);
                                        return 0;
 
                                } else if (current.event_type==OMX_EventCmdComplete && current.data1==command && current.data2==data2) {
                                        omx_events.erase(itty);
-                                       omx_event_mutex.Unlock();
+                                       omx_event_mutex.unlock();
                                        //Log::getInstance()->log("Video", Log::DEBUG, "Command Finished Completed");
                                        return 1;
                                }
@@ -1900,7 +1899,7 @@ int VideoOMX::CommandFinished(OMX_HANDLETYPE handle,OMX_U32 command,OMX_U32 data
                        itty++;
 
                }
-               omx_event_mutex.Unlock();
+               omx_event_mutex.unlock();
                omx_event_ready_signal.waitForSignalTimed(10);
                //MILLISLEEP(2);
                i++;
@@ -1947,7 +1946,7 @@ int VideoOMX::PrepareInputBufsOMX() //needs to be called with locked mutex
                return 0;
        }
 
-       input_bufs_omx_mutex.Lock();
+       input_bufs_omx_mutex.lock();
        for (unsigned int i=0; i< port_def_type.nBufferCountActual;i++) {
 
        //      unsigned char* new_buffer_data=(unsigned char*)malloc(port_def_type.nbufferSize);
@@ -1955,13 +1954,13 @@ int VideoOMX::PrepareInputBufsOMX() //needs to be called with locked mutex
        /*      error=OMX_Usebuffer(omx_vid_dec,&buf_head,omx_codec_input_port,NULL,port_def_type.nbufferSize,new_buffer_data);
                if (error!=OMX_ErrorNone){
                        Log::getInstance()->log("Video", Log::DEBUG, "Use OMX_Usebuffer failed %x", error);
-                       input_bufs_omx_mutex.Unlock();
+                       input_bufs_omx_mutex.unlock();
                        return 0;
                }*/
                error=OMX_AllocateBuffer(omx_vid_dec,&buf_head,omx_codec_input_port,NULL,port_def_type.nBufferSize);
                if (error!=OMX_ErrorNone){
                        Log::getInstance()->log("Video", Log::DEBUG, "Use OMX_AllocateBuffer failed %x", error);
-                               input_bufs_omx_mutex.Unlock();
+                               input_bufs_omx_mutex.unlock();
                        return 0;
                }
                input_bufs_omx_all.push_back(buf_head);
@@ -1971,7 +1970,7 @@ int VideoOMX::PrepareInputBufsOMX() //needs to be called with locked mutex
 
        firstsynched=false;
        cur_input_buf_omx=NULL;
-       input_bufs_omx_mutex.Unlock();
+       input_bufs_omx_mutex.unlock();
 
 
        Log::getInstance()->log("Video", Log::DEBUG, "PrepareInputBufsOMX mark3");
@@ -1988,21 +1987,21 @@ int VideoOMX::DestroyInputBufsOMX() //need s to be called with locked mutex
        OMX_ERRORTYPE error;
 
        cur_input_buf_omx=NULL;
-       input_bufs_omx_mutex.Lock();
+       input_bufs_omx_mutex.lock();
        for (UINT i=0; i< input_bufs_omx_all.size();i++) {
        //      free(input_bufs_omx_all[i]->pBuffer);
        //      input_bufs_omx_all[i]->pBuffer=NULL;
                error=OMX_FreeBuffer(omx_vid_dec,omx_codec_input_port,input_bufs_omx_all[i]);
                if (error!=OMX_ErrorNone){
                        Log::getInstance()->log("Video", Log::DEBUG, "Use OMX_FreeBuffer failed %x", error);
-                       input_bufs_omx_mutex.Unlock();
+                       input_bufs_omx_mutex.unlock();
                        return 0;
                }
 
        }
        input_bufs_omx_all.clear();
        input_bufs_omx_free.clear();
-       input_bufs_omx_mutex.Unlock();
+       input_bufs_omx_mutex.unlock();
 
        return 1;
 }
@@ -2154,7 +2153,7 @@ int VideoOMX::DeAllocateCodecsOMX()
 
                cur_input_buf_omx=NULL;//write out old data
        }
-   clock_mutex.Lock();
+   clock_mutex.lock();
    clearEvents();
        if (omx_vid_dec) {
                // first stop the omx elements
@@ -2162,10 +2161,10 @@ int VideoOMX::DeAllocateCodecsOMX()
                        Log::getInstance()->log("Video", Log::DEBUG, "vid_dec ChangeComponentState");
 
                }
-               clock_mutex.Unlock();
+               clock_mutex.unlock();
 
                idleClock();
-               clock_mutex.Lock();
+               clock_mutex.lock();
 
                if (dodeint) {
                        if (!ChangeComponentState(omx_vid_deint, OMX_StateIdle)) {
@@ -2338,12 +2337,12 @@ int VideoOMX::DeAllocateCodecsOMX()
                error=OMX_FreeHandle(omx_vid_rend);
                if (dodeint) error=OMX_FreeHandle(omx_vid_deint);
                omx_vid_dec=NULL;
-               clock_mutex.Unlock();
+               clock_mutex.unlock();
                destroyClock();
                if (error!=OMX_ErrorNone) {
                        Log::getInstance()->log("Video", Log::DEBUG, "FreeHandle failed %d", error);
                }
-       } else  clock_mutex.Unlock();
+       } else  clock_mutex.unlock();
          Log::getInstance()->log("Video", Log::DEBUG, "leave deallocate codecs OMX");
 
        return 1;
@@ -2352,7 +2351,7 @@ int VideoOMX::DeAllocateCodecsOMX()
 
 void VideoOMX::destroyClock()
 {
-       clock_mutex.Lock();
+       clock_mutex.lock();
        if (clock_references>0) {
                clock_references--;
                if (clock_references==0) {
@@ -2365,7 +2364,7 @@ void VideoOMX::destroyClock()
 
                }
        }
-       clock_mutex.Unlock();
+       clock_mutex.unlock();
 
 }
 
@@ -2456,7 +2455,7 @@ ULLONG VideoOMX::getCurrentTimestamp() {
                int oldcanceltype;
                pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &oldcancelstate);
                pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &oldcanceltype);
-               clock_mutex.Lock();
+               clock_mutex.lock();
                OMX_ERRORTYPE error;
                OMX_TIME_CONFIG_CLOCKSTATETYPE clock_conf;
                memset(&clock_conf, 0, sizeof(clock_conf));
@@ -2485,7 +2484,7 @@ ULLONG VideoOMX::getCurrentTimestamp() {
                                ncur_clock_time = cur_clock_time = temp * 10LL;
                        }
                }
-               clock_mutex.Unlock();
+               clock_mutex.unlock();
                pthread_setcancelstate(oldcancelstate, NULL);
                pthread_setcanceltype(oldcanceltype, NULL);
        }
@@ -2610,7 +2609,7 @@ void VideoOMX::FirstFrameFix()
        Demuxer* demux=Demuxer::getInstance();
        pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &oldcancelstate);
        pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &oldcanceltype);
-       clock_mutex.Lock();
+       clock_mutex.lock();
        if (WaitForEvent(omx_vid_dec,OMX_EventPortSettingsChanged,0)){
                WaitForEvent(omx_vid_deint,OMX_EventPortSettingsChanged,0); //clear old messages
                OMX_ERRORTYPE error;
@@ -2624,7 +2623,7 @@ void VideoOMX::FirstFrameFix()
                if (error != OMX_ErrorNone) {
                        Log::getInstance()->log("Video", Log::DEBUG,
                                        "OMX_IndexParamPortDefinition fix failed %x", error);
-                       clock_mutex.Unlock();
+                       clock_mutex.unlock();
                        return;
                }
 
@@ -2668,7 +2667,7 @@ void VideoOMX::FirstFrameFix()
                        if (error != OMX_ErrorNone) {
                                Log::getInstance()->log("Video", Log::DEBUG,
                                                "Set OMX_IndexParamPortDefinition1 failed %x", error);
-                               clock_mutex.Unlock();
+                               clock_mutex.unlock();
                                pthread_setcancelstate(oldcancelstate, NULL);
                                pthread_setcanceltype(oldcanceltype, NULL);
                                return;
@@ -2682,7 +2681,7 @@ void VideoOMX::FirstFrameFix()
                        if (error != OMX_ErrorNone) {
                                Log::getInstance()->log("Video", Log::DEBUG,
                                                "Set OMX_IndexParamPortDefinition1 failed %x", error);
-                               clock_mutex.Unlock();
+                               clock_mutex.unlock();
                                pthread_setcancelstate(oldcancelstate, NULL);
                                pthread_setcanceltype(oldcanceltype, NULL);
                                return;
@@ -2699,7 +2698,7 @@ void VideoOMX::FirstFrameFix()
                        if (error != OMX_ErrorNone) {
                                Log::getInstance()->log("Video", Log::DEBUG,
                                                "Get OMX_IndexParamPortDefinition2 failed %x", error);
-                               clock_mutex.Unlock();
+                               clock_mutex.unlock();
                                pthread_setcancelstate(oldcancelstate, NULL);
                                pthread_setcanceltype(oldcanceltype, NULL);
                                return;
@@ -2722,7 +2721,7 @@ void VideoOMX::FirstFrameFix()
                if (error != OMX_ErrorNone) {
                        Log::getInstance()->log("Video", Log::DEBUG,
                                        "Set OMX_IndexParamPortDefinition3 failed %x", error);
-                       clock_mutex.Unlock();
+                       clock_mutex.unlock();
                        pthread_setcancelstate(oldcancelstate, NULL);
                        pthread_setcanceltype(oldcanceltype, NULL);
                        return;
@@ -2736,7 +2735,7 @@ void VideoOMX::FirstFrameFix()
                EnablePort(omx_vid_dec,omx_codec_output_port,true);
                EnablePort(omx_vid_sched,omx_shed_input_port,true);
        }
-       clock_mutex.Unlock();
+       clock_mutex.unlock();
        pthread_setcancelstate(oldcancelstate, NULL);
        pthread_setcanceltype(oldcanceltype, NULL);
 
@@ -2768,7 +2767,7 @@ OMX_ERRORTYPE VideoOMX::ProtOMXEmptyThisBuffer(OMX_HANDLETYPE handle, OMX_BUFFER
        //pthread_testcancel();
        pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &oldcancelstate);
        pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &oldcanceltype);
-       clock_mutex.Lock();
+       clock_mutex.lock();
 // Diagnosis code
 /*     OMX_ERRORTYPE error;
        OMX_TIME_CONFIG_TIMESTAMPTYPE timestamp;
@@ -2792,7 +2791,7 @@ OMX_ERRORTYPE VideoOMX::ProtOMXEmptyThisBuffer(OMX_HANDLETYPE handle, OMX_BUFFER
        Log::getInstance()->log("Video", Log::NOTICE, "OMXETB %x %lld %lld %x",handle,temp,temp2,buffer->nFlags);*/
        OMX_ERRORTYPE ret_val;
        ret_val=OMX_EmptyThisBuffer(handle,buffer);
-       clock_mutex.Unlock();
+       clock_mutex.unlock();
        pthread_setcancelstate(oldcancelstate, NULL);
        pthread_setcanceltype(oldcanceltype, NULL);
        //pthread_testcancel();
@@ -2842,9 +2841,9 @@ bool VideoOMX::DrainTargetBufferFull()
 {
        //Check, if we have OMX output buffers
        bool full;
-       input_bufs_omx_mutex.Lock();
+       input_bufs_omx_mutex.lock();
        full=(input_bufs_omx_free.size()==0);
-       input_bufs_omx_mutex.Unlock();
+       input_bufs_omx_mutex.unlock();
        checkForStalledBuffers(); // check if the decoder has a problem
        if (full && omx_vid_stalled && !omx_first_frame) {
                omx_vid_stalled=false;
@@ -2855,10 +2854,10 @@ bool VideoOMX::DrainTargetBufferFull()
                pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &oldcancelstate);
                pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &oldcanceltype);
 
-               clock_mutex.Lock();
+               clock_mutex.lock();
                FlushRenderingPipe();
                omx_first_frame=true;
-               clock_mutex.Unlock();
+               clock_mutex.unlock();
 
                pthread_setcancelstate(oldcancelstate, NULL);
                pthread_setcanceltype(oldcanceltype, NULL);
@@ -2981,9 +2980,9 @@ UINT VideoOMX::DeliverMediaPacket(MediaPacket packet,
        }
        //Log::getInstance()->log("Video", Log::DEBUG, "DMP mark 6");
        if (!cur_input_buf_omx) {
-               input_bufs_omx_mutex.Lock();
+               input_bufs_omx_mutex.lock();
                if (input_bufs_omx_free.size()==0) {
-                       input_bufs_omx_mutex.Unlock();
+                       input_bufs_omx_mutex.unlock();
                        //Log::getInstance()->log("Video", Log::DEBUG, "Deliver MediaPacket no free sample");
                        //Log::getInstance()->log("Video", Log::DEBUG, "DMP mark 7");
                        return 0; // we do not have a free media sample
@@ -2994,7 +2993,7 @@ UINT VideoOMX::DeliverMediaPacket(MediaPacket packet,
                cur_input_buf_omx->nOffset=0;
                cur_input_buf_omx->nTimeStamp=intToOMXTicks(0);
                input_bufs_omx_free.pop_front();
-               input_bufs_omx_mutex.Unlock();
+               input_bufs_omx_mutex.unlock();
        }
 
 
@@ -3045,9 +3044,9 @@ UINT VideoOMX::DeliverMediaPacket(MediaPacket packet,
                PutBufferToPres(cur_input_buf_omx);
                cur_input_buf_omx=NULL;
                // get5 new buffer
-               input_bufs_omx_mutex.Lock();
+               input_bufs_omx_mutex.lock();
                if (input_bufs_omx_free.size()==0) {
-                       input_bufs_omx_mutex.Unlock();
+                       input_bufs_omx_mutex.unlock();
                //      Log::getInstance()->log("Video", Log::DEBUG, "Deliver MediaPacket no free sample2");
                        return *samplepos; // we do not have a free media sample
                }
@@ -3057,7 +3056,7 @@ UINT VideoOMX::DeliverMediaPacket(MediaPacket packet,
                cur_input_buf_omx->nFlags=OMX_BUFFERFLAG_TIME_UNKNOWN;
                cur_input_buf_omx->nTimeStamp=intToOMXTicks(0);
                input_bufs_omx_free.pop_front();
-               input_bufs_omx_mutex.Unlock();
+               input_bufs_omx_mutex.unlock();
                //Log::getInstance()->log("Video", Log::DEBUG, "DMP mark 10");
 
        }
@@ -3084,9 +3083,9 @@ bool VideoOMX::displayIFrame(const UCHAR* buffer, UINT length) {
        //int haveToCopy = length;
 
        if (!cur_input_buf_omx) {
-               input_bufs_omx_mutex.Lock();
+               input_bufs_omx_mutex.lock();
                if (input_bufs_omx_free.size() == 0) {
-                       input_bufs_omx_mutex.Unlock();
+                       input_bufs_omx_mutex.unlock();
                //      Log::getInstance()->log("Video", Log::DEBUG,
                        //              "Deliver MediaPacket no free sample");
                        return false; // we do not have a free media sample
@@ -3097,7 +3096,7 @@ bool VideoOMX::displayIFrame(const UCHAR* buffer, UINT length) {
                cur_input_buf_omx->nOffset = 0;
                cur_input_buf_omx->nTimeStamp = intToOMXTicks(0);
                input_bufs_omx_free.pop_front();
-               input_bufs_omx_mutex.Unlock();
+               input_bufs_omx_mutex.unlock();
        }
 
        int read_pos = 0;
@@ -3141,9 +3140,9 @@ bool VideoOMX::displayIFrame(const UCHAR* buffer, UINT length) {
                                                while (count < 100 && omx_running && iframemode) {
                                                        count++;
 
-                                                       input_bufs_omx_mutex.Lock();
+                                                       input_bufs_omx_mutex.lock();
                                                        if (input_bufs_omx_free.size() == 0) {
-                                                               input_bufs_omx_mutex.Unlock();
+                                                               input_bufs_omx_mutex.unlock();
                                        //                      Log::getInstance()->log("Video", Log::DEBUG,
                                                //                              "Ifrane no free sample");
                                                                MILLISLEEP(5);
@@ -3156,7 +3155,7 @@ bool VideoOMX::displayIFrame(const UCHAR* buffer, UINT length) {
                                                        cur_input_buf_omx->nTimeStamp = intToOMXTicks(0);
                                                        cur_input_buf_omx->nFlags|= OMX_BUFFERFLAG_TIME_UNKNOWN;
                                                        input_bufs_omx_free.pop_front();
-                                                       input_bufs_omx_mutex.Unlock();
+                                                       input_bufs_omx_mutex.unlock();
                                                        break;
                                                }
                                                if (!cur_input_buf_omx)
index a17b6b1bc5a2eb374e6af6dab075bce9eb0abd60..b3819b7ddcf61d5ef6319fe39ba0c3705a853c58 100644 (file)
     GNU General Public License for more details.
 
     You should have received a copy of the GNU General Public License
-    along with VOMP; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+    along with VOMP.  If not, see <https://www.gnu.org/licenses/>.
 */
 
 
 #ifndef VIDEOOMX_H
 #define VIDEOOMX_H
 
-#include "mutex.h"
-#include "signal.h"
-
-
 #include <stdio.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include <string.h>
-
 #include <stdint.h>
-
 #include <list>
 #include <vector>
+#include <mutex>
 
+#include "signal.h"
 
 #include "defines.h"
 #include "video.h"
@@ -222,8 +217,8 @@ class VideoOMX : public Video
        int idleClock();
        int getClockAudioandInit(OMX_HANDLETYPE *p_omx_clock,OMX_U32 *p_omx_clock_output_port);
        int getClockVideoandInit();
-       void LockClock() {clock_mutex.Lock();};
-       void UnlockClock() {clock_mutex.Unlock();};
+       void LockClock() {clock_mutex.lock();};
+       void UnlockClock() {clock_mutex.unlock();};
        OMX_ERRORTYPE ProtOMXEmptyThisBuffer(OMX_HANDLETYPE handle, OMX_BUFFERHEADERTYPE* buffer);
        void clockPause();
        void clockUnpause();
@@ -233,7 +228,7 @@ class VideoOMX : public Video
 
        void interlaceSwitch4Demux();
 
-       Mutex clock_mutex; //clock mutex is now responsible for all omx stuff
+       std::mutex clock_mutex; //clock mutex is now responsible for all omx stuff
        long long cur_clock_time;
 
 
@@ -271,7 +266,7 @@ class VideoOMX : public Video
 
           std::vector<OMX_BUFFERHEADERTYPE*> input_bufs_omx_all;
           std::list<OMX_BUFFERHEADERTYPE*> input_bufs_omx_free;
-          Mutex input_bufs_omx_mutex;
+          std::mutex input_bufs_omx_mutex;
           OMX_BUFFERHEADERTYPE* cur_input_buf_omx;
 
           void PutBufferToPres(OMX_BUFFERHEADERTYPE* buffer);
@@ -281,7 +276,7 @@ class VideoOMX : public Video
           bool omx_running;
           bool omx_first_frame;
 
-          Mutex omx_event_mutex;
+          std::mutex omx_event_mutex;
           Signal omx_event_ready_signal;
 
           std::list<VPE_OMX_EVENT> omx_events;