1
0
mirror of https://github.com/rofafor/vdr-plugin-satip.git synced 2023-10-10 11:37:42 +00:00

13 Commits

Author SHA1 Message Date
Rolf Ahrenberg
acea8748a4 Added SATIP_XCI variable for enabling CI support. 2015-01-10 18:30:07 +02:00
Rolf Ahrenberg
755f1049bb Reduced tuner sleep timeout to get better performance for pid updates. 2015-01-10 14:14:30 +02:00
Rolf Ahrenberg
2f6315280f Tweaked setting the pid update cache timer. 2015-01-09 19:56:43 +02:00
Rolf Ahrenberg
695dd53bfc Added initial support for x_ci parameter. 2015-01-09 16:38:02 +02:00
Rolf Ahrenberg
5fef77518e Changed the PMT debugging into a separate trace mode. 2015-01-09 02:06:20 +02:00
Rolf Ahrenberg
791767f02b Documented CI extension parameters. 2015-01-07 17:45:48 +02:00
Rolf Ahrenberg
0d52649dbd Added the missing translation item. 2015-01-06 21:41:52 +02:00
Rolf Ahrenberg
0c03c1b8d4 Added a CI extension item into the device info menu. 2015-01-06 19:46:56 +02:00
Rolf Ahrenberg
db59aa9c29 Added support for Digital Devices CI extension. 2015-01-06 15:53:31 +02:00
Rolf Ahrenberg
0fd559ce79 Added a fallback for older glibc libraries. 2015-01-05 20:24:45 +02:00
Rolf Ahrenberg
e10ce57210 Removed the unnecessary config directory definition. 2015-01-05 20:15:04 +02:00
Rolf Ahrenberg
c7f4b265d5 Fixed the server teardown. 2015-01-05 20:12:15 +02:00
Rolf Ahrenberg
35c0f25c38 Updated the command-line help and README. 2015-01-05 20:09:45 +02:00
22 changed files with 190 additions and 36 deletions

View File

@@ -88,3 +88,12 @@ VDR Plugin 'satip' Revision History
- Added plenty of performance tweaks (Thanks to
Stefan Schallenberg).
- Fixed EIT scan (Thanks to Stefan Schallenberg).
2015-01-10: Version 1.0.1
- Updated the command-line help and README.
- Fixed the server teardown.
- Removed the unnecessary config directory definition.
- Added a fallback for older glibc libraries.
- Improved pid selection performance.
- Added support for Digital Devices CI extension.

View File

@@ -10,6 +10,10 @@
#SATIP_USE_TINYXML = 1
# Enable CI extension - requires VDR API implementing GetPmt(int, int, int)
#SATIP_XCI = 1
# Strip debug symbols? Set eg. to /bin/true if not
STRIP = strip
@@ -76,8 +80,16 @@ LIBS += -lpugixml
endif
ifdef SATIP_DEBUG
ifeq ($(SATIP_DEBUG),1)
DEFINES += -DDEBUG
endif
endif
ifdef SATIP_XCI
ifeq ($(SATIP_XCI),1)
DEFINES += -DXCI
endif
endif
ifneq ($(strip $(GITTAG)),)
DEFINES += -DGITVERSION='"-GIT-$(GITTAG)"'

19
README
View File

