From b95e93408fc514f9e88d3c6b43ff605c692ff05d Mon Sep 17 00:00:00 2001 From: Rolf Ahrenberg Date: Sun, 16 Sep 2007 13:11:19 +0000 Subject: [PATCH] Reworked channel parameter field. --- README | 6 ++++-- device.c | 35 +++++++++++++++++++++++------------ device.h | 4 ++-- 3 files changed, 29 insertions(+), 16 deletions(-) diff --git a/README b/README index 56f3025..7399577 100644 --- a/README +++ b/README @@ -37,8 +37,7 @@ make plugins Channels.conf example: -TV1;IPTV:1:IPTV-UDP-192.168.0.1-1234:P:27500:512:650:2321:0:17:8438:4097:0 -TV2;IPTV:2:IPTV-UDP-192.168.0.2-1234:P:27500:513:660:2321:0:33:8438:4097:0 +TV1;IPTV:1:IPTV|UDP|192.168.0.1|1234:P:27500:512:650:2321:0:17:8438:4097:0 ^ ^ ^ ^ ^ ^ | | | | | Source type ("P") | | | | IP Port Number @@ -47,6 +46,9 @@ TV2;IPTV:2:IPTV-UDP-192.168.0.2-1234:P:27500:513:660:2321:0:33:8438:4097:0 | Plugin ID ("IPTV") Unique enumeration +TV2;IPTV:2:IPTV|HTTP|127.0.0.1/TS/2|8080:P:27500:513:660:2321:0:33:8438:4097:0 +TV3;IPTV:2:IPTV|FILE|/media/video.ts|8080:P:27500:513:660:2321:0:33:8438:4097:0 + Notes: - Remember to open IGMP in the firewall for multicast streams diff --git a/device.c b/device.c index 344e6b7..251c474 100644 --- a/device.c +++ b/device.c @@ -3,7 +3,7 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: device.c,v 1.18 2007/09/16 12:18:15 ajhseppa Exp $ + * $Id: device.c,v 1.19 2007/09/16 13:11:19 rahrenbe Exp $ */ #include "common.h" @@ -32,9 +32,9 @@ cIptvDevice::cIptvDevice(unsigned int Index) tsBufferPrefill -= (tsBufferPrefill % TS_SIZE); //debug("Buffer=%d Prefill=%d\n", MEGABYTE(IptvConfig.GetBufferSizeMB()), tsBufferPrefill); pUdpProtocol = new cIptvProtocolUdp(); - //pRtspProtocol = new cIptvProtocolRtsp(); pHttpProtocol = new cIptvProtocolHttp(); pFileProtocol = new cIptvProtocolFile(); + //pRtspProtocol = new cIptvProtocolRtsp(); pIptvStreamer = new cIptvStreamer(tsBuffer, &mutex); StartSectionHandler(); } @@ -78,21 +78,32 @@ cIptvDevice *cIptvDevice::Get(unsigned int DeviceIndex) cString cIptvDevice::GetChannelSettings(const char *Param, int *IpPort, cIptvProtocolIf* *Protocol) { - unsigned int a, b, c, d; - debug("cIptvDevice::GetChannelSettings(%d)\n", deviceIndex); - if (sscanf(Param, "IPTV-UDP-%u.%u.%u.%u-%u", &a, &b, &c, &d, IpPort) == 5) { + char *loc = NULL; + if (sscanf(Param, "IPTV|UDP|%a[^|]|%u", &loc, IpPort) == 5) { + cString addr(loc, true); + free(loc); *Protocol = pUdpProtocol; - return cString::sprintf("%u.%u.%u.%u", a, b, c, d); + return addr; } - //else if (sscanf(Param, "IPTV-RTSP-%u.%u.%u.%u-%u", &a, &b, &c, &d, IpPort) == 5) { - // *Protocol = pRtspProtocol; - // return cString::sprintf("%u.%u.%u.%u", a, b, c, d); - // } - else if (sscanf(Param, "IPTV-HTTP-%u.%u.%u.%u-%u", &a, &b, &c, &d, IpPort) == 5) { + else if (sscanf(Param, "IPTV|HTTP|%a[^|]|%u", &loc, IpPort) == 5) { + cString addr(loc, true); + free(loc); *Protocol = pHttpProtocol; - return cString::sprintf("%u.%u.%u.%u", a, b, c, d); + return addr; } + //else if (sscanf(Param, "IPTV|FILE|%a[^|]|%u", &loc, IpPort) == 5) { + // cString addr(loc, true); + // free(loc); + // *Protocol = pFileProtocol; + // return addr; + // } + //else if (sscanf(Param, "IPTV|RTSP|%a[^|]|%u", &loc, IpPort) == 5) { + // cString addr(loc, true); + // free(loc); + // *Protocol = pRtspProtocol; + // return addr; + // } return NULL; } diff --git a/device.h b/device.h index 128a76a..6952428 100644 --- a/device.h +++ b/device.h @@ -3,7 +3,7 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: device.h,v 1.8 2007/09/16 12:18:15 ajhseppa Exp $ + * $Id: device.h,v 1.9 2007/09/16 13:11:19 rahrenbe Exp $ */ #ifndef __IPTV_DEVICE_H @@ -32,9 +32,9 @@ private: cRingBufferLinear *tsBuffer; int tsBufferPrefill; cIptvProtocolUdp *pUdpProtocol; - //cIptvProtocolRtsp *pRtspProtocol; cIptvProtocolHttp *pHttpProtocol; cIptvProtocolFile *pFileProtocol; + //cIptvProtocolRtsp *pRtspProtocol; cIptvStreamer *pIptvStreamer; cMutex mutex;