#include "mvpclient.h"
// This is here else it causes compile errors with something in libdvbmpeg
-#include <vdr/menu.h>
+//#include <vdr/menu.h>
+
+pthread_mutex_t threadClientMutex;
+int MVPClient::nr_clients = 0;
+
MVPClient::MVPClient(char* tconfigDirExtra, int tsocket)
: tcp(tsocket)
log = Log::getInstance();
loggedIn = false;
configDirExtra = tconfigDirExtra;
+ incClients();
}
MVPClient::~MVPClient()
}
if (loggedIn) cleanConfig();
+ decClients();
}
ULLONG MVPClient::ntohll(ULLONG a)
return 1;
}
+void MVPClient::incClients()
+{
+ pthread_mutex_lock(&threadClientMutex);
+ MVPClient::nr_clients++;
+ pthread_mutex_unlock(&threadClientMutex);
+}
+
+void MVPClient::decClients()
+{
+ pthread_mutex_lock(&threadClientMutex);
+ MVPClient::nr_clients--;
+ pthread_mutex_unlock(&threadClientMutex);
+}
+
+int MVPClient::getNrClients()
+{
+ int nrClients;
+ pthread_mutex_lock(&threadClientMutex);
+ nrClients = MVPClient::nr_clients;
+ pthread_mutex_unlock(&threadClientMutex);
+ return nrClients;
+}
+
int MVPClient::processGetRecInfo(UCHAR* data, int length)
{
// data is a pointer to the fileName string
#include <vdr/videodir.h>
#include <vdr/plugin.h>
#include <vdr/timers.h>
+#include <vdr/menu.h>
#include "defines.h"
#include "tcp.h"
int run();
// not for external use
void run2();
+ static int getNrClients();
private:
+ static int nr_clients;
pthread_t runThread;
int initted;
TCP tcp;
int processReScanRecording(UCHAR* data, int length); // FIXME obselete
+ void incClients();
+ void decClients();
+
cChannel* channelFromNumber(ULONG channelNumber);
void writeResumeData();
void cleanConfig();
#include "mvpserver.h"
+extern pthread_mutex_t threadClientMutex;
+
MVPServer::MVPServer()
{
+ // MH in case anbody has a better position :-)
+ pthread_mutex_init(&threadClientMutex, NULL);
}
MVPServer::~MVPServer()
#include <getopt.h>
#include "mvpserver.h"
+#include "mvpclient.h"
static const char *VERSION = "0.2.6";
static const char *DESCRIPTION = "VDR on MVP plugin by Chris Tallon";
virtual bool Initialize(void);
virtual bool Start(void);
virtual bool SetupParse(const char *Name, const char *Value);
+ virtual cString Active(void);
private:
return false;
}
+cString cPluginVompserver::Active(void)
+{
+ if(MVPClient::getNrClients() != 0) return tr("VOMP client(s) connected");
+ return NULL;
+}
+
VDRPLUGINCREATOR(cPluginVompserver); // Don't touch this!