@@ -23,6 +23,9 @@ Requirements:
TinyXML - a simple, small, C++ XML parser
http://www.grinninglizard.com/tinyxml/
- Glibc >= 2.12 - the GNU C library (recvmmsg)
http://www.gnu.org/software/libc/
- VDR >= 2.1.4 for scrambled channels
Description:
@@ -63,8 +66,14 @@ S19.2E 3 Astra 1KR/1L/1M/2C
=> Signal source = 3
A channel can be assigned into a specific SAT>IP frontend by giving the
identifier number in RID field of a channels.conf entry.
Valid range: 1 ... 8
identifier number in RID field of a channels.conf entry:
FE = RID % 100
Valid range: 1 ... 99
A channel can be assigned into a specific integrated CI slot by giving
the identifier number in RID field of a channels.conf entry:
CI# = (RID / 100) % 10
Valid range: 1 ... 9
Setup menu:
@@ -76,6 +85,10 @@ Setup menu:
option to "low". Similarly, the "high"
value prefers the SAT>IP over the local
DVB cards when selecting available devices.
- Use CI extension = no If you want to use the CI extension found
in some SAT>IP hardware (e.g. Digital
Devices OctopusNet), set this option to
"yes".
- Enable EPG scanning = yes If you want exclude all SAT>IP devices
from VDR's EIT background scanning, set
this option to "no".
@@ -119,6 +132,8 @@ Notes:
- Tracing can be set on/off dynamically via command-line switch or
SVDRP command.
- OctopusNet firmware 1.0.40 or greater recommended.
Acknowledgements:
- Big thanks to Digital Devices GmbH for providing the Octopus Net

View File

@@ -14,6 +14,7 @@ cSatipConfig SatipConfig;
cSatipConfig::cSatipConfig(void)
: operatingModeM(eOperatingModeLow),
traceModeM(eTraceModeNormal),
ciExtensionM(0),
eitScanM(1),
useBytesM(1)
{
@@ -21,7 +22,6 @@ cSatipConfig::cSatipConfig(void)
disabledSourcesM[i] = cSource::stNone;
for (unsigned int i = 0; i < ARRAY_SIZE(disabledFiltersM); ++i)
disabledFiltersM[i] = -1;
memset(configDirectoryM, 0, sizeof(configDirectoryM));
}
unsigned int cSatipConfig::GetDisabledSourcesCount(void) const
@@ -61,9 +61,3 @@ void cSatipConfig::SetDisabledFilters(unsigned int indexP, int numberP)
if (indexP < ARRAY_SIZE(disabledFiltersM))
disabledFiltersM[indexP] = numberP;
}
void cSatipConfig::SetConfigDirectory(const char *directoryP)
{
debug1("%s (%s)", __PRETTY_FUNCTION__, directoryP);
ERROR_IF(!realpath(directoryP, configDirectoryM), "Cannot canonicalize configuration directory");
}

View File

@@ -16,11 +16,11 @@ class cSatipConfig
private:
unsigned int operatingModeM;
unsigned int traceModeM;
unsigned int ciExtensionM;
unsigned int eitScanM;
unsigned int useBytesM;
int disabledSourcesM[MAX_DISABLED_SOURCES_COUNT];
int disabledFiltersM[SECTION_FILTER_TABLE_SIZE];
char configDirectoryM[PATH_MAX];
public:
enum eOperatingMode {
@@ -59,9 +59,9 @@ public:
void ToggleOperatingMode(void) { operatingModeM = (operatingModeM + 1) % eOperatingModeCount; }
unsigned int GetTraceMode(void) const { return traceModeM; }
bool IsTraceMode(eTraceMode modeP) const { return (traceModeM & modeP); }
unsigned int GetCIExtension(void) const { return ciExtensionM; }
unsigned int GetEITScan(void) const { return eitScanM; }
unsigned int GetUseBytes(void) const { return useBytesM; }
const char *GetConfigDirectory(void) const { return configDirectoryM; }
unsigned int GetDisabledSourcesCount(void) const;
int GetDisabledSources(unsigned int indexP) const;
unsigned int GetDisabledFiltersCount(void) const;
@@ -69,9 +69,9 @@ public:
void SetOperatingMode(unsigned int operatingModeP) { operatingModeM = operatingModeP; }
void SetTraceMode(unsigned int modeP) { traceModeM = (modeP & eTraceModeMask); }
void SetCIExtension(unsigned int onOffP) { ciExtensionM = onOffP; }
void SetEITScan(unsigned int onOffP) { eitScanM = onOffP; }
void SetUseBytes(unsigned int onOffP) { useBytesM = onOffP; }
void SetConfigDirectory(const char *directoryP);
void SetDisabledSources(unsigned int indexP, int sourceP);
void SetDisabledFilters(unsigned int indexP, int numberP);
};

