]> git.vomp.tv Git - vompclient.git/commitdiff
Windows compilation and other fixes
authorMarten Richter <marten.richter@freenet.de>
Sat, 1 Dec 2012 15:19:56 +0000 (16:19 +0100)
committerMarten Richter <marten.richter@freenet.de>
Sat, 1 Dec 2012 15:19:56 +0000 (16:19 +0100)
12 files changed:
boxstack.cc
boxstack.h
defines.h
dvbsubtitles.h
osdwin.cc
remote.cc
surface.cc
surfacewin.cc
surfacewin.h
videowin.cc
winmain.cc
wselectlist.cc

index 4c821d2b7d6b94e56a25e32333dc8252c368308d..455439f814a1b82971e7fce0d7f26944b8ef093d 100644 (file)
@@ -49,12 +49,6 @@ int BoxStack::init()
   if (initted) return 0;
   initted = 1;
   
-#ifndef WIN32
-  pthread_mutex_init(&boxLock, NULL);
-#else
-  boxLock = CreateMutex(NULL,FALSE,NULL);
-#endif
-
   return 1;
 }
 
@@ -73,30 +67,18 @@ int BoxStack::add(Boxx* v)
 {
   if (!initted) return 0;
   Log::getInstance()->log("BoxStack", Log::DEBUG, "add called"); 
-#ifndef WIN32
-  pthread_mutex_lock(&boxLock);
-#else
-  WaitForSingleObject(boxLock, INFINITE);
-#endif
+  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"); 
-#ifndef WIN32
-    pthread_mutex_unlock(&boxLock);
-#else
-    ReleaseMutex(boxLock);
-#endif
+    boxLock.Unlock();
     return 0;
   }
   boxes[numBoxes++] = v;
 
-#ifndef WIN32
-  pthread_mutex_unlock(&boxLock);
-#else
-  ReleaseMutex(boxLock);
-#endif
+  boxLock.Unlock();
 
   Log::getInstance()->log("BoxStack", Log::DEBUG, "Unlocked for add");
   
@@ -109,20 +91,12 @@ int BoxStack::remove(Boxx* toDelete)
 {
   if (!initted) return 0;
 
-  #ifndef WIN32
-  pthread_mutex_lock(&boxLock);
-  #else
-  WaitForSingleObject(boxLock, INFINITE);
-  #endif
+  boxLock.Lock();
   Log::getInstance()->log("BoxStack", Log::DEBUG, "Locked for remove");  
   
   if (numBoxes == 0)
   {
-    #ifndef WIN32
-    pthread_mutex_unlock(&boxLock);
-    #else
-    ReleaseMutex(boxLock);
-    #endif
+    boxLock.Unlock();
     Log::getInstance()->log("BoxStack", Log::ERR, "Unlocked for remove numBoxes == 0");  
     return 0;
   }
@@ -149,29 +123,17 @@ int BoxStack::remove(Boxx* toDelete)
     {
       // not a Box we have!
       // FIXME
-      #ifndef WIN32
-      pthread_mutex_unlock(&boxLock);
-      #else
-      ReleaseMutex(boxLock);
-      #endif
+      boxLock.Unlock();
       Log::getInstance()->log("BoxStack", Log::ERR, "Unlocked for remove - no boxx deleted");  
       return 0;
     }
   }
 
-#ifndef WIN32
-  pthread_mutex_unlock(&boxLock);
-#else
-  ReleaseMutex(boxLock);
-#endif
+  boxLock.Unlock();
 
 toDelete->preDelete();
 
-#ifndef WIN32
-  pthread_mutex_lock(&boxLock);
-#else
-  WaitForSingleObject(boxLock, INFINITE);
-#endif
+  boxLock.Lock();
 
 //  Log::getInstance()->log("BoxStack", Log::DEBUG, "Starting deleteBox");
   deleteBox(i);
@@ -190,11 +152,7 @@ toDelete->preDelete();
     Command::getInstance()->postMessageNoLock(m);
   }
 
-#ifndef WIN32
-  pthread_mutex_unlock(&boxLock);
-#else
-  ReleaseMutex(boxLock);
-#endif
+  boxLock.Unlock();
   Log::getInstance()->log("BoxStack", Log::DEBUG, "Unlocked for remove");  
  
   // Delete the box
