summaryrefslogtreecommitdiff
path: root/server/connectionIGMP.c
diff options
context:
space:
mode:
authorschmirl <schmirl>2009-02-13 10:39:20 +0000
committerschmirl <schmirl>2009-02-13 10:39:20 +0000
commit78410ea5761eab03a7bc33852e85621594df7254 (patch)
tree38b0238e9797d4ab97fee50c822518ff460def16 /server/connectionIGMP.c
parentc26b89f9c287d64915b94cc56fb0e4e709d235a4 (diff)
downloadvdr-plugin-streamdev-78410ea5761eab03a7bc33852e85621594df7254.tar.gz
vdr-plugin-streamdev-78410ea5761eab03a7bc33852e85621594df7254.tar.bz2
Added IGMP multicast server
Modified Files: CONTRIBUTORS HISTORY Makefile README po/de_DE.po po/fi_FI.po po/fr_FR.po po/it_IT.po po/ru_RU.po server/component.c server/component.h server/connection.c server/connection.h server/livefilter.c server/server.c server/setup.c server/setup.h server/streamer.c server/streamer.h streamdev/streamdevhosts.conf tools/socket.c tools/socket.h Added Files: patches/vdr-cap_net_raw.diff server/componentIGMP.c server/componentIGMP.h server/connectionIGMP.c server/connectionIGMP.h
Diffstat (limited to 'server/connectionIGMP.c')
-rw-r--r--server/connectionIGMP.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/server/connectionIGMP.c b/server/connectionIGMP.c
new file mode 100644
index 0000000..dc08798
--- /dev/null
+++ b/server/connectionIGMP.c
@@ -0,0 +1,64 @@
+/*
+ * $Id: connectionIGMP.c,v 1.1 2009/02/13 10:39:22 schmirl Exp $
+ */
+
+#include <ctype.h>
+
+#include "server/connectionIGMP.h"
+#include "server/server.h"
+#include "server/setup.h"
+#include <vdr/channels.h>
+
+cConnectionIGMP::cConnectionIGMP(const char* Name, int ClientPort, eStreamType StreamType) :
+ cServerConnection(Name, SOCK_DGRAM),
+ m_LiveStreamer(NULL),
+ m_ClientPort(ClientPort),
+ m_StreamType(StreamType)
+{
+}
+
+cConnectionIGMP::~cConnectionIGMP()
+{
+ delete m_LiveStreamer;
+}
+
+bool cConnectionIGMP::Start(cChannel *Channel, in_addr_t Dst)
+{
+ if (Channel != NULL) {
+ cDevice *device = GetDevice(Channel, 0);
+ if (device != NULL) {
+ device->SwitchChannel(Channel, false);
+ struct in_addr ip;
+ ip.s_addr = Dst;
+ if (Connect(inet_ntoa(ip), m_ClientPort)) {
+ m_LiveStreamer = new cStreamdevLiveStreamer(0);
+ if (m_LiveStreamer->SetChannel(Channel, m_StreamType)) {
+ m_LiveStreamer->SetDevice(device);
+ if (!SetDSCP())
+ LOG_ERROR_STR("unable to set DSCP sockopt");
+ Dprintf("streamer start\n");
+ m_LiveStreamer->Start(this);
+ return true;
+ }
+ else
+ esyslog("streamdev-server IGMP: SetDevice failed");
+ DELETENULL(m_LiveStreamer);
+ }
+ else
+ esyslog("streamdev-server IGMP: Connect failed: %m");
+ }
+ else
+ esyslog("streamdev-server IGMP: GetDevice failed");
+ }
+ else
+ esyslog("streamdev-server IGMP: Channel not found");
+ return false;
+}
+
+void cConnectionIGMP::Stop()
+{
+ if (m_LiveStreamer) {
+ m_LiveStreamer->Stop();
+ DELETENULL(m_LiveStreamer);
+ }
+}