mirror of
https://projects.vdr-developer.org/git/vdr-plugin-streamdev.git
synced 2023-10-10 19:16:51 +02:00
server_live-filter-streamer.patch by Petri Hintukainen
- Add cStreamdevFilterStreamer that is binded to current device, not channel - new streamer can exist even when there is no active data connection (live view) Modified Files: server/livestreamer.c server/livestreamer.h
This commit is contained in:
parent
99d19c67d8
commit
9994ecfd08
@ -6,6 +6,7 @@
|
|||||||
#include <vdr/ringbuffer.h>
|
#include <vdr/ringbuffer.h>
|
||||||
|
|
||||||
#include "server/livestreamer.h"
|
#include "server/livestreamer.h"
|
||||||
|
#include "server/livefilter.h"
|
||||||
#include "remux/ts2ps.h"
|
#include "remux/ts2ps.h"
|
||||||
#include "remux/ts2es.h"
|
#include "remux/ts2es.h"
|
||||||
#include "remux/extern.h"
|
#include "remux/extern.h"
|
||||||
@ -591,3 +592,110 @@ std::string cStreamdevLiveStreamer::Report(void)
|
|||||||
result += "\n";
|
result += "\n";
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --- cStreamdevFilterStreamer -------------------------------------------------
|
||||||
|
|
||||||
|
#if VDRVERSNUM >= 10300
|
||||||
|
cStreamdevFilterStreamer::cStreamdevFilterStreamer():
|
||||||
|
cStreamdevStreamer("streamdev-filterstreaming"),
|
||||||
|
m_Device(NULL),
|
||||||
|
m_Filter(NULL)/*,
|
||||||
|
m_Channel(NULL)*/
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
cStreamdevFilterStreamer::~cStreamdevFilterStreamer()
|
||||||
|
{
|
||||||
|
Dprintf("Desctructing Filter streamer\n");
|
||||||
|
Detach();
|
||||||
|
m_Device = NULL;
|
||||||
|
DELETENULL(m_Filter);
|
||||||
|
Stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
void cStreamdevFilterStreamer::Attach(void)
|
||||||
|
{
|
||||||
|
Dprintf("cStreamdevFilterStreamer::Attach()\n");
|
||||||
|
LOCK_THREAD;
|
||||||
|
if(m_Device && m_Filter)
|
||||||
|
m_Device->AttachFilter(m_Filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
void cStreamdevFilterStreamer::Detach(void)
|
||||||
|
{
|
||||||
|
Dprintf("cStreamdevFilterStreamer::Detach()\n");
|
||||||
|
LOCK_THREAD;
|
||||||
|
if(m_Device && m_Filter)
|
||||||
|
m_Device->Detach(m_Filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
void cStreamdevFilterStreamer::SetChannel(const cChannel *Channel)
|
||||||
|
{
|
||||||
|
LOCK_THREAD;
|
||||||
|
Dprintf("cStreamdevFilterStreamer::SetChannel(%s : %s)", Channel?Channel->Name():"<null>",
|
||||||
|
Channel ? *Channel->GetChannelID().ToString() : "");
|
||||||
|
m_Channel = Channel;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void cStreamdevFilterStreamer::SetDevice(cDevice *Device)
|
||||||
|
{
|
||||||
|
Dprintf("cStreamdevFilterStreamer::SetDevice()\n");
|
||||||
|
LOCK_THREAD;
|
||||||
|
if(Device != m_Device) {
|
||||||
|
Detach();
|
||||||
|
m_Device = Device;
|
||||||
|
//m_Channel = NULL;
|
||||||
|
Attach();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool cStreamdevFilterStreamer::SetFilter(u_short Pid, u_char Tid, u_char Mask, bool On)
|
||||||
|
{
|
||||||
|
Dprintf("cStreamdevFilterStreamer::SetFilter(%u,0x%x,0x%x,%s)\n", Pid, Tid, Mask, On?"On":"Off");
|
||||||
|
|
||||||
|
if(!m_Device)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (On) {
|
||||||
|
if (m_Filter == NULL) {
|
||||||
|
m_Filter = new cStreamdevLiveFilter(this);
|
||||||
|
Dprintf("attaching filter to device\n");
|
||||||
|
Attach();
|
||||||
|
}
|
||||||
|
m_Filter->Set(Pid, Tid, Mask);
|
||||||
|
} else if (m_Filter != NULL)
|
||||||
|
m_Filter->Del(Pid, Tid, Mask);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
void cStreamdevFilterStreamer::ChannelSwitch(const cDevice *Device, int ChannelNumber) {
|
||||||
|
LOCK_THREAD;
|
||||||
|
if(Device == m_Device) {
|
||||||
|
if(ChannelNumber > 0) {
|
||||||
|
cChannel *ch = Channels.GetByNumber(ChannelNumber);
|
||||||
|
if(ch != NULL) {
|
||||||
|
if(m_Filter != NULL &&
|
||||||
|
m_Channel != NULL &&
|
||||||
|
(! TRANSPONDER(ch, m_Channel))) {
|
||||||
|
|
||||||
|
isyslog("***** LiveFilterStreamer: transponder changed ! %s",
|
||||||
|
*ch->GetChannelID().ToString());
|
||||||
|
|
||||||
|
uchar buffer[TS_SIZE] = {TS_SYNC_BYTE, 0xff, 0xff, 0xff, 0x7f, 0};
|
||||||
|
strcpy((char*)(buffer + 5), ch->GetChannelID().ToString());
|
||||||
|
int p = Put(buffer, TS_SIZE);
|
||||||
|
if (p != TS_SIZE)
|
||||||
|
ReportOverflow(TS_SIZE - p);
|
||||||
|
}
|
||||||
|
m_Channel = ch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // if VDRVERSNUM >= 10300
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
#include <vdr/receiver.h>
|
#include <vdr/receiver.h>
|
||||||
|
|
||||||
#include "server/streamer.h"
|
#include "server/streamer.h"
|
||||||
#include "server/livefilter.h"
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
class cTS2PSRemux;
|
class cTS2PSRemux;
|
||||||
@ -56,4 +55,36 @@ public:
|
|||||||
virtual std::string Report(void);
|
virtual std::string Report(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// --- cStreamdevFilterStreamer -------------------------------------------------
|
||||||
|
|
||||||
|
# if VDRVERSNUM >= 10300
|
||||||
|
|
||||||
|
//#include <vdr/status.h>
|
||||||
|
|
||||||
|
class cStreamdevLiveFilter;
|
||||||
|
|
||||||
|
class cStreamdevFilterStreamer: public cStreamdevStreamer /*, public cStatus*/ {
|
||||||
|
private:
|
||||||
|
cDevice *m_Device;
|
||||||
|
cStreamdevLiveFilter *m_Filter;
|
||||||
|
//const cChannel *m_Channel;
|
||||||
|
|
||||||
|
public:
|
||||||
|
cStreamdevFilterStreamer();
|
||||||
|
virtual ~cStreamdevFilterStreamer();
|
||||||
|
|
||||||
|
void SetDevice(cDevice *Device);
|
||||||
|
//void SetChannel(const cChannel *Channel);
|
||||||
|
bool SetFilter(u_short Pid, u_char Tid, u_char Mask, bool On);
|
||||||
|
|
||||||
|
virtual void Attach(void);
|
||||||
|
virtual void Detach(void);
|
||||||
|
|
||||||
|
// cStatus message handlers
|
||||||
|
//virtual void ChannelSwitch(const cDevice *Device, int ChannelNumber);
|
||||||
|
};
|
||||||
|
|
||||||
|
# endif // if VDRVERSNUM >= 10300
|
||||||
|
|
||||||
#endif // VDR_STREAMDEV_LIVESTREAMER_H
|
#endif // VDR_STREAMDEV_LIVESTREAMER_H
|
||||||
|
Loading…
Reference in New Issue
Block a user