@@ -224,11 +182,7 @@ void BoxStack::deleteBox(int z)
 
 void BoxStack::redrawAllBoxes()
 {
-#ifndef WIN32
-  pthread_mutex_lock(&boxLock);
-#else
-  WaitForSingleObject(boxLock, INFINITE);
-#endif
+  boxLock.Lock();
 
   for (int z = 0; z < numBoxes; z++)
   {
@@ -236,23 +190,15 @@ void BoxStack::redrawAllBoxes()
   }
 
 
-#ifndef WIN32
-    pthread_mutex_unlock(&boxLock);
-#else
-    ReleaseMutex(boxLock);
-#endif
-    update(NULL,NULL); // should blt all
+  boxLock.Unlock();
+  update(NULL,NULL); // should blt all
 }
 
 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
-#ifndef WIN32
-  pthread_mutex_lock(&boxLock);
-#else
-  WaitForSingleObject(boxLock, INFINITE);
-#endif
+  boxLock.Lock();
   Log::getInstance()->log("BoxStack", Log::DEBUG, "Locked for update");
 
   // Get the z index of the box
@@ -267,11 +213,7 @@ void BoxStack::update(Boxx* toUpdate, Region* regionToUpdate)
     if (z == numBoxes)
     {
       // not a Box we have!
-  #ifndef WIN32
-      pthread_mutex_unlock(&boxLock);
-  #else
-      ReleaseMutex(boxLock);
-  #endif 
+      boxLock.Unlock();
       Log::getInstance()->log("BoxStack", Log::ERR, "Unlocked for update! box not inside boxstack");
       return;
     }
@@ -282,11 +224,7 @@ void BoxStack::update(Boxx* toUpdate, Region* regionToUpdate)
   }
 
   if (!toUpdate) {
-#ifndef WIN32
-         pthread_mutex_unlock(&boxLock);
-#else
-         ReleaseMutex(boxLock);
-#endif
+      boxLock.Unlock();
          Log::getInstance()->log("BoxStack", Log::DEBUG, "Unlocked for update, no box present");
          return ;
   }
@@ -319,11 +257,7 @@ void BoxStack::update(Boxx* toUpdate, Region* regionToUpdate)
     rl.pop_front();
   }
 
-#ifndef WIN32
-  pthread_mutex_unlock(&boxLock);
-#else
-  ReleaseMutex(boxLock);
-#endif  
+  boxLock.Unlock();
   Log::getInstance()->log("BoxStack", Log::DEBUG, "Unlocked for update");
 }
 
@@ -500,37 +434,21 @@ void BoxStack::removeAll()
   
   while(numBoxes > 1)
   {
-    #ifndef WIN32
-      pthread_mutex_lock(&boxLock);
-    #else
-      WaitForSingleObject(boxLock, INFINITE);
-    #endif  
+    boxLock.Lock(); 
 
     if (numBoxes == 1)
     {
-      #ifndef WIN32
-        pthread_mutex_unlock(&boxLock);
-      #else
-        ReleaseMutex(boxLock);
-      #endif
+      boxLock.Unlock();
       break;
     }    
   
     toDel = boxes[numBoxes - 1];
 
-    #ifndef WIN32
-      pthread_mutex_unlock(&boxLock);
-    #else
-      ReleaseMutex(boxLock);
-    #endif
+    boxLock.Unlock();
 
     toDel->preDelete();
     
-    #ifndef WIN32
-      pthread_mutex_lock(&boxLock);
-    #else
-      WaitForSingleObject(boxLock, INFINITE);
-    #endif  
+    boxLock.Lock();
 
     // If boxes[numBoxes - 1] isn't toDel then there's a problem
     if (boxes[numBoxes - 1] == toDel)
@@ -543,11 +461,7 @@ void BoxStack::removeAll()
       toDel = NULL;
     }
 
-    #ifndef WIN32
-      pthread_mutex_unlock(&boxLock);
-    #else
-      ReleaseMutex(boxLock);
-    #endif
+    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 1e0d638e94c50ba2e021fb4cd3e7ef485581821b..b0b7156eeb966b56d3bb29a213f9de29e1408bb7 100644 (file)
@@ -30,6 +30,8 @@
 #include <pthread.h>
 #endif
 
