1
0
mirror of https://github.com/rofafor/vdr-plugin-iptv.git synced 2023-10-10 13:37:03 +02:00

Moved EXT protocol base port setting from the command line switch to the setup menu entry.

This commit is contained in:
Rolf Ahrenberg 2007-10-20 17:26:46 +00:00
parent 987696a35b
commit 0670667e9b
8 changed files with 51 additions and 45 deletions

49
README
View File

@ -55,7 +55,11 @@ Setup menu:
- TS buffer prefill ratio [%] = 0 Defines prefill ratio for transport - TS buffer prefill ratio [%] = 0 Defines prefill ratio for transport
stream ringbuffer before data is stream ringbuffer before data is
transferred to VDR. 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 - Use section filtering = 1 Defines whether section filtering shall
be used. be used.
Valid range: 0...1 Valid range: 0...1
@ -118,26 +122,30 @@ Configuration:
External streaming: External streaming:
- Starting from version 0.0.2 IPTV plugin features support for external - Starting from version 0.0.2 IPTV plugin features a support for external
streaming applications. What this means in short is that with proper helper streaming applications. With proper helper applications and configuration
applications and configuration the plugin is able to display streams not the IPTV plugin is now able to display not only MPEG1/2 transport streams
originally in MPEG1/2 TS format. but also other formats like MP3 radio streams.
- To add an externally received channel, add an EXT entry to channels.conf. - To watch an externally received channel add an EXT entry to channels.conf
Specify a script name as the location parameter. This script is executed and specify a script name and parameter. The specified script is executed
from plugin configuration directory when VDR tunes to the specified from plugin configuration directory when VDR tunes to the channel. The
channel. The port parameter in channels.conf is passed to the script and specified script parameter is passed to the script and it can be used to
can be used to select for example between different URLs. select for example between different URLs.
- When EXT channel is opened IPTV plugin opens an UDP listening port on the - When an EXT channel is opened the IPTV plugin opens an UDP listening port
local host. The script executing is then responsible for supplying IPTV on the localhost. The external script is responsible for supplying IPTV
plugin with MPEG2 TS data in UDP format to the opened port. The data will plugin with MPEG2 TS data in UDP/RTP format to the listening port. The
then be processed by VDR as usual. The opened listening port can be data will be processed in VDR like a normal DVB broadcast. The listening
specified in plugin configuration. 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 - IPTV plugin includes an example script which uses VLC media player for
receiving streams, transcoding and handing the result to IPTV plugin. IPTV receiving streams, transcoding and handing the result to IPTV plugin. The
was tested with VLC version 0.8.6c plugin was tested with VLC version 0.8.6c.
Notes: Notes:
@ -148,13 +156,6 @@ Notes:
- The following section filters are recommended to be disabled: - The following section filters are recommended to be disabled:
"NIT (0x40)", "SDT (0x42)", "TDT (0x70)" "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: Acknowledgements:
- The IPTV section filtering code is derived from Linux kernel. - The IPTV section filtering code is derived from Linux kernel.

View File

