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. * 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" #include "common.h"
@ -14,6 +14,8 @@ cIptvConfig IptvConfig;
cIptvConfig::cIptvConfig(void) cIptvConfig::cIptvConfig(void)
: readBufferTsCount(48), : readBufferTsCount(48),
tsBufferSize(2), 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. * 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 #ifndef __IPTV_CONFIG_H
@ -18,14 +18,20 @@ protected:
unsigned int readBufferTsCount; unsigned int readBufferTsCount;
unsigned int tsBufferSize; unsigned int tsBufferSize;
unsigned int tsBufferPrefillRatio; unsigned int tsBufferPrefillRatio;
unsigned int sectionFiltering;
unsigned int sidScanning;
public: public:
cIptvConfig(); cIptvConfig();
unsigned int GetReadBufferTsCount(void) { return readBufferTsCount; } unsigned int GetReadBufferTsCount(void) { return readBufferTsCount; }
unsigned int GetTsBufferSize(void) { return tsBufferSize; } unsigned int GetTsBufferSize(void) { return tsBufferSize; }
unsigned int GetTsBufferPrefillRatio(void) { return tsBufferPrefillRatio; } 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 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 SetSidScanning(unsigned int On) { sidScanning = On; }
}; };
extern cIptvConfig IptvConfig; extern cIptvConfig IptvConfig;

View File

