diff options
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | ffnetdev.c | 23 | ||||
-rw-r--r-- | ffnetdev.h | 4 | ||||
-rw-r--r-- | streamdevice.c | 21 | ||||
-rw-r--r-- | streamdevice.h | 1 | ||||
-rw-r--r-- | tools/socket.c | 2 | ||||
-rw-r--r-- | tsworker.c | 5 | ||||
-rw-r--r-- | tsworker.h | 2 |
8 files changed, 49 insertions, 13 deletions
@@ -53,8 +53,8 @@ COMMONOBJS = i18n.o \ SERVEROBJS = $(PLUGIN).o \ \ - ffnetdev.o ffnetdevsetup.o osdworker.o tsworker.o netosd.o streamdevice.o pes2ts.o remote.o \ - vncEncodeRRE.o vncEncodeCoRRE.o vncEncodeHexT.o \ + ffnetdev.o ffnetdevsetup.o osdworker.o tsworker.o clientcontrol.o netosd.o streamdevice.o \ + pes2ts.o remote.o vncEncodeRRE.o vncEncodeCoRRE.o vncEncodeHexT.o \ vncEncoder.o translate.o \ ifdef DEBUG @@ -17,6 +17,7 @@ #include "streamdevice.h" #include "remote.h" #include "osdworker.h" +#include "clientcontrol.h" #include "config.h" #include "ffnetdevsetup.h" @@ -57,6 +58,7 @@ cPluginFFNetDev::cPluginFFNetDev(void) // VDR OBJECTS TO EXIST OR PRODUCE ANY OUTPUT! TSPort = STREAMPORT; OSDPort = OSDPORT; + ControlPort = CONTROLPORT; EnableRemote = false; m_origPrimaryDevice = -1; m_Remote = NULL; @@ -68,6 +70,7 @@ cPluginFFNetDev::~cPluginFFNetDev() { cOSDWorker::Exit(); cTSWorker::Exit(); + cClientControl::Exit(); delete m_Remote; } @@ -78,6 +81,7 @@ const char *cPluginFFNetDev::CommandLineHelp(void) return " -t PORT, --tsport PORT port number for sending TS to.\n" " -o PORT, --osdport PORT listen on this port for OSD connect.\n" + " -c PORT, --controlport PORT listen on this port for ClientControl connect.\n" " -e enable remote control over OSD connection.\n" "\n"; } @@ -89,12 +93,13 @@ bool cPluginFFNetDev::ProcessArgs(int argc, char *argv[]) static struct option long_options[] = { { "tsport", required_argument , NULL, 't' }, { "osdport", required_argument , NULL, 'o' }, + { "controlport", required_argument , NULL, 'c' }, { "enable-remote", no_argument , NULL, 'e' }, { NULL, 0 , NULL, 0 } }; int c; - while ((c = getopt_long(argc, argv, "t:o:e", long_options, NULL)) != -1) { + while ((c = getopt_long(argc, argv, "t:o:c:e", long_options, NULL)) != -1) { switch (c) { case 'e': EnableRemote = true; dsyslog("[ffnetdev] Remote enabled\n"); @@ -121,6 +126,17 @@ bool cPluginFFNetDev::ProcessArgs(int argc, char *argv[]) esyslog("[ffnetdev] invalid port number: %s\n", optarg); return 2; break; + case 'c': if (isnumber(optarg)) { + int n = atoi(optarg); + if (0 < n && n < 65536) { + ControlPort = n; + dsyslog("[ffnetdev] ClientControl Port: %d\n", n); + break; + } + } + esyslog("[ffnetdev] invalid port number: %s\n", optarg); + return 2; + break; default : return 2; } } @@ -131,14 +147,14 @@ bool cPluginFFNetDev::ProcessArgs(int argc, char *argv[]) #if VDRVERSNUM >= 10347 cString cPluginFFNetDev::Active(void) { - if(cOSDWorker::Active() || cTSWorker::Active()) + if(cOSDWorker::Active() || cTSWorker::Active() || cClientControl::Active()) return tr("ffnetdev is running"); return NULL; } #else bool cPluginFFNetDev::Active(void) { - return (cOSDWorker::Active() || cTSWorker::Active()); + return (cOSDWorker::Active() || cTSWorker::Active() || cClientControl::Active()); } #endif @@ -150,6 +166,7 @@ bool cPluginFFNetDev::Start(void) cOSDWorker::Init(OSDPort, this); cTSWorker::Init(m_StreamDevice, TSPort, this); + cClientControl::Init(ControlPort, this); return true; } @@ -13,6 +13,7 @@ #define OSDPORT 20001 #define STREAMPORT 20002 +#define CONTROLPORT 20005 class cPluginFFNetDev : public cPlugin { private: @@ -23,8 +24,9 @@ private: cMyRemote *m_Remote; int OSDPort; int TSPort; + int ControlPort; bool EnableRemote; - int m_origPrimaryDevice; + int m_origPrimaryDevice; public: cPluginFFNetDev(void); diff --git a/streamdevice.c b/streamdevice.c index 7380e9e..c5e0bb8 100644 --- a/streamdevice.c +++ b/streamdevice.c @@ -9,12 +9,14 @@ #include "osdworker.h" #include "tsworker.h" #include "netosd.h" +#include "vdr/player.h" cStreamDevice::cStreamDevice(void) { dsyslog("[ffnetdev] Device: Constructor cStreamDevice \n"); //m_Remux = new cPES2TSRemux(TS_VPID, TS_APID); - m_Remux = new cPES2PESRemux(); + m_Remux = new cPES2PESRemux(); + m_Playing = false; } cStreamDevice::~cStreamDevice(void) @@ -52,6 +54,17 @@ bool cStreamDevice::SetPlayMode(ePlayMode PlayMode) m_Remux->ClearInput(); m_Remux->ClearOutput(); m_Remux->PlayModeChange(); + cControl *pControl = cControl::Control(); + if (pControl) + { + bool Forward; + int Speed; + pControl->GetReplayMode(m_Playing, Forward, Speed); + } + else + { + m_Playing = false; + } return true; } @@ -114,7 +127,8 @@ int cStreamDevice::PlayAudio(const uchar *Data, int Length, uchar Id) { if (cTSWorker::HaveStreamClient()) { - while ((m_Remux->InputFree() < Length) && cTSWorker::HaveStreamClient()) + while (((m_Remux->InputFree() < Length) && (!m_Playing) || + (m_Remux->Available() > TCP_SEND_SIZE * 10) && (m_Playing)) && cTSWorker::HaveStreamClient()) cCondWait::SleepMs(1); int result=m_Remux->Put(Data, Length); if (result!=Length) { @@ -144,7 +158,8 @@ int cStreamDevice::PlayVideo(const uchar *Data, int Length) if (cTSWorker::HaveStreamClient()) { - while ((m_Remux->InputFree() < Length) && cTSWorker::HaveStreamClient()) + while (((m_Remux->InputFree() < Length) && (!m_Playing) || + (m_Remux->Available() > TCP_SEND_SIZE * 10) && (m_Playing)) && cTSWorker::HaveStreamClient()) cCondWait::SleepMs(1); int result=m_Remux->Put(Data, Length); if (result!=Length) { diff --git a/streamdevice.h b/streamdevice.h index 6cd3fa5..8f8603b 100644 --- a/streamdevice.h +++ b/streamdevice.h @@ -18,6 +18,7 @@ class cStreamDevice: public cDevice { private: cPESRemux *m_Remux; + bool m_Playing; protected: public: cStreamDevice(void); diff --git a/tools/socket.c b/tools/socket.c index 5e5c505..92c0e07 100644 --- a/tools/socket.c +++ b/tools/socket.c @@ -9,7 +9,7 @@ #include <fcntl.h> #define UDP_TX_BUF_SIZE (188*348) -//#define TCP_TX_BUF_SIZE (1024 * 30) +//#define TCP_TX_BUF_SIZE (1024 * 60) cTBSocket::cTBSocket(int Type) { memset(&m_LocalAddr, 0, sizeof(m_LocalAddr)); @@ -19,7 +19,6 @@ #define UDP_PACKET_SIZE (TS_PACKET_SIZE * 7) #define UDP_MAX_BITRATE 8112832 #define UDP_SEND_INTERVALL 1000 -#define TCP_SEND_SIZE (1024 * 10) // 8388608 = 8MBit struct TSData @@ -101,12 +100,12 @@ void cTSWorker::ActionTCP(void) { m_Active = true; have_Streamclient = false; - if (!m_StreamListen.Listen(m_ListenIp, m_StreamListenPort, 1)) { // ToDo JN place to allow more connections/clients! + if (!m_StreamListen.Listen(m_ListenIp, m_StreamListenPort, 1)) { // ToDo JN place to allow more connections/clients! esyslog("[ffnetdev] Streamer: Couldn't listen %s:%d: %s", m_ListenIp, m_StreamListenPort, strerror(errno)); m_Active = false; } else - isyslog("[ffnetdev] Streamer: Listening on port %d", m_StreamListenPort); + isyslog("[ffnetdev] Streamer: Listening on port %d", m_StreamListenPort); while (m_Active) { select.Clear(); @@ -18,6 +18,8 @@ typedef unsigned long long u64; +#define TCP_SEND_SIZE (1024 * 20) + // --- cTSWorker ------------------------------------------------------------- |