@ -3,7 +3,7 @@
* *
* See the README file for copyright information and how to reach the author. * 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" #include "config.h"
@ -14,10 +14,10 @@ cIptvConfig::cIptvConfig(void)
: readBufferTsCount(48), : readBufferTsCount(48),
tsBufferSize(2), tsBufferSize(2),
tsBufferPrefillRatio(0), tsBufferPrefillRatio(0),
extProtocolBasePort(4321),
useBytes(1), useBytes(1),
sectionFiltering(1), sectionFiltering(1),
sidScanning(1), sidScanning(1)
extListenPortBase(4321)
{ {
for (unsigned int i = 0; i < sizeof(disabledFilters); ++i) for (unsigned int i = 0; i < sizeof(disabledFilters); ++i)
disabledFilters[i] = -1; disabledFilters[i] = -1;

View File

@ -3,7 +3,7 @@
* *
* See the README file for copyright information and how to reach the author. * 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 #ifndef __IPTV_CONFIG_H
@ -19,10 +19,10 @@ private:
unsigned int readBufferTsCount; unsigned int readBufferTsCount;
unsigned int tsBufferSize; unsigned int tsBufferSize;
unsigned int tsBufferPrefillRatio; unsigned int tsBufferPrefillRatio;
unsigned int extProtocolBasePort;
unsigned int useBytes; unsigned int useBytes;
unsigned int sectionFiltering; unsigned int sectionFiltering;
unsigned int sidScanning; unsigned int sidScanning;
unsigned int extListenPortBase;
int disabledFilters[SECTION_FILTER_TABLE_SIZE]; int disabledFilters[SECTION_FILTER_TABLE_SIZE];
char configDirectory[255]; char configDirectory[255];
@ -31,19 +31,19 @@ public:
unsigned int GetReadBufferTsCount(void) { return readBufferTsCount; } unsigned int GetReadBufferTsCount(void) { return readBufferTsCount; }
unsigned int GetTsBufferSize(void) { return tsBufferSize; } unsigned int GetTsBufferSize(void) { return tsBufferSize; }
unsigned int GetTsBufferPrefillRatio(void) { return tsBufferPrefillRatio; } unsigned int GetTsBufferPrefillRatio(void) { return tsBufferPrefillRatio; }
unsigned int GetExtProtocolBasePort(void) { return extProtocolBasePort; }
unsigned int GetUseBytes(void) { return useBytes; } unsigned int GetUseBytes(void) { return useBytes; }
unsigned int GetSectionFiltering(void) { return sectionFiltering; } unsigned int GetSectionFiltering(void) { return sectionFiltering; }
unsigned int GetSidScanning(void) { return sidScanning; } unsigned int GetSidScanning(void) { return sidScanning; }
unsigned int GetExtListenPortBase(void) { return extListenPortBase; }
const char *GetConfigDirectory(void) { return configDirectory; } const char *GetConfigDirectory(void) { return configDirectory; }
unsigned int GetDisabledFiltersCount(void); unsigned int GetDisabledFiltersCount(void);
int GetDisabledFilters(unsigned int Index); int GetDisabledFilters(unsigned int Index);
void SetTsBufferSize(unsigned int Size) { tsBufferSize = Size; } void SetTsBufferSize(unsigned int Size) { tsBufferSize = Size; }
void SetTsBufferPrefillRatio(unsigned int Ratio) { tsBufferPrefillRatio = Ratio; } void SetTsBufferPrefillRatio(unsigned int Ratio) { tsBufferPrefillRatio = Ratio; }
void SetExtProtocolBasePort(unsigned int PortNumber) { extProtocolBasePort = PortNumber; }
void SetUseBytes(unsigned int On) { useBytes = On; } void SetUseBytes(unsigned int On) { useBytes = On; }
void SetSectionFiltering(unsigned int On) { sectionFiltering = On; } void SetSectionFiltering(unsigned int On) { sectionFiltering = On; }
void SetSidScanning(unsigned int On) { sidScanning = On; } void SetSidScanning(unsigned int On) { sidScanning = On; }
void SetExtListenPortBase(unsigned int PortNumber) { extListenPortBase = PortNumber; }
void SetDisabledFilters(unsigned int Index, int Number); void SetDisabledFilters(unsigned int Index, int Number);
void SetConfigDirectory(const char *directoryP); void SetConfigDirectory(const char *directoryP);
}; };

13
iptv.c
View File