@ -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.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" #include "common.h"
@ -152,7 +152,7 @@ bool cIptvDevice::SetChannelDevice(const cChannel *Channel, bool LiveView)
return false; return false;
} }
pIptvStreamer->Set(addr, port, protocol); pIptvStreamer->Set(addr, port, protocol);
if (sidFinder && (Setup.UpdateChannels >= 2)) if (sidFinder && IptvConfig.GetSidScanning())
sidFinder->SetChannel(Channel); sidFinder->SetChannel(Channel);
return true; 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) 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 // Black-listing check, refuse certain filters
if (IsBlackListed(Pid, Tid, Mask)) if (IsBlackListed(Pid, Tid, Mask))
return -1; return -1;
@ -228,7 +232,7 @@ bool cIptvDevice::OpenDvr(void)
mutex.Unlock(); mutex.Unlock();
ResetBuffering(); ResetBuffering();
pIptvStreamer->Open(); pIptvStreamer->Open();
if (sidFinder && (Setup.UpdateChannels >= 4)) if (sidFinder && IptvConfig.GetSidScanning())
sidFinder->SetStatus(true); sidFinder->SetStatus(true);
isOpenDvr = true; isOpenDvr = true;
return true; return true;
@ -237,7 +241,7 @@ bool cIptvDevice::OpenDvr(void)
void cIptvDevice::CloseDvr(void) void cIptvDevice::CloseDvr(void)
{ {
debug("cIptvDevice::CloseDvr(%d)\n", deviceIndex); debug("cIptvDevice::CloseDvr(%d)\n", deviceIndex);
if (sidFinder && (Setup.UpdateChannels >= 4)) if (sidFinder && IptvConfig.GetSidScanning())
sidFinder->SetStatus(false); sidFinder->SetStatus(false);
pIptvStreamer->Close(); pIptvStreamer->Close();
isOpenDvr = false; isOpenDvr = false;

6
iptv.c
View File

@ -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.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> #include <getopt.h>
@ -158,6 +158,10 @@ bool cPluginIptv::SetupParse(const char *Name, const char *Value)
IptvConfig.SetTsBufferSize(atoi(Value)); IptvConfig.SetTsBufferSize(atoi(Value));
else if (!strcasecmp(Name, "TsBufferPrefill")) else if (!strcasecmp(Name, "TsBufferPrefill"))
IptvConfig.SetTsBufferPrefillRatio(atoi(Value)); IptvConfig.SetTsBufferPrefillRatio(atoi(Value));
else if (!strcasecmp(Name, "SectionFiltering"))
IptvConfig.SetSectionFiltering(atoi(Value));
else if (!strcasecmp(Name, "SidScanning"))
IptvConfig.SetSidScanning(atoi(Value));
else else
return false; return false;
return true; return true;

View File

@ -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-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" "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"
@ -47,14 +47,26 @@ msgstr "Osoite"
msgid "Port" msgid "Port"
msgstr "Portti" 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" msgid "IPTV Channels"
msgstr "IPTV-kanavat" msgstr "IPTV-kanavat"
#: setup.c:441 #: setup.c:478
msgid "TS buffer size [MB]" msgid "TS buffer size [MB]"
msgstr "TS-puskurin koko [MB]" msgstr "TS-puskurin koko [MB]"
#: setup.c:442 #: setup.c:479
msgid "TS buffer prefill ratio [%]" msgid "TS buffer prefill ratio [%]"
msgstr "TS-puskurin esitäyttöaste [%]" 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"

25
setup.c
View File

@ -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.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> #include <string.h>
@ -204,22 +204,17 @@ eOSState cIptvMenuEditChannel::ProcessKey(eKeys Key)
if (Key == kOk) { if (Key == kOk) {
cChannel newchannel; cChannel newchannel;
SetChannelData(&newchannel); SetChannelData(&newchannel);
bool uniquityFailed = false; bool uniquityFailed = false;
// Search for identical channels as these will be ignored by vdr // Search for identical channels as these will be ignored by vdr
for (cChannel *iteratorChannel = Channels.First(); iteratorChannel; for (cChannel *iteratorChannel = Channels.First(); iteratorChannel;
iteratorChannel = Channels.Next(iteratorChannel)) { iteratorChannel = Channels.Next(iteratorChannel)) {
// This is one of the channels cause the uniquity check to fail // This is one of the channels cause the uniquity check to fail
if (!iteratorChannel->GroupSep() && iteratorChannel != channel if (!iteratorChannel->GroupSep() && iteratorChannel != channel
&& iteratorChannel->GetChannelID() == newchannel.GetChannelID()) { && iteratorChannel->GetChannelID() == newchannel.GetChannelID()) {
// See if it has unique Plugin param. If yes then increment // See if it has unique Plugin param. If yes then increment
// the corresponding Rid until it is unique // the corresponding Rid until it is unique
if (strcmp(iteratorChannel->PluginParam(), if (strcmp(iteratorChannel->PluginParam(),
newchannel.PluginParam())) { newchannel.PluginParam())) {
// If the channel RID is already at maximum, then fail the // If the channel RID is already at maximum, then fail the
// channel modification // channel modification
if (iteratorChannel->Rid() >= 8192) { if (iteratorChannel->Rid() >= 8192) {
@ -227,26 +222,23 @@ eOSState cIptvMenuEditChannel::ProcessKey(eKeys Key)
uniquityFailed = true; uniquityFailed = true;
break; break;
} }
debug("Incrementing conflicting channel RID\n"); debug("Incrementing conflicting channel RID\n");
iteratorChannel->SetId(iteratorChannel->Nid(), iteratorChannel->SetId(iteratorChannel->Nid(),
iteratorChannel->Tid(), iteratorChannel->Tid(),
iteratorChannel->Sid(), iteratorChannel->Sid(),
iteratorChannel->Rid() + 1); iteratorChannel->Rid() + 1);
// Re-set the search and start again // Re-set the search and start again
iteratorChannel = Channels.First(); iteratorChannel = Channels.First();
continue; continue;
// Cannot work around by incrementing rid because channels // Cannot work around by incrementing rid because channels
// are actually copies of each other // are actually copies of each other
} else { }
else {
uniquityFailed = true; uniquityFailed = true;
break; break;
} }
} }
} }
if (!uniquityFailed) { if (!uniquityFailed) {
if (channel) { if (channel) {
SetChannelData(channel); SetChannelData(channel);
@ -264,7 +256,7 @@ eOSState cIptvMenuEditChannel::ProcessKey(eKeys Key)
Channels.SetModified(true); Channels.SetModified(true);
} }
else { else {
Skins.Message(mtError, trVDR("Cannot find unique channel settings!")); Skins.Message(mtError, tr("Cannot find unique channel settings!"));
state = osContinue; state = osContinue;
} }
} }
@ -473,6 +465,8 @@ cIptvPluginSetup::cIptvPluginSetup()
{ {
tsBufferSize = IptvConfig.GetTsBufferSize(); tsBufferSize = IptvConfig.GetTsBufferSize();
tsBufferPrefill = IptvConfig.GetTsBufferPrefillRatio(); tsBufferPrefill = IptvConfig.GetTsBufferPrefillRatio();
sectionFiltering = IptvConfig.GetSectionFiltering();
sidScanning = IptvConfig.GetSidScanning();
Setup(); Setup();
SetHelp(trVDR("Channels"), NULL, NULL, NULL); SetHelp(trVDR("Channels"), NULL, NULL, NULL);
} }
@ -483,6 +477,9 @@ void cIptvPluginSetup::Setup(void)
Clear(); Clear();
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"), &sectionFiltering));
if (sectionFiltering)
Add(new cMenuEditBoolItem(tr("Scan Sid automatically"), &sidScanning));
SetCurrent(Get(current)); SetCurrent(Get(current));
Display(); Display();
} }
@ -511,8 +508,12 @@ void cIptvPluginSetup::Store(void)
// Store values into setup.conf // Store values into setup.conf
SetupStore("TsBufferSize", tsBufferSize); SetupStore("TsBufferSize", tsBufferSize);
SetupStore("TsBufferPrefill", tsBufferPrefill); SetupStore("TsBufferPrefill", tsBufferPrefill);
SetupStore("SectionFiltering", sectionFiltering);
SetupStore("SidScanning", sidScanning);
// Update global config // Update global config
IptvConfig.SetTsBufferSize(tsBufferSize); IptvConfig.SetTsBufferSize(tsBufferSize);
IptvConfig.SetTsBufferPrefillRatio(tsBufferPrefill); 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. * 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 #ifndef __IPTV_SETUP_H
@ -16,6 +16,8 @@ class cIptvPluginSetup : public cMenuSetupPage
private: private:
int tsBufferSize; int tsBufferSize;
int tsBufferPrefill; int tsBufferPrefill;
int sectionFiltering;
int sidScanning;
eOSState EditChannel(void); eOSState EditChannel(void);
virtual void Setup(void); virtual void Setup(void);