[SCM] vdr-plugin-vnsiserver/master: Imported Upstream version 1.2.1
tiber-guest at users.alioth.debian.org
tiber-guest at users.alioth.debian.org
Thu Feb 26 20:14:48 UTC 2015
The following commit has been merged in the master branch:
commit 20cef32cbadabb2157e1419daf6e605c9b687483
Author: etobi <git at e-tobi.net>
Date: Thu Feb 26 19:14:07 2015 +0100
Imported Upstream version 1.2.1
diff --git a/HISTORY b/HISTORY
index 7d80b41..674db0b 100644
--- a/HISTORY
+++ b/HISTORY
@@ -1,6 +1,12 @@
VDR Plugin 'vnsiserver' Revision History
----------------------------------------
+2015-01-25: Version 1.2.1
+
+- add cmd line switch for setting tcp port
+- fix potential segfault on stop streaming
+- stop triggering epg updates if client does not fetch epg
+
2014-09-03: Version 1.2.0
- add cmd line switch "-d". if set, vnsi creates a dummy dvb device which makes femon work
diff --git a/config.c b/config.c
index 0902728..5ce3549 100644
--- a/config.c
+++ b/config.c
@@ -36,6 +36,7 @@ cVNSIServerConfig::cVNSIServerConfig()
ConfigDirectory = NULL;
stream_timeout = 10;
device = false;
+ testStreamActive = false;
}
/* Global instance */
diff --git a/config.h b/config.h
index 176b3d4..50feb2e 100644
--- a/config.h
+++ b/config.h
@@ -79,6 +79,8 @@ public:
uint16_t listen_port; // Port of remote server
uint16_t stream_timeout; // timeout in seconds for stream data
bool device; // true if vnsi should act as dummy device
+ cString testStreamFile; // TS file to simulate channel
+ bool testStreamActive; // true if test mode is enabled
};
// Global instance
diff --git a/responsepacket.c b/responsepacket.c
index a0188d4..439dfa7 100644
--- a/responsepacket.c
+++ b/responsepacket.c
@@ -213,7 +213,7 @@ bool cResponsePacket::copyin(const uint8_t* src, uint32_t len)
}
uint8_t* cResponsePacket::reserve(uint32_t len) {
- if (!checkExtend(len)) return false;
+ if (!checkExtend(len)) return 0;
uint8_t* result = buffer + bufUsed;
bufUsed += len;
return result;
diff --git a/streamer.c b/streamer.c
index 277f576..6f5fa2f 100644
--- a/streamer.c
+++ b/streamer.c
@@ -88,10 +88,10 @@ bool cLiveStreamer::Open(int serial)
return false;
bool recording = false;
- if (0) // test harness
+ if (VNSIServerConfig.testStreamActive) // test harness
{
recording = true;
- m_VideoBuffer = cVideoBuffer::Create("/home/xbmc/test.ts");
+ m_VideoBuffer = cVideoBuffer::Create(VNSIServerConfig.testStreamFile);
}
else if (PlayRecording && serial == -1)
{
diff --git a/videoinput.c b/videoinput.c
index 9b1842b..d7e45eb 100644
--- a/videoinput.c
+++ b/videoinput.c
@@ -491,9 +491,11 @@ void cVideoInput::Close()
}
}
m_Channel = NULL;
+ m_Device = NULL;
if (m_VideoBuffer)
{
m_VideoBuffer->AttachInput(false);
+ m_VideoBuffer = NULL;
}
}
diff --git a/vnsi.c b/vnsi.c
index ca6005e..18c8616 100644
--- a/vnsi.c
+++ b/vnsi.c
@@ -45,26 +45,45 @@ cPluginVNSIServer::~cPluginVNSIServer()
const char *cPluginVNSIServer::CommandLineHelp(void)
{
- return " -t n, --timeout=n stream data timeout in seconds (default: 10)\n";
+ return " -t n, --timeout=n stream data timeout in seconds (default: 10)\n"
+ " -d , --device act as the primary device\n"
+ " -s n, --test=n TS stream test file to simulate as channel\n"
+ " -p n, --port=n tcp port to listen on\n";
}
bool cPluginVNSIServer::ProcessArgs(int argc, char *argv[])
{
// Implement command line argument processing here if applicable.
static struct option long_options[] = {
+ { "port", required_argument, NULL, 'p' },
{ "timeout", required_argument, NULL, 't' },
{ "device", no_argument, NULL, 'd' },
+ { "test", required_argument, NULL, 'T' },
{ NULL, no_argument, NULL, 0 }
};
int c;
- while ((c = getopt_long(argc, argv, "t:d", long_options, NULL)) != -1) {
+ while ((c = getopt_long(argc, argv, "t:dT:p:", long_options, NULL)) != -1) {
switch (c) {
+ case 'p': if(optarg != NULL) VNSIServerConfig.listen_port = atoi(optarg);
+ break;
case 't': if(optarg != NULL) VNSIServerConfig.stream_timeout = atoi(optarg);
break;
case 'd': VNSIServerConfig.device = true;
break;
+ case 'T': if(optarg != NULL) {
+ VNSIServerConfig.testStreamFile = optarg;
+
+ struct stat file_stat;
+ if (stat(VNSIServerConfig.testStreamFile, &file_stat) == 0) {
+ VNSIServerConfig.testStreamActive = true;
+ printf("vnsiserver: requested test stream file '%s' played now on all channels\n", *VNSIServerConfig.testStreamFile);
+ }
+ else
+ printf("vnsiserver: requested test stream file '%s' not present, started without\n", *VNSIServerConfig.testStreamFile);
+ }
+ break;
default: return false;
}
}
@@ -82,6 +101,7 @@ bool cPluginVNSIServer::Initialize(void)
bool cPluginVNSIServer::Start(void)
{
+ INFOLOG("Starting vnsi server at port=%d\n", VNSIServerConfig.listen_port);
Server = new cVNSIServer(VNSIServerConfig.listen_port);
return true;
diff --git a/vnsi.h b/vnsi.h
index 88a1469..167024c 100644
--- a/vnsi.h
+++ b/vnsi.h
@@ -26,7 +26,7 @@
#include <vdr/plugin.h>
#include "vnsiserver.h"
-static const char *VERSION = "1.2.0";
+static const char *VERSION = "1.2.1";
static const char *DESCRIPTION = "VDR-Network-Streaming-Interface (VNSI) Server";
extern int PmtTimeout;
diff --git a/vnsiclient.c b/vnsiclient.c
index 37e2aa8..d0d4195 100644
--- a/vnsiclient.c
+++ b/vnsiclient.c
@@ -254,7 +254,7 @@ void cVNSIClient::EpgChange()
if (!schedules)
return;
- std::map<int, time_t>::iterator it;
+ std::map<int, sEpgUpdate>::iterator it;
for (const cSchedule *schedule = schedules->First(); schedule; schedule = schedules->Next(schedule))
{
cEvent *lastEvent = schedule->Events()->Last();
@@ -273,11 +273,17 @@ void cVNSIClient::EpgChange()
uint32_t channelId = CreateStringHash(schedule->ChannelID().ToString());
it = m_epgUpdate.find(channelId);
- if (it != m_epgUpdate.end() && it->second >= lastEvent->StartTime())
+ if (it != m_epgUpdate.end() && it->second.lastEvent >= lastEvent->StartTime())
{
continue;
}
+ if (it->second.attempts > 3)
+ {
+ continue;
+ }
+ it->second.attempts++;
+
INFOLOG("Trigger EPG update for channel %s, id: %d", channel->Name(), channelId);
cResponsePacket *resp = new cResponsePacket();
@@ -1010,10 +1016,11 @@ bool cVNSIClient::processCHANNELS_GetChannels() /* OPCODE 63 */
if (filter && !VNSIChannelFilter.PassFilter(*channel))
continue;
+ uint32_t uuid = CreateChannelUID(channel);
m_resp->add_U32(channel->Number());
m_resp->add_String(m_toUTF8.Convert(channel->Name()));
m_resp->add_String(m_toUTF8.Convert(channel->Provider()));
- m_resp->add_U32(CreateChannelUID(channel));
+ m_resp->add_U32(uuid);
m_resp->add_U32(channel->Ca(0));
caid_idx = 0;
caids = "caids:";
@@ -1027,6 +1034,15 @@ bool cVNSIClient::processCHANNELS_GetChannels() /* OPCODE 63 */
{
m_resp->add_String(CreatePiconRef(channel));
}
+
+ // create entry in EPG map on first query
+ std::map<int, sEpgUpdate>::iterator it;
+ it = m_epgUpdate.find(uuid);
+ if (it == m_epgUpdate.end())
+ {
+ m_epgUpdate[uuid].lastEvent = 0;
+ m_epgUpdate[uuid].attempts = 0;
+ }
}
Channels.Unlock();
@@ -1896,7 +1912,6 @@ bool cVNSIClient::processEPG_GetForChannel() /* OPCODE 120 */
cSchedulesLock MutexLock;
const cSchedules *Schedules = cSchedules::Schedules(MutexLock);
- m_epgUpdate[channelUID] = 0;
if (!Schedules)
{
m_resp->add_U32(0);
@@ -1991,7 +2006,8 @@ bool cVNSIClient::processEPG_GetForChannel() /* OPCODE 120 */
cEvent *lastEvent = Schedule->Events()->Last();
if (lastEvent)
{
- m_epgUpdate[channelUID] = lastEvent->StartTime();
+ m_epgUpdate[channelUID].lastEvent = lastEvent->StartTime();
+ m_epgUpdate[channelUID].attempts = 0;
}
DEBUGLOG("written schedules packet");
diff --git a/vnsiclient.h b/vnsiclient.h
index f09517d..b61e2e9 100644
--- a/vnsiclient.h
+++ b/vnsiclient.h
@@ -65,7 +65,12 @@ private:
cMutex m_msgLock;
static cMutex m_timerLock;
cVnsiOsdProvider *m_Osd;
- std::map<int, time_t> m_epgUpdate;
+ typedef struct
+ {
+ int attempts;
+ time_t lastEvent;
+ } sEpgUpdate;
+ std::map<int, sEpgUpdate> m_epgUpdate;
protected:
--
vdr-plugin-vnsiserver packaging
More information about the pkg-multimedia-commits
mailing list