diff --git a/HISTORY b/HISTORY index d2304b3..8827b77 100644 --- a/HISTORY +++ b/HISTORY @@ -44,3 +44,5 @@ VDR Plugin 'iptv' Revision History - Updated French translation (Thanks to Michaël Nival). - Modified VDR locale support detection. - Added preliminary automatic Pid scanning functionality. +- Modified channels.conf format to enable/disable channel + specific pid and sid scanning functionality. diff --git a/README b/README index 9a4afae..617a8cc 100644 --- a/README +++ b/README @@ -107,15 +107,16 @@ Configuration: - channels.conf - TV4;IPTV:4:IPTV|EXT|iptvstream.sh|0:P:0:0:680:0:0:4:0:0:0 - TV3;IPTV:3:IPTV|FILE|/video/stream.ts|5:P:0:514:670:2321:0:3:0:0:0 - TV2;IPTV:2:IPTV|HTTP|127.0.0.1/TS/2|3000:P:0:513:660:2321:0:2:0:0:0 - TV1;IPTV:1:IPTV|UDP|127.0.0.1|1234:P:0:512:650:2321:0:1:0:0:0 - ^ ^ ^ ^ ^ ^ - | | | | | Source type ("P") - | | | | IP Port Number, File delay (ms), Script parameter - | | | IP Address, File location, Script location - | | Protocol ("UDP", "HTTP", "FILE", "EXT") + TV4;IPTV:4:IPTV|S1P0|EXT|iptvstream.sh|0:P:0:0:680:0:0:4:0:0:0 + TV3;IPTV:3:IPTV|S0P1|FILE|/video/stream.ts|5:P:0:514:670:2321:0:3:0:0:0 + TV2;IPTV:2:IPTV|S0P1|HTTP|127.0.0.1/TS/2|3000:P:0:513:660:2321:0:2:0:0:0 + TV1;IPTV:1:IPTV|S1P0|UDP|127.0.0.1|1234:P:0:512:650:2321:0:1:0:0:0 + ^ ^ ^ ^ ^ ^ ^ + | | | | | | Source type ("P") + | | | | | IP Port Number, File delay (ms), Script parameter + | | | | IP Address, File location, Script location + | | | Protocol ("UDP", "HTTP", "FILE", "EXT") + | | Parameters ("S" Sid scan, "P" Pid scan, "0" disable, "1" enable) | Plugin ID ("IPTV") Unique enumeration diff --git a/device.c b/device.c index d9d2b50..2f3cb3f 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.81 2008/01/30 22:41:59 rahrenbe Exp $ + * $Id: device.c,v 1.82 2008/01/31 22:28:53 rahrenbe Exp $ */ #include "config.h" @@ -19,6 +19,8 @@ cIptvDevice::cIptvDevice(unsigned int Index) : deviceIndex(Index), isPacketDelivered(false), isOpenDvr(false), + sidScanEnabled(false), + pidScanEnabled(false), mutex() { debug("cIptvDevice::cIptvDevice(%d)\n", deviceIndex); @@ -157,13 +159,13 @@ cString cIptvDevice::GetInformation(unsigned int Page) return info; } -cString cIptvDevice::GetChannelSettings(const char *IptvParam, int *Parameter, cIptvProtocolIf* *Protocol) +cString cIptvDevice::GetChannelSettings(const char *IptvParam, int *Parameter, int *SidScan, int *PidScan, cIptvProtocolIf* *Protocol) { debug("cIptvDevice::GetChannelSettings(%d)\n", deviceIndex); char *tag = NULL; char *proto = NULL; char *loc = NULL; - if (sscanf(IptvParam, "%a[^|]|%a[^|]|%a[^|]|%u", &tag, &proto, &loc, Parameter) == 4) { + if (sscanf(IptvParam, "%a[^|]|S%dP%d|%a[^|]|%a[^|]|%u", &tag, SidScan, PidScan, &proto, &loc, Parameter) == 6) { cString tagstr(tag, true); cString protostr(proto, true); cString locstr(loc, true); @@ -184,6 +186,30 @@ cString cIptvDevice::GetChannelSettings(const char *IptvParam, int *Parameter, c return locstr; } } + // compatibility mode for old channels.conf format + else if (sscanf(IptvParam, "%a[^|]|%a[^|]|%a[^|]|%u", &tag, &proto, &loc, Parameter) == 4) { + cString tagstr(tag, true); + cString protostr(proto, true); + cString locstr(loc, true); + *SidScan = 0; + *PidScan = 0; + // check if IPTV tag + if (strncasecmp(*tagstr, "IPTV", 4) == 0) { + // check if protocol is supported and update the pointer + if (strncasecmp(*protostr, "UDP", 3) == 0) + *Protocol = pUdpProtocol; + else if (strncasecmp(*protostr, "HTTP", 4) == 0) + *Protocol = pHttpProtocol; + else if (strncasecmp(*protostr, "FILE", 4) == 0) + *Protocol = pFileProtocol; + else if (strncasecmp(*protostr, "EXT", 3) == 0) + *Protocol = pExtProtocol; + else + return NULL; + // return location + return locstr; + } + } return NULL; } @@ -225,20 +251,22 @@ int cIptvDevice::NumProvidedSystems(void) const bool cIptvDevice::SetChannelDevice(const cChannel *Channel, bool LiveView) { - int parameter; + int parameter, sidscan, pidscan; cString location; cIptvProtocolIf *protocol; debug("cIptvDevice::SetChannelDevice(%d)\n", deviceIndex); - location = GetChannelSettings(Channel->PluginParam(), ¶meter, &protocol); + location = GetChannelSettings(Channel->PluginParam(), ¶meter, &sidscan, &pidscan, &protocol); if (isempty(location)) { error("ERROR: Unrecognized IPTV channel settings: %s", Channel->PluginParam()); return false; } + sidScanEnabled = sidscan ? true : false; + pidScanEnabled = pidscan ? true : false; pIptvStreamer->Set(location, parameter, deviceIndex, protocol); - if (pSidScanner && IptvConfig.GetSectionFiltering() && IptvConfig.GetSidScanning()) + if (sidScanEnabled && pSidScanner && IptvConfig.GetSectionFiltering() && IptvConfig.GetSidScanning()) pSidScanner->SetChannel(Channel); - if (pPidScanner && IptvConfig.GetPidScanning()) + if (pidScanEnabled && pPidScanner && IptvConfig.GetPidScanning()) pPidScanner->SetChannel(Channel); return true; } @@ -318,7 +346,7 @@ bool cIptvDevice::OpenDvr(void) mutex.Unlock(); ResetBuffering(); pIptvStreamer->Open(); - if (pSidScanner && IptvConfig.GetSectionFiltering() && IptvConfig.GetSidScanning()) + if (sidScanEnabled && pSidScanner && IptvConfig.GetSectionFiltering() && IptvConfig.GetSidScanning()) pSidScanner->SetStatus(true); isOpenDvr = true; return true; @@ -327,7 +355,7 @@ bool cIptvDevice::OpenDvr(void) void cIptvDevice::CloseDvr(void) { debug("cIptvDevice::CloseDvr(%d)\n", deviceIndex); - if (pSidScanner && IptvConfig.GetSectionFiltering() && IptvConfig.GetSidScanning()) + if (pidScanEnabled && pSidScanner && IptvConfig.GetSectionFiltering() && IptvConfig.GetSidScanning()) pSidScanner->SetStatus(false); if (pIptvStreamer) pIptvStreamer->Close(); @@ -388,7 +416,7 @@ bool cIptvDevice::GetTSPacket(uchar *&Data) // Update pid statistics AddPidStatistic(ts_pid(p), payload(p)); // Analyze incomplete streams with built-in pid analyzer - if (pPidScanner && IptvConfig.GetPidScanning()) + if (pidScanEnabled && pPidScanner && IptvConfig.GetPidScanning()) pPidScanner->Process(p); // Run the data through all filters for (unsigned int i = 0; i < eMaxSecFilterCount; ++i) { diff --git a/device.h b/device.h index b8c5cee..b2e66a6 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.37 2008/01/30 22:41:59 rahrenbe Exp $ + * $Id: device.h,v 1.38 2008/01/31 22:28:53 rahrenbe Exp $ */ #ifndef __IPTV_DEVICE_H @@ -37,6 +37,8 @@ private: unsigned int deviceIndex; bool isPacketDelivered; bool isOpenDvr; + bool sidScanEnabled; + bool pidScanEnabled; cRingBufferLinear *tsBuffer; int tsBufferPrefill; cIptvProtocolUdp *pUdpProtocol; @@ -67,7 +69,7 @@ private: // for channel parsing & buffering private: - cString GetChannelSettings(const char *IptvParam, int *Parameter, cIptvProtocolIf* *Protocol); + cString GetChannelSettings(const char *IptvParam, int *Parameter, int *SidScan, int *PidScan, cIptvProtocolIf* *Protocol); bool ProvidesIptv(const char *Param) const; void ResetBuffering(void); bool IsBuffering(void); diff --git a/po/de_DE.po b/po/de_DE.po index d34d7be..064b2ba 100644 --- a/po/de_DE.po +++ b/po/de_DE.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: iptv 0.0.6\n" "Report-Msgid-Bugs-To: Rolf Ahrenberg\n" -"POT-Creation-Date: 2008-01-30 23:53+0200\n" +"POT-Creation-Date: 2008-02-01 00:24+0200\n" "PO-Revision-Date: 2007-10-29 21:19+0100\n" "Last-Translator: Tobias Grimm \n" "Language-Team: German\n" @@ -70,6 +70,12 @@ msgstr "Adresse" msgid "Port" msgstr "Port" +msgid "Scan Sid" +msgstr "Scanne SID" + +msgid "Scan Pid" +msgstr "Scanne PID" + msgid "Nid" msgstr "Nid" diff --git a/po/fi_FI.po b/po/fi_FI.po index 2d30a7c..685d543 100644 --- a/po/fi_FI.po +++ b/po/fi_FI.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: iptv 0.0.6\n" "Report-Msgid-Bugs-To: Rolf Ahrenberg\n" -"POT-Creation-Date: 2008-01-30 23:53+0200\n" +"POT-Creation-Date: 2008-02-01 00:24+0200\n" "PO-Revision-Date: 2007-08-12 23:22+0300\n" "Last-Translator: Rolf Ahrenberg\n" "Language-Team: \n" @@ -69,6 +69,12 @@ msgstr "Osoite" msgid "Port" msgstr "Portti" +msgid "Scan Sid" +msgstr "Etsi palvelu-ID" + +msgid "Scan Pid" +msgstr "Etsi ohjelmatunnisteet" + msgid "Nid" msgstr "Verkko-ID" diff --git a/po/fr_FR.po b/po/fr_FR.po index 1448f39..f446a43 100644 --- a/po/fr_FR.po +++ b/po/fr_FR.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: iptv 0.0.6\n" "Report-Msgid-Bugs-To: Rolf Ahrenberg\n" -"POT-Creation-Date: 2008-01-30 23:53+0200\n" +"POT-Creation-Date: 2008-02-01 00:24+0200\n" "PO-Revision-Date: 2008-01-26 13:14+0100\n" "Last-Translator: NIVAL Michaël \n" "Language-Team: French\n" @@ -71,6 +71,12 @@ msgstr "Adresse" msgid "Port" msgstr "Port" +msgid "Scan Sid" +msgstr "Scanne les SID" + +msgid "Scan Pid" +msgstr "Scanne les PID" + msgid "Nid" msgstr "Nid" diff --git a/po/it_IT.po b/po/it_IT.po index cc35f9d..2f5227a 100644 --- a/po/it_IT.po +++ b/po/it_IT.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: iptv 0.0.6\n" "Report-Msgid-Bugs-To: Rolf Ahrenberg\n" -"POT-Creation-Date: 2008-01-30 23:53+0200\n" +"POT-Creation-Date: 2008-02-01 00:24+0200\n" "PO-Revision-Date: 2008-01-13 16:46+0100\n" "Last-Translator: Gringo \n" "Language-Team: Italian\n" @@ -70,6 +70,12 @@ msgstr "Indirizzo" msgid "Port" msgstr "Porta" +msgid "Scan Sid" +msgstr "Scansione Sid" + +msgid "Scan Pid" +msgstr "Scansione Pid" + msgid "Nid" msgstr "Nid" diff --git a/setup.c b/setup.c index 649f690..313fdd6 100644 --- a/setup.c +++ b/setup.c @@ -3,7 +3,7 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: setup.c,v 1.51 2008/01/30 21:57:33 rahrenbe Exp $ + * $Id: setup.c,v 1.52 2008/01/31 22:28:53 rahrenbe Exp $ */ #include @@ -37,12 +37,13 @@ private: struct tIptvChannel { int frequency, source, protocol, parameter, vpid, ppid, tpid, sid, nid, tid, rid; int apid[MAXAPIDS + 1], dpid[MAXDPIDS + 1], spid[MAXSPIDS + 1], caids[MAXCAIDS + 1]; + int sidscan, pidscan; char name[256], location[256]; } data; cChannel *channel; const char *protocols[eProtocolCount]; void Setup(void); - cString GetIptvSettings(const char *Param, int *Parameter, int *Protocol); + cString GetIptvSettings(const char *Param, int *Parameter, int *SidScan, int *PidScan, int *Protocol); void GetChannelData(cChannel *Channel); void SetChannelData(cChannel *Channel); @@ -69,12 +70,12 @@ cIptvMenuEditChannel::cIptvMenuEditChannel(cChannel *Channel, bool New) Setup(); } -cString cIptvMenuEditChannel::GetIptvSettings(const char *Param, int *Parameter, int *Protocol) +cString cIptvMenuEditChannel::GetIptvSettings(const char *Param, int *Parameter, int *SidScan, int *PidScan, int *Protocol) { char *tag = NULL; char *proto = NULL; char *loc = NULL; - if (sscanf(Param, "%a[^|]|%a[^|]|%a[^|]|%d", &tag, &proto, &loc, Parameter) == 4) { + if (sscanf(Param, "%a[^|]|S%dP%d|%a[^|]|%a[^|]|%d", &tag, SidScan, PidScan, &proto, &loc, Parameter) == 6) { cString tagstr(tag, true); cString protostr(proto, true); cString locstr(loc, true); @@ -95,13 +96,36 @@ cString cIptvMenuEditChannel::GetIptvSettings(const char *Param, int *Parameter, return locstr; } } + else if (sscanf(Param, "%a[^|]|%a[^|]|%a[^|]|%d", &tag, &proto, &loc, Parameter) == 4) { + cString tagstr(tag, true); + cString protostr(proto, true); + cString locstr(loc, true); + *SidScan = 0; + *PidScan = 0; + // check if IPTV tag + if (strncasecmp(*tagstr, "IPTV", 4) == 0) { + // check if protocol is supported and update the pointer + if (strncasecmp(*protostr, "UDP", 3) == 0) + *Protocol = eProtocolUDP; + else if (strncasecmp(*protostr, "HTTP", 4) == 0) + *Protocol = eProtocolHTTP; + else if (strncasecmp(*protostr, "FILE", 4) == 0) + *Protocol = eProtocolFILE; + else if (strncasecmp(*protostr, "EXT", 3) == 0) + *Protocol = eProtocolEXT; + else + return NULL; + // return location + return locstr; + } + } return NULL; } void cIptvMenuEditChannel::GetChannelData(cChannel *Channel) { if (Channel) { - int parameter, protocol; + int parameter, protocol, sidscan, pidscan; data.frequency = Channel->Frequency(); data.source = Channel->Source(); data.vpid = Channel->Vpid(); @@ -120,7 +144,9 @@ void cIptvMenuEditChannel::GetChannelData(cChannel *Channel) data.tid = Channel->Tid(); data.rid = Channel->Rid(); strn0cpy(data.name, Channel->Name(), sizeof(data.name)); - strn0cpy(data.location, *GetIptvSettings(Channel->PluginParam(), ¶meter, &protocol), sizeof(data.location)); + strn0cpy(data.location, *GetIptvSettings(Channel->PluginParam(), ¶meter, &sidscan, &pidscan, &protocol), sizeof(data.location)); + data.sidscan = sidscan; + data.pidscan = pidscan; data.protocol = protocol; data.parameter = parameter; } @@ -144,6 +170,8 @@ void cIptvMenuEditChannel::GetChannelData(cChannel *Channel) data.rid = 0; strn0cpy(data.name, "IPTV", sizeof(data.name)); strn0cpy(data.location, "127.0.0.1", sizeof(data.location)); + data.sidscan = 0; + data.pidscan = 0; data.protocol = eProtocolUDP; data.parameter = 1234; } @@ -157,17 +185,17 @@ void cIptvMenuEditChannel::SetChannelData(cChannel *Channel) char dlangs[MAXDPIDS][MAXLANGCODE2] = { "" }; switch (data.protocol) { case eProtocolEXT: - param = cString::sprintf("IPTV|EXT|%s|%d", data.location, data.parameter); + param = cString::sprintf("IPTV|S%dP%d|EXT|%s|%d", data.sidscan, data.pidscan, data.location, data.parameter); break; case eProtocolFILE: - param = cString::sprintf("IPTV|FILE|%s|%d", data.location, data.parameter); + param = cString::sprintf("IPTV|S%dP%d|FILE|%s|%d", data.sidscan, data.pidscan, data.location, data.parameter); break; case eProtocolHTTP: - param = cString::sprintf("IPTV|HTTP|%s|%d", data.location, data.parameter); + param = cString::sprintf("IPTV|S%dP%d|HTTP|%s|%d", data.sidscan, data.pidscan, data.location, data.parameter); break; default: case eProtocolUDP: - param = cString::sprintf("IPTV|UDP|%s|%d", data.location, data.parameter); + param = cString::sprintf("IPTV|S%dP%d|UDP|%s|%d", data.sidscan, data.pidscan, data.location, data.parameter); break; } #if defined(APIVERSNUM) && APIVERSNUM < 10510 @@ -218,6 +246,8 @@ void cIptvMenuEditChannel::Setup(void) Add(new cMenuEditIntItem(tr("Port"), &data.parameter, 0, 0xFFFF)); break; } + Add(new cMenuEditBoolItem(tr("Scan Sid"), &data.sidscan)); + Add(new cMenuEditBoolItem(tr("Scan Pid"), &data.pidscan)); // Normal settings #if defined(APIVERSNUM) && APIVERSNUM < 10511 Add(new cMenuEditStrItem(trVDR("Name"), data.name, sizeof(data.name), trVDR(FileNameChars)));