+#include "mutex.h"
+
 #include "boxx.h"
 #include "region.h"
 #include "message.h"
@@ -69,11 +71,8 @@ class BoxStack
     Boxx* boxes[20];
     int numBoxes;
 
-#ifndef WIN32
-    pthread_mutex_t boxLock;
-#else
-    HANDLE boxLock;
-#endif
+    Mutex boxLock;
+
 
     void deleteBox(int z);
     void repaintRevealed(int x, Region r);
index 4ed4f15e10ac172375da8d00967ccef689014fa1..757855368ec2d199aa9cfe4a9d66ff9520d64d1e 100644 (file)
--- a/defines.h
+++ b/defines.h
@@ -43,6 +43,8 @@ long long getTimeMS();
   #define Thread_TYPE ThreadWin
   #define ThreadID_TYPE unsigned int
 
+  #define RemoteStartDev ""//No devices passed
+
   #define SNPRINTF _snprintf
   #define VSNPRINTF _vsnprintf
   #define STRCASECMP _stricmp
index d08f3c36b1e7b1a5e069ae19d9b48de82ffae03e..7258c1833cc64620b2aad4bc4f8359d549a6ab74 100644 (file)
 
 #include "bitmap.h"
 #include "demuxer.h"
-#include "inttypes.h"
+#ifndef WIN32
+#include <inttypes.h>
+#else
+typedef unsigned long long     uint64_t;
+#endif
 #include <ctime>
 #include <vector>
 #include <deque>
index c55bb112388df60b059e726619a337fbcf31690e..4c70e09fc41def65623c842fb23cf8f8680bc568 100644 (file)
--- a/osdwin.cc
+++ b/osdwin.cc
@@ -28,8 +28,8 @@
 #include "message.h"
 #include "command.h"
 
-#define  BACKBUFFER_WIDTH 1280
-#define  BACKBUFFER_HEIGHT 720
+#define  BACKBUFFER_WIDTH 1920
+#define  BACKBUFFER_HEIGHT 1080
 
 
 
index a17e6ee1a1f8885b31d4fa04e80e7a8cea348663..d0bf8963f848d29f148f8bb19ea91d7149c6ba00 100644 (file)
--- a/remote.cc
+++ b/remote.cc
@@ -27,6 +27,7 @@
 
 Remote* Remote::instance = NULL;
 
+#ifndef _MSC_VER
 
 const ULONG Remote::NOLEARNMODE;
 // Not buttons
@@ -101,6 +102,8 @@ const  UCHAR Remote::PLAYPAUSE;
 const  UCHAR Remote::OLDREMOTE;
 const  UCHAR Remote::NEWREMOTE;
 
