mirror of
https://projects.vdr-developer.org/git/vdr-plugin-streamdev.git
synced 2023-10-10 19:16:51 +02:00
- transfer
This commit is contained in:
parent
78b9b7c6ba
commit
c1cb77c3f8
@ -33,10 +33,12 @@ cStreamdevLiveStreamer::cStreamdevLiveStreamer(int Priority):
|
||||
cStreamdevStreamer("streamdev-livestreaming") {
|
||||
m_Priority = Priority;
|
||||
m_NumPids = 0;
|
||||
m_StreamType = stTSPIDS;
|
||||
m_Channel = NULL;
|
||||
m_Device = NULL;
|
||||
m_Receiver = NULL;
|
||||
m_Remux = NULL;
|
||||
m_PESRemux = NULL;
|
||||
}
|
||||
|
||||
cStreamdevLiveStreamer::~cStreamdevLiveStreamer() {
|
||||
@ -103,7 +105,8 @@ bool cStreamdevLiveStreamer::SetChannel(const cChannel *Channel, eStreamType Str
|
||||
Dprintf("Initializing Remuxer for full channel transfer\n");
|
||||
printf("ca pid: %d\n", Channel->Ca());
|
||||
m_Channel = Channel;
|
||||
switch (StreamType) {
|
||||
m_StreamType = StreamType;
|
||||
switch (m_StreamType) {
|
||||
case stES:
|
||||
{
|
||||
int pid = ISRADIO(Channel) ? Channel->Apid(0) : Channel->Vpid();
|
||||
@ -112,8 +115,8 @@ bool cStreamdevLiveStreamer::SetChannel(const cChannel *Channel, eStreamType Str
|
||||
}
|
||||
|
||||
case stPES:
|
||||
m_Remux = new cTS2PSRemux(Channel->Vpid(), Channel->Apid(0), Channel->Apid(1),
|
||||
Channel->Dpid(0), 0, false);
|
||||
m_PESRemux = new cRemux(Channel->Vpid(), Channel->Apids(), Channel->Dpids(),
|
||||
Channel->Spids(), false);
|
||||
return SetPid(Channel->Vpid(), true)
|
||||
&& SetPid(Channel->Apid(0), true)
|
||||
&& SetPid(Channel->Apid(1), true)
|
||||
@ -156,6 +159,51 @@ bool cStreamdevLiveStreamer::SetFilter(u_short Pid, u_char Tid, u_char Mask,
|
||||
#endif
|
||||
}
|
||||
|
||||
int cStreamdevLiveStreamer::Put(const uchar *Data, int Count)
|
||||
{
|
||||
switch (m_StreamType) {
|
||||
case stTS:
|
||||
case stTSPIDS:
|
||||
return cStreamdevStreamer::Put(Data, Count);
|
||||
|
||||
case stPES:
|
||||
return m_PESRemux->Put(Data, Count);
|
||||
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
uchar *cStreamdevLiveStreamer::Get(int &Count)
|
||||
{
|
||||
switch (m_StreamType) {
|
||||
case stTS:
|
||||
case stTSPIDS:
|
||||
return cStreamdevStreamer::Get(Count);
|
||||
|
||||
case stPES:
|
||||
return m_PESRemux->Get(Count);
|
||||
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
void cStreamdevLiveStreamer::Del(int Count)
|
||||
{
|
||||
switch (m_StreamType) {
|
||||
case stTS:
|
||||
case stTSPIDS:
|
||||
cStreamdevStreamer::Del(Count);
|
||||
|
||||
case stPES:
|
||||
m_PESRemux->Del(Count);
|
||||
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Remuxer einbinden
|
||||
#if 0
|
||||
uchar *cStreamdevLiveStreamer::Process(const uchar *Data, int &Count, int &Result) {
|
||||
|
@ -13,6 +13,7 @@
|
||||
#endif
|
||||
|
||||
class cTSRemux;
|
||||
class cRemux;
|
||||
|
||||
class cStreamdevLiveReceiver: public cReceiver {
|
||||
friend class cStreamdevLiveStreamer;
|
||||
@ -35,15 +36,14 @@ private:
|
||||
int m_Priority;
|
||||
int m_Pids[MAXRECEIVEPIDS + 1];
|
||||
int m_NumPids;
|
||||
eStreamType m_StreamType;
|
||||
const cChannel *m_Channel;
|
||||
cDevice *m_Device;
|
||||
cStreamdevLiveReceiver *m_Receiver;
|
||||
cRemux *m_PESRemux;
|
||||
cTSRemux *m_Remux;
|
||||
uchar *m_Buffer;
|
||||
|
||||
protected:
|
||||
//virtual uchar *Process(const uchar *Data, int &Count, int &Result);
|
||||
|
||||
public:
|
||||
cStreamdevLiveStreamer(int Priority);
|
||||
virtual ~cStreamdevLiveStreamer();
|
||||
@ -53,6 +53,10 @@ public:
|
||||
bool SetChannel(const cChannel *Channel, eStreamType StreamType);
|
||||
bool SetFilter(u_short Pid, u_char Tid, u_char Mask, bool On);
|
||||
|
||||
virtual int Put(const uchar *Data, int Count);
|
||||
virtual uchar *Get(int &Count);
|
||||
virtual void Del(int Count);
|
||||
|
||||
virtual void Detach(void);
|
||||
virtual void Attach(void);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: streamer.c,v 1.4 2005/02/08 19:54:52 lordjaxom Exp $
|
||||
* $Id: streamer.c,v 1.5 2005/02/09 19:47:09 lordjaxom Exp $
|
||||
*/
|
||||
|
||||
#include <vdr/ringbuffer.h>
|
||||
@ -35,11 +35,15 @@ void cStreamdevWriter::Action(void)
|
||||
int count;
|
||||
uchar *block = m_Streamer->Get(count);
|
||||
|
||||
if (!m_Socket->SafeWrite(block, count)) {
|
||||
esyslog("ERROR: streamdev-server: couldn't send data: %m");
|
||||
break;
|
||||
if (block) {
|
||||
if (!m_Socket->TimedWrite(block, count, 2000)) {
|
||||
esyslog("ERROR: streamdev-server: couldn't send data: %m");
|
||||
break;
|
||||
}
|
||||
if (count > max)
|
||||
max = count;
|
||||
m_Streamer->Del(count);
|
||||
}
|
||||
m_Streamer->Del(count);
|
||||
}
|
||||
m_Active = false;
|
||||
Dprintf("Max. Transmit Blocksize was: %d\n", max);
|
||||
@ -112,7 +116,7 @@ void cStreamdevStreamer::Action(void)
|
||||
int got;
|
||||
uchar *block = m_RingBuffer->Get(got);
|
||||
|
||||
if (block && got > 0) {
|
||||
if (block) {
|
||||
int count = Put(block, got);
|
||||
if (count)
|
||||
m_RingBuffer->Del(count);
|
||||
|
Loading…
Reference in New Issue
Block a user