mirror of
https://github.com/rofafor/vdr-plugin-iptv.git
synced 2023-10-10 13:37:03 +02:00
Added configurable UDP listen port for EXT protocol.
This commit is contained in:
parent
8e3956cbeb
commit
4dd9e42a71
4
README
4
README
@ -124,6 +124,10 @@ 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).
|
||||
|
||||
Acknowledgements:
|
||||
|
||||
- The IPTV section filtering code is derived from Linux kernel.
|
||||
|
5
config.c
5
config.c
@ -3,7 +3,7 @@
|
||||
*
|
||||
* See the README file for copyright information and how to reach the author.
|
||||
*
|
||||
* $Id: config.c,v 1.15 2007/10/08 23:51:58 rahrenbe Exp $
|
||||
* $Id: config.c,v 1.16 2007/10/19 22:18:55 rahrenbe Exp $
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
@ -16,7 +16,8 @@ cIptvConfig::cIptvConfig(void)
|
||||
tsBufferPrefillRatio(0),
|
||||
useBytes(1),
|
||||
sectionFiltering(1),
|
||||
sidScanning(1)
|
||||
sidScanning(1),
|
||||
extListenPortBase(4321)
|
||||
{
|
||||
for (unsigned int i = 0; i < sizeof(disabledFilters); ++i)
|
||||
disabledFilters[i] = -1;
|
||||
|
5
config.h
5
config.h
@ -3,7 +3,7 @@
|
||||
*
|
||||
* See the README file for copyright information and how to reach the author.
|
||||
*
|
||||
* $Id: config.h,v 1.13 2007/10/08 23:51:58 rahrenbe Exp $
|
||||
* $Id: config.h,v 1.14 2007/10/19 22:18:55 rahrenbe Exp $
|
||||
*/
|
||||
|
||||
#ifndef __IPTV_CONFIG_H
|
||||
@ -22,6 +22,7 @@ protected:
|
||||
unsigned int useBytes;
|
||||
unsigned int sectionFiltering;
|
||||
unsigned int sidScanning;
|
||||
unsigned int extListenPortBase;
|
||||
int disabledFilters[SECTION_FILTER_TABLE_SIZE];
|
||||
|
||||
public:
|
||||
@ -32,6 +33,7 @@ public:
|
||||
unsigned int GetUseBytes(void) { return useBytes; }
|
||||
unsigned int GetSectionFiltering(void) { return sectionFiltering; }
|
||||
unsigned int GetSidScanning(void) { return sidScanning; }
|
||||
unsigned int GetExtListenPortBase(void) { return extListenPortBase; }
|
||||
unsigned int GetDisabledFiltersCount(void);
|
||||
int GetDisabledFilters(unsigned int Index);
|
||||
void SetTsBufferSize(unsigned int Size) { tsBufferSize = Size; }
|
||||
@ -39,6 +41,7 @@ public:
|
||||
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);
|
||||
};
|
||||
|
||||
|
4
device.c
4
device.c
@ -3,7 +3,7 @@
|
||||
*
|
||||
* See the README file for copyright information and how to reach the author.
|
||||
*
|
||||
* $Id: device.c,v 1.70 2007/10/19 21:36:27 rahrenbe Exp $
|
||||
* $Id: device.c,v 1.71 2007/10/19 22:18:55 rahrenbe Exp $
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
@ -225,7 +225,7 @@ bool cIptvDevice::SetChannelDevice(const cChannel *Channel, bool LiveView)
|
||||
error("ERROR: Unrecognized IPTV channel settings: %s", Channel->PluginParam());
|
||||
return false;
|
||||
}
|
||||
pIptvStreamer->Set(location, parameter, protocol);
|
||||
pIptvStreamer->Set(location, parameter, deviceIndex, protocol);
|
||||
if (pSidScanner && IptvConfig.GetSectionFiltering() && IptvConfig.GetSidScanning())
|
||||
pSidScanner->SetChannel(Channel);
|
||||
return true;
|
||||
|
11
iptv.c
11
iptv.c
@ -3,7 +3,7 @@
|
||||
*
|
||||
* See the README file for copyright information and how to reach the author.
|
||||
*
|
||||
* $Id: iptv.c,v 1.21 2007/10/15 21:03:45 rahrenbe Exp $
|
||||
* $Id: iptv.c,v 1.22 2007/10/19 22:18:55 rahrenbe Exp $
|
||||
*/
|
||||
|
||||
#include <getopt.h>
|
||||
@ -66,7 +66,8 @@ const char *cPluginIptv::CommandLineHelp(void)
|
||||
{
|
||||
debug("cPluginIptv::CommandLineHelp()\n");
|
||||
// Return a string that describes all known command line options.
|
||||
return " -d <num>, --devices=<number> number of devices to be created (default: 1)\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[])
|
||||
@ -75,15 +76,19 @@ 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:", long_options, NULL)) != -1) {
|
||||
while ((c = getopt_long(argc, argv, "d:p:", long_options, NULL)) != -1) {
|
||||
switch (c) {
|
||||
case 'd':
|
||||
deviceCount = atoi(optarg);
|
||||
break;
|
||||
case 'p':
|
||||
IptvConfig.SetExtListenPortBase(atoi(optarg));
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* See the README file for copyright information and how to reach the author.
|
||||
*
|
||||
* $Id: protocolext.c,v 1.7 2007/10/19 21:36:28 rahrenbe Exp $
|
||||
* $Id: protocolext.c,v 1.8 2007/10/19 22:18:55 rahrenbe Exp $
|
||||
*/
|
||||
|
||||
#include <sys/wait.h>
|
||||
@ -22,7 +22,7 @@
|
||||
|
||||
cIptvProtocolExt::cIptvProtocolExt()
|
||||
: pid(-1),
|
||||
listenPort(4321),
|
||||
listenPort(IptvConfig.GetExtListenPortBase()),
|
||||
scriptParameter(0),
|
||||
socketDesc(-1),
|
||||
readBufferLen(TS_SIZE * IptvConfig.GetReadBufferTsCount())
|
||||
@ -269,13 +269,15 @@ bool cIptvProtocolExt::Close(void)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool cIptvProtocolExt::Set(const char* Location, const int Parameter)
|
||||
bool cIptvProtocolExt::Set(const char* Location, const int Parameter, const int Index)
|
||||
{
|
||||
debug("cIptvProtocolExt::Set(): Location=%s Parameter=%d\n", Location, Parameter);
|
||||
debug("cIptvProtocolExt::Set(): Location=%s Parameter=%d Index=%d\n", Location, Parameter, Index);
|
||||
if (!isempty(Location)) {
|
||||
// Update stream address and port
|
||||
// Update script file and parameter
|
||||
scriptFile = strcpyrealloc(scriptFile, Location);
|
||||
scriptParameter = Parameter;
|
||||
// Update listen port
|
||||
listenPort = IptvConfig.GetExtListenPortBase() + Index;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* See the README file for copyright information and how to reach the author.
|
||||
*
|
||||
* $Id: protocolext.h,v 1.4 2007/10/19 21:36:28 rahrenbe Exp $
|
||||
* $Id: protocolext.h,v 1.5 2007/10/19 22:18:55 rahrenbe Exp $
|
||||
*/
|
||||
|
||||
#ifndef __IPTV_PROTOCOLEXT_H
|
||||
@ -35,7 +35,7 @@ public:
|
||||
cIptvProtocolExt();
|
||||
virtual ~cIptvProtocolExt();
|
||||
virtual int Read(unsigned char* *BufferAddr);
|
||||
virtual bool Set(const char* Location, const int Parameter);
|
||||
virtual bool Set(const char* Location, const int Parameter, const int Index);
|
||||
virtual bool Open(void);
|
||||
virtual bool Close(void);
|
||||
virtual cString GetInformation(void);
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* See the README file for copyright information and how to reach the author.
|
||||
*
|
||||
* $Id: protocolfile.c,v 1.11 2007/10/19 21:36:28 rahrenbe Exp $
|
||||
* $Id: protocolfile.c,v 1.12 2007/10/19 22:18:55 rahrenbe Exp $
|
||||
*/
|
||||
|
||||
#include <fcntl.h>
|
||||
@ -106,9 +106,9 @@ bool cIptvProtocolFile::Close(void)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool cIptvProtocolFile::Set(const char* Location, const int Parameter)
|
||||
bool cIptvProtocolFile::Set(const char* Location, const int Parameter, const int Index)
|
||||
{
|
||||
debug("cIptvProtocolFile::Set(): Location=%s Parameter=%d\n", Location, Parameter);
|
||||
debug("cIptvProtocolFile::Set(): Location=%s Parameter=%d Index=%d\n", Location, Parameter, Index);
|
||||
if (!isempty(Location)) {
|
||||
// Close the file stream
|
||||
CloseFile();
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* See the README file for copyright information and how to reach the author.
|
||||
*
|
||||
* $Id: protocolfile.h,v 1.6 2007/10/19 21:36:28 rahrenbe Exp $
|
||||
* $Id: protocolfile.h,v 1.7 2007/10/19 22:18:55 rahrenbe Exp $
|
||||
*/
|
||||
|
||||
#ifndef __IPTV_PROTOCOLFILE_H
|
||||
@ -29,7 +29,7 @@ public:
|
||||
cIptvProtocolFile();
|
||||
virtual ~cIptvProtocolFile();
|
||||
virtual int Read(unsigned char* *BufferAddr);
|
||||
virtual bool Set(const char* Location, const int Parameter);
|
||||
virtual bool Set(const char* Location, const int Parameter, const int Index);
|
||||
virtual bool Open(void);
|
||||
virtual bool Close(void);
|
||||
virtual cString GetInformation(void);
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* See the README file for copyright information and how to reach the author.
|
||||
*
|
||||
* $Id: protocolhttp.c,v 1.11 2007/10/19 21:36:28 rahrenbe Exp $
|
||||
* $Id: protocolhttp.c,v 1.12 2007/10/19 22:18:55 rahrenbe Exp $
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -349,9 +349,9 @@ bool cIptvProtocolHttp::Close(void)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool cIptvProtocolHttp::Set(const char* Location, const int Parameter)
|
||||
bool cIptvProtocolHttp::Set(const char* Location, const int Parameter, const int Index)
|
||||
{
|
||||
debug("cIptvProtocolHttp::Set(): Location=%s Parameter=%d\n", Location, Parameter);
|
||||
debug("cIptvProtocolHttp::Set(): Location=%s Parameter=%d Index=%d\n", Location, Parameter, Index);
|
||||
if (!isempty(Location)) {
|
||||
// Disconnect the current socket
|
||||
Disconnect();
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* See the README file for copyright information and how to reach the author.
|
||||
*
|
||||
* $Id: protocolhttp.h,v 1.8 2007/10/19 21:36:28 rahrenbe Exp $
|
||||
* $Id: protocolhttp.h,v 1.9 2007/10/19 22:18:55 rahrenbe Exp $
|
||||
*/
|
||||
|
||||
#ifndef __IPTV_PROTOCOLHTTP_H
|
||||
@ -36,7 +36,7 @@ public:
|
||||
cIptvProtocolHttp();
|
||||
virtual ~cIptvProtocolHttp();
|
||||
virtual int Read(unsigned char* *BufferAddr);
|
||||
virtual bool Set(const char* Location, const int Parameter);
|
||||
virtual bool Set(const char* Location, const int Parameter, const int Index);
|
||||
virtual bool Open(void);
|
||||
virtual bool Close(void);
|
||||
virtual cString GetInformation(void);
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* See the README file for copyright information and how to reach the author.
|
||||
*
|
||||
* $Id: protocolif.h,v 1.6 2007/10/19 21:36:28 rahrenbe Exp $
|
||||
* $Id: protocolif.h,v 1.7 2007/10/19 22:18:55 rahrenbe Exp $
|
||||
*/
|
||||
|
||||
#ifndef __IPTV_PROTOCOLIF_H
|
||||
@ -14,7 +14,7 @@ public:
|
||||
cIptvProtocolIf() {}
|
||||
virtual ~cIptvProtocolIf() {}
|
||||
virtual int Read(unsigned char* *BufferAddr) = 0;
|
||||
virtual bool Set(const char* Location, const int Parameter) = 0;
|
||||
virtual bool Set(const char* Location, const int Parameter, const int Index) = 0;
|
||||
virtual bool Open(void) = 0;
|
||||
virtual bool Close(void) = 0;
|
||||
virtual cString GetInformation(void) = 0;
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* See the README file for copyright information and how to reach the author.
|
||||
*
|
||||
* $Id: protocoludp.c,v 1.12 2007/10/19 21:36:28 rahrenbe Exp $
|
||||
* $Id: protocoludp.c,v 1.13 2007/10/19 22:18:55 rahrenbe Exp $
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -232,9 +232,9 @@ bool cIptvProtocolUdp::Close(void)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool cIptvProtocolUdp::Set(const char* Location, const int Parameter)
|
||||
bool cIptvProtocolUdp::Set(const char* Location, const int Parameter, const int Index)
|
||||
{
|
||||
debug("cIptvProtocolUdp::Set(): Location=%s Parameter=%d\n", Location, Parameter);
|
||||
debug("cIptvProtocolUdp::Set(): Location=%s Parameter=%d Index=%d\n", Location, Parameter, Index);
|
||||
if (!isempty(Location)) {
|
||||
// Drop the multicast group
|
||||
DropMulticast();
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* See the README file for copyright information and how to reach the author.
|
||||
*
|
||||
* $Id: protocoludp.h,v 1.9 2007/10/19 21:36:28 rahrenbe Exp $
|
||||
* $Id: protocoludp.h,v 1.10 2007/10/19 22:18:55 rahrenbe Exp $
|
||||
*/
|
||||
|
||||
#ifndef __IPTV_PROTOCOLUDP_H
|
||||
@ -32,7 +32,7 @@ public:
|
||||
cIptvProtocolUdp();
|
||||
virtual ~cIptvProtocolUdp();
|
||||
virtual int Read(unsigned char* *BufferAddr);
|
||||
virtual bool Set(const char* Location, const int Parameter);
|
||||
virtual bool Set(const char* Location, const int Parameter, const int Index);
|
||||
virtual bool Open(void);
|
||||
virtual bool Close(void);
|
||||
virtual cString GetInformation(void);
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* See the README file for copyright information and how to reach the author.
|
||||
*
|
||||
* $Id: streamer.c,v 1.24 2007/10/19 21:36:28 rahrenbe Exp $
|
||||
* $Id: streamer.c,v 1.25 2007/10/19 22:18:55 rahrenbe Exp $
|
||||
*/
|
||||
|
||||
#include <vdr/thread.h>
|
||||
@ -77,7 +77,7 @@ bool cIptvStreamer::Close(void)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool cIptvStreamer::Set(const char* Location, const int Parameter, cIptvProtocolIf* Protocol)
|
||||
bool cIptvStreamer::Set(const char* Location, const int Parameter, const int Index, cIptvProtocolIf* Protocol)
|
||||
{
|
||||
debug("cIptvStreamer::Set(): %s:%d\n", Location, Parameter);
|
||||
if (!isempty(Location)) {
|
||||
@ -91,7 +91,7 @@ bool cIptvStreamer::Set(const char* Location, const int Parameter, cIptvProtocol
|
||||
}
|
||||
// Set protocol location and parameter
|
||||
if (protocol)
|
||||
protocol->Set(Location, Parameter);
|
||||
protocol->Set(Location, Parameter, Index);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* See the README file for copyright information and how to reach the author.
|
||||
*
|
||||
* $Id: streamer.h,v 1.12 2007/10/19 21:36:28 rahrenbe Exp $
|
||||
* $Id: streamer.h,v 1.13 2007/10/19 22:18:55 rahrenbe Exp $
|
||||
*/
|
||||
|
||||
#ifndef __IPTV_STREAMER_H
|
||||
@ -29,7 +29,7 @@ public:
|
||||
cIptvStreamer(cRingBufferLinear* RingBuffer, cMutex* Mutex);
|
||||
virtual ~cIptvStreamer();
|
||||
virtual void Action(void);
|
||||
bool Set(const char* Location, const int Parameter, cIptvProtocolIf* Protocol);
|
||||
bool Set(const char* Location, const int Parameter, const int Index, cIptvProtocolIf* Protocol);
|
||||
bool Open(void);
|
||||
bool Close(void);
|
||||
cString GetInformation(void);
|
||||
|
Loading…
Reference in New Issue
Block a user