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

Added setup options for section filtering and Sid scanning.

This commit is contained in:
Rolf Ahrenberg 2007-09-30 21:38:31 +00:00
parent e4f7904187
commit 588a86284d
7 changed files with 67 additions and 36 deletions

View File

@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
* $Id: config.c,v 1.10 2007/09/29 18:15:31 rahrenbe Exp $
* $Id: config.c,v 1.11 2007/09/30 21:38:31 rahrenbe Exp $
*/
#include "common.h"
@ -14,6 +14,8 @@ cIptvConfig IptvConfig;
cIptvConfig::cIptvConfig(void)
: readBufferTsCount(48),
tsBufferSize(2),
tsBufferPrefillRatio(0)
tsBufferPrefillRatio(0),
sectionFiltering(1),
sidScanning(1)
{
}

View File

@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
* $Id: config.h,v 1.8 2007/09/29 18:15:31 rahrenbe Exp $
* $Id: config.h,v 1.9 2007/09/30 21:38:31 rahrenbe Exp $
*/
#ifndef __IPTV_CONFIG_H
@ -18,14 +18,20 @@ protected:
unsigned int readBufferTsCount;
unsigned int tsBufferSize;
unsigned int tsBufferPrefillRatio;
unsigned int sectionFiltering;
unsigned int sidScanning;
public:
cIptvConfig();
unsigned int GetReadBufferTsCount(void) { return readBufferTsCount; }
unsigned int GetTsBufferSize(void) { return tsBufferSize; }
unsigned int GetTsBufferPrefillRatio(void) { return tsBufferPrefillRatio; }
unsigned int GetSectionFiltering(void) { return sectionFiltering; }
unsigned int GetSidScanning(void) { return sidScanning; }
void SetTsBufferSize(unsigned int Size) { tsBufferSize = Size; }
void SetTsBufferPrefillRatio(unsigned int Ratio) { tsBufferPrefillRatio = Ratio; }
void SetSectionFiltering(unsigned int On) { sectionFiltering = On; }
void SetSidScanning(unsigned int On) { sidScanning = On; }
};
extern cIptvConfig IptvConfig;

View File

