summaryrefslogtreecommitdiff
path: root/server/livestreamer.c
diff options
context:
space:
mode:
authorschmirl <schmirl>2007-04-24 11:36:16 +0000
committerschmirl <schmirl>2007-04-24 11:36:16 +0000
commit9994ecfd08e350b227cb1ca4bcaf6c120f2d91ee (patch)
treecc67e1377f749f72d02c747fa58268c672d5499c /server/livestreamer.c
parent99d19c67d84cfdfa71872147b2e903d81d05d85e (diff)
downloadvdr-plugin-streamdev-9994ecfd08e350b227cb1ca4bcaf6c120f2d91ee.tar.gz
vdr-plugin-streamdev-9994ecfd08e350b227cb1ca4bcaf6c120f2d91ee.tar.bz2
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
Diffstat (limited to 'server/livestreamer.c')
-rw-r--r--server/livestreamer.c108
1 files changed, 108 insertions, 0 deletions
diff --git a/server/livestreamer.c b/server/livestreamer.c
index c889e8d..1ba3450 100644
--- a/server/livestreamer.c
+++ b/server/livestreamer.c
@@ -6,6 +6,7 @@
#include <vdr/ringbuffer.h>
#include "server/livestreamer.h"
+#include "server/livefilter.h"
#include "remux/ts2ps.h"
#include "remux/ts2es.h"
#include "remux/extern.h"
@@ -591,3 +592,110 @@ std::string cStreamdevLiveStreamer::Report(void)
result += "\n";
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