View File

@@ -331,8 +331,8 @@ bool cSatipDevice::SetChannelDevice(const cChannel *channelP, bool liveViewP)
}
cSatipDiscover::GetInstance()->SetTransponder(server, channelP->Transponder());
if (pTunerM && pTunerM->SetSource(server, *params, deviceIndexM)) {
deviceNameM = cString::sprintf("%s %d %s", *DeviceType(), deviceIndexM, *cSatipDiscover::GetInstance()->GetServerString(server));
channelM = *channelP;
deviceNameM = cString::sprintf("%s %d %s", *DeviceType(), deviceIndexM, *cSatipDiscover::GetInstance()->GetServerString(server));
return true;
}
}
@@ -406,7 +406,7 @@ bool cSatipDevice::HasLock(int timeoutMsP) const
bool cSatipDevice::HasInternalCam(void)
{
debug16("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
return false;
return SatipConfig.GetCIExtension();
}
void cSatipDevice::WriteData(uchar *bufferP, int lengthP)
@@ -428,6 +428,23 @@ int cSatipDevice::GetId(void)
return deviceIndexM;
}
int cSatipDevice::GetPmtPid(void)
{
int pid = 0;
#ifdef XCI
pid = channelM.Ca() ? ::GetPmtPid(channelM.Source(), channelM.Transponder(), channelM.Sid()) : 0;
#endif
debug11("%s pmtpid=%d source=%c transponder=%d sid=%d name=%s [device %u]", __PRETTY_FUNCTION__, pid, cSource::ToChar(channelM.Source()), channelM.Transponder(), channelM.Sid(), channelM.Name(), deviceIndexM);
return pid;
}
int cSatipDevice::GetCISlot(void)
{
int slot = channelM.Ca() ? (channelM.Rid() / 100) % 10 : 0;
debug11("%s slot=%d name=%s [device %u]", __PRETTY_FUNCTION__, slot, channelM.Name(), deviceIndexM);
return slot;
}
uchar *cSatipDevice::GetData(int *availableP)
{
debug16("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);

View File

@@ -108,6 +108,8 @@ public:
public:
virtual void WriteData(u_char *bufferP, int lengthP);
virtual int GetId(void);
virtual int GetPmtPid(void);
virtual int GetCISlot(void);
};
#endif // __SATIP_DEVICE_H

View File

@@ -14,6 +14,8 @@ public:
virtual ~cSatipDeviceIf() {}
virtual void WriteData(u_char *bufferP, int lengthP) = 0;
virtual int GetId(void) = 0;
virtual int GetPmtPid(void) = 0;
virtual int GetCISlot(void) = 0;
private:
cSatipDeviceIf(const cSatipDeviceIf&);

2
log.h
View File

@@ -32,7 +32,7 @@
#define debug9(x...) void( SatipConfig.IsTraceMode(cSatipConfig::eTraceModeDebug9) ? dsyslog("SATIP9: " x) : void() )
// 0x0200: RTCP packets
#define debug10(x...) void( SatipConfig.IsTraceMode(cSatipConfig::eTraceModeDebug10) ? dsyslog("SATIP10: " x) : void() )
// 0x0400: TBD
// 0x0400: CI
#define debug11(x...) void( SatipConfig.IsTraceMode(cSatipConfig::eTraceModeDebug11) ? dsyslog("SATIP11: " x) : void() )
// 0x0800: TBD
#define debug12(x...) void( SatipConfig.IsTraceMode(cSatipConfig::eTraceModeDebug12) ? dsyslog("SATIP12: " x) : void() )

View File

@@ -191,8 +191,8 @@ cString GetTransponderUrlParameters(const cChannel *channelP)
ST("C *") q += PrintUrlString(q, STBUFLEFT, dtp.System(), SatipSystemValuesCable);
ST(" T*") q += PrintUrlString(q, STBUFLEFT, dtp.System(), SatipSystemValuesTerrestrial);
ST(" T*") q += PrintUrlString(q, STBUFLEFT, dtp.Transmission(), SatipTransmissionValues);
if (channelP->Rid() > 0)
q += snprintf(q, STBUFLEFT, "&fe=%d", channelP->Rid());
if ((channelP->Rid() % 100) > 0)
q += snprintf(q, STBUFLEFT, "&fe=%d", channelP->Rid() % 100);
#undef ST
return buffer;
}