@ -3,7 +3,7 @@
* *
* See the README file for copyright information and how to reach the author. * 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 <getopt.h> #include <getopt.h>
@ -66,8 +66,7 @@ const char *cPluginIptv::CommandLineHelp(void)
{ {
debug("cPluginIptv::CommandLineHelp()\n"); debug("cPluginIptv::CommandLineHelp()\n");
// Return a string that describes all known command line options. // Return a string that describes all known command line options.
return " -d <num>, --devices=<number> number of devices to be created\n" return " -d <num>, --devices=<number> number of devices to be created\n";
" -p <port>,--port=<port> base port number for EXT protocol UDP streaming\n";
} }
bool cPluginIptv::ProcessArgs(int argc, char *argv[]) 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. // Implement command line argument processing here if applicable.
static const struct option long_options[] = { static const struct option long_options[] = {
{ "devices", required_argument, NULL, 'd' }, { "devices", required_argument, NULL, 'd' },
{ "port", required_argument, NULL, 'p' },
{ NULL } { NULL }
}; };
int c; 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) { switch (c) {
case 'd': case 'd':
deviceCount = atoi(optarg); deviceCount = atoi(optarg);
break; break;
case 'p':
IptvConfig.SetExtListenPortBase(atoi(optarg));
break;
default: default:
return false; return false;
} }
@ -183,6 +178,8 @@ bool cPluginIptv::SetupParse(const char *Name, const char *Value)
IptvConfig.SetTsBufferSize(atoi(Value)); IptvConfig.SetTsBufferSize(atoi(Value));
else if (!strcasecmp(Name, "TsBufferPrefill")) else if (!strcasecmp(Name, "TsBufferPrefill"))
IptvConfig.SetTsBufferPrefillRatio(atoi(Value)); IptvConfig.SetTsBufferPrefillRatio(atoi(Value));
else if (!strcasecmp(Name, "ExtProtocolBasePort"))
IptvConfig.SetExtProtocolBasePort(atoi(Value));
else if (!strcasecmp(Name, "SectionFiltering")) else if (!strcasecmp(Name, "SectionFiltering"))
IptvConfig.SetSectionFiltering(atoi(Value)); IptvConfig.SetSectionFiltering(atoi(Value));
else if (!strcasecmp(Name, "SidScanning")) else if (!strcasecmp(Name, "SidScanning"))

View File

@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: VDR 1.5.7\n" "Project-Id-Version: VDR 1.5.7\n"
"Report-Msgid-Bugs-To: Rolf Ahrenberg\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" "PO-Revision-Date: 2007-08-12 23:22+0300\n"
"Last-Translator: Rolf Ahrenberg\n" "Last-Translator: Rolf Ahrenberg\n"
"Language-Team: <vdr@linuxtv.org>\n" "Language-Team: <vdr@linuxtv.org>\n"
@ -108,6 +108,9 @@ msgstr "TS-puskurin koko [MB]"
msgid "TS buffer prefill ratio [%]" msgid "TS buffer prefill ratio [%]"
msgstr "TS-puskurin esitäyttöaste [%]" msgstr "TS-puskurin esitäyttöaste [%]"
msgid "EXT protocol base port"
msgstr "EXT-protokollan perusportti"
msgid "Use section filtering" msgid "Use section filtering"
msgstr "Käytä sektioiden suodatusta" msgstr "Käytä sektioiden suodatusta"

View File

@ -3,7 +3,7 @@
* *
* See the README file for copyright information and how to reach the author. * 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 <sys/wait.h> #include <sys/wait.h>
@ -22,7 +22,7 @@
cIptvProtocolExt::cIptvProtocolExt() cIptvProtocolExt::cIptvProtocolExt()
: pid(-1), : pid(-1),
listenPort(IptvConfig.GetExtListenPortBase()), listenPort(IptvConfig.GetExtProtocolBasePort()),
scriptParameter(0), scriptParameter(0),
socketDesc(-1), socketDesc(-1),
readBufferLen(TS_SIZE * IptvConfig.GetReadBufferTsCount()) readBufferLen(TS_SIZE * IptvConfig.GetReadBufferTsCount())
@ -297,7 +297,7 @@ bool cIptvProtocolExt::Set(const char* Location, const int Parameter, const int
} }
scriptParameter = Parameter; scriptParameter = Parameter;
// Update listen port // Update listen port
listenPort = IptvConfig.GetExtListenPortBase() + Index; listenPort = IptvConfig.GetExtProtocolBasePort() + Index;
} }
return true; return true;
} }

