From 0670667e9b6635cdeac67a328936f189d70612c2 Mon Sep 17 00:00:00 2001 From: Rolf Ahrenberg Date: Sat, 20 Oct 2007 17:26:46 +0000 Subject: [PATCH] Moved EXT protocol base port setting from the command line switch to the setup menu entry. --- README | 49 +++++++++++++++++++++++++------------------------ config.c | 6 +++--- config.h | 8 ++++---- iptv.c | 13 +++++-------- po/fi_FI.po | 5 ++++- protocolext.c | 6 +++--- setup.c | 6 +++++- setup.h | 3 ++- 8 files changed, 51 insertions(+), 45 deletions(-) diff --git a/README b/README index 3da4c96..76253e7 100644 --- a/README +++ b/README @@ -55,7 +55,11 @@ Setup menu: - TS buffer prefill ratio [%] = 0 Defines prefill ratio for transport stream ringbuffer before data is transferred to VDR. - The valid range: 0...40 + Valid range: 0...40 +- EXT protocol base port = 4321 Defines base port used in EXT protocol. + The port range is defined by the number + of IPTV devices (max. 8). + Valid range: 0...65527 - Use section filtering = 1 Defines whether section filtering shall be used. Valid range: 0...1 @@ -118,26 +122,30 @@ Configuration: External streaming: -- Starting from version 0.0.2 IPTV plugin features support for external - streaming applications. What this means in short is that with proper helper - applications and configuration the plugin is able to display streams not - originally in MPEG1/2 TS format. +- Starting from version 0.0.2 IPTV plugin features a support for external + streaming applications. With proper helper applications and configuration + the IPTV plugin is now able to display not only MPEG1/2 transport streams + but also other formats like MP3 radio streams. -- To add an externally received channel, add an EXT entry to channels.conf. - Specify a script name as the location parameter. This script is executed - from plugin configuration directory when VDR tunes to the specified - channel. The port parameter in channels.conf is passed to the script and - can be used to select for example between different URLs. +- To watch an externally received channel add an EXT entry to channels.conf + and specify a script name and parameter. The specified script is executed + from plugin configuration directory when VDR tunes to the channel. The + specified script parameter is passed to the script and it can be used to + select for example between different URLs. -- When EXT channel is opened IPTV plugin opens an UDP listening port on the - local host. The script executing is then responsible for supplying IPTV - plugin with MPEG2 TS data in UDP format to the opened port. The data will - then be processed by VDR as usual. The opened listening port can be - specified in plugin configuration. +- When an EXT channel is opened the IPTV plugin opens an UDP listening port + on the localhost. The external script is responsible for supplying IPTV + plugin with MPEG2 TS data in UDP/RTP format to the listening port. The + data will be processed in VDR like a normal DVB broadcast. The listening + base port can be specified in the plugin configuration menu. + +- Each IPTV device is having a different listen port. The port number is + specified as a base port number plus IPTV device index minus one. Maximum + 8 IPTV devices can be used. - IPTV plugin includes an example script which uses VLC media player for - receiving streams, transcoding and handing the result to IPTV plugin. IPTV - was tested with VLC version 0.8.6c + receiving streams, transcoding and handing the result to IPTV plugin. The + plugin was tested with VLC version 0.8.6c. Notes: @@ -148,13 +156,6 @@ Notes: - The following section filters are recommended to be disabled: "NIT (0x40)", "SDT (0x42)", "TDT (0x70)" -- The EXT protocol listens UDP packets from localhost. The default listen - port base number is 4321 and it can be configured via a commandline - switch. The port range is defined by the number of IPTV devices (max. 8). - -- The EXT protocol scripts must be located in the config directory of the - plugin. - Acknowledgements: - The IPTV section filtering code is derived from Linux kernel. diff --git a/config.c b/config.c index 352dc34..40985b8 100644 --- a/config.c +++ b/config.c @@ -3,7 +3,7 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: config.c,v 1.17 2007/10/19 22:54:03 rahrenbe Exp $ + * $Id: config.c,v 1.18 2007/10/20 17:26:46 rahrenbe Exp $ */ #include "config.h" @@ -14,10 +14,10 @@ cIptvConfig::cIptvConfig(void) : readBufferTsCount(48), tsBufferSize(2), tsBufferPrefillRatio(0), + extProtocolBasePort(4321), useBytes(1), sectionFiltering(1), - sidScanning(1), - extListenPortBase(4321) + sidScanning(1) { for (unsigned int i = 0; i < sizeof(disabledFilters); ++i) disabledFilters[i] = -1; diff --git a/config.h b/config.h index 1d2341a..04f2ea0 100644 --- a/config.h +++ b/config.h @@ -3,7 +3,7 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: config.h,v 1.15 2007/10/19 22:54:03 rahrenbe Exp $ + * $Id: config.h,v 1.16 2007/10/20 17:26:46 rahrenbe Exp $ */ #ifndef __IPTV_CONFIG_H @@ -19,10 +19,10 @@ private: unsigned int readBufferTsCount; unsigned int tsBufferSize; unsigned int tsBufferPrefillRatio; + unsigned int extProtocolBasePort; unsigned int useBytes; unsigned int sectionFiltering; unsigned int sidScanning; - unsigned int extListenPortBase; int disabledFilters[SECTION_FILTER_TABLE_SIZE]; char configDirectory[255]; @@ -31,19 +31,19 @@ public: unsigned int GetReadBufferTsCount(void) { return readBufferTsCount; } unsigned int GetTsBufferSize(void) { return tsBufferSize; } unsigned int GetTsBufferPrefillRatio(void) { return tsBufferPrefillRatio; } + unsigned int GetExtProtocolBasePort(void) { return extProtocolBasePort; } unsigned int GetUseBytes(void) { return useBytes; } unsigned int GetSectionFiltering(void) { return sectionFiltering; } unsigned int GetSidScanning(void) { return sidScanning; } - unsigned int GetExtListenPortBase(void) { return extListenPortBase; } const char *GetConfigDirectory(void) { return configDirectory; } unsigned int GetDisabledFiltersCount(void); int GetDisabledFilters(unsigned int Index); void SetTsBufferSize(unsigned int Size) { tsBufferSize = Size; } void SetTsBufferPrefillRatio(unsigned int Ratio) { tsBufferPrefillRatio = Ratio; } + void SetExtProtocolBasePort(unsigned int PortNumber) { extProtocolBasePort = PortNumber; } void SetUseBytes(unsigned int On) { useBytes = On; } void SetSectionFiltering(unsigned int On) { sectionFiltering = On; } void SetSidScanning(unsigned int On) { sidScanning = On; } - void SetExtListenPortBase(unsigned int PortNumber) { extListenPortBase = PortNumber; } void SetDisabledFilters(unsigned int Index, int Number); void SetConfigDirectory(const char *directoryP); }; diff --git a/iptv.c b/iptv.c index 78571dc..cc543ee 100644 --- a/iptv.c +++ b/iptv.c @@ -3,7 +3,7 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: iptv.c,v 1.23 2007/10/19 22:54:03 rahrenbe Exp $ + * $Id: iptv.c,v 1.24 2007/10/20 17:26:46 rahrenbe Exp $ */ #include @@ -66,8 +66,7 @@ const char *cPluginIptv::CommandLineHelp(void) { debug("cPluginIptv::CommandLineHelp()\n"); // Return a string that describes all known command line options. - return " -d , --devices= number of devices to be created\n" - " -p ,--port= base port number for EXT protocol UDP streaming\n"; + return " -d , --devices= number of devices to be created\n"; } bool cPluginIptv::ProcessArgs(int argc, char *argv[]) @@ -76,19 +75,15 @@ bool cPluginIptv::ProcessArgs(int argc, char *argv[]) // Implement command line argument processing here if applicable. static const struct option long_options[] = { { "devices", required_argument, NULL, 'd' }, - { "port", required_argument, NULL, 'p' }, { NULL } }; int c; - while ((c = getopt_long(argc, argv, "d:p:", long_options, NULL)) != -1) { + while ((c = getopt_long(argc, argv, "d:", long_options, NULL)) != -1) { switch (c) { case 'd': deviceCount = atoi(optarg); break; - case 'p': - IptvConfig.SetExtListenPortBase(atoi(optarg)); - break; default: return false; } @@ -183,6 +178,8 @@ bool cPluginIptv::SetupParse(const char *Name, const char *Value) IptvConfig.SetTsBufferSize(atoi(Value)); else if (!strcasecmp(Name, "TsBufferPrefill")) IptvConfig.SetTsBufferPrefillRatio(atoi(Value)); + else if (!strcasecmp(Name, "ExtProtocolBasePort")) + IptvConfig.SetExtProtocolBasePort(atoi(Value)); else if (!strcasecmp(Name, "SectionFiltering")) IptvConfig.SetSectionFiltering(atoi(Value)); else if (!strcasecmp(Name, "SidScanning")) diff --git a/po/fi_FI.po b/po/fi_FI.po index 857fd3a..2ffe7cb 100644 --- a/po/fi_FI.po +++ b/po/fi_FI.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: VDR 1.5.7\n" "Report-Msgid-Bugs-To: Rolf Ahrenberg\n" -"POT-Creation-Date: 2007-10-19 23:10+0300\n" +"POT-Creation-Date: 2007-10-20 19:43+0300\n" "PO-Revision-Date: 2007-08-12 23:22+0300\n" "Last-Translator: Rolf Ahrenberg\n" "Language-Team: \n" @@ -108,6 +108,9 @@ msgstr "TS-puskurin koko [MB]" msgid "TS buffer prefill ratio [%]" msgstr "TS-puskurin esitäyttöaste [%]" +msgid "EXT protocol base port" +msgstr "EXT-protokollan perusportti" + msgid "Use section filtering" msgstr "Käytä sektioiden suodatusta" diff --git a/protocolext.c b/protocolext.c index a88962e..98397a3 100644 --- a/protocolext.c +++ b/protocolext.c @@ -3,7 +3,7 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: protocolext.c,v 1.11 2007/10/20 11:36:21 ajhseppa Exp $ + * $Id: protocolext.c,v 1.12 2007/10/20 17:26:46 rahrenbe Exp $ */ #include @@ -22,7 +22,7 @@ cIptvProtocolExt::cIptvProtocolExt() : pid(-1), - listenPort(IptvConfig.GetExtListenPortBase()), + listenPort(IptvConfig.GetExtProtocolBasePort()), scriptParameter(0), socketDesc(-1), readBufferLen(TS_SIZE * IptvConfig.GetReadBufferTsCount()) @@ -297,7 +297,7 @@ bool cIptvProtocolExt::Set(const char* Location, const int Parameter, const int } scriptParameter = Parameter; // Update listen port - listenPort = IptvConfig.GetExtListenPortBase() + Index; + listenPort = IptvConfig.GetExtProtocolBasePort() + Index; } return true; } diff --git a/setup.c b/setup.c index ff286a7..4f23d18 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.39 2007/10/19 22:54:03 rahrenbe Exp $ + * $Id: setup.c,v 1.40 2007/10/20 17:26:46 rahrenbe Exp $ */ #include @@ -593,6 +593,7 @@ cIptvPluginSetup::cIptvPluginSetup() debug("cIptvPluginSetup::cIptvPluginSetup()\n"); tsBufferSize = IptvConfig.GetTsBufferSize(); tsBufferPrefill = IptvConfig.GetTsBufferPrefillRatio(); + extProtocolBasePort = IptvConfig.GetExtProtocolBasePort(); sectionFiltering = IptvConfig.GetSectionFiltering(); sidScanning = IptvConfig.GetSidScanning(); numDisabledFilters = IptvConfig.GetDisabledFiltersCount(); @@ -612,6 +613,7 @@ void cIptvPluginSetup::Setup(void) Clear(); Add(new cMenuEditIntItem( tr("TS buffer size [MB]"), &tsBufferSize, 1, 4)); Add(new cMenuEditIntItem( tr("TS buffer prefill ratio [%]"), &tsBufferPrefill, 0, 40)); + Add(new cMenuEditIntItem( tr("EXT protocol base port"), &extProtocolBasePort, 0, 0xFFF7)); Add(new cMenuEditBoolItem(tr("Use section filtering"), §ionFiltering)); if (sectionFiltering) { Add(new cMenuEditBoolItem(tr("Scan Sid automatically"), &sidScanning)); @@ -685,12 +687,14 @@ void cIptvPluginSetup::Store(void) // Store values into setup.conf SetupStore("TsBufferSize", tsBufferSize); SetupStore("TsBufferPrefill", tsBufferPrefill); + SetupStore("ExtProtocolBasePort", extProtocolBasePort); SetupStore("SectionFiltering", sectionFiltering); SetupStore("SidScanning", sidScanning); StoreFilters("DisabledFilters", disabledFilterIndexes); // Update global config IptvConfig.SetTsBufferSize(tsBufferSize); IptvConfig.SetTsBufferPrefillRatio(tsBufferPrefill); + IptvConfig.SetExtProtocolBasePort(extProtocolBasePort); IptvConfig.SetSectionFiltering(sectionFiltering); IptvConfig.SetSidScanning(sidScanning); for (int i = 0; i < SECTION_FILTER_TABLE_SIZE; ++i) diff --git a/setup.h b/setup.h index 9e4b59c..efcc77e 100644 --- a/setup.h +++ b/setup.h @@ -3,7 +3,7 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: setup.h,v 1.15 2007/10/09 16:37:16 rahrenbe Exp $ + * $Id: setup.h,v 1.16 2007/10/20 17:26:46 rahrenbe Exp $ */ #ifndef __IPTV_SETUP_H @@ -17,6 +17,7 @@ class cIptvPluginSetup : public cMenuSetupPage private: int tsBufferSize; int tsBufferPrefill; + int extProtocolBasePort; int sectionFiltering; int sidScanning; int numDisabledFilters;