View File

@@ -5,10 +5,10 @@
#
msgid ""
msgstr ""
"Project-Id-Version: vdr-satip 1.0.0\n"
"Project-Id-Version: vdr-satip 1.0.1\n"
"Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2014-12-24 12:24+0200\n"
"PO-Revision-Date: 2014-12-24 12:24+0200\n"
"POT-Creation-Date: 2015-01-10 01:10+0200\n"
"PO-Revision-Date: 2015-01-10 01:10+0200\n"
"Last-Translator: Gabriel Bonich <gbonich@gmail.com>\n"
"Language-Team: Catalan <vdr@linuxtv.org>\n"
"Language: ca\n"
@@ -49,6 +49,9 @@ msgstr "Model"
msgid "Description"
msgstr "Descripció"
msgid "CI extension"
msgstr ""
msgid "Creation date"
msgstr "Creació de data"
@@ -103,6 +106,15 @@ msgstr ""
"Normal - Dispositius treballan en parametres normals\n"
"Alta - Dispositius treballan a prioritat Alta"
msgid "Enable CI extension"
msgstr ""
msgid ""
"Define whether a CI extension shall be used.\n"
"\n"
"This setting enables integrated CI/CAM handling found in some SAT>IP hardware (e.g. Digital Devices OctopusNet)."
msgstr ""
msgid "Enable EPG scanning"
msgstr "Activa Escanneig EPG"

View File

@@ -5,10 +5,10 @@
#
msgid ""
msgstr ""
"Project-Id-Version: vdr-satip 1.0.0\n"
"Project-Id-Version: vdr-satip 1.0.1\n"
"Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2014-12-24 12:24+0200\n"
"PO-Revision-Date: 2014-12-24 12:24+0200\n"
"POT-Creation-Date: 2015-01-10 01:10+0200\n"
"PO-Revision-Date: 2015-01-10 01:10+0200\n"
"Last-Translator: Frank Neumann <fnu@yavdr.org>\n"
"Language-Team: German <vdr@linuxtv.org>\n"
"Language: de\n"
@@ -49,6 +49,9 @@ msgstr "Modell"
msgid "Description"
msgstr "Beschreibung"
msgid "CI extension"
msgstr "CI Erweiterung"
msgid "Creation date"
msgstr "Zeitpunkt der Erstellung"
@@ -83,7 +86,7 @@ msgid "high"
msgstr "hoch"
msgid "Button$Devices"
msgstr ""
msgstr "Geräte"
msgid "Operating mode"
msgstr "Betriebsmodus"
@@ -103,6 +106,18 @@ msgstr ""
"normal - Geräte arbeiten innerhalb der gewöhnlichen Parameter\n"
"hoch - Geräte arbeiten mit höchste Priorität"
msgid "Enable CI extension"
msgstr "Aktiviere CI Erweiterung"
msgid ""
"Define whether a CI extension shall be used.\n"
"\n"
"This setting enables integrated CI/CAM handling found in some SAT>IP hardware (e.g. Digital Devices OctopusNet)."
msgstr ""
"Legt fest ob eine CI Erweiterung genutzt werden soll.\n"
"\n"
"Diese Einstellung aktiviert die Nutzung des integrierten CI/CAM einiger SAT>IP Geräte (z.B. Digital Devices OctopusNet)."
msgid "Enable EPG scanning"
msgstr "Aktiviere EPG Aktualisierung"

View File

