if (initted) return 0;
initted = 1;
-#ifndef WIN32
- pthread_mutex_init(&boxLock, NULL);
-#else
- boxLock = CreateMutex(NULL,FALSE,NULL);
-#endif
-
return 1;
}
{
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");
{
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;
}
{
// 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);
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
void BoxStack::redrawAllBoxes()
{
-#ifndef WIN32
- pthread_mutex_lock(&boxLock);
-#else
- WaitForSingleObject(boxLock, INFINITE);
-#endif
+ boxLock.Lock();
for (int z = 0; z < numBoxes; z++)
{
}
-#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
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;
}
}
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 ;
}
rl.pop_front();
}
-#ifndef WIN32
- pthread_mutex_unlock(&boxLock);
-#else
- ReleaseMutex(boxLock);
-#endif
+ boxLock.Unlock();
Log::getInstance()->log("BoxStack", Log::DEBUG, "Unlocked for update");
}
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)
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);
#include <pthread.h>
#endif
+#include "mutex.h"
+
#include "boxx.h"
#include "region.h"
#include "message.h"
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);
#define Thread_TYPE ThreadWin
#define ThreadID_TYPE unsigned int
+ #define RemoteStartDev ""//No devices passed
+
#define SNPRINTF _snprintf
#define VSNPRINTF _vsnprintf
#define STRCASECMP _stricmp
#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>
#include "message.h"
#include "command.h"
-#define BACKBUFFER_WIDTH 1280
-#define BACKBUFFER_HEIGHT 720
+#define BACKBUFFER_WIDTH 1920
+#define BACKBUFFER_HEIGHT 1080
Remote* Remote::instance = NULL;
+#ifndef _MSC_VER
const ULONG Remote::NOLEARNMODE;
// Not buttons
const UCHAR Remote::OLDREMOTE;
const UCHAR Remote::NEWREMOTE;
+#endif
+
Remote::Remote()
{
if (instance) return;
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.;
#include "osdwin.h"
#include "bitmap.h"
#include "log.h"
+#include <D3dx9tex.h>
SurfaceWin::SurfaceWin(int id)
: Surface(id)
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();
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);
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;
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)
if (!getCurrentVideoMediaSample(&ms) || ms==NULL) {// get the current sample
MILLISLEEP(10);
- return ;
+ return false;
}
write_pos=0;
ms_length=ms->GetSize();
// -------------------------------------------------------------------------------------------------------------------
-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
if (seloption<0) seloption=0;
else if (seloption>options.size()-1) seloption=options.size()-1;
selectedOption=seloption;*/
+ return false;
}