2007-09-15 17:38:38 +02:00
|
|
|
/*
|
|
|
|
* config.c: IPTV plugin for the Video Disk Recorder
|
|
|
|
*
|
|
|
|
* See the README file for copyright information and how to reach the author.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2015-03-08 13:33:18 +01:00
|
|
|
#include "log.h"
|
2007-09-15 17:38:38 +02:00
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
cIptvConfig IptvConfig;
|
|
|
|
|
|
|
|
cIptvConfig::cIptvConfig(void)
|
2015-03-08 13:33:18 +01:00
|
|
|
: traceModeM(eTraceModeNormal),
|
|
|
|
protocolBasePortM(4321),
|
2013-02-23 14:31:11 +01:00
|
|
|
useBytesM(1),
|
|
|
|
sectionFilteringM(1)
|
2007-09-15 17:38:38 +02:00
|
|
|
{
|
2013-02-23 14:31:11 +01:00
|
|
|
for (unsigned int i = 0; i < ARRAY_SIZE(disabledFiltersM); ++i)
|
|
|
|
disabledFiltersM[i] = -1;
|
2013-02-23 16:12:46 +01:00
|
|
|
memset(configDirectoryM, 0, sizeof(configDirectoryM));
|
2014-03-09 15:04:54 +01:00
|
|
|
memset(resourceDirectoryM, 0, sizeof(resourceDirectoryM));
|
2007-10-06 02:02:50 +02:00
|
|
|
}
|
|
|
|
|
2008-01-05 00:36:37 +01:00
|
|
|
unsigned int cIptvConfig::GetDisabledFiltersCount(void) const
|
2007-10-06 02:02:50 +02:00
|
|
|
{
|
|
|
|
unsigned int n = 0;
|
2013-02-23 14:31:11 +01:00
|
|
|
while ((n < ARRAY_SIZE(disabledFiltersM) && (disabledFiltersM[n] != -1)))
|
2008-02-01 22:54:24 +01:00
|
|
|
n++;
|
2007-10-06 02:02:50 +02:00
|
|
|
return n;
|
|
|
|
}
|
|
|
|
|
2013-02-23 14:31:11 +01:00
|
|
|
int cIptvConfig::GetDisabledFilters(unsigned int indexP) const
|
2007-10-06 02:02:50 +02:00
|
|
|
{
|
2013-02-23 14:31:11 +01:00
|
|
|
return (indexP < ARRAY_SIZE(disabledFiltersM)) ? disabledFiltersM[indexP] : -1;
|
2007-10-06 02:02:50 +02:00
|
|
|
}
|
|
|
|
|
2013-02-23 14:31:11 +01:00
|
|
|
void cIptvConfig::SetDisabledFilters(unsigned int indexP, int numberP)
|
2007-10-06 02:02:50 +02:00
|
|
|
{
|
2013-02-23 14:31:11 +01:00
|
|
|
if (indexP < ARRAY_SIZE(disabledFiltersM))
|
|
|
|
disabledFiltersM[indexP] = numberP;
|
2007-09-15 17:38:38 +02:00
|
|
|
}
|
2007-10-20 00:54:03 +02:00
|
|
|
|
|
|
|
void cIptvConfig::SetConfigDirectory(const char *directoryP)
|
|
|
|
{
|
2015-03-08 13:33:18 +01:00
|
|
|
debug1("%s (%s)", __PRETTY_FUNCTION__, directoryP);
|
2013-02-23 14:31:11 +01:00
|
|
|
ERROR_IF(!realpath(directoryP, configDirectoryM), "Cannot canonicalize configuration directory");
|
2007-10-20 00:54:03 +02:00
|
|
|
}
|
2014-03-09 15:04:54 +01:00
|
|
|
|
|
|
|
void cIptvConfig::SetResourceDirectory(const char *directoryP)
|
|
|
|
{
|
2015-03-08 13:33:18 +01:00
|
|
|
debug1("%s (%s)", __PRETTY_FUNCTION__, directoryP);
|
2014-03-09 15:04:54 +01:00
|
|
|
ERROR_IF(!realpath(directoryP, resourceDirectoryM), "Cannot canonicalize resource directory");
|
|
|
|
}
|