@@ -5,10 +5,10 @@
#
msgid ""
msgstr ""
"Project-Id-Version: vdr-satip 1.0.0\n"
"Project-Id-Version: vdr-satip 1.0.1\n"
"Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2014-12-24 12:24+0200\n"
"PO-Revision-Date: 2014-12-24 12:24+0200\n"
"POT-Creation-Date: 2015-01-10 01:10+0200\n"
"PO-Revision-Date: 2015-01-10 01:10+0200\n"
"Last-Translator: Gabriel Bonich <gbonich@gmail.com>\n"
"Language-Team: Spanish <vdr@linuxtv.org>\n"
"Language: es\n"
@@ -49,6 +49,9 @@ msgstr "Modelo"
msgid "Description"
msgstr "Descripción"
msgid "CI extension"
msgstr ""
msgid "Creation date"
msgstr "Fecha creación"
@@ -103,6 +106,15 @@ msgstr ""
"Normal - Dispositivos trabajando con prioridad Normal\n"
"Alta - Dispositivos trabajando con prioridad Alta"
msgid "Enable CI extension"
msgstr ""
msgid ""
"Define whether a CI extension shall be used.\n"
"\n"
"This setting enables integrated CI/CAM handling found in some SAT>IP hardware (e.g. Digital Devices OctopusNet)."
msgstr ""
msgid "Enable EPG scanning"
msgstr "Activa Escaneo EPG"

View File

@@ -5,10 +5,10 @@
#
msgid ""
msgstr ""
"Project-Id-Version: vdr-satip 1.0.0\n"
"Project-Id-Version: vdr-satip 1.0.1\n"
"Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2014-12-24 12:24+0200\n"
"PO-Revision-Date: 2014-12-24 12:24+0200\n"
"POT-Creation-Date: 2015-01-10 01:10+0200\n"
"PO-Revision-Date: 2015-01-10 01:10+0200\n"
"Last-Translator: Rolf Ahrenberg\n"
"Language-Team: Finnish <vdr@linuxtv.org>\n"
"Language: fi\n"
@@ -49,6 +49,9 @@ msgstr "Malli"
msgid "Description"
msgstr "Kuvaus"
msgid "CI extension"
msgstr "CI-laajennos"
msgid "Creation date"
msgstr "Luontiajankohta"
@@ -102,6 +105,18 @@ msgstr ""
"normaali - laitteet toimivat normaalilla prioriteetilla\n"
"korkea - laitteet toimivat korkealla prioriteetilla"
msgid "Enable CI extension"
msgstr "Käytä CI-laajennosta"
msgid ""
"Define whether a CI extension shall be used.\n"
"\n"
"This setting enables integrated CI/CAM handling found in some SAT>IP hardware (e.g. Digital Devices OctopusNet)."
msgstr ""
"Määrittele CI-laajennoksen käyttöönotto\n"
"\n"
"Tällä asetuksella saadaan otettua käyttöön SAT>IP-laitteiden sisäinen CI-paikka (esim. Digital Devices OctopusNet)."
msgid "Enable EPG scanning"
msgstr "Käytä ohjelmaoppaan taustapäivitystä"

View File