+#endif
+
 Remote::Remote()
 {
   if (instance) return;
index 1ae541161916112bd4180afdd6712e8bdff357a8..ba8f7476471ae3f8d90ddd85ac720b7ac56d8b9d 100644 (file)
@@ -53,14 +53,14 @@ void initpol_tables(){
         float fposy=((float)(ttcharsizey))/((float)(charsizey))*((float)py);
         float yweight=fposy-floor(fposy);
         float yinvweight=1.-yweight;
-        interpol_upline[py]=min((unsigned int)ceil(fposy),9);
-        interpol_lowline[py]=max((unsigned int)floor(fposy),0);
+        interpol_upline[py]=min((int)(ceil(fposy)),9);
+        interpol_lowline[py]=max((int)(floor(fposy)),0);
         for (int px=0;px<charsizex;px++) {
             float fposx=((float)(ttcharsizex))/((float)(charsizex))*((float)px);
             float xweight=fposx-floor(fposx);
             float xinvweight=1.-xweight;
-            interpol_upbit[px]= (min((unsigned int)ceil(fposx),11));
-            interpol_lowbit[px]= (max((unsigned int)floor(fposx),0));
+            interpol_upbit[px]= (min((int)ceil(fposx),11));
+            interpol_lowbit[px]= (max((int)floor(fposx),0));
 
             interpol_table_fac1[px][py]=xweight*yweight*256.;
             interpol_table_fac2[px][py]=xinvweight*yweight*256.;
index e64f5639da56fff393ea9dc1996ded8f2c26d014..9c7c81cb0b38ebe941ec64dc32e667d2c04bd11d 100644 (file)
@@ -22,6 +22,7 @@
 #include "osdwin.h"
 #include "bitmap.h"
 #include "log.h"
+#include <D3dx9tex.h>
 
 SurfaceWin::SurfaceWin(int id)
 : Surface(id)
@@ -236,7 +237,7 @@ void SurfaceWin::drawVertLine(int x, int y1, int y2, const DrawStyle& c)
   fillblt(x, y1, 1, y2-y1, c);
 }
 
-void SurfaceWin::drawBitmap(int x, int y, const Bitmap& bm)
+void SurfaceWin::drawBitmap(int x, int y, const Bitmap& bm,const DisplayRegion & region)
 {
   // Temporary code? Draw one pixel at a time using drawPixel()
   startFastDraw();
index 093b28e3b4f93149f7d8964d65efe302e63c734f..5be38cf715b7da7abf431b2714cab060f75b6a05 100644 (file)
@@ -41,7 +41,7 @@ class SurfaceWin : public Surface
     int fillblt(int x, int y, int width, int height, const DrawStyle& c);
     void drawHorzLine(int x1, int x2, int y, const DrawStyle& c);
     void drawVertLine(int x, int y1, int y2, const DrawStyle& c);
-    void drawBitmap(int x, int y, const Bitmap& bm);
+    void drawBitmap(int x, int y, const Bitmap& bm,const DisplayRegion & region);
     int updateToScreen(int sx, int sy, int w, int h, int dx, int dy);
     void readPixel(int x, int y, unsigned char* r, unsigned char* g, unsigned char* b);
     void screenShot(const char* fileName);
index 06983dac976d03afc94f7076200083d824f5e906..dcde4aa2b25714a24514e98100a9f936e68dc93d 100644 (file)
@@ -1942,10 +1942,10 @@ bool VideoWin::displayIFrame(const UCHAR* buffer, UINT length)
   IMediaSample* ms=NULL;
   REFERENCE_TIME reftime1=0;
   REFERENCE_TIME reftime2=0;
-  if (!videoon) return;
+  if (!videoon) return false;
   if (!getCurrentVideoMediaSample(&ms) || ms==NULL) {// get the current sample
     MILLISLEEP(10);
-    return ;
+    return false;
   }
   BYTE *ms_buf;
   DWORD ms_length;
@@ -1957,7 +1957,7 @@ bool VideoWin::displayIFrame(const UCHAR* buffer, UINT length)
   DWORD pattern, packet_length;
   DWORD headerstrip=0;
   bool first=true;
-  if (length < 4) return ;
+  if (length < 4) return false;
   //Now we strip the pes header
   pattern = (buffer[0] << 16) | (buffer[1] << 8) | (buffer[2]);
   while (read_pos + 7 <= length)
@@ -1989,7 +1989,7 @@ bool VideoWin::displayIFrame(const UCHAR* buffer, UINT length)
 
                          if (!getCurrentVideoMediaSample(&ms) || ms==NULL) {// get the current sample
                                MILLISLEEP(10);
-                               return ;
+                               return false;
                          }
                          write_pos=0;
                          ms_length=ms->GetSize();
index 9b261f07c209973360f3c564754ac079cbc1481c..d120f8a6b7d3f2323daa3394ec1649cb1cd63223 100644 (file)
@@ -901,15 +901,16 @@ void shutdown(int code)
 
 // -------------------------------------------------------------------------------------------------------------------
 
-ULLONG ntohll(ULLONG a)
-{
-  return htonll(a);
-}
-
 ULLONG htonll(ULLONG a)
 {
   return (((ULLONG)htonl((ULONG)((a<<32)>> 32))<<32)
     |(ULONG)htonl(((ULONG) (a >> 32))));
 }
+
+ULLONG ntohll(ULLONG a)
+{
+  return htonll(a);
+}
+
 #endif
 
index 3c9b0a0843c54deb48d9f169fe4b6e17a39f5173..1c5e2d7f0e627fb10344711fadc96c62b098986a 100644 (file)
@@ -249,6 +249,7 @@ bool WSelectList::mouseAndroidScroll(int x, int y,int sx, int sy)
        if (seloption<0) seloption=0;
        else if (seloption>options.size()-1) seloption=options.size()-1;
        selectedOption=seloption;*/
+    return false;
 
 }