- 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>
@ -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

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
@ -15,7 +15,6 @@ struct cStreamdevClientSetup {
int StartClient;
char RemoteIp[20];
int RemotePort;
int StreamPIDS;
#if VDRVERSNUM >= 10300
int StreamFilters;
#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>
@ -15,23 +15,25 @@
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 {
return m_DataSockets[Id];
@ -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",
isyslog("Streamdev: Connected to server %s:%d using capabilities TSPIDS",
(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;
}
@ -241,8 +230,6 @@ 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;
if (!Command((On ? "ADDP " : "DELP ") + cTBString::Number(Pid), 220)) {
@ -251,7 +238,6 @@ bool cClientSocket::SetPid(int Pid, bool On) {
(const char*)LocalIp(), LocalPort());
return false;
}
}
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
@ -19,7 +19,6 @@ class cPES2TSRemux;
class cClientSocket: public cTBSocket {
private:
bool m_StreamPIDS;
cTBSocket *m_DataSockets[si_Count];
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>
@ -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):

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

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"
@ -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;
}
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");

View File

@ -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

View File

@ -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);
}
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) {

View File

@ -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);