@@ -27,7 +27,7 @@
#define GITVERSION ""
#endif
const char VERSION[] = "1.0.0" GITVERSION;
const char VERSION[] = "1.0.1" GITVERSION;
static const char DESCRIPTION[] = trNOOP("SAT>IP Devices");
class cPluginSatip : public cPlugin {
@@ -81,6 +81,7 @@ const char *cPluginSatip::CommandLineHelp(void)
debug1("%s", __PRETTY_FUNCTION__);
// Return a string that describes all known command line options.
return " -d <num>, --devices=<number> set number of devices to be created\n"
" -t <mode>, --trace=<mode> set the tracing mode\n"
" -s <ipaddr>|<model>|<desc>, --server=<ipaddr1>|<model1>|<desc1>;<ipaddr2>|<model2>|<desc2>\n"
" define hard-coded SAT>IP server(s)\n";
}
@@ -121,7 +122,6 @@ bool cPluginSatip::Initialize(void)
// Initialize any background activities the plugin shall perform.
if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK)
error("Unable to initialize CURL");
SatipConfig.SetConfigDirectory(cPlugin::ResourceDirectory(PLUGIN_NAME_I18N));
cSatipPoller::GetInstance()->Initialize();
cSatipDiscover::GetInstance()->Initialize(serversM);
return cSatipDevice::Initialize(deviceCountM);
@@ -274,6 +274,8 @@ bool cPluginSatip::SetupParse(const char *nameP, const char *valueP)
// Parse your own setup parameters and store their values.
if (!strcasecmp(nameP, "OperatingMode"))
SatipConfig.SetOperatingMode(atoi(valueP));
else if (!strcasecmp(nameP, "EnableCIExtension"))
SatipConfig.SetCIExtension(atoi(valueP));
else if (!strcasecmp(nameP, "EnableEITScan"))
SatipConfig.SetEITScan(atoi(valueP));
else if (!strcasecmp(nameP, "DisabledSources")) {

View File

@@ -45,6 +45,9 @@ cSatipServer::cSatipServer(const char *addressP, const char *modelP, const char
quirkM |= eSatipQuirkForceLock;
if (quirkM != eSatipQuirkNone)
info("Malfunctioning '%s' server detected! Please, fix the firmware.", *descriptionM);
// These devices support the X_PMT protocol extension
if (strstr(*descriptionM, "OctopusNet")) // Digital Devices OctopusNet
quirkM |= eSatipQuirkUseXCI;
}
char *s, *p = strdup(*modelM);
char *r = strtok_r(p, ",", &s);

View File

@@ -37,6 +37,7 @@ public:
eSatipQuirkSessionId = 0x01,
eSatipQuirkPlayPids = 0x02,
eSatipQuirkForceLock = 0x04,
eSatipQuirkUseXCI = 0x08,
eSatipQuirkMask = 0x0F
};
enum eSatipModelType {

10
setup.c
View File

@@ -89,6 +89,7 @@ private:
cString addressM;
cString modelM;
cString descriptionM;
cString ciExtensionM;
uint64_t createdM;
void Setup(void);
@@ -103,6 +104,7 @@ cSatipServerInfo::cSatipServerInfo(cSatipServer *serverP)
addressM(serverP ? serverP->Address() : "---"),
modelM(serverP ? serverP->Model() : "---"),
descriptionM(serverP ? serverP->Description() : "---"),
ciExtensionM(serverP && serverP->Quirk(cSatipServer::eSatipQuirkUseXCI) ? trVDR("yes") : trVDR("no")),
createdM(serverP ? serverP->Created() : 0)
{
SetMenuCategory(mcSetupPlugins);
@@ -119,6 +121,7 @@ void cSatipServerInfo::Setup(void)
Add(new cOsdItem(cString::sprintf("%s:\t%s", tr("Address"), *addressM), osUnknown, false));
Add(new cOsdItem(cString::sprintf("%s:\t%s", tr("Model"), *modelM), osUnknown, false));
Add(new cOsdItem(cString::sprintf("%s:\t%s", tr("Description"), *descriptionM), osUnknown, false));
Add(new cOsdItem(cString::sprintf("%s:\t%s", tr("CI extension"), *ciExtensionM), osUnknown, false));
Add(new cOsdItem(cString::sprintf("%s:\t%s", tr("Creation date"), *DayDateTime(createdM)), osUnknown, false));
}
@@ -329,6 +332,7 @@ eOSState cSatipMenuInfo::ProcessKey(eKeys keyP)
cSatipPluginSetup::cSatipPluginSetup()
: deviceCountM(0),
operatingModeM(SatipConfig.GetOperatingMode()),
ciExtensionM(SatipConfig.GetCIExtension()),
eitScanM(SatipConfig.GetEITScan()),
numDisabledSourcesM(SatipConfig.GetDisabledSourcesCount()),
numDisabledFiltersM(SatipConfig.GetDisabledFiltersCount())
@@ -364,6 +368,10 @@ void cSatipPluginSetup::Setup(void)
helpM.Append(tr("Define the used operating mode for all SAT>IP devices:\n\noff - devices are disabled\nlow - devices are working at the lowest priority\nnormal - devices are working within normal parameters\nhigh - devices are working at the highest priority"));
if (operatingModeM) {
#ifdef XCI
Add(new cMenuEditBoolItem(tr("Enable CI extension"), &ciExtensionM));
helpM.Append(tr("Define whether a CI extension shall be used.\n\nThis setting enables integrated CI/CAM handling found in some SAT>IP hardware (e.g. Digital Devices OctopusNet)."));
#endif
Add(new cMenuEditBoolItem(tr("Enable EPG scanning"), &eitScanM));
helpM.Append(tr("Define whether the EPG background scanning shall be used.\n\nThis setting disables the automatic EIT scanning functionality for all SAT>IP devices."));
@@ -510,11 +518,13 @@ void cSatipPluginSetup::Store(void)
{
// Store values into setup.conf
SetupStore("OperatingMode", operatingModeM);
SetupStore("EnableCIExtension", ciExtensionM);
SetupStore("EnableEITScan", eitScanM);
StoreSources("DisabledSources", disabledSourcesM);
StoreFilters("DisabledFilters", disabledFilterIndexesM);
// Update global config
SatipConfig.SetOperatingMode(operatingModeM);
SatipConfig.SetCIExtension(ciExtensionM);
SatipConfig.SetEITScan(eitScanM);
for (int i = 0; i < MAX_DISABLED_SOURCES_COUNT; ++i)
SatipConfig.SetDisabledSources(i, disabledSourcesM[i]);

View File

@@ -18,6 +18,7 @@ private:
int deviceCountM;
int operatingModeM;
const char *operatingModeTextsM[cSatipConfig::eOperatingModeCount];
int ciExtensionM;
int eitScanM;
int numDisabledSourcesM;
int disabledSourcesM[MAX_DISABLED_SOURCES_COUNT];

View File

@@ -136,6 +136,7 @@ int cSatipSocket::Read(unsigned char *bufferAddrP, unsigned int bufferLenP)
int cSatipSocket::ReadMulti(unsigned char *bufferAddrP, unsigned int *elementRecvSizeP, unsigned int elementCountP, unsigned int elementBufferSizeP)
{
debug16("%s (, , %d, %d)", __PRETTY_FUNCTION__, elementCountP, elementBufferSizeP);
#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2,12)
// Error out if socket not initialized
if (socketDescM <= 0) {
error("%s Invalid socket", __PRETTY_FUNCTION__);
@@ -159,6 +160,17 @@ int cSatipSocket::ReadMulti(unsigned char *bufferAddrP, unsigned int *elementRec
ERROR_IF_RET(count < 0 && errno != EAGAIN && errno != EWOULDBLOCK, "recvmmsg()", return -1);
for (int i = 0; i < count; ++i)
elementRecvSizeP[i] = mmsgh[i].msg_len;
#else
int count = 0;
while (count < (int)elementCountP) {
int len = Read(bufferAddrP + count * elementBufferSizeP, elementBufferSizeP);
if (len < 0)
return -1;
else if (len == 0)
break;
elementRecvSizeP[count++] = len;
}
#endif
debug16("%s Received %d packets size[0]=%d", __PRETTY_FUNCTION__, count, elementRecvSizeP[0]);
return count;

25
tuner.c
View File

@@ -41,6 +41,7 @@ cSatipTuner::cSatipTuner(cSatipDeviceIf &deviceP, unsigned int packetLenP)
signalStrengthM(-1),
signalQualityM(-1),
streamIdM(-1),
pmtPidM(-1),
addPidsM(),
delPidsM(),
pidsM()
@@ -186,8 +187,6 @@ bool cSatipTuner::Connect(void)
// Just retune
if (streamIdM >= 0) {
cString uri = cString::sprintf("%sstream=%d?%s", *connectionUri, streamIdM, *streamParamM);
//if (pidsM.Size())
// uri = cString::sprintf("%s&pids=%s", *uri, *pidsM.ListPids());
debug1("%s Retuning [device %d]", __PRETTY_FUNCTION__, deviceIdM);
if (rtspM.Play(*uri)) {
keepAliveM.Set(timeoutM);
@@ -226,6 +225,8 @@ bool cSatipTuner::Disconnect(void)
if (!isempty(*streamAddrM) && (streamIdM >= 0)) {
cString uri = cString::sprintf("rtsp://%s/stream=%d", *streamAddrM, streamIdM);
rtspM.Teardown(*uri);
// some devices requires a teardown for TCP connection also
rtspM.Reset();
streamIdM = -1;
}
@@ -238,6 +239,7 @@ bool cSatipTuner::Disconnect(void)
cSatipDiscover::GetInstance()->UseServer(currentServerM, false);
statusUpdateM.Set(0);
timeoutM = eMinKeepAliveIntervalMs;
pmtPidM = -1;
addPidsM.Clear();
delPidsM.Clear();
@@ -376,7 +378,6 @@ bool cSatipTuner::SetPid(int pidP, int typeP, bool onP)
addPidsM.RemovePid(pidP);
}
debug9("%s (%d, %d, %d) pids=%s [device %d]", __PRETTY_FUNCTION__, pidP, typeP, onP, *pidsM.ListPids(), deviceIdM);
pidUpdateCacheM.Set(ePidUpdateIntervalMs);
sleepM.Signal();
return true;
@@ -389,6 +390,7 @@ bool cSatipTuner::UpdatePids(bool forceP)
if (((forceP && pidsM.Size()) || (pidUpdateCacheM.TimedOut() && (addPidsM.Size() || delPidsM.Size()))) &&
!isempty(*streamAddrM) && (streamIdM > 0)) {
cString uri = cString::sprintf("rtsp://%s/stream=%d", *streamAddrM, streamIdM);
bool useci = (SatipConfig.GetCIExtension() && !!(currentServerM && currentServerM->Quirk(cSatipServer::eSatipQuirkUseXCI)));
bool usedummy = !!(currentServerM && currentServerM->Quirk(cSatipServer::eSatipQuirkPlayPids));
if (forceP || usedummy) {
if (pidsM.Size())
@@ -402,6 +404,23 @@ bool cSatipTuner::UpdatePids(bool forceP)
if (delPidsM.Size())
uri = cString::sprintf("%s%sdelpids=%s", *uri, addPidsM.Size() ? "&" : "?", *delPidsM.ListPids());
}
if (useci) {
// CI extension parameters:
// - x_pmt : specifies the PMT of the service you want the CI to decode
// - x_ci : specfies which CI slot (1..n) to use
// value 0 releases the CI slot
// CI slot released automatically if the stream is released,
// but not when used retuning to another channel
int pid = deviceM->GetPmtPid();
if ((pid > 0) && (pid != pmtPidM)) {
int slot = deviceM->GetCISlot();
uri = cString::sprintf("%s&x_pmt=%d", *uri, pid);
if (slot > 0)
uri = cString::sprintf("%s&x_ci=%d", *uri, slot);
}
pmtPidM = pid;
}
pidUpdateCacheM.Set(ePidUpdateIntervalMs);
if (!rtspM.Play(*uri))
return false;
addPidsM.Clear();

View File

@@ -68,7 +68,7 @@ private:
eDummyPid = 100,
eDefaultSignalStrength = 15,
eDefaultSignalQuality = 224,
eSleepTimeoutMs = 1000, // in milliseconds
eSleepTimeoutMs = 250, // in milliseconds
eStatusUpdateTimeoutMs = 1000, // in milliseconds
ePidUpdateIntervalMs = 250, // in milliseconds
eConnectTimeoutMs = 5000, // in milliseconds
@@ -101,6 +101,7 @@ private:
int signalStrengthM;
int signalQualityM;
int streamIdM;
int pmtPidM;
cSatipPid addPidsM;
cSatipPid delPidsM;
cSatipPid pidsM;