From 0132230de0a894c4bf40dced2b82ea60546b9a61 Mon Sep 17 00:00:00 2001 From: lordjaxom Date: Tue, 8 Feb 2005 15:34:38 +0000 Subject: [PATCH] - transfer --- client/setup.c | 6 +---- client/setup.h | 3 +-- client/socket.c | 50 +++++++++++++++-------------------------- client/socket.h | 3 +-- common.c | 5 +++-- common.h | 7 ++++-- server/connectionHTTP.c | 4 ++-- server/connectionVTP.c | 22 +++++------------- server/connectionVTP.h | 3 --- server/livestreamer.c | 26 +++++++++------------ server/livestreamer.h | 5 +---- 11 files changed, 47 insertions(+), 87 deletions(-) diff --git a/client/setup.c b/client/setup.c index f8f53db..8d7b9cb 100644 --- a/client/setup.c +++ b/client/setup.c @@ -1,5 +1,5 @@ /* - * $Id: setup.c,v 1.1 2004/12/30 22:44:03 lordjaxom Exp $ + * $Id: setup.c,v 1.2 2005/02/08 15:34:38 lordjaxom Exp $ */ #include @@ -13,7 +13,6 @@ cStreamdevClientSetup StreamdevClientSetup; cStreamdevClientSetup::cStreamdevClientSetup(void) { StartClient = false; RemotePort = 2004; - StreamPIDS = true; #if VDRVERSNUM >= 10300 StreamFilters = false; #endif @@ -30,7 +29,6 @@ bool cStreamdevClientSetup::SetupParse(const char *Name, const char *Value) { strcpy(RemoteIp, Value); } else if (strcmp(Name, "RemotePort") == 0) RemotePort = atoi(Value); - else if (strcmp(Name, "StreamPIDS") == 0) StreamPIDS = atoi(Value); #if VDRVERSNUM >= 10300 else if (strcmp(Name, "StreamFilters") == 0) StreamFilters = atoi(Value); #endif @@ -45,7 +43,6 @@ cStreamdevClientMenuSetupPage::cStreamdevClientMenuSetupPage(void) { AddBoolEdit (tr("Start Client"), m_NewSetup.StartClient); AddIpEdit (tr("Remote IP"), m_NewSetup.RemoteIp); AddShortEdit(tr("Remote Port"), m_NewSetup.RemotePort); - AddBoolEdit (tr("MultiPID Streaming"), m_NewSetup.StreamPIDS); #if VDRVERSNUM >= 10300 AddBoolEdit (tr("Filter Streaming"), m_NewSetup.StreamFilters); #endif @@ -70,7 +67,6 @@ void cStreamdevClientMenuSetupPage::Store(void) { else SetupStore("RemoteIp", m_NewSetup.RemoteIp); SetupStore("RemotePort", m_NewSetup.RemotePort); - SetupStore("StreamPIDS", m_NewSetup.StreamPIDS); #if VDRVERSNUM >= 10300 SetupStore("StreamFilters", m_NewSetup.StreamFilters); #endif diff --git a/client/setup.h b/client/setup.h index fe8e975..b0a1867 100644 --- a/client/setup.h +++ b/client/setup.h @@ -1,5 +1,5 @@ /* - * $Id: setup.h,v 1.1 2004/12/30 22:44:03 lordjaxom Exp $ + * $Id: setup.h,v 1.2 2005/02/08 15:34:38 lordjaxom Exp $ */ #ifndef VDR_STREAMDEV_SETUPCLIENT_H @@ -15,7 +15,6 @@ struct cStreamdevClientSetup { int StartClient; char RemoteIp[20]; int RemotePort; - int StreamPIDS; #if VDRVERSNUM >= 10300 int StreamFilters; #endif diff --git a/client/socket.c b/client/socket.c index 9e399cb..6b3f860 100644 --- a/client/socket.c +++ b/client/socket.c @@ -1,5 +1,5 @@ /* - * $Id: socket.c,v 1.2 2005/02/08 13:59:16 lordjaxom Exp $ + * $Id: socket.c,v 1.3 2005/02/08 15:34:38 lordjaxom Exp $ */ #include @@ -15,22 +15,24 @@ cClientSocket ClientSocket; -cClientSocket::cClientSocket(void) { +cClientSocket::cClientSocket(void) +{ memset(m_DataSockets, 0, sizeof(cTBSocket*) * si_Count); Reset(); } -cClientSocket::~cClientSocket() { +cClientSocket::~cClientSocket() +{ Reset(); if (IsOpen()) Quit(); } -void cClientSocket::Reset(void) { - m_StreamPIDS = false; - - for (int it = 0; it < si_Count; ++it) +void cClientSocket::Reset(void) +{ + for (int it = 0; it < si_Count; ++it) { if (m_DataSockets[it] != NULL) DELETENULL(m_DataSockets[it]); + } } cTBSocket *cClientSocket::DataSocket(eSocketId Id) const { @@ -128,7 +130,7 @@ bool cClientSocket::CheckConnection(void) { return false; } - if (!Command((cTBString)"CAPS TS", 220)) { + if (!Command((cTBString)"CAPS TSPIDS", 220)) { if (errno == 0) esyslog("ERROR: Streamdev: Couldn't negotiate capabilities on %s:%d", (const char*)RemoteIp(), RemotePort()); @@ -136,21 +138,8 @@ bool cClientSocket::CheckConnection(void) { return false; } - if (StreamdevClientSetup.StreamPIDS) { - if (!Command("CAPS TSPIDS", 220)) { - if (errno != 0) { - Close(); - return false; - } - - esyslog("ERROR: Streamdev: Server %s:%d isn't capable of PID streaming", - (const char*)RemoteIp(), RemotePort()); - } else - m_StreamPIDS = true; - } - - isyslog("Streamdev: Connected to server %s:%d using capabilities TS%s", - (const char*)RemoteIp(), RemotePort(), m_StreamPIDS ? ", TSPIDS" : ""); + isyslog("Streamdev: Connected to server %s:%d using capabilities TSPIDS", + (const char*)RemoteIp(), RemotePort()); return true; } @@ -241,16 +230,13 @@ bool cClientSocket::SetChannelDevice(const cChannel *Channel) { bool cClientSocket::SetPid(int Pid, bool On) { if (!CheckConnection()) return false; - if (m_StreamPIDS) { - Dprintf("m_StreamPIDS is ON\n"); - CMD_LOCK; + CMD_LOCK; - if (!Command((On ? "ADDP " : "DELP ") + cTBString::Number(Pid), 220)) { - if (errno == 0) - esyslog("Streamdev: Pid %d not available from %s:%d", Pid, - (const char*)LocalIp(), LocalPort()); - return false; - } + if (!Command((On ? "ADDP " : "DELP ") + cTBString::Number(Pid), 220)) { + if (errno == 0) + esyslog("Streamdev: Pid %d not available from %s:%d", Pid, + (const char*)LocalIp(), LocalPort()); + return false; } return true; } diff --git a/client/socket.h b/client/socket.h index d4f360a..a603727 100644 --- a/client/socket.h +++ b/client/socket.h @@ -1,5 +1,5 @@ /* - * $Id: socket.h,v 1.1 2004/12/30 22:44:04 lordjaxom Exp $ + * $Id: socket.h,v 1.2 2005/02/08 15:34:38 lordjaxom Exp $ */ #ifndef VDR_STREAMDEV_CLIENT_CONNECTION_H @@ -19,7 +19,6 @@ class cPES2TSRemux; class cClientSocket: public cTBSocket { private: - bool m_StreamPIDS; cTBSocket *m_DataSockets[si_Count]; cMutex m_Mutex; diff --git a/common.c b/common.c index af80c6e..b615fec 100644 --- a/common.c +++ b/common.c @@ -1,5 +1,5 @@ /* - * $Id: common.c,v 1.1 2004/12/30 22:43:55 lordjaxom Exp $ + * $Id: common.c,v 1.2 2005/02/08 15:34:38 lordjaxom Exp $ */ #include @@ -18,6 +18,7 @@ const char *StreamTypes[st_Count] = { "PES", "PS", "ES", + "", // used internally only }; const char *SuspendModes[sm_Count] = { @@ -118,7 +119,7 @@ void cStreamdevMenuSetupPage::AddSuspEdit(const char *Title, int &Value) { Add(new cMenuEditStraItem(Title, &Value, sm_Count, SuspendModesTR)); } void cStreamdevMenuSetupPage::AddTypeEdit(const char *Title, int &Value) { - Add(new cMenuEditStraItem(Title, &Value, st_Count, StreamTypes)); + Add(new cMenuEditStraItem(Title, &Value, st_CountSetup, StreamTypes)); } cMenuEditIpItem::cMenuEditIpItem(const char *Name, char *Value): diff --git a/common.h b/common.h index 9f4afdd..630d47c 100644 --- a/common.h +++ b/common.h @@ -1,5 +1,5 @@ /* - * $Id: common.h,v 1.2 2005/02/08 13:59:16 lordjaxom Exp $ + * $Id: common.h,v 1.3 2005/02/08 15:34:38 lordjaxom Exp $ */ #ifndef VDR_STREAMDEV_COMMON_H @@ -65,7 +65,10 @@ enum eStreamType { stPES, stPS, stES, - st_Count + stTSPIDS, + +#define st_CountSetup (stES+1) +#define st_Count (stTSPIDS+1) }; enum eSuspendMode { diff --git a/server/connectionHTTP.c b/server/connectionHTTP.c index 0d3a039..044ad61 100644 --- a/server/connectionHTTP.c +++ b/server/connectionHTTP.c @@ -1,5 +1,5 @@ /* - * $Id: connectionHTTP.c,v 1.2 2005/02/08 13:59:16 lordjaxom Exp $ + * $Id: connectionHTTP.c,v 1.3 2005/02/08 15:34:38 lordjaxom Exp $ */ #include "server/connectionHTTP.h" @@ -57,7 +57,7 @@ bool cConnectionHTTP::Command(char *Cmd) { if (device != NULL) { device->SwitchChannel(m_Channel, false); m_LiveStreamer->SetDevice(device); - if (m_LiveStreamer->SetChannel(m_Channel, m_StreamType, false)) { + if (m_LiveStreamer->SetChannel(m_Channel, m_StreamType)) { m_Startup = true; if (m_StreamType == stES && (m_Channel->Vpid() == 0 || m_Channel->Vpid() == 1 || m_Channel->Vpid() == 0x1FFF)) { diff --git a/server/connectionVTP.c b/server/connectionVTP.c index 092bd26..9642f22 100644 --- a/server/connectionVTP.c +++ b/server/connectionVTP.c @@ -1,5 +1,5 @@ /* - * $Id: connectionVTP.c,v 1.2 2005/02/08 13:59:16 lordjaxom Exp $ + * $Id: connectionVTP.c,v 1.3 2005/02/08 15:34:38 lordjaxom Exp $ */ #include "server/connectionVTP.h" @@ -27,10 +27,7 @@ */ cConnectionVTP::cConnectionVTP(void): cServerConnection("VTP") { - m_StreamPIDS = false; m_LiveStreamer = NULL; - m_ClientCaps = stTS; - memset(m_DataSockets, 0, sizeof(cTBSocket*) * si_Count); } @@ -89,18 +86,9 @@ bool cConnectionVTP::Command(char *Cmd) { } bool cConnectionVTP::CmdCAPS(char *Opts) { - if (strcasecmp(Opts, "TSPIDS") == 0) m_StreamPIDS = true; - else { - int idx = 0; - while (idx < st_Count && strcasecmp(Opts, StreamTypes[idx]) != 0) - ++idx; - - if (idx == st_Count) - return Respond(561, (cTBString)"Capability \"" + Opts + "\" not known"); - - m_ClientCaps = (eStreamType)idx; - } - return Respond(220, (cTBString)"Capability \"" + Opts + "\" accepted"); + if (strcasecmp(Opts, "TSPIDS") == 0) + return Respond(220, (cTBString)"Capability \"" + Opts + "\" accepted"); + return Respond(561, (cTBString)"Capability \"" + Opts + "\" not known"); } bool cConnectionVTP::CmdPROV(char *Opts) { @@ -188,7 +176,7 @@ bool cConnectionVTP::CmdTUNE(char *Opts) { delete m_LiveStreamer; m_LiveStreamer = new cStreamdevLiveStreamer(1); - m_LiveStreamer->SetChannel(chan, m_ClientCaps, m_StreamPIDS); + m_LiveStreamer->SetChannel(chan, stTSPIDS); m_LiveStreamer->SetDevice(dev); return Respond(220, "Channel tuned"); diff --git a/server/connectionVTP.h b/server/connectionVTP.h index ec42d23..64915e8 100644 --- a/server/connectionVTP.h +++ b/server/connectionVTP.h @@ -10,9 +10,6 @@ class cStreamdevLiveStreamer; class cConnectionVTP: public cServerConnection { private: cTBSocket *m_DataSockets[si_Count]; - eStreamType m_ClientCaps; - bool m_StreamPIDS; - cStreamdevLiveStreamer *m_LiveStreamer; // Members adopted from SVDRP diff --git a/server/livestreamer.c b/server/livestreamer.c index 7848d3f..0a77ceb 100644 --- a/server/livestreamer.c +++ b/server/livestreamer.c @@ -34,9 +34,6 @@ cStreamdevLiveStreamer::cStreamdevLiveStreamer(int Priority): m_Remux = NULL; m_Buffer = NULL; m_Sequence = 0; -#if VDRVERSNUM >= 10300 - m_Filter = NULL; -#endif memset(m_Pids, 0, sizeof(m_Pids)); } @@ -45,7 +42,7 @@ cStreamdevLiveStreamer::~cStreamdevLiveStreamer() { delete m_Receiver; delete m_Remux; #if VDRVERSNUM >= 10300 - delete m_Filter; + //delete m_Filter; TODO #endif free(m_Buffer); } @@ -100,8 +97,8 @@ bool cStreamdevLiveStreamer::SetPid(int Pid, bool On) { return true; } -bool cStreamdevLiveStreamer::SetChannel(const cChannel *Channel, int StreamType, - bool StreamPIDS) { +bool cStreamdevLiveStreamer::SetChannel(const cChannel *Channel, eStreamType StreamType) +{ Dprintf("Initializing Remuxer for full channel transfer\n"); printf("ca pid: %d\n", Channel->Ca()); m_Channel = Channel; @@ -120,31 +117,28 @@ bool cStreamdevLiveStreamer::SetChannel(const cChannel *Channel, int StreamType, && SetPid(Channel->Apid(0), true) && SetPid(Channel->Apid(1), true) && SetPid(Channel->Dpid(0), true); - break; case stPS: m_Remux = new cTS2PSRemux(Channel->Vpid(), Channel->Apid(0), 0, 0, 0, true); return SetPid(Channel->Vpid(), true) && SetPid(Channel->Apid(0), true); - break; case stTS: - if (!StreamPIDS) { - return SetPid(Channel->Vpid(), true) - && SetPid(Channel->Apid(0), true) - && SetPid(Channel->Apid(1), true) - && SetPid(Channel->Dpid(0), true); - } + return SetPid(Channel->Vpid(), true) + && SetPid(Channel->Apid(0), true) + && SetPid(Channel->Apid(1), true) + && SetPid(Channel->Dpid(0), true); + + case stTSPIDS: Dprintf("pid streaming mode\n"); return true; - break; } return false; } bool cStreamdevLiveStreamer::SetFilter(u_short Pid, u_char Tid, u_char Mask, bool On) { -#if VDRVERSNUM >= 10300 +#if 0 Dprintf("setting filter\n"); if (On) { if (m_Filter == NULL) { diff --git a/server/livestreamer.h b/server/livestreamer.h index 62137d1..a22dbb3 100644 --- a/server/livestreamer.h +++ b/server/livestreamer.h @@ -40,9 +40,6 @@ private: cTSRemux *m_Remux; uchar *m_Buffer; int m_Sequence; -#if VDRVERSNUM >= 10300 - cStreamdevLiveFilter *m_Filter; -#endif protected: virtual uchar *Process(const uchar *Data, int &Count, int &Result); @@ -53,7 +50,7 @@ public: void SetDevice(cDevice *Device) { m_Device = Device; } bool SetPid(int Pid, bool On); - bool SetChannel(const cChannel *Channel, int StreamType, bool StreamPIDS); + bool SetChannel(const cChannel *Channel, eStreamType StreamType); bool SetFilter(u_short Pid, u_char Tid, u_char Mask, bool On); virtual void Detach(void);