summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormethodus <methodus@web.de>2012-11-04 17:01:56 +0100
committermethodus <methodus@web.de>2012-11-04 17:01:56 +0100
commit9b25495fffec4be843e8540c115dd5d9e9e4c7a0 (patch)
tree323f0bfa76e9bad58a258eac3fef948547672002
parent89d79438c4825fb0e66761d0c79ae4d06fe4e82b (diff)
downloadvdr-plugin-upnp-9b25495fffec4be843e8540c115dd5d9e9e4c7a0.tar.gz
vdr-plugin-upnp-9b25495fffec4be843e8540c115dd5d9e9e4c7a0.tar.bz2
Added check if there are active streams ongoing.
-rw-r--r--httptnt/resourceStreamer.ecpp4
-rw-r--r--include/tools.h2
-rw-r--r--upnp.cpp11
-rw-r--r--upnp.h1
4 files changed, 18 insertions, 0 deletions
diff --git a/httptnt/resourceStreamer.ecpp b/httptnt/resourceStreamer.ecpp
index 3af5768..1854916 100644
--- a/httptnt/resourceStreamer.ecpp
+++ b/httptnt/resourceStreamer.ecpp
@@ -10,13 +10,17 @@ int resourceID = 0;
#include "../include/tools.h"
#include "../include/media/mediaManager.h"
#include "../include/server.h"
+#include "../include/media/requestCounter.h"
using namespace upnp;
</%pre>
<%request>
boost::shared_ptr<cResourceStreamer> streamer;
+ request_counter_t counter;
</%request>
<%cpp>
+ _unused(counter);
+
if(objectID.empty()){
reply.out() << "Object ID missing";
return HTTP_BAD_REQUEST;
diff --git a/include/tools.h b/include/tools.h
index 4c6908d..966040d 100644
--- a/include/tools.h
+++ b/include/tools.h
@@ -30,6 +30,8 @@ using namespace std;
#define MAX_METADATA_LENGTH_L 1024
#define MAX_METADATA_LENGTH_S 256
+#define _unused(x) ((void)x)
+
namespace upnp {
typedef std::list<std::string> StringList;
diff --git a/upnp.cpp b/upnp.cpp
index f634b5e..bf585d7 100644
--- a/upnp.cpp
+++ b/upnp.cpp
@@ -10,10 +10,13 @@
#include <getopt.h>
#include "upnp.h"
#include "include/setup.h"
+#include "include/media/requestCounter.h"
using namespace std;
using namespace upnp;
+int request_counter_t::OPEN_REQUESTS = 0;
+
cPluginUpnp::cPluginUpnp(void)
{
mMediaServer = cMediaServer::GetInstance();
@@ -78,6 +81,14 @@ void cPluginUpnp::Stop(void)
mMediaServer->Stop();
}
+cString cPluginUpnp::Active(void)
+{
+ if(request_counter_t::OPEN_REQUESTS > 0){
+ return cString::sprintf(tr("There are %d requests active."), request_counter_t::OPEN_REQUESTS);
+ }
+ return NULL;
+}
+
void cPluginUpnp::Housekeeping(void)
{
// Perform any cleanup or other regular tasks.
diff --git a/upnp.h b/upnp.h
index d952384..ca87653 100644
--- a/upnp.h
+++ b/upnp.h
@@ -30,6 +30,7 @@ public:
virtual bool Initialize(void);
virtual bool Start(void);
virtual void Stop(void);
+ virtual cString Active(void);
virtual void Housekeeping(void);
virtual void MainThreadHook(void);
virtual cMenuSetupPage *SetupMenu(void);