Forced EXT script location only to plugin's config directory.

This commit is contained in:
Rolf Ahrenberg 2007-10-19 22:54:03 +00:00
parent 78b1c491f0
commit 1aeccbe51d
6 changed files with 38 additions and 16 deletions

9
README
View File

@ -42,6 +42,8 @@ ln -s iptv-X.Y.Z iptv
cd /put/your/path/here/VDR
patch -p1 < PLUGINS/src/iptv/patches/vdr-X.Y.Z-pluginparam.patch
cp sources.conf /path/to/vdrconf/
mkdir -p /path/to/vdrconf/plugins/iptv
cp PLUGINS/src/iptv/examples/iptvstream.sh /path/to/vdrconf/plugins/iptv/
make
make plugins
./vdr -P iptv
@ -95,8 +97,8 @@ Configuration:
- channels.conf
TV4;IPTV:4:IPTV|EXT|/video/iptvstream.sh|4321:P:0:0:680:0:0:4:0:0:0
TV3;IPTV:3:IPTV|FILE|/media/video.ts|5:P:0:514:670:2321:0:3:0:0:0
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
^ ^ ^ ^ ^ ^
@ -128,6 +130,9 @@ Notes:
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.

View File

@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
* $Id: config.c,v 1.16 2007/10/19 22:18:55 rahrenbe Exp $
* $Id: config.c,v 1.17 2007/10/19 22:54:03 rahrenbe Exp $
*/
#include "config.h"
@ -21,6 +21,7 @@ cIptvConfig::cIptvConfig(void)
{
for (unsigned int i = 0; i < sizeof(disabledFilters); ++i)
disabledFilters[i] = -1;
memset(configDirectory, '\0', sizeof(configDirectory));
}
unsigned int cIptvConfig::GetDisabledFiltersCount(void)
@ -41,3 +42,9 @@ void cIptvConfig::SetDisabledFilters(unsigned int Index, int Number)
if (Index < sizeof(disabledFilters))
disabledFilters[Index] = Number;
}
void cIptvConfig::SetConfigDirectory(const char *directoryP)
{
debug("cIptvConfig::SetConfigDirectory(%s)", directoryP);
strn0cpy(configDirectory, directoryP, sizeof(configDirectory));
}

View File

@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
* $Id: config.h,v 1.14 2007/10/19 22:18:55 rahrenbe Exp $
* $Id: config.h,v 1.15 2007/10/19 22:54:03 rahrenbe Exp $
*/
#ifndef __IPTV_CONFIG_H
@ -15,7 +15,7 @@
class cIptvConfig
{
protected:
private:
unsigned int readBufferTsCount;
unsigned int tsBufferSize;
unsigned int tsBufferPrefillRatio;
@ -24,6 +24,7 @@ protected:
unsigned int sidScanning;
unsigned int extListenPortBase;
int disabledFilters[SECTION_FILTER_TABLE_SIZE];
char configDirectory[255];
public:
cIptvConfig();
@ -34,6 +35,7 @@ public:
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; }
@ -43,6 +45,7 @@ public:
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);
};
extern cIptvConfig IptvConfig;

3
iptv.c
View File

@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
* $Id: iptv.c,v 1.22 2007/10/19 22:18:55 rahrenbe Exp $
* $Id: iptv.c,v 1.23 2007/10/19 22:54:03 rahrenbe Exp $
*/
#include <getopt.h>
@ -100,6 +100,7 @@ bool cPluginIptv::Initialize(void)
{
debug("cPluginIptv::Initialize()\n");
// Initialize any background activities the plugin shall perform.
IptvConfig.SetConfigDirectory(cPlugin::ConfigDirectory(PLUGIN_NAME_I18N));
return cIptvDevice::Initialize(deviceCount);
}

View File

@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
* $Id: protocolext.c,v 1.8 2007/10/19 22:18:55 rahrenbe Exp $
* $Id: protocolext.c,v 1.9 2007/10/19 22:54:03 rahrenbe Exp $
*/
#include <sys/wait.h>
@ -273,12 +273,18 @@ bool cIptvProtocolExt::Set(const char* Location, const int Parameter, const int
{
debug("cIptvProtocolExt::Set(): Location=%s Parameter=%d Index=%d\n", Location, Parameter, Index);
if (!isempty(Location)) {
// Update script file and parameter
scriptFile = strcpyrealloc(scriptFile, Location);
scriptParameter = Parameter;
// Update listen port
listenPort = IptvConfig.GetExtListenPortBase() + Index;
}
struct stat stbuf;
// Update script file and parameter
free(scriptFile);
asprintf(&scriptFile, "%s/%s", IptvConfig.GetConfigDirectory(), Location);
if ((stat(scriptFile, &stbuf) != 0) || (strstr(scriptFile, "..") != 0)) {
error("ERROR: Non-existent script '%s'", scriptFile);
return false;
}
scriptParameter = Parameter;
// Update listen port
listenPort = IptvConfig.GetExtListenPortBase() + Index;
}
return true;
}

View File

@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
* $Id: setup.c,v 1.38 2007/10/19 21:36:28 rahrenbe Exp $
* $Id: setup.c,v 1.39 2007/10/19 22:54:03 rahrenbe Exp $
*/
#include <string.h>
@ -294,11 +294,11 @@ eOSState cIptvMenuEditChannel::ProcessKey(eKeys Key)
if ((Key != kNone) && (data.protocol != oldProtocol)) {
switch (data.protocol) {
case eProtocolEXT:
strn0cpy(data.location, "/video/iptvstream.sh", sizeof(data.location));
strn0cpy(data.location, "iptvstream.sh", sizeof(data.location));
data.parameter = 0;
break;
case eProtocolFILE:
strn0cpy(data.location, "/tmp/video.ts", sizeof(data.location));
strn0cpy(data.location, "/video/stream.ts", sizeof(data.location));
data.parameter = 0;
break;
case eProtocolHTTP: