- transfer

This commit is contained in:
lordjaxom 2005-02-08 15:34:38 +00:00
parent 916ed238bc
commit 0132230de0
11 changed files with 47 additions and 87 deletions

View File

@ -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 <vdr/menuitems.h> #include <vdr/menuitems.h>
@ -13,7 +13,6 @@ cStreamdevClientSetup StreamdevClientSetup;
cStreamdevClientSetup::cStreamdevClientSetup(void) { cStreamdevClientSetup::cStreamdevClientSetup(void) {
StartClient = false; StartClient = false;
RemotePort = 2004; RemotePort = 2004;
StreamPIDS = true;
#if VDRVERSNUM >= 10300 #if VDRVERSNUM >= 10300
StreamFilters = false; StreamFilters = false;
#endif #endif
@ -30,7 +29,6 @@ bool cStreamdevClientSetup::SetupParse(const char *Name, const char *Value) {
strcpy(RemoteIp, Value); strcpy(RemoteIp, Value);
} }
else if (strcmp(Name, "RemotePort") == 0) RemotePort = atoi(Value); else if (strcmp(Name, "RemotePort") == 0) RemotePort = atoi(Value);
else if (strcmp(Name, "StreamPIDS") == 0) StreamPIDS = atoi(Value);
#if VDRVERSNUM >= 10300 #if VDRVERSNUM >= 10300
else if (strcmp(Name, "StreamFilters") == 0) StreamFilters = atoi(Value); else if (strcmp(Name, "StreamFilters") == 0) StreamFilters = atoi(Value);
#endif #endif
@ -45,7 +43,6 @@ cStreamdevClientMenuSetupPage::cStreamdevClientMenuSetupPage(void) {
AddBoolEdit (tr("Start Client"), m_NewSetup.StartClient); AddBoolEdit (tr("Start Client"), m_NewSetup.StartClient);
AddIpEdit (tr("Remote IP"), m_NewSetup.RemoteIp); AddIpEdit (tr("Remote IP"), m_NewSetup.RemoteIp);
AddShortEdit(tr("Remote Port"), m_NewSetup.RemotePort); AddShortEdit(tr("Remote Port"), m_NewSetup.RemotePort);
AddBoolEdit (tr("MultiPID Streaming"), m_NewSetup.StreamPIDS);
#if VDRVERSNUM >= 10300 #if VDRVERSNUM >= 10300
AddBoolEdit (tr("Filter Streaming"), m_NewSetup.StreamFilters); AddBoolEdit (tr("Filter Streaming"), m_NewSetup.StreamFilters);
#endif #endif
@ -70,7 +67,6 @@ void cStreamdevClientMenuSetupPage::Store(void) {
else else
SetupStore("RemoteIp", m_NewSetup.RemoteIp); SetupStore("RemoteIp", m_NewSetup.RemoteIp);
SetupStore("RemotePort", m_NewSetup.RemotePort); SetupStore("RemotePort", m_NewSetup.RemotePort);
SetupStore("StreamPIDS", m_NewSetup.StreamPIDS);
#if VDRVERSNUM >= 10300 #if VDRVERSNUM >= 10300
SetupStore("StreamFilters", m_NewSetup.StreamFilters); SetupStore("StreamFilters", m_NewSetup.StreamFilters);
#endif #endif

View File

@ -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 #ifndef VDR_STREAMDEV_SETUPCLIENT_H
@ -15,7 +15,6 @@ struct cStreamdevClientSetup {
int StartClient; int StartClient;
char RemoteIp[20]; char RemoteIp[20];
int RemotePort; int RemotePort;
int StreamPIDS;
#if VDRVERSNUM >= 10300 #if VDRVERSNUM >= 10300
int StreamFilters; int StreamFilters;
#endif #endif

View File

@ -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 <tools/select.h> #include <tools/select.h>
@ -15,22 +15,24 @@
cClientSocket ClientSocket; cClientSocket ClientSocket;
cClientSocket::cClientSocket(void) { cClientSocket::cClientSocket(void)
{
memset(m_DataSockets, 0, sizeof(cTBSocket*) * si_Count); memset(m_DataSockets, 0, sizeof(cTBSocket*) * si_Count);
Reset(); Reset();
} }
cClientSocket::~cClientSocket() { cClientSocket::~cClientSocket()
{
Reset(); Reset();
if (IsOpen()) Quit(); if (IsOpen()) Quit();
} }
void cClientSocket::Reset(void) { void cClientSocket::Reset(void)
m_StreamPIDS = false; {
for (int it = 0; it < si_Count; ++it) {
for (int it = 0; it < si_Count; ++it)
if (m_DataSockets[it] != NULL) if (m_DataSockets[it] != NULL)
DELETENULL(m_DataSockets[it]); DELETENULL(m_DataSockets[it]);
}
} }
cTBSocket *cClientSocket::DataSocket(eSocketId Id) const { cTBSocket *cClientSocket::DataSocket(eSocketId Id) const {
@ -128,7 +130,7 @@ bool cClientSocket::CheckConnection(void) {
return false; return false;
} }
if (!Command((cTBString)"CAPS TS", 220)) { if (!Command((cTBString)"CAPS TSPIDS", 220)) {
if (errno == 0) if (errno == 0)
esyslog("ERROR: Streamdev: Couldn't negotiate capabilities on %s:%d", esyslog("ERROR: Streamdev: Couldn't negotiate capabilities on %s:%d",
(const char*)RemoteIp(), RemotePort()); (const char*)RemoteIp(), RemotePort());
@ -136,21 +138,8 @@ bool cClientSocket::CheckConnection(void) {
return false; return false;
} }
if (StreamdevClientSetup.StreamPIDS) { isyslog("Streamdev: Connected to server %s:%d using capabilities TSPIDS",
if (!Command("CAPS TSPIDS", 220)) { (const char*)RemoteIp(), RemotePort());
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" : "");
return true; return true;
} }
@ -241,16 +230,13 @@ bool cClientSocket::SetChannelDevice(const cChannel *Channel) {
bool cClientSocket::SetPid(int Pid, bool On) { bool cClientSocket::SetPid(int Pid, bool On) {
if (!CheckConnection()) return false; if (!CheckConnection()) return false;
if (m_StreamPIDS) { CMD_LOCK;
Dprintf("m_StreamPIDS is ON\n");
CMD_LOCK;
if (!Command((On ? "ADDP " : "DELP ") + cTBString::Number(Pid), 220)) { if (!Command((On ? "ADDP " : "DELP ") + cTBString::Number(Pid), 220)) {
if (errno == 0) if (errno == 0)
esyslog("Streamdev: Pid %d not available from %s:%d", Pid, esyslog("Streamdev: Pid %d not available from %s:%d", Pid,
(const char*)LocalIp(), LocalPort()); (const char*)LocalIp(), LocalPort());
return false; return false;
}
} }
return true; return true;
} }

View File

@ -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 #ifndef VDR_STREAMDEV_CLIENT_CONNECTION_H
@ -19,7 +19,6 @@ class cPES2TSRemux;
class cClientSocket: public cTBSocket { class cClientSocket: public cTBSocket {
private: private:
bool m_StreamPIDS;
cTBSocket *m_DataSockets[si_Count]; cTBSocket *m_DataSockets[si_Count];
cMutex m_Mutex; cMutex m_Mutex;

View File

@ -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 <vdr/channels.h> #include <vdr/channels.h>
@ -18,6 +18,7 @@ const char *StreamTypes[st_Count] = {
"PES", "PES",
"PS", "PS",
"ES", "ES",
"", // used internally only
}; };
const char *SuspendModes[sm_Count] = { 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)); Add(new cMenuEditStraItem(Title, &Value, sm_Count, SuspendModesTR));
} }
void cStreamdevMenuSetupPage::AddTypeEdit(const char *Title, int &Value) { 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): cMenuEditIpItem::cMenuEditIpItem(const char *Name, char *Value):

View File

@ -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 #ifndef VDR_STREAMDEV_COMMON_H
@ -65,7 +65,10 @@ enum eStreamType {
stPES, stPES,
stPS, stPS,
stES, stES,
st_Count stTSPIDS,
#define st_CountSetup (stES+1)
#define st_Count (stTSPIDS+1)
}; };
enum eSuspendMode { enum eSuspendMode {

View File

@ -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" #include "server/connectionHTTP.h"
@ -57,7 +57,7 @@ bool cConnectionHTTP::Command(char *Cmd) {
if (device != NULL) { if (device != NULL) {
device->SwitchChannel(m_Channel, false); device->SwitchChannel(m_Channel, false);
m_LiveStreamer->SetDevice(device); m_LiveStreamer->SetDevice(device);
if (m_LiveStreamer->SetChannel(m_Channel, m_StreamType, false)) { if (m_LiveStreamer->SetChannel(m_Channel, m_StreamType)) {
m_Startup = true; m_Startup = true;
if (m_StreamType == stES && (m_Channel->Vpid() == 0 if (m_StreamType == stES && (m_Channel->Vpid() == 0
|| m_Channel->Vpid() == 1 || m_Channel->Vpid() == 0x1FFF)) { || m_Channel->Vpid() == 1 || m_Channel->Vpid() == 0x1FFF)) {

View File

@ -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" #include "server/connectionVTP.h"
@ -27,10 +27,7 @@
*/ */
cConnectionVTP::cConnectionVTP(void): cServerConnection("VTP") { cConnectionVTP::cConnectionVTP(void): cServerConnection("VTP") {
m_StreamPIDS = false;
m_LiveStreamer = NULL; m_LiveStreamer = NULL;
m_ClientCaps = stTS;
memset(m_DataSockets, 0, sizeof(cTBSocket*) * si_Count); memset(m_DataSockets, 0, sizeof(cTBSocket*) * si_Count);
} }
@ -89,18 +86,9 @@ bool cConnectionVTP::Command(char *Cmd) {
} }
bool cConnectionVTP::CmdCAPS(char *Opts) { bool cConnectionVTP::CmdCAPS(char *Opts) {
if (strcasecmp(Opts, "TSPIDS") == 0) m_StreamPIDS = true; if (strcasecmp(Opts, "TSPIDS") == 0)
else { return Respond(220, (cTBString)"Capability \"" + Opts + "\" accepted");
int idx = 0; return Respond(561, (cTBString)"Capability \"" + Opts + "\" not known");
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");
} }
bool cConnectionVTP::CmdPROV(char *Opts) { bool cConnectionVTP::CmdPROV(char *Opts) {
@ -188,7 +176,7 @@ bool cConnectionVTP::CmdTUNE(char *Opts) {
delete m_LiveStreamer; delete m_LiveStreamer;
m_LiveStreamer = new cStreamdevLiveStreamer(1); m_LiveStreamer = new cStreamdevLiveStreamer(1);
m_LiveStreamer->SetChannel(chan, m_ClientCaps, m_StreamPIDS); m_LiveStreamer->SetChannel(chan, stTSPIDS);
m_LiveStreamer->SetDevice(dev); m_LiveStreamer->SetDevice(dev);
return Respond(220, "Channel tuned"); return Respond(220, "Channel tuned");

View File

@ -10,9 +10,6 @@ class cStreamdevLiveStreamer;
class cConnectionVTP: public cServerConnection { class cConnectionVTP: public cServerConnection {
private: private:
cTBSocket *m_DataSockets[si_Count]; cTBSocket *m_DataSockets[si_Count];
eStreamType m_ClientCaps;
bool m_StreamPIDS;
cStreamdevLiveStreamer *m_LiveStreamer; cStreamdevLiveStreamer *m_LiveStreamer;
// Members adopted from SVDRP // Members adopted from SVDRP

View File

@ -34,9 +34,6 @@ cStreamdevLiveStreamer::cStreamdevLiveStreamer(int Priority):
m_Remux = NULL; m_Remux = NULL;
m_Buffer = NULL; m_Buffer = NULL;
m_Sequence = 0; m_Sequence = 0;
#if VDRVERSNUM >= 10300
m_Filter = NULL;
#endif
memset(m_Pids, 0, sizeof(m_Pids)); memset(m_Pids, 0, sizeof(m_Pids));
} }
@ -45,7 +42,7 @@ cStreamdevLiveStreamer::~cStreamdevLiveStreamer() {
delete m_Receiver; delete m_Receiver;
delete m_Remux; delete m_Remux;
#if VDRVERSNUM >= 10300 #if VDRVERSNUM >= 10300
delete m_Filter; //delete m_Filter; TODO
#endif #endif
free(m_Buffer); free(m_Buffer);
} }
@ -100,8 +97,8 @@ bool cStreamdevLiveStreamer::SetPid(int Pid, bool On) {
return true; return true;
} }
bool cStreamdevLiveStreamer::SetChannel(const cChannel *Channel, int StreamType, bool cStreamdevLiveStreamer::SetChannel(const cChannel *Channel, eStreamType StreamType)
bool StreamPIDS) { {
Dprintf("Initializing Remuxer for full channel transfer\n"); Dprintf("Initializing Remuxer for full channel transfer\n");
printf("ca pid: %d\n", Channel->Ca()); printf("ca pid: %d\n", Channel->Ca());
m_Channel = Channel; m_Channel = Channel;
@ -120,31 +117,28 @@ bool cStreamdevLiveStreamer::SetChannel(const cChannel *Channel, int StreamType,
&& SetPid(Channel->Apid(0), true) && SetPid(Channel->Apid(0), true)
&& SetPid(Channel->Apid(1), true) && SetPid(Channel->Apid(1), true)
&& SetPid(Channel->Dpid(0), true); && SetPid(Channel->Dpid(0), true);
break;
case stPS: case stPS:
m_Remux = new cTS2PSRemux(Channel->Vpid(), Channel->Apid(0), 0, 0, 0, true); m_Remux = new cTS2PSRemux(Channel->Vpid(), Channel->Apid(0), 0, 0, 0, true);
return SetPid(Channel->Vpid(), true) return SetPid(Channel->Vpid(), true)
&& SetPid(Channel->Apid(0), true); && SetPid(Channel->Apid(0), true);
break;
case stTS: case stTS:
if (!StreamPIDS) { return SetPid(Channel->Vpid(), true)
return SetPid(Channel->Vpid(), true) && SetPid(Channel->Apid(0), true)
&& SetPid(Channel->Apid(0), true) && SetPid(Channel->Apid(1), true)
&& SetPid(Channel->Apid(1), true) && SetPid(Channel->Dpid(0), true);
&& SetPid(Channel->Dpid(0), true);
} case stTSPIDS:
Dprintf("pid streaming mode\n"); Dprintf("pid streaming mode\n");
return true; return true;
break;
} }
return false; return false;
} }
bool cStreamdevLiveStreamer::SetFilter(u_short Pid, u_char Tid, u_char Mask, bool cStreamdevLiveStreamer::SetFilter(u_short Pid, u_char Tid, u_char Mask,
bool On) { bool On) {
#if VDRVERSNUM >= 10300 #if 0
Dprintf("setting filter\n"); Dprintf("setting filter\n");
if (On) { if (On) {
if (m_Filter == NULL) { if (m_Filter == NULL) {

View File

@ -40,9 +40,6 @@ private:
cTSRemux *m_Remux; cTSRemux *m_Remux;
uchar *m_Buffer; uchar *m_Buffer;
int m_Sequence; int m_Sequence;
#if VDRVERSNUM >= 10300
cStreamdevLiveFilter *m_Filter;
#endif
protected: protected:
virtual uchar *Process(const uchar *Data, int &Count, int &Result); virtual uchar *Process(const uchar *Data, int &Count, int &Result);
@ -53,7 +50,7 @@ public:
void SetDevice(cDevice *Device) { m_Device = Device; } void SetDevice(cDevice *Device) { m_Device = Device; }
bool SetPid(int Pid, bool On); 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); bool SetFilter(u_short Pid, u_char Tid, u_char Mask, bool On);
virtual void Detach(void); virtual void Detach(void);