@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
* $Id: device.c,v 1.47 2007/09/30 17:32:43 ajhseppa Exp $
* $Id: device.c,v 1.48 2007/09/30 21:38:31 rahrenbe Exp $
*/
#include "common.h"
@ -152,7 +152,7 @@ bool cIptvDevice::SetChannelDevice(const cChannel *Channel, bool LiveView)
return false;
}
pIptvStreamer->Set(addr, port, protocol);
if (sidFinder && (Setup.UpdateChannels >= 2))
if (sidFinder && IptvConfig.GetSidScanning())
sidFinder->SetChannel(Channel);
return true;
}
@ -192,6 +192,10 @@ bool cIptvDevice::IsBlackListed(u_short Pid, u_char Tid, u_char Mask)
int cIptvDevice::OpenFilter(u_short Pid, u_char Tid, u_char Mask)
{
// Check if disabled by user
if (!IptvConfig.GetSectionFiltering())
return -1;
// Black-listing check, refuse certain filters
if (IsBlackListed(Pid, Tid, Mask))
return -1;
@ -228,7 +232,7 @@ bool cIptvDevice::OpenDvr(void)
mutex.Unlock();
ResetBuffering();
pIptvStreamer->Open();
if (sidFinder && (Setup.UpdateChannels >= 4))
if (sidFinder && IptvConfig.GetSidScanning())
sidFinder->SetStatus(true);
isOpenDvr = true;
return true;
@ -237,7 +241,7 @@ bool cIptvDevice::OpenDvr(void)
void cIptvDevice::CloseDvr(void)
{
debug("cIptvDevice::CloseDvr(%d)\n", deviceIndex);
if (sidFinder && (Setup.UpdateChannels >= 4))
if (sidFinder && IptvConfig.GetSidScanning())
sidFinder->SetStatus(false);
pIptvStreamer->Close();
isOpenDvr = false;

6
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.8 2007/09/29 18:15:31 rahrenbe Exp $
* $Id: iptv.c,v 1.9 2007/09/30 21:38:31 rahrenbe Exp $
*/
#include <getopt.h>
@ -158,6 +158,10 @@ bool cPluginIptv::SetupParse(const char *Name, const char *Value)
IptvConfig.SetTsBufferSize(atoi(Value));
else if (!strcasecmp(Name, "TsBufferPrefill"))
IptvConfig.SetTsBufferPrefillRatio(atoi(Value));
else if (!strcasecmp(Name, "SectionFiltering"))
IptvConfig.SetSectionFiltering(atoi(Value));
else if (!strcasecmp(Name, "SidScanning"))
IptvConfig.SetSidScanning(atoi(Value));
else
return false;
return true;

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: VDR 1.5.7\n"
"Report-Msgid-Bugs-To: Rolf Ahrenberg\n"
"POT-Creation-Date: 2007-09-29 21:11+0300\n"
"POT-Creation-Date: 2007-10-01 00:37+0300\n"
"PO-Revision-Date: 2007-08-12 23:22+0300\n"
"Last-Translator: Rolf Ahrenberg\n"
"Language-Team: <vdr@linuxtv.org>\n"
@ -47,14 +47,26 @@ msgstr "Osoite"
msgid "Port"
msgstr "Portti"
#: setup.c:298
#: setup.c:259
msgid "Cannot find unique channel settings!"
msgstr "Yksilöllisiä kanava-asetuksia ei löydetä!"
#: setup.c:333
msgid "IPTV Channels"
msgstr "IPTV-kanavat"
#: setup.c:441
#: setup.c:478
msgid "TS buffer size [MB]"
msgstr "TS-puskurin koko [MB]"
#: setup.c:442
#: setup.c:479
msgid "TS buffer prefill ratio [%]"
msgstr "TS-puskurin esitäyttöaste [%]"
#: setup.c:480
msgid "Use section filtering"
msgstr "Käytä sektioiden suodatusta"
#: setup.c:482
msgid "Scan Sid automatically"
msgstr "Etsi palvelu-ID automaattisesti"

47
setup.c
View File

@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
* $Id: setup.c,v 1.15 2007/09/30 17:34:13 ajhseppa Exp $
* $Id: setup.c,v 1.16 2007/09/30 21:38:31 rahrenbe Exp $
*/
#include <string.h>
@ -204,22 +204,17 @@ eOSState cIptvMenuEditChannel::ProcessKey(eKeys Key)
if (Key == kOk) {
cChannel newchannel;
SetChannelData(&newchannel);
bool uniquityFailed = false;
// Search for identical channels as these will be ignored by vdr
for (cChannel *iteratorChannel = Channels.First(); iteratorChannel;
iteratorChannel = Channels.Next(iteratorChannel)) {
// This is one of the channels cause the uniquity check to fail
if (!iteratorChannel->GroupSep() && iteratorChannel != channel
&& iteratorChannel->GetChannelID() == newchannel.GetChannelID()) {
// See if it has unique Plugin param. If yes then increment
// the corresponding Rid until it is unique
if (strcmp(iteratorChannel->PluginParam(),
newchannel.PluginParam())) {
// If the channel RID is already at maximum, then fail the
// channel modification
if (iteratorChannel->Rid() >= 8192) {
@ -227,26 +222,23 @@ eOSState cIptvMenuEditChannel::ProcessKey(eKeys Key)
uniquityFailed = true;
break;
}
debug("Incrementing conflicting channel RID\n");
iteratorChannel->SetId(iteratorChannel->Nid(),
iteratorChannel->Tid(),
iteratorChannel->Sid(),
iteratorChannel->Rid() + 1);
// Re-set the search and start again
iteratorChannel = Channels.First();
continue;
// Cannot work around by incrementing rid because channels
// are actually copies of each other
} else {
uniquityFailed = true;
break;
}
// Re-set the search and start again
iteratorChannel = Channels.First();
continue;
// Cannot work around by incrementing rid because channels
// are actually copies of each other
}
else {
uniquityFailed = true;
break;
}
}
}
}
if (!uniquityFailed) {
if (channel) {
SetChannelData(channel);
@ -264,7 +256,7 @@ eOSState cIptvMenuEditChannel::ProcessKey(eKeys Key)
Channels.SetModified(true);
}
else {
Skins.Message(mtError, trVDR("Cannot find unique channel settings!"));
Skins.Message(mtError, tr("Cannot find unique channel settings!"));
state = osContinue;
}
}
@ -473,6 +465,8 @@ cIptvPluginSetup::cIptvPluginSetup()
{
tsBufferSize = IptvConfig.GetTsBufferSize();
tsBufferPrefill = IptvConfig.GetTsBufferPrefillRatio();
sectionFiltering = IptvConfig.GetSectionFiltering();
sidScanning = IptvConfig.GetSidScanning();
Setup();
SetHelp(trVDR("Channels"), NULL, NULL, NULL);
}
@ -481,8 +475,11 @@ void cIptvPluginSetup::Setup(void)
{
int current = Current();
Clear();
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 size [MB]"), &tsBufferSize, 2, 16));
Add(new cMenuEditIntItem( tr("TS buffer prefill ratio [%]"), &tsBufferPrefill, 0, 40));
Add(new cMenuEditBoolItem(tr("Use section filtering"), &sectionFiltering));
if (sectionFiltering)
Add(new cMenuEditBoolItem(tr("Scan Sid automatically"), &sidScanning));
SetCurrent(Get(current));
Display();
}
@ -511,8 +508,12 @@ void cIptvPluginSetup::Store(void)
// Store values into setup.conf
SetupStore("TsBufferSize", tsBufferSize);
SetupStore("TsBufferPrefill", tsBufferPrefill);
SetupStore("SectionFiltering", sectionFiltering);
SetupStore("SidScanning", sidScanning);
// Update global config
IptvConfig.SetTsBufferSize(tsBufferSize);
IptvConfig.SetTsBufferPrefillRatio(tsBufferPrefill);
IptvConfig.SetSectionFiltering(sectionFiltering);
IptvConfig.SetSidScanning(sidScanning);
}

View File

@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
* $Id: setup.h,v 1.8 2007/09/29 18:15:31 rahrenbe Exp $
* $Id: setup.h,v 1.9 2007/09/30 21:38:31 rahrenbe Exp $
*/
#ifndef __IPTV_SETUP_H
@ -16,6 +16,8 @@ class cIptvPluginSetup : public cMenuSetupPage
private:
int tsBufferSize;
int tsBufferPrefill;
int sectionFiltering;
int sidScanning;
eOSState EditChannel(void);
virtual void Setup(void);