mirror of
https://github.com/rofafor/vdr-plugin-iptv.git
synced 2023-10-10 13:37:03 +02:00
Added a user configurable section filter blacklist.
This commit is contained in:
parent
d7e2e8d0d3
commit
3e553d5324
18
common.c
18
common.c
@ -3,11 +3,12 @@
|
|||||||
*
|
*
|
||||||
* 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: common.c,v 1.1 2007/10/05 20:01:24 ajhseppa Exp $
|
* $Id: common.c,v 1.2 2007/10/06 00:02:50 rahrenbe Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <vdr/i18n.h>
|
||||||
#include <vdr/tools.h>
|
#include <vdr/tools.h>
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
uint16_t ts_pid(const uint8_t *buf)
|
uint16_t ts_pid(const uint8_t *buf)
|
||||||
{
|
{
|
||||||
@ -28,3 +29,16 @@ uint8_t payload(const uint8_t *tsp)
|
|||||||
|
|
||||||
return 184;
|
return 184;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const section_filter_table_type section_filter_table[SECTION_FILTER_TABLE_SIZE] =
|
||||||
|
{
|
||||||
|
/* description pid tid mask */
|
||||||
|
{trNOOP("PAT (0x00)"), 0x00, 0x00, 0xFF},
|
||||||
|
{trNOOP("NIT (0x40)"), 0x10, 0x40, 0xFF},
|
||||||
|
{trNOOP("SDT (0x42)"), 0x11, 0x42, 0xFF},
|
||||||
|
{trNOOP("EIT (0x4E/0x4F)"), 0x12, 0x4E, 0xFE},
|
||||||
|
{trNOOP("EIT (0x5X)"), 0x12, 0x50, 0xF0},
|
||||||
|
{trNOOP("EIT (0x6X)"), 0x12, 0x60, 0xF0},
|
||||||
|
{trNOOP("TDT (0x70)"), 0x14, 0x70, 0xFF},
|
||||||
|
};
|
||||||
|
|
||||||
|
13
common.h
13
common.h
@ -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: common.h,v 1.3 2007/10/05 20:01:24 ajhseppa Exp $
|
* $Id: common.h,v 1.4 2007/10/06 00:02:50 rahrenbe Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __IPTV_COMMON_H
|
#ifndef __IPTV_COMMON_H
|
||||||
@ -22,5 +22,16 @@ uint8_t payload(const uint8_t *tsp);
|
|||||||
#define error(x...) esyslog("IPTV: " x);
|
#define error(x...) esyslog("IPTV: " x);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define SECTION_FILTER_TABLE_SIZE 7
|
||||||
|
|
||||||
|
typedef struct _section_filter_table_type {
|
||||||
|
const char *description;
|
||||||
|
u_short pid;
|
||||||
|
u_char tid;
|
||||||
|
u_char mask;
|
||||||
|
} section_filter_table_type;
|
||||||
|
|
||||||
|
extern const section_filter_table_type section_filter_table[SECTION_FILTER_TABLE_SIZE];
|
||||||
|
|
||||||
#endif // __IPTV_COMMON_H
|
#endif // __IPTV_COMMON_H
|
||||||
|
|
||||||
|
23
config.c
23
config.c
@ -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.11 2007/09/30 21:38:31 rahrenbe Exp $
|
* $Id: config.c,v 1.12 2007/10/06 00:02:50 rahrenbe Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
@ -18,4 +18,25 @@ cIptvConfig::cIptvConfig(void)
|
|||||||
sectionFiltering(1),
|
sectionFiltering(1),
|
||||||
sidScanning(1)
|
sidScanning(1)
|
||||||
{
|
{
|
||||||
|
for (unsigned int i = 0; i < sizeof(disabledFilters); ++i)
|
||||||
|
disabledFilters[i] = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int cIptvConfig::GetDisabledFiltersCount(void)
|
||||||
|
{
|
||||||
|
unsigned int n = 0;
|
||||||
|
while ((disabledFilters[n] != -1) && (n < sizeof(disabledFilters)))
|
||||||
|
n++;
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
int cIptvConfig::GetDisabledFilters(unsigned int Index)
|
||||||
|
{
|
||||||
|
return (Index < sizeof(disabledFilters)) ? disabledFilters[Index] : -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void cIptvConfig::SetDisabledFilters(unsigned int Index, int Number)
|
||||||
|
{
|
||||||
|
if (Index < sizeof(disabledFilters))
|
||||||
|
disabledFilters[Index] = Number;
|
||||||
}
|
}
|
||||||
|
6
config.h
6
config.h
@ -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.9 2007/09/30 21:38:31 rahrenbe Exp $
|
* $Id: config.h,v 1.10 2007/10/06 00:02:50 rahrenbe Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __IPTV_CONFIG_H
|
#ifndef __IPTV_CONFIG_H
|
||||||
@ -20,6 +20,7 @@ protected:
|
|||||||
unsigned int tsBufferPrefillRatio;
|
unsigned int tsBufferPrefillRatio;
|
||||||
unsigned int sectionFiltering;
|
unsigned int sectionFiltering;
|
||||||
unsigned int sidScanning;
|
unsigned int sidScanning;
|
||||||
|
int disabledFilters[SECTION_FILTER_TABLE_SIZE];
|
||||||
|
|
||||||
public:
|
public:
|
||||||
cIptvConfig();
|
cIptvConfig();
|
||||||
@ -28,10 +29,13 @@ public:
|
|||||||
unsigned int GetTsBufferPrefillRatio(void) { return tsBufferPrefillRatio; }
|
unsigned int GetTsBufferPrefillRatio(void) { return tsBufferPrefillRatio; }
|
||||||
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 GetDisabledFiltersCount(void);
|
||||||
|
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 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 SetDisabledFilters(unsigned int Index, int Number);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern cIptvConfig IptvConfig;
|
extern cIptvConfig IptvConfig;
|
||||||
|
24
device.c
24
device.c
@ -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: device.c,v 1.50 2007/10/05 19:00:44 ajhseppa Exp $
|
* $Id: device.c,v 1.51 2007/10/06 00:02:50 rahrenbe Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
@ -182,15 +182,17 @@ bool cIptvDevice::DeleteFilter(unsigned int Index)
|
|||||||
bool cIptvDevice::IsBlackListed(u_short Pid, u_char Tid, u_char Mask)
|
bool cIptvDevice::IsBlackListed(u_short Pid, u_char Tid, u_char Mask)
|
||||||
{
|
{
|
||||||
//debug("cIptvDevice::IsBlackListed(%d) Pid=%d Tid=%02X Mask=%02X\n", deviceIndex, Pid, Tid, Mask);
|
//debug("cIptvDevice::IsBlackListed(%d) Pid=%d Tid=%02X Mask=%02X\n", deviceIndex, Pid, Tid, Mask);
|
||||||
// Black list. Should maybe be configurable via plugin setup menu
|
// loop through section filter table
|
||||||
switch (Pid) {
|
for (int i = 0; i < SECTION_FILTER_TABLE_SIZE; ++i) {
|
||||||
case 0x10: // NIT (0x40)
|
int index = IptvConfig.GetDisabledFilters(i);
|
||||||
case 0x11: // SDT (0x42)
|
// check if matches
|
||||||
case 0x14: // TDT (0x70)
|
if ((index >= 0) && (index < SECTION_FILTER_TABLE_SIZE) &&
|
||||||
|
(section_filter_table[i].pid == Pid) && (section_filter_table[i].tid == Tid) &&
|
||||||
|
(section_filter_table[i].mask == Mask)) {
|
||||||
|
//debug("cIptvDevice::IsBlackListed(%d) Found=%s\n", deviceIndex, section_filter_table[i].description);
|
||||||
return true;
|
return true;
|
||||||
default:
|
}
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,11 +201,9 @@ int cIptvDevice::OpenFilter(u_short Pid, u_char Tid, u_char Mask)
|
|||||||
// Check if disabled by user
|
// Check if disabled by user
|
||||||
if (!IptvConfig.GetSectionFiltering())
|
if (!IptvConfig.GetSectionFiltering())
|
||||||
return -1;
|
return -1;
|
||||||
|
// Blacklist check, refuse certain filters
|
||||||
// Black-listing check, refuse certain filters
|
|
||||||
if (IsBlackListed(Pid, Tid, Mask))
|
if (IsBlackListed(Pid, Tid, Mask))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
// Search the next free filter slot
|
// Search the next free filter slot
|
||||||
for (unsigned int i = 0; i < eMaxSecFilterCount; ++i) {
|
for (unsigned int i = 0; i < eMaxSecFilterCount; ++i) {
|
||||||
if (!secfilters[i]) {
|
if (!secfilters[i]) {
|
||||||
|
27
iptv.c
27
iptv.c
@ -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.9 2007/09/30 21:38:31 rahrenbe Exp $
|
* $Id: iptv.c,v 1.10 2007/10/06 00:02:50 rahrenbe Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
@ -18,8 +18,8 @@ static const char *DESCRIPTION = trNOOP("Experiment the IPTV");
|
|||||||
|
|
||||||
class cPluginIptv : public cPlugin {
|
class cPluginIptv : public cPlugin {
|
||||||
private:
|
private:
|
||||||
// Add any member variables or functions you may need here.
|
|
||||||
unsigned int deviceCount;
|
unsigned int deviceCount;
|
||||||
|
int ParseFilters(const char *Value, int *Values);
|
||||||
public:
|
public:
|
||||||
cPluginIptv(void);
|
cPluginIptv(void);
|
||||||
virtual ~cPluginIptv();
|
virtual ~cPluginIptv();
|
||||||
@ -150,6 +150,23 @@ cMenuSetupPage *cPluginIptv::SetupMenu(void)
|
|||||||
return new cIptvPluginSetup();
|
return new cIptvPluginSetup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int cPluginIptv::ParseFilters(const char *Value, int *Filters)
|
||||||
|
{
|
||||||
|
debug("cPluginIptv::ParseFilters(): Value=%s\n", Value);
|
||||||
|
char buffer[256];
|
||||||
|
int n = 0;
|
||||||
|
while (Value && *Value && (n < SECTION_FILTER_TABLE_SIZE)) {
|
||||||
|
strn0cpy(buffer, Value, sizeof(buffer));
|
||||||
|
int i = atoi(buffer);
|
||||||
|
debug("cPluginIptv::ParseFilters(): Filters[%d]=%d\n", n, i);
|
||||||
|
if (i >= 0)
|
||||||
|
Filters[n++] = i;
|
||||||
|
if ((Value = strchr(Value, ' ')) != NULL)
|
||||||
|
Value++;
|
||||||
|
}
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
bool cPluginIptv::SetupParse(const char *Name, const char *Value)
|
bool cPluginIptv::SetupParse(const char *Name, const char *Value)
|
||||||
{
|
{
|
||||||
debug("cPluginIptv::SetupParse()\n");
|
debug("cPluginIptv::SetupParse()\n");
|
||||||
@ -162,6 +179,12 @@ bool cPluginIptv::SetupParse(const char *Name, const char *Value)
|
|||||||
IptvConfig.SetSectionFiltering(atoi(Value));
|
IptvConfig.SetSectionFiltering(atoi(Value));
|
||||||
else if (!strcasecmp(Name, "SidScanning"))
|
else if (!strcasecmp(Name, "SidScanning"))
|
||||||
IptvConfig.SetSidScanning(atoi(Value));
|
IptvConfig.SetSidScanning(atoi(Value));
|
||||||
|
else if (!strcasecmp(Name, "DisabledFilters")) {
|
||||||
|
int DisabledFilters[SECTION_FILTER_TABLE_SIZE] = { -1 };
|
||||||
|
int DisabledFiltersCount = ParseFilters(Value, DisabledFilters);
|
||||||
|
for (int i = 0; i < DisabledFiltersCount; ++i)
|
||||||
|
IptvConfig.SetDisabledFilters(i, DisabledFilters[i]);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
|
47
po/fi_FI.po
47
po/fi_FI.po
@ -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-01 21:07+0300\n"
|
"POT-Creation-Date: 2007-10-06 02:54+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"
|
||||||
@ -15,6 +15,34 @@ msgstr ""
|
|||||||
"Content-Type: text/plain; charset=ISO-8859-15\n"
|
"Content-Type: text/plain; charset=ISO-8859-15\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
|
||||||
|
#: common.c:36
|
||||||
|
msgid "PAT (0x00)"
|
||||||
|
msgstr "PAT (0x00)"
|
||||||
|
|
||||||
|
#: common.c:37
|
||||||
|
msgid "NIT (0x40)"
|
||||||
|
msgstr "NIT (0x40)"
|
||||||
|
|
||||||
|
#: common.c:38
|
||||||
|
msgid "SDT (0x42)"
|
||||||
|
msgstr "SDT (0x42)"
|
||||||
|
|
||||||
|
#: common.c:39
|
||||||
|
msgid "EIT (0x4E/0x4F)"
|
||||||
|
msgstr "EIT (0x4E/0x4F)"
|
||||||
|
|
||||||
|
#: common.c:40
|
||||||
|
msgid "EIT (0x5X)"
|
||||||
|
msgstr "EIT (0x5X)"
|
||||||
|
|
||||||
|
#: common.c:41
|
||||||
|
msgid "EIT (0x6X)"
|
||||||
|
msgstr "EIT (0x6X)"
|
||||||
|
|
||||||
|
#: common.c:42
|
||||||
|
msgid "TDT (0x70)"
|
||||||
|
msgstr "TDT (0x70)"
|
||||||
|
|
||||||
#: iptv.c:17
|
#: iptv.c:17
|
||||||
msgid "Experiment the IPTV"
|
msgid "Experiment the IPTV"
|
||||||
msgstr "Koe IPTV:n ihmeellinen maailma"
|
msgstr "Koe IPTV:n ihmeellinen maailma"
|
||||||
@ -59,18 +87,27 @@ msgstr "Yksil
|
|||||||
msgid "IPTV Channels"
|
msgid "IPTV Channels"
|
||||||
msgstr "IPTV-kanavat"
|
msgstr "IPTV-kanavat"
|
||||||
|
|
||||||
#: setup.c:486
|
#: setup.c:494
|
||||||
msgid "TS buffer size [MB]"
|
msgid "TS buffer size [MB]"
|
||||||
msgstr "TS-puskurin koko [MB]"
|
msgstr "TS-puskurin koko [MB]"
|
||||||
|
|
||||||
#: setup.c:487
|
#: setup.c:495
|
||||||
msgid "TS buffer prefill ratio [%]"
|
msgid "TS buffer prefill ratio [%]"
|
||||||
msgstr "TS-puskurin esitäyttöaste [%]"
|
msgstr "TS-puskurin esitäyttöaste [%]"
|
||||||
|
|
||||||
#: setup.c:488
|
#: setup.c:496
|
||||||
msgid "Use section filtering"
|
msgid "Use section filtering"
|
||||||
msgstr "Käytä sektioiden suodatusta"
|
msgstr "Käytä sektioiden suodatusta"
|
||||||
|
|
||||||
#: setup.c:490
|
#: setup.c:498
|
||||||
msgid "Scan Sid automatically"
|
msgid "Scan Sid automatically"
|
||||||
msgstr "Etsi palvelu-ID automaattisesti"
|
msgstr "Etsi palvelu-ID automaattisesti"
|
||||||
|
|
||||||
|
#: setup.c:499
|
||||||
|
msgid "Disable filters"
|
||||||
|
msgstr "Poista suodattimia käytöstä"
|
||||||
|
|
||||||
|
#. TRANSLATORS: note the singular!
|
||||||
|
#: setup.c:502
|
||||||
|
msgid "Disable filter"
|
||||||
|
msgstr "Poista suodatin käytöstä"
|
||||||
|
48
setup.c
48
setup.c
@ -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.19 2007/10/01 18:14:57 rahrenbe Exp $
|
* $Id: setup.c,v 1.20 2007/10/06 00:02:50 rahrenbe Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -471,10 +471,18 @@ eOSState cIptvMenuChannels::ProcessKey(eKeys Key)
|
|||||||
|
|
||||||
cIptvPluginSetup::cIptvPluginSetup()
|
cIptvPluginSetup::cIptvPluginSetup()
|
||||||
{
|
{
|
||||||
|
debug("cIptvPluginSetup::cIptvPluginSetup()\n");
|
||||||
tsBufferSize = IptvConfig.GetTsBufferSize();
|
tsBufferSize = IptvConfig.GetTsBufferSize();
|
||||||
tsBufferPrefill = IptvConfig.GetTsBufferPrefillRatio();
|
tsBufferPrefill = IptvConfig.GetTsBufferPrefillRatio();
|
||||||
sectionFiltering = IptvConfig.GetSectionFiltering();
|
sectionFiltering = IptvConfig.GetSectionFiltering();
|
||||||
sidScanning = IptvConfig.GetSidScanning();
|
sidScanning = IptvConfig.GetSidScanning();
|
||||||
|
numDisabledFilters = IptvConfig.GetDisabledFiltersCount();
|
||||||
|
if (numDisabledFilters > SECTION_FILTER_TABLE_SIZE)
|
||||||
|
numDisabledFilters = SECTION_FILTER_TABLE_SIZE;
|
||||||
|
for (int i = 0; i < SECTION_FILTER_TABLE_SIZE; ++i) {
|
||||||
|
disabledFilterIndexes[i] = IptvConfig.GetDisabledFilters(i);
|
||||||
|
disabledFilterNames[i] = tr(section_filter_table[i].description);
|
||||||
|
}
|
||||||
Setup();
|
Setup();
|
||||||
SetHelp(trVDR("Channels"), NULL, NULL, NULL);
|
SetHelp(trVDR("Channels"), NULL, NULL, NULL);
|
||||||
}
|
}
|
||||||
@ -486,14 +494,21 @@ void cIptvPluginSetup::Setup(void)
|
|||||||
Add(new cMenuEditIntItem( tr("TS buffer size [MB]"), &tsBufferSize, 2, 16));
|
Add(new cMenuEditIntItem( tr("TS buffer size [MB]"), &tsBufferSize, 2, 16));
|
||||||
Add(new cMenuEditIntItem( tr("TS buffer prefill ratio [%]"), &tsBufferPrefill, 0, 40));
|
Add(new cMenuEditIntItem( tr("TS buffer prefill ratio [%]"), &tsBufferPrefill, 0, 40));
|
||||||
Add(new cMenuEditBoolItem(tr("Use section filtering"), §ionFiltering));
|
Add(new cMenuEditBoolItem(tr("Use section filtering"), §ionFiltering));
|
||||||
if (sectionFiltering)
|
if (sectionFiltering) {
|
||||||
Add(new cMenuEditBoolItem(tr("Scan Sid automatically"), &sidScanning));
|
Add(new cMenuEditBoolItem(tr("Scan Sid automatically"), &sidScanning));
|
||||||
|
Add(new cMenuEditIntItem( tr("Disable filters"), &numDisabledFilters, 0, SECTION_FILTER_TABLE_SIZE));
|
||||||
|
for (int i = 0; i < numDisabledFilters; ++i) {
|
||||||
|
// TRANSLATORS: note the singular!
|
||||||
|
Add(new cMenuEditStraItem(tr("Disable filter"), &disabledFilterIndexes[i], SECTION_FILTER_TABLE_SIZE, disabledFilterNames));
|
||||||
|
}
|
||||||
|
}
|
||||||
SetCurrent(Get(current));
|
SetCurrent(Get(current));
|
||||||
Display();
|
Display();
|
||||||
}
|
}
|
||||||
|
|
||||||
eOSState cIptvPluginSetup::EditChannel(void)
|
eOSState cIptvPluginSetup::EditChannel(void)
|
||||||
{
|
{
|
||||||
|
debug("cIptvPluginSetup::EditChannel()\n");
|
||||||
if (HasSubMenu())
|
if (HasSubMenu())
|
||||||
return osContinue;
|
return osContinue;
|
||||||
return AddSubMenu(new cIptvMenuChannels());
|
return AddSubMenu(new cIptvMenuChannels());
|
||||||
@ -501,6 +516,8 @@ eOSState cIptvPluginSetup::EditChannel(void)
|
|||||||
|
|
||||||
eOSState cIptvPluginSetup::ProcessKey(eKeys Key)
|
eOSState cIptvPluginSetup::ProcessKey(eKeys Key)
|
||||||
{
|
{
|
||||||
|
int oldsectionFiltering = sectionFiltering;
|
||||||
|
int oldNumDisabledFilters = numDisabledFilters;
|
||||||
eOSState state = cMenuSetupPage::ProcessKey(Key);
|
eOSState state = cMenuSetupPage::ProcessKey(Key);
|
||||||
if (state == osUnknown) {
|
if (state == osUnknown) {
|
||||||
switch (Key) {
|
switch (Key) {
|
||||||
@ -508,9 +525,33 @@ eOSState cIptvPluginSetup::ProcessKey(eKeys Key)
|
|||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ((Key != kNone) && ((numDisabledFilters != oldNumDisabledFilters) || (sectionFiltering != oldsectionFiltering))) {
|
||||||
|
while (numDisabledFilters && (numDisabledFilters < oldNumDisabledFilters))
|
||||||
|
disabledFilterIndexes[--oldNumDisabledFilters] = -1;
|
||||||
|
Setup();
|
||||||
|
}
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cIptvPluginSetup::StoreFilters(const char *Name, int *Values)
|
||||||
|
{
|
||||||
|
char buffer[SECTION_FILTER_TABLE_SIZE * 4];
|
||||||
|
char *q = buffer;
|
||||||
|
for (int i = 0; i < SECTION_FILTER_TABLE_SIZE; ++i) {
|
||||||
|
char s[3];
|
||||||
|
if (Values[i] < 0)
|
||||||
|
break;
|
||||||
|
if (q > buffer)
|
||||||
|
*q++ = ' ';
|
||||||
|
snprintf(s, sizeof(s), "%d", Values[i]);
|
||||||
|
strncpy(q, s, strlen(s));
|
||||||
|
q += strlen(s);
|
||||||
|
}
|
||||||
|
*q = 0;
|
||||||
|
debug("cIptvPluginSetup::StoreFilters(): %s=%s\n", Name, buffer);
|
||||||
|
SetupStore(Name, buffer);
|
||||||
|
}
|
||||||
|
|
||||||
void cIptvPluginSetup::Store(void)
|
void cIptvPluginSetup::Store(void)
|
||||||
{
|
{
|
||||||
// Store values into setup.conf
|
// Store values into setup.conf
|
||||||
@ -518,9 +559,12 @@ void cIptvPluginSetup::Store(void)
|
|||||||
SetupStore("TsBufferPrefill", tsBufferPrefill);
|
SetupStore("TsBufferPrefill", tsBufferPrefill);
|
||||||
SetupStore("SectionFiltering", sectionFiltering);
|
SetupStore("SectionFiltering", sectionFiltering);
|
||||||
SetupStore("SidScanning", sidScanning);
|
SetupStore("SidScanning", sidScanning);
|
||||||
|
StoreFilters("DisabledFilters", disabledFilterIndexes);
|
||||||
// Update global config
|
// Update global config
|
||||||
IptvConfig.SetTsBufferSize(tsBufferSize);
|
IptvConfig.SetTsBufferSize(tsBufferSize);
|
||||||
IptvConfig.SetTsBufferPrefillRatio(tsBufferPrefill);
|
IptvConfig.SetTsBufferPrefillRatio(tsBufferPrefill);
|
||||||
IptvConfig.SetSectionFiltering(sectionFiltering);
|
IptvConfig.SetSectionFiltering(sectionFiltering);
|
||||||
IptvConfig.SetSidScanning(sidScanning);
|
IptvConfig.SetSidScanning(sidScanning);
|
||||||
|
for (int i = 0; i < SECTION_FILTER_TABLE_SIZE; ++i)
|
||||||
|
IptvConfig.SetDisabledFilters(i, disabledFilterIndexes[i]);
|
||||||
}
|
}
|
||||||
|
8
setup.h
8
setup.h
@ -3,13 +3,14 @@
|
|||||||
*
|
*
|
||||||
* 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.9 2007/09/30 21:38:31 rahrenbe Exp $
|
* $Id: setup.h,v 1.10 2007/10/06 00:02:50 rahrenbe Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __IPTV_SETUP_H
|
#ifndef __IPTV_SETUP_H
|
||||||
#define __IPTV_SETUP_H
|
#define __IPTV_SETUP_H
|
||||||
|
|
||||||
#include <vdr/menuitems.h>
|
#include <vdr/menuitems.h>
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
class cIptvPluginSetup : public cMenuSetupPage
|
class cIptvPluginSetup : public cMenuSetupPage
|
||||||
{
|
{
|
||||||
@ -18,8 +19,13 @@ private:
|
|||||||
int tsBufferPrefill;
|
int tsBufferPrefill;
|
||||||
int sectionFiltering;
|
int sectionFiltering;
|
||||||
int sidScanning;
|
int sidScanning;
|
||||||
|
int numDisabledFilters;
|
||||||
|
int disabledFilterIndexes[SECTION_FILTER_TABLE_SIZE];
|
||||||
|
const char *disabledFilterNames[SECTION_FILTER_TABLE_SIZE];
|
||||||
|
|
||||||
eOSState EditChannel(void);
|
eOSState EditChannel(void);
|
||||||
virtual void Setup(void);
|
virtual void Setup(void);
|
||||||
|
void StoreFilters(const char *Name, int *Values);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual eOSState ProcessKey(eKeys Key);
|
virtual eOSState ProcessKey(eKeys Key);
|
||||||
|
Loading…
Reference in New Issue
Block a user