View File

@ -3,7 +3,7 @@
* *
* See the README file for copyright information and how to reach the author. * 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 <string.h> #include <string.h>
@ -593,6 +593,7 @@ cIptvPluginSetup::cIptvPluginSetup()
debug("cIptvPluginSetup::cIptvPluginSetup()\n"); debug("cIptvPluginSetup::cIptvPluginSetup()\n");
tsBufferSize = IptvConfig.GetTsBufferSize(); tsBufferSize = IptvConfig.GetTsBufferSize();
tsBufferPrefill = IptvConfig.GetTsBufferPrefillRatio(); tsBufferPrefill = IptvConfig.GetTsBufferPrefillRatio();
extProtocolBasePort = IptvConfig.GetExtProtocolBasePort();
sectionFiltering = IptvConfig.GetSectionFiltering(); sectionFiltering = IptvConfig.GetSectionFiltering();
sidScanning = IptvConfig.GetSidScanning(); sidScanning = IptvConfig.GetSidScanning();
numDisabledFilters = IptvConfig.GetDisabledFiltersCount(); numDisabledFilters = IptvConfig.GetDisabledFiltersCount();
@ -612,6 +613,7 @@ void cIptvPluginSetup::Setup(void)
Clear(); Clear();
Add(new cMenuEditIntItem( tr("TS buffer size [MB]"), &tsBufferSize, 1, 4)); 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("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"), &sectionFiltering)); Add(new cMenuEditBoolItem(tr("Use section filtering"), &sectionFiltering));
if (sectionFiltering) { if (sectionFiltering) {
Add(new cMenuEditBoolItem(tr("Scan Sid automatically"), &sidScanning)); Add(new cMenuEditBoolItem(tr("Scan Sid automatically"), &sidScanning));
@ -685,12 +687,14 @@ void cIptvPluginSetup::Store(void)
// Store values into setup.conf // Store values into setup.conf
SetupStore("TsBufferSize", tsBufferSize); SetupStore("TsBufferSize", tsBufferSize);
SetupStore("TsBufferPrefill", tsBufferPrefill); SetupStore("TsBufferPrefill", tsBufferPrefill);
SetupStore("ExtProtocolBasePort", extProtocolBasePort);
SetupStore("SectionFiltering", sectionFiltering); SetupStore("SectionFiltering", sectionFiltering);
SetupStore("SidScanning", sidScanning); SetupStore("SidScanning", sidScanning);
StoreFilters("DisabledFilters", disabledFilterIndexes); StoreFilters("DisabledFilters", disabledFilterIndexes);
// Update global config // Update global config
IptvConfig.SetTsBufferSize(tsBufferSize); IptvConfig.SetTsBufferSize(tsBufferSize);
IptvConfig.SetTsBufferPrefillRatio(tsBufferPrefill); IptvConfig.SetTsBufferPrefillRatio(tsBufferPrefill);
IptvConfig.SetExtProtocolBasePort(extProtocolBasePort);
IptvConfig.SetSectionFiltering(sectionFiltering); IptvConfig.SetSectionFiltering(sectionFiltering);
IptvConfig.SetSidScanning(sidScanning); IptvConfig.SetSidScanning(sidScanning);
for (int i = 0; i < SECTION_FILTER_TABLE_SIZE; ++i) for (int i = 0; i < SECTION_FILTER_TABLE_SIZE; ++i)

View File

@ -3,7 +3,7 @@
* *
* See the README file for copyright information and how to reach the author. * 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 #ifndef __IPTV_SETUP_H
@ -17,6 +17,7 @@ class cIptvPluginSetup : public cMenuSetupPage
private: private:
int tsBufferSize; int tsBufferSize;
int tsBufferPrefill; int tsBufferPrefill;
int extProtocolBasePort;
int sectionFiltering; int sectionFiltering;
int sidScanning; int sidScanning;
int numDisabledFilters; int numDisabledFilters;