From 8c05ce31f93bad88d4ea5ad0634fc652170aa480 Mon Sep 17 00:00:00 2001 From: Rolf Ahrenberg Date: Mon, 10 Mar 2014 21:21:08 +0200 Subject: [PATCH] Switched to standard 'S' and 'T' sources. Added a new OperationMode setup parameter. Added new SVDRP commands. --- HISTORY | 6 + Makefile | 4 +- README | 136 +++++-------------- config.c | 3 +- config.h | 15 ++ device.c | 56 ++++---- device.h | 1 + discover.c | 23 +++- discover.h | 2 +- param.c | 168 +++++++++++++++++++++++ param.h | 15 ++ po/de_DE.po | 76 +++++------ po/fi_FI.po | 74 +++++----- satip.c | 28 +++- setup.c | 52 ++++--- setup.h | 2 + source.c | 384 ---------------------------------------------------- source.h | 93 ------------- tuner.c | 6 +- 19 files changed, 416 insertions(+), 728 deletions(-) create mode 100644 param.c create mode 100644 param.h delete mode 100644 source.c delete mode 100644 source.h diff --git a/HISTORY b/HISTORY index ee2ba59..7d0b5b3 100644 --- a/HISTORY +++ b/HISTORY @@ -6,3 +6,9 @@ VDR Plugin 'satip' Revision History - Initial revision. - Added German translation (Thanks to Frank Neumann). + +2014-03-15: Version 0.0.2 + +- Switched to standard 'S' and 'T' sources. +- Added a new OperationMode setup parameter. +- Added new SVDRP commands. diff --git a/Makefile b/Makefile index 6d1a566..b4de8b6 100644 --- a/Makefile +++ b/Makefile @@ -77,8 +77,8 @@ all-redirect: all ### The object files (add further files here): -OBJS = $(PLUGIN).o common.o config.o device.o discover.o \ - sectionfilter.o setup.o socket.o source.o statistics.o tuner.o +OBJS = $(PLUGIN).o common.o config.o device.o discover.o param.o \ + sectionfilter.o setup.o socket.o statistics.o tuner.o ### The main target: diff --git a/README b/README index 65f22f1..df03584 100644 --- a/README +++ b/README @@ -32,9 +32,35 @@ Installation: tar -xzf /put/your/path/here/vdr-satip-X.Y.Z.tgz make -C satip-X.Y.Z install +Configuration: + +The plugin accepts a "--devices" (-d) command-line parameter defaulting +to one. This parameter defines how many simultaneous transponders can +be received, if there are available SAT>IP tuners. + +SAT>IP satellite positions (aka. signal sources) shall be defined via +sources.conf. If the source description begins with a number, it's used +as SAT>IP signal source selection parameter. Otherwise, the default +parameter is one: + +S19.2E Astra 1KR/1L/1M/2C +=> Signal source = 1 + +S19.2E 2 +=> Signal source = 2 + +S19.2E 3 Astra 1KR/1L/1M/2C +=> Signal source = 3 + Setup menu: -- Enable EPG scanning = yes If you want exclude all SAT>IP devices +- Operating mode = off If you want exclude all SAT>IP devices + low from VDR's device handling, set this + normal option to "off". Otherwise, if you want + to keep SAT>IP at a low priority when + selecting available devices, set this + option to "low". +- Enable EPG scanning = yes If you want exclude all SAT>IP devices from VDR's EIT background scanning, set this option to "no". - Disabled filters = none Certain section filters might cause some @@ -57,108 +83,6 @@ Information menu: - [Yellow:Filters] Opens the section filter statistics page. - [Blue:Bits/bytes] Toggles between bits and bytes mode. -SAT>IP device menu: - -- [Red:Scan] Starts the channel scanning sometime in - the future. - -Configuration: - -- Parameters - - Various parameters, depending on whether this is a DVB-S, DVB-S2, DVB-T, - or DVB-T2 channel. Each parameter consist of a key character, followed by - an integer number that represents the actual setting of that parameter. - The valid key characters, their meaning, and allowed values are: - - B Bandwidth (1712, 5, 6, 7, 8, 10) - C Code rate high priority (12, 23, 34, 35, 45, 56, 67, 78, 89, 910) - G Guard interval (4, 8, 16, 32, 128, 19128, 19256) - H Horizontal polarization - L Left circular polarization - M Modulation (2, 5, 16, 64, 256) - N pilot toNes (0, 1) - O rollOff (20, 25, 35) - P stream id (0-255) - Q t2 system id (0-65535) - R Right circular polarization - S delivery System (0, 1) - T Transmission mode (1, 2, 4, 8, 16, 32) - V Vertical polarization - X siso/miso mode (0, 1) - Z signal source position (1-255) - - Bandwidth: The bandwidth of the channel in MHz (1712 in kHz) - (DVB-T/DVB-T2) - - Code rate high priority: Forward Error Correction (FEC) of the high - priority stream (DVB-T/DVB-T2) or the the inner FEC scheme (DVB-S/DVB-S2) - 12 = 1/2, 23 = 2/3, 34 = 3/4, 35 = 3/5, 45 = 4/5, 56 = 5/6, - 67 = 6/7, 78 = 7/8, 89 = 8/9, 910 = 9/10 - (DVB-T/DVB-T2/DVB-S/DVB-S2) - - Guard interval: The guard interval value - 4 = 1/4, 8 = 1/8, 16 = 1/16, 32 = 1/32, 128 = 1/128, - 19128 = 19/128, 19256 = 19/256 - (DVB-T/DVB-T2) - - Modulation: Specifies the modulation/constellation of the channel - 2 = QPSK (DVB-S, DVB-S2, DVB-T, DVB-T2) - 5 = 8PSK (DVB-S, DVB-S2) - 16 = QAM16 (DVB-T, DVB-T2) - 64 = QAM64 (DVB-T, DVB-T2) - 256 = QAM256 (DVB-T2) - - Pilot tones: Specifies pilot tones usage - 0 = off, 1 = on - (DVB-S2) - - Rolloff: The Nyquist filter rolloff factor - 35 = 0.35, 25 = 0.25, 20 = 0.20 - (DVB-S/DVB-S2) - - Stream id: Physical Layer Pipe (PLP) id (0-255) for DVB-T2 multiplex - (DVB-T2) - - T2 system id: Unique identifier (0-65535) of the T2 system - (DVB-T2) - - Transmission mode: Number of DVB-T OFDM carriers - 32 = 32k, 16 = 16k, 8 = 8k, 4 = 4k, 2 = 2k, 1 = 1k - (DVB-T/DVB-T2) - - Delivery System: The delivery system - 0 = "first generation" (DVB-S/DVB-T) - 1 = "second generation" (DVB-S2/DVB-T2) - - Polarization: Satellite antenna polarization - H = horizontal, V = vertical - R = circular right, L = circular left - (DVB-S/DVB-S2) - - Signal source: Specifies the signal source (satellite) position - (DVB-S/DVB-S2) - - SISO/MISO: Specifies the Single-Input/Multiple-Input Single-Output mode - 0 = SISO, 1 = MISO - (DVB-T2) - -- Source - - There are two separate signal sources for SAT>IP channels: - Z = SAT>IP Satellite (DVB-S/DVB-S2) - Y = SAT>IP Terrestrial (DVB-T/DVB-T2) - -- Examples - - MTV3;DVB-T:658000000:B8C23D23G8M64S0T8Y0:T:0:305=2:561=fin@4,562=dut@4:5010;1073=fin,1074=dut:0:49:8438:8193:0 - => - MTV3;SAT>IP:658000000:B8C23G8M64S0T8:Y:0:305=2:561=fin@4,562=dut@4:5010;1073=fin,1074=dut:0:49:8438:8193:0 - - Das Erste HD;DVB-S2:11494:HC23M5O35S1:S19.2E:22000:5101=27:5102=deu@3,5103=mis@3;5106=deu@106:5104;5105=deu:0:10301:1:1019:0 - => - Das Erste HD;SAT>IP:11494:HC23M5O35S1:Z:22000:5101=27:5102=deu@3,5103=mis@3;5106=deu@106:5104;5105=deu:0:10301:1:1019:0 - Notes: - The stream id "-1" states about unsuccessful tuning. This might be a @@ -169,6 +93,12 @@ Notes: - If the plugin doesn't detect your SAT>IP network device, make sure your setup doesn't have firewalled the UDP port 1900. +- Stream decryption requires a separate CAM plugin that works without + direct access to any DVB card devices. + +- The 100% compliance against SAT>IP specification 1.2 requires a + patched VDR. + Acknowledgements: - Big thanks to Digital Devices GmbH for providing the Octopus Net diff --git a/config.c b/config.c index 3962f90..b1503b5 100644 --- a/config.c +++ b/config.c @@ -11,7 +11,8 @@ cSatipConfig SatipConfig; cSatipConfig::cSatipConfig(void) -: eitScanM(1), +: operatingModeM(OPERATING_MODE_LOW), + eitScanM(1), useBytesM(1) { for (unsigned int i = 0; i < ARRAY_SIZE(disabledFiltersM); ++i) diff --git a/config.h b/config.h index 95002b2..c77de1c 100644 --- a/config.h +++ b/config.h @@ -14,19 +14,34 @@ class cSatipConfig { private: + unsigned int operatingModeM; unsigned int eitScanM; unsigned int useBytesM; int disabledFiltersM[SECTION_FILTER_TABLE_SIZE]; char configDirectoryM[PATH_MAX]; public: + enum { + OPERATING_MODE_OFF = 0, + OPERATING_MODE_LOW, + OPERATING_MODE_NORMAL, + OPERATING_MODE_HIGH, + NUMBER_OF_OPERATING_MODES + }; cSatipConfig(); + unsigned int GetOperatingMode(void) const { return operatingModeM; } + bool IsOperatingModeOff(void) const { return (operatingModeM == OPERATING_MODE_OFF); } + bool IsOperatingModeLow(void) const { return (operatingModeM == OPERATING_MODE_LOW); } + bool IsOperatingModeNormal(void) const { return (operatingModeM == OPERATING_MODE_NORMAL); } + bool IsOperatingModeHigh(void) const { return (operatingModeM == OPERATING_MODE_HIGH); } + void ToggleOperatingMode(void) { operatingModeM = (operatingModeM + 1) % NUMBER_OF_OPERATING_MODES; } unsigned int GetEITScan(void) const { return eitScanM; } unsigned int GetUseBytes(void) const { return useBytesM; } const char *GetConfigDirectory(void) const { return configDirectoryM; } unsigned int GetDisabledFiltersCount(void) const; int GetDisabledFilters(unsigned int indexP) const; + void SetOperatingMode(unsigned int operatingModeP) { operatingModeM = operatingModeP; } void SetEITScan(unsigned int onOffP) { eitScanM = onOffP; } void SetUseBytes(unsigned int onOffP) { useBytesM = onOffP; } void SetConfigDirectory(const char *directoryP); diff --git a/device.c b/device.c index 3f89e82..fa1d45d 100644 --- a/device.c +++ b/device.c @@ -7,7 +7,7 @@ #include "config.h" #include "discover.h" -#include "source.h" +#include "param.h" #include "device.h" #define SATIP_MAX_DEVICES MAXDEVICES @@ -49,8 +49,6 @@ cSatipDevice::~cSatipDevice() bool cSatipDevice::Initialize(unsigned int deviceCountP) { debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceCountP); - new cSatipSourceParam('Y', "DVB-T (SAT>IP)"); - new cSatipSourceParam('Z', "DVB-S (SAT>IP)"); if (deviceCountP > SATIP_MAX_DEVICES) deviceCountP = SATIP_MAX_DEVICES; for (unsigned int i = 0; i < deviceCountP; ++i) @@ -158,6 +156,12 @@ cString cSatipDevice::DeviceName(void) const return deviceNameM; } +bool cSatipDevice::AvoidRecording(void) const +{ + //debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM); + return SatipConfig.IsOperatingModeLow(); +} + int cSatipDevice::SignalStrength(void) const { //debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM); @@ -173,12 +177,7 @@ int cSatipDevice::SignalQuality(void) const bool cSatipDevice::ProvidesSource(int sourceP) const { debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM); - int model = 0; - if (cSource::IsType(sourceP, 'Z')) - model |= cSatipServer::eSatipModelTypeDVBS2; - if (cSource::IsType(sourceP, 'Y')) - model |= cSatipServer::eSatipModelTypeDVBT2 | cSatipServer::eSatipModelTypeDVBT; - return !!cSatipDiscover::GetInstance()->GetServer(model); + return (!SatipConfig.IsOperatingModeOff() && !!cSatipDiscover::GetInstance()->GetServer(sourceP)); } bool cSatipDevice::ProvidesTransponder(const cChannel *channelP) const @@ -230,7 +229,18 @@ bool cSatipDevice::ProvidesEIT(void) const int cSatipDevice::NumProvidedSystems(void) const { - return cSatipDiscover::GetInstance()->NumProvidedSystems(); + int count = cSatipDiscover::GetInstance()->NumProvidedSystems(); + // Tweak the count according to operation mode + if (SatipConfig.IsOperatingModeLow()) + count = 15; + else if (SatipConfig.IsOperatingModeHigh()) + count = 1; + // Clamp the count between 1 and 15 + if (count > 15) + count = 15; + else if (count < 1) + count = 1; + return count; } const cChannel *cSatipDevice::GetCurrentlyTunedTransponder(void) const @@ -255,31 +265,19 @@ bool cSatipDevice::MaySwitchTransponder(const cChannel *channelP) const bool cSatipDevice::SetChannelDevice(const cChannel *channelP, bool liveViewP) { if (channelP) { - cSatipTransponderParameters stp(channelP->Parameters()); - cString params = stp.UrlParameters(cSource::ToChar(channelP->Source())); + cDvbTransponderParameters dtp(channelP->Parameters()); + cString params = GetTransponderUrlParameters(channelP); + if (isempty(params)) { + error("Unrecognized SAT>IP channel parameters: %s", channelP->Parameters()); + return false; + } cString address; - int mode = 0; - if (cSource::IsType(channelP->Source(), 'Z')) - mode |= cSatipServer::eSatipModelTypeDVBS2; - if (cSource::IsType(channelP->Source(), 'Y')) - mode |= stp.System() ? cSatipServer::eSatipModelTypeDVBT2 : cSatipServer::eSatipModelTypeDVBT; - cSatipServer *server = cSatipDiscover::GetInstance()->GetServer(mode); + cSatipServer *server = cSatipDiscover::GetInstance()->GetServer(channelP->Source(), dtp.System()); if (!server) { debug("cSatipDevice::%s(%u): no suitable server found", __FUNCTION__, deviceIndexM); return false; } address = server->Address(); - float freq = channelP->Frequency(); - if (isempty(params)) { - error("Unrecognized SAT>IP channel parameters: %s", channelP->Parameters()); - return false; - } - // Scale down frequencies to MHz - while (freq > 20000L) - freq /= 1000L; - params = cString::sprintf("freq=%s%s", *dtoa(freq, "%.3f"), *params); - if (cSource::IsType(channelP->Source(), 'Z')) - params = cString::sprintf("%s&sr=%d", *params, channelP->Srate()); if (pTunerM && pTunerM->SetSource(*address, *params, deviceIndexM)) { deviceNameM = cString::sprintf("%s %d %s:%s:%s", *DeviceType(), deviceIndexM, server->Address(), server->Model(), server->Description()); channelM = *channelP; diff --git a/device.h b/device.h index bdfc7c9..f086e37 100644 --- a/device.h +++ b/device.h @@ -56,6 +56,7 @@ private: public: virtual cString DeviceType(void) const; virtual cString DeviceName(void) const; + virtual bool AvoidRecording(void) const; virtual int SignalStrength(void) const; virtual int SignalQuality(void) const; diff --git a/discover.c b/discover.c index 510b262..9d28963 100644 --- a/discover.c +++ b/discover.c @@ -241,12 +241,21 @@ bool cSatipDiscover::IsValidServer(cSatipServer *serverP) return false; } -cSatipServer *cSatipDiscover::GetServer(int modelP) +cSatipServer *cSatipDiscover::GetServer(int sourceP, int systemP) { - //debug("cSatipDiscover::%s(%d)", __FUNCTION__, modelP); + //debug("cSatipDiscover::%s(%d, %d)", __FUNCTION__, sourceP, systemP); cMutexLock MutexLock(&mutexM); + int model = 0; + if (cSource::IsType(sourceP, 'S')) + model |= cSatipServer::eSatipModelTypeDVBS2; + if (cSource::IsType(sourceP, 'T')) { + if (systemP < 0) + model |= cSatipServer::eSatipModelTypeDVBT2 | cSatipServer::eSatipModelTypeDVBT; + else + model |= systemP ? cSatipServer::eSatipModelTypeDVBT2 : cSatipServer::eSatipModelTypeDVBT; + } for (cSatipServer *srv = serversM->First(); srv; srv = serversM->Next(srv)) { - if (srv->Match(modelP)) + if (srv->Match(model)) return srv; } return NULL; @@ -275,9 +284,11 @@ int cSatipDiscover::NumProvidedSystems(void) cMutexLock MutexLock(&mutexM); int count = 0; for (cSatipServer *srv = serversM->First(); srv; srv = serversM->Next(srv)) { - count += srv->Satellite(); - count += srv->Terrestrial(); - count += srv->Terrestrial2(); + // DVB-S*: qpsk, 8psk + count += srv->Satellite() * 4; + // DVB-T*: qpsk, qam16, qam64, qam256 + count += (srv->Terrestrial2() ? srv->Terrestrial2() : srv->Terrestrial()) * 4; } + count = 1; return count; } diff --git a/discover.h b/discover.h index 9562a12..91eeb89 100644 --- a/discover.h +++ b/discover.h @@ -120,7 +120,7 @@ public: static void Destroy(void); virtual ~cSatipDiscover(); bool IsValidServer(cSatipServer *serverP); - cSatipServer *GetServer(int modelP); + cSatipServer *GetServer(int sourceP, int systemP = -1); cSatipServers *GetServers(void); cString GetServerList(void); int NumProvidedSystems(void); diff --git a/param.c b/param.c new file mode 100644 index 0000000..9d853a8 --- /dev/null +++ b/param.c @@ -0,0 +1,168 @@ +/* + * param.c: SAT>IP plugin for the Video Disk Recorder + * + * See the README file for copyright information and how to reach the author. + * + */ + +#include +#include +#include "common.h" +#include "param.h" + +// --- cSatipParameterMaps ---------------------------------------------------- + +struct tSatipParameterMap { + int driverValue; + const char *satipString; +}; + +static const tSatipParameterMap SatipBandwidthValues[] = { + { 5000000, "bw=5" }, + { 6000000, "bw=6" }, + { 7000000, "bw=7" }, + { 8000000, "bw=8" }, + { 10000000, "bw=10" }, + { 1712000, "bw=1.712" }, + { -1, NULL } +}; + +static const tSatipParameterMap SatipPilotValues[] = { + { PILOT_OFF, "plts=off" }, + { PILOT_ON, "plts=on" }, + { PILOT_AUTO, "" }, + { -1, NULL } +}; + +static const tSatipParameterMap SatipSisoMisoValues[] = { + { 0, "sm=0" }, + { 1, "sm=1" }, + { -1, NULL } +}; + +static const tSatipParameterMap SatipCodeRateValues[] = { + { FEC_NONE, "" }, + { FEC_1_2, "fec=12" }, + { FEC_2_3, "fec=23" }, + { FEC_3_4, "fec=34" }, + { FEC_3_5, "fec=35" }, + { FEC_4_5, "fec=45" }, + { FEC_5_6, "fec=56" }, + { FEC_6_7, "fec=67" }, + { FEC_7_8, "fec=78" }, + { FEC_8_9, "fec=89" }, + { FEC_9_10, "fec=910" }, + { FEC_AUTO, "" }, + { -1, NULL } +}; + +static const tSatipParameterMap SatipModulationValues[] = { + { QPSK, "mtype=qpsk" }, + { PSK_8, "mtype=8psk" }, + { QAM_16, "mtype=16qam" }, + { QAM_64, "mtype=64qam" }, + { QAM_256, "mtype=256qam" }, + { QAM_AUTO, "" }, + { -1, NULL } +}; + +static const tSatipParameterMap SatipSystemValuesSat[] = { + { 0, "msys=dvbs" }, + { 1, "msys=dvbs2" }, + { -1, NULL } +}; + +static const tSatipParameterMap SatipSystemValuesTerr[] = { + { 0, "msys=dvbt" }, + { 1, "msys=dvbt2" }, + { -1, NULL } +}; + +static const tSatipParameterMap SatipTransmissionValues[] = { + { TRANSMISSION_MODE_1K, "tmode=1k" }, + { TRANSMISSION_MODE_2K, "tmode=2k" }, + { TRANSMISSION_MODE_4K, "tmode=4k" }, + { TRANSMISSION_MODE_8K, "tmode=8k" }, + { TRANSMISSION_MODE_16K, "tmode=16k" }, + { TRANSMISSION_MODE_32K, "tmode=32k" }, + { TRANSMISSION_MODE_AUTO, "" }, + { -1, NULL } +}; + +static const tSatipParameterMap SatipGuardValues[] = { + { GUARD_INTERVAL_1_4, "gi=14" }, + { GUARD_INTERVAL_1_8, "gi=18" }, + { GUARD_INTERVAL_1_16, "gi=116" }, + { GUARD_INTERVAL_1_32, "gi=132" }, + { GUARD_INTERVAL_1_128, "gi=1128" }, + { GUARD_INTERVAL_19_128, "gi=19128" }, + { GUARD_INTERVAL_19_256, "gi=19256" }, + { GUARD_INTERVAL_AUTO, "" }, + { -1, NULL } +}; + +static const tSatipParameterMap SatipRollOffValues[] = { + { ROLLOFF_AUTO, "" }, + { ROLLOFF_20, "ro=0.20" }, + { ROLLOFF_25, "ro=0.25" }, + { ROLLOFF_35, "ro=0.35" }, + { -1, NULL } +}; + +static int SatipUserIndex(int valueP, const tSatipParameterMap *mapP) +{ + const tSatipParameterMap *map = mapP; + while (map && map->driverValue != -1) { + if (map->driverValue == valueP) + return map - mapP; + map++; + } + return -1; +} + +static int PrintUrlString(char *ptrP, int valueP, const tSatipParameterMap *mapP) +{ + int n = SatipUserIndex(valueP, mapP); + return (n >= 0) ? sprintf(ptrP, "&%s", tr(mapP[n].satipString)) : 0; +} + +cString GetTransponderUrlParameters(const cChannel *channelP) +{ + if (channelP) { + cDvbTransponderParameters dtp(channelP->Parameters()); + int Pilot = PILOT_AUTO; // should be added into cDvbTransponderParameters + int T2SystemId = 0; // should be added into cDvbTransponderParameters + int SisoMiso = 0; // should be added into cDvbTransponderParameters + float freq = channelP->Frequency(); + char type = cSource::ToChar(channelP->Source()); + cSource *source = Sources.Get(channelP->Source()); + int src = (strchr("S", type) && source) ? atoi(source->Description()) : 1; + char buffer[255]; + char *q = buffer; + *q = 0; + // Scale down frequencies to MHz + while (freq > 20000L) + freq /= 1000L; + q += sprintf(q, "freq=%s", *dtoa(freq, "%.3f")); +#define ST(s) if (strchr(s, type) && (strchr(s, '0' + dtp.System() + 1) || strchr(s, '*'))) + ST("S *") q += sprintf(q, "&src=%d", ((src > 0) && (src <= 255)) ? src : 1); + ST("S *") q += sprintf(q, "&sr=%d", channelP->Srate()); + ST("S *") q += sprintf(q, "&pol=%c", tolower(dtp.Polarization())); + ST(" T2") q += sprintf(q, "&plp=%d", dtp.StreamId()); + ST(" T2") q += sprintf(q, "&t2id=%d", T2SystemId); + ST(" T2") q += PrintUrlString(q, SisoMiso, SatipSisoMisoValues); + ST(" T*") q += PrintUrlString(q, dtp.Bandwidth(), SatipBandwidthValues); + ST(" T*") q += PrintUrlString(q, dtp.Guard(), SatipGuardValues); + ST("ST*") q += PrintUrlString(q, dtp.CoderateH(), SatipCodeRateValues); + ST("S 2") q += PrintUrlString(q, Pilot, SatipPilotValues); + ST("S 2") q += PrintUrlString(q, dtp.Modulation(), SatipModulationValues); + ST(" T*") q += PrintUrlString(q, dtp.Modulation(), SatipModulationValues); + ST("S 2") q += PrintUrlString(q, dtp.RollOff(), SatipRollOffValues); + ST("S *") q += PrintUrlString(q, dtp.System(), SatipSystemValuesSat); + ST(" T*") q += PrintUrlString(q, dtp.System(), SatipSystemValuesTerr); + ST(" T*") q += PrintUrlString(q, dtp.Transmission(), SatipTransmissionValues); +#undef ST + return buffer; + } + return NULL; +} diff --git a/param.h b/param.h new file mode 100644 index 0000000..ae68578 --- /dev/null +++ b/param.h @@ -0,0 +1,15 @@ +/* + * param.h: SAT>IP plugin for the Video Disk Recorder + * + * See the README file for copyright information and how to reach the author. + * + */ + +#ifndef __SATIP_PARAM_H +#define __SATIP_PARAM_H + +#include "common.h" + +cString GetTransponderUrlParameters(const cChannel *channelP); + +#endif // __SATIP_PARAM_H diff --git a/po/de_DE.po b/po/de_DE.po index 735d12a..1dde4b2 100644 --- a/po/de_DE.po +++ b/po/de_DE.po @@ -5,10 +5,10 @@ # msgid "" msgstr "" -"Project-Id-Version: vdr-satip 0.0.1\n" +"Project-Id-Version: vdr-satip 0.0.2\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-03-08 03:08+0200\n" -"PO-Revision-Date: 2014-03-08 03:08+0200\n" +"POT-Creation-Date: 2014-03-15 03:15+0200\n" +"PO-Revision-Date: 2014-03-15 03:15+0200\n" "Last-Translator: Frank Neumann \n" "Language-Team: German \n" "Language: de\n" @@ -43,9 +43,6 @@ msgstr "SAT>IP Geräte" msgid "SAT>IP Device" msgstr "SAT>IP Gerät" -msgid "Button$Scan" -msgstr "Starte Kanalsuche" - msgid "SAT>IP Information" msgstr "SAT>IP Informationen" @@ -64,6 +61,36 @@ msgstr "Bits/Bytes" msgid "SAT>IP information not available!" msgstr "Keine SAT>IP Informationen verfügbar!" +msgid "off" +msgstr "aus" + +msgid "low" +msgstr "niedrig" + +msgid "normal" +msgstr "normal" + +msgid "high" +msgstr "hoch" + +msgid "Operating mode" +msgstr "Betriebsmodus" + +msgid "" +"Define the used operating mode for all SAT>IP devices:\n" +"\n" +"off - devices are disabled\n" +"low - devices are working at the lowest priority\n" +"normal - devices are working within normal parameters\n" +"high - devices are working at the highest priority" +msgstr "" +"Bestimme den Betriebsmodus für alle SAT>IP Geräte:\n" +"\n" +"aus - Geräte sind abgeschaltet\n" +"niedrig - Geräte arbeiten mit geringster Priorität\n" +"normal - Geräte arbeiten innerhalb der gewöhnlichen Parameter\n" +"hoch - Geräte arbeiten mit höchste Priorität" + msgid "Enable EPG scanning" msgstr "Aktiviere EPG Aktualisierung" @@ -76,7 +103,6 @@ msgstr "" "\n" "Diese Einstellung schaltet die automatische EIT Aktualisierung für alle SAT>IP Geräte." - msgid "Disabled filters" msgstr "Deaktivierte Filter" @@ -103,39 +129,3 @@ msgstr "Aktive SAT>IP Geräte:" msgid "Help" msgstr "Hilfe" - -msgid "off" -msgstr "aus" - -msgid "on" -msgstr "ein" - -msgid "auto" -msgstr "auto" - -msgid "SISO" -msgstr "SISO" - -msgid "MISO" -msgstr "MISO" - -msgid "Nid" -msgstr "Nid" - -msgid "Tid" -msgstr "Tid" - -msgid "Rid" -msgstr "Rid" - -msgid "SignalSource" -msgstr "Signalquelle" - -msgid "PilotTones" -msgstr "Pilottöne" - -msgid "T2SystemId" -msgstr "T2-Systemkennung" - -msgid "SISO/MISO" -msgstr "SISO/MISO" diff --git a/po/fi_FI.po b/po/fi_FI.po index 881358d..5089486 100644 --- a/po/fi_FI.po +++ b/po/fi_FI.po @@ -5,10 +5,10 @@ # msgid "" msgstr "" -"Project-Id-Version: vdr-satip 0.0.1\n" +"Project-Id-Version: vdr-satip 0.0.2\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-03-08 03:08+0200\n" -"PO-Revision-Date: 2014-03-08 03:08+0200\n" +"POT-Creation-Date: 2014-03-15 03:15+0200\n" +"PO-Revision-Date: 2014-03-15 03:15+0200\n" "Last-Translator: Rolf Ahrenberg\n" "Language-Team: Finnish \n" "Language: fi\n" @@ -43,9 +43,6 @@ msgstr "SAT>IP-laitteet" msgid "SAT>IP Device" msgstr "SAT>IP-laite" -msgid "Button$Scan" -msgstr "Kanavahaku" - msgid "SAT>IP Information" msgstr "SAT>IP-tiedot" @@ -64,6 +61,35 @@ msgstr "Bitit/tavut" msgid "SAT>IP information not available!" msgstr "SAT>IP-tietoja ei saatavilla!" +msgid "off" +msgstr "ei käytössä" + +msgid "low" +msgstr "matala" + +msgid "normal" +msgstr "normaali" + +msgid "high" +msgstr "korkea" + +msgid "Operating mode" +msgstr "Laitteiden toimintatapa" + +msgid "" +"Define the used operating mode for all SAT>IP devices:\n" +"\n" +"off - devices are disabled\n" +"low - devices are working at the lowest priority\n" +"normal - devices are working within normal parameters\n" +"high - devices are working at the highest priority" +msgstr "" +"Määrittele toimintamoodi SAT>IP-laitteille:\n" +"ei käytössä - laitteet ovat pois käytöstä\n" +"matala - laitteet toimivat matalalla prioriteetilla\n" +"normaali - laitteet toimivat normaalilla prioriteetilla\n" +"korkea - laitteet toimivat korkealla prioriteetilla" + msgid "Enable EPG scanning" msgstr "Käytä ohjelmaoppaan taustapäivitystä" @@ -102,39 +128,3 @@ msgstr "Aktiiviset SAT>IP-laitteet:" msgid "Help" msgstr "Opaste" - -msgid "off" -msgstr "pois" - -msgid "on" -msgstr "päällä" - -msgid "auto" -msgstr "auto" - -msgid "SISO" -msgstr "SISO" - -msgid "MISO" -msgstr "MISO" - -msgid "Nid" -msgstr "Verkko-ID" - -msgid "Tid" -msgstr "Lähete-ID" - -msgid "Rid" -msgstr "Radio-ID" - -msgid "SignalSource" -msgstr "Signaalin lähde" - -msgid "PilotTones" -msgstr "Pilottiäänet" - -msgid "T2SystemId" -msgstr "T2-järjestelmä" - -msgid "SISO/MISO" -msgstr "SISO/MISO" diff --git a/satip.c b/satip.c index 607d247..18711c2 100644 --- a/satip.c +++ b/satip.c @@ -21,7 +21,7 @@ #define GITVERSION "" #endif - const char VERSION[] = "0.0.1" GITVERSION; + const char VERSION[] = "0.0.2" GITVERSION; static const char DESCRIPTION[] = trNOOP("SAT>IP Devices"); class cPluginSatip : public cPlugin { @@ -194,6 +194,8 @@ bool cPluginSatip::SetupParse(const char *nameP, const char *valueP) { debug("cPluginSatip::%s()", __FUNCTION__); // Parse your own setup parameters and store their values. + if (!strcasecmp(nameP, "OperatingMode")) + SatipConfig.SetOperatingMode(atoi(valueP)); if (!strcasecmp(nameP, "EnableEITScan")) SatipConfig.SetEITScan(atoi(valueP)); else if (!strcasecmp(nameP, "DisabledFilters")) { @@ -229,6 +231,8 @@ const char **cPluginSatip::SVDRPHelpPages(void) " Lists active SAT>IP servers.\n", "CONT\n" " Shows SAT>IP device count.\n", + "OPER\n" + " Toggles operating mode of SAT>IP devices.\n", NULL }; return HelpPages; @@ -284,6 +288,28 @@ cString cPluginSatip::SVDRPCommand(const char *commandP, const char *optionP, in else if (strcasecmp(commandP, "CONT") == 0) { return cString::sprintf("SAT>IP device count: %u", cSatipDevice::Count()); } + else if (strcasecmp(commandP, "OPER") == 0) { + cString mode; + SatipConfig.ToggleOperatingMode(); + switch (SatipConfig.GetOperatingMode()) { + case cSatipConfig::OPERATING_MODE_OFF: + mode = "off"; + break; + case cSatipConfig::OPERATING_MODE_LOW: + mode = "low"; + break; + case cSatipConfig::OPERATING_MODE_NORMAL: + mode = "normal"; + break; + case cSatipConfig::OPERATING_MODE_HIGH: + mode = "high"; + break; + default: + mode = "unknown"; + break; + } + return cString::sprintf("SAT>IP operating mode: %s\n", *mode); + } return NULL; } diff --git a/setup.c b/setup.c index 1de3e88..d0b7438 100644 --- a/setup.c +++ b/setup.c @@ -14,9 +14,9 @@ #include "discover.h" #include "setup.h" -// --- cSatipMenuScan --------------------------------------------------------- +// --- cSatipServerInfo ------------------------------------------------------- -class cSatipMenuScan : public cOsdMenu +class cSatipServerInfo : public cOsdMenu { private: enum { @@ -26,13 +26,13 @@ private: cTimeMs timeoutM; public: - cSatipMenuScan(cSatipServer *serverP); - virtual ~cSatipMenuScan(); + cSatipServerInfo(cSatipServer *serverP); + virtual ~cSatipServerInfo(); virtual void Display(void); virtual eOSState ProcessKey(eKeys keyP); }; -cSatipMenuScan::cSatipMenuScan(cSatipServer *serverP) +cSatipServerInfo::cSatipServerInfo(cSatipServer *serverP) : cOsdMenu(tr("SAT>IP Device")), textM("") { @@ -45,14 +45,14 @@ cSatipMenuScan::cSatipMenuScan(cSatipServer *serverP) if (serverP->Description()) textM = cString::sprintf("%s\nDescription:\t%s", *textM, serverP->Description()); } - SetHelp(tr("Button$Scan"), NULL, NULL, NULL); + SetHelp(NULL, NULL, NULL, NULL); } -cSatipMenuScan::~cSatipMenuScan() +cSatipServerInfo::~cSatipServerInfo() { } -void cSatipMenuScan::Display(void) +void cSatipServerInfo::Display(void) { cOsdMenu::Display(); DisplayMenu()->SetText(textM, true); @@ -60,7 +60,7 @@ void cSatipMenuScan::Display(void) cStatus::MsgOsdTextItem(textM); } -eOSState cSatipMenuScan::ProcessKey(eKeys keyP) +eOSState cSatipServerInfo::ProcessKey(eKeys keyP) { eOSState state = cOsdMenu::ProcessKey(keyP); @@ -75,7 +75,7 @@ eOSState cSatipMenuScan::ProcessKey(eKeys keyP) return state; } -// --- cSatipMenuInfo --------------------------------------------------------- +// --- cSatipServerItem ------------------------------------------------------- class cSatipServerItem : public cOsdItem { private: @@ -203,10 +203,15 @@ eOSState cSatipMenuInfo::ProcessKey(eKeys keyP) cSatipPluginSetup::cSatipPluginSetup() : deviceCountM(0), + operatingModeM(SatipConfig.GetOperatingMode()), eitScanM(SatipConfig.GetEITScan()), numDisabledFiltersM(SatipConfig.GetDisabledFiltersCount()) { debug("cSatipPluginSetup::%s()", __FUNCTION__); + operatingModeTextsM[0] = tr("off"); + operatingModeTextsM[1] = tr("low"); + operatingModeTextsM[2] = tr("normal"); + operatingModeTextsM[3] = tr("high"); if (numDisabledFiltersM > SECTION_FILTER_TABLE_SIZE) numDisabledFiltersM = SECTION_FILTER_TABLE_SIZE; for (int i = 0; i < SECTION_FILTER_TABLE_SIZE; ++i) { @@ -225,17 +230,21 @@ void cSatipPluginSetup::Setup(void) Clear(); helpM.Clear(); - 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.")); + Add(new cMenuEditStraItem(tr("Operating mode"), &operatingModeM, ELEMENTS(operatingModeTextsM), operatingModeTextsM)); + 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")); - Add(new cMenuEditIntItem(tr("Disabled filters"), &numDisabledFiltersM, 0, SECTION_FILTER_TABLE_SIZE, tr("none"))); - helpM.Append(tr("Define number of section filters to be disabled.\n\nCertain section filters might cause some unwanted behaviour to VDR such as time being falsely synchronized. By black-listing the filters here useful section data can be left intact for VDR to process.")); + if (operatingModeM) { + 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.")); - for (int i = 0; i < numDisabledFiltersM; ++i) { - Add(new cMenuEditStraItem(*cString::sprintf(" %s %d", tr("Filter"), i + 1), &disabledFilterIndexesM[i], SECTION_FILTER_TABLE_SIZE, disabledFilterNamesM)); - helpM.Append(tr("Define an ill-behaving filter to be blacklisted.")); - } + Add(new cMenuEditIntItem(tr("Disabled filters"), &numDisabledFiltersM, 0, SECTION_FILTER_TABLE_SIZE, tr("none"))); + helpM.Append(tr("Define number of section filters to be disabled.\n\nCertain section filters might cause some unwanted behaviour to VDR such as time being falsely synchronized. By black-listing the filters here useful section data can be left intact for VDR to process.")); + for (int i = 0; i < numDisabledFiltersM; ++i) { + Add(new cMenuEditStraItem(*cString::sprintf(" %s %d", tr("Filter"), i + 1), &disabledFilterIndexesM[i], SECTION_FILTER_TABLE_SIZE, disabledFilterNamesM)); + helpM.Append(tr("Define an ill-behaving filter to be blacklisted.")); + } + } Add(new cOsdItem(tr("Active SAT>IP devices:"), osUnknown, false)); helpM.Append(""); @@ -258,7 +267,7 @@ eOSState cSatipPluginSetup::ChannelScan(void) cSatipServerItem *item = reinterpret_cast(Get(Current())); if (item && cSatipDiscover::GetInstance()->IsValidServer(item->Server())) - return AddSubMenu(new cSatipMenuScan(item->Server())); + return AddSubMenu(new cSatipServerInfo(item->Server())); return osContinue; } @@ -275,6 +284,7 @@ eOSState cSatipPluginSetup::ShowInfo(void) eOSState cSatipPluginSetup::ProcessKey(eKeys keyP) { bool hadSubMenu = HasSubMenu(); + int oldOperatingMode = operatingModeM; int oldNumDisabledFilters = numDisabledFiltersM; eOSState state = cMenuSetupPage::ProcessKey(keyP); @@ -295,7 +305,7 @@ eOSState cSatipPluginSetup::ProcessKey(eKeys keyP) if ((keyP == kNone) && (cSatipDiscover::GetInstance()->GetServers()->Count() != deviceCountM)) Setup(); - if ((keyP != kNone) && (numDisabledFiltersM != oldNumDisabledFilters)) { + if ((keyP != kNone) && ((numDisabledFiltersM != oldNumDisabledFilters) || (operatingModeM != oldOperatingMode))) { while ((numDisabledFiltersM < oldNumDisabledFilters) && (oldNumDisabledFilters > 0)) disabledFilterIndexesM[--oldNumDisabledFilters] = -1; Setup(); @@ -326,9 +336,11 @@ void cSatipPluginSetup::StoreFilters(const char *nameP, int *valuesP) void cSatipPluginSetup::Store(void) { // Store values into setup.conf + SetupStore("OperatingMode", operatingModeM); SetupStore("EnableEITScan", eitScanM); StoreFilters("DisabledFilters", disabledFilterIndexesM); // Update global config + SatipConfig.SetOperatingMode(operatingModeM); SatipConfig.SetEITScan(eitScanM); for (int i = 0; i < SECTION_FILTER_TABLE_SIZE; ++i) SatipConfig.SetDisabledFilters(i, disabledFilterIndexesM[i]); diff --git a/setup.h b/setup.h index 61f192d..d097381 100644 --- a/setup.h +++ b/setup.h @@ -16,6 +16,8 @@ class cSatipPluginSetup : public cMenuSetupPage { private: int deviceCountM; + int operatingModeM; + const char *operatingModeTextsM[4]; int eitScanM; int numDisabledFiltersM; int disabledFilterIndexesM[SECTION_FILTER_TABLE_SIZE]; diff --git a/source.c b/source.c deleted file mode 100644 index bf6c650..0000000 --- a/source.c +++ /dev/null @@ -1,384 +0,0 @@ -/* - * source.c: SAT>IP plugin for the Video Disk Recorder - * - * See the README file for copyright information and how to reach the author. - * - */ - -#include -#include "common.h" -#include "source.h" - -// --- cSatipParameterMaps ---------------------------------------------------- - -static const tSatipParameterMap SatipBandwidthValues[] = { - { 5, "5 MHz", "bw=5" }, - { 6, "6 MHz", "bw=6" }, - { 7, "7 MHz", "bw=7" }, - { 8, "8 MHz", "bw=8" }, - { 10, "10 MHz", "bw=10" }, - { 1712, "1.712 MHz", "bw=1.712" }, - { -1, NULL, NULL } -}; - -static const tSatipParameterMap SatipPilotTonesValues[] = { - { 0, trNOOP("off"), "plts=off" }, - { 1, trNOOP("on"), "plts=on" }, - { 999, trNOOP("auto"), "" }, - { -1, NULL, NULL } -}; - -static const tSatipParameterMap SatipSisoMisoValues[] = { - { 0, trNOOP("SISO"), "sm=0" }, - { 1, trNOOP("MISO"), "sm=1" }, - { 999, trNOOP("auto"), "" }, - { -1, NULL, NULL } -}; - -static const tSatipParameterMap SatipCodeRateValues[] = { - { 0, trNOOP("none"), "" }, - { 12, "1/2", "fec=12" }, - { 23, "2/3", "fec=23" }, - { 34, "3/4", "fec=34" }, - { 35, "3/5", "fec=35" }, - { 45, "4/5", "fec=45" }, - { 56, "5/6", "fec=56" }, - { 78, "7/8", "fec=78" }, - { 89, "8/9", "fec=89" }, - { 910, "9/10", "fec=910" }, - { 999, trNOOP("auto"), "" }, - { -1, NULL, NULL } -}; - -static const tSatipParameterMap SatipModulationValues[] = { - { 2, "QPSK", "mtype=qpsk" }, - { 5, "8PSK", "mtype=8psk" }, - { 16, "QAM16", "mtype=16qam" }, - { 64, "QAM64", "mtype=64qam" }, - { 256, "QAM256", "mtype=256qam" }, - { 999, trNOOP("auto"), "" }, - { -1, NULL, NULL } -}; - -static const tSatipParameterMap SatipSystemValuesSat[] = { - { 0, "DVB-S", "msys=dvbs" }, - { 1, "DVB-S2", "msys=dvbs2" }, - { -1, NULL, NULL } -}; - -static const tSatipParameterMap SatipSystemValuesTerr[] = { - { 0, "DVB-T", "msys=dvbt" }, - { 1, "DVB-T2", "msys=dvbt2" }, - { -1, NULL, NULL } -}; - -static const tSatipParameterMap SatipTransmissionValues[] = { - { 1, "1K", "tmode=1k" }, - { 2, "2K", "tmode=2k" }, - { 4, "4K", "tmode=4k" }, - { 8, "8K", "tmode=8k" }, - { 16, "16K", "tmode=16k" }, - { 32, "32K", "tmode=32k" }, - { 999, trNOOP("auto"), "" }, - { -1, NULL, NULL } -}; - -static const tSatipParameterMap SatipGuardValues[] = { - { 4, "1/4", "gi=14" }, - { 8, "1/8", "gi=18" }, - { 16, "1/16", "gi=116" }, - { 32, "1/32", "gi=132" }, - { 128, "1/128", "gi=1128" }, - { 19128, "19/128", "gi=19128" }, - { 19256, "19/256", "gi=19256" }, - { 999, trNOOP("auto"), "" }, - { -1, NULL, NULL } -}; - -static const tSatipParameterMap SatipRollOffValues[] = { - { 0, trNOOP("auto"), "" }, - { 20, "0.20", "ro=0.20" }, - { 25, "0.25", "ro=0.25" }, - { 35, "0.35", "ro=0.35" }, - { -1, NULL, NULL } -}; - -static int SatipUserIndex(int valueP, const tSatipParameterMap *mapP) -{ - const tSatipParameterMap *map = mapP; - while (map && map->userValue != -1) { - if (map->userValue == valueP) - return map - mapP; - map++; - } - return -1; -} - -static int SatipMapToUser(int valueP, const tSatipParameterMap *mapP, const char **strP) -{ - int n = SatipUserIndex(valueP, mapP); - if (n >= 0) { - if (strP) - *strP = tr(mapP[n].userString); - return mapP[n].userValue; - } - return -1; -} - -// --- cMenuEditSatipItem ----------------------------------------------------- - -class cMenuEditSatipItem : public cMenuEditItem { -protected: - int *valueM; - const tSatipParameterMap *mapM; - const char *zeroStringM; - virtual void Set(void); - -public: - cMenuEditSatipItem(const char *nameP, int *valueP, const tSatipParameterMap *mapP, const char *zeroStringP = NULL); - virtual eOSState ProcessKey(eKeys keyP); -}; - -cMenuEditSatipItem::cMenuEditSatipItem(const char *nameP, int *valueP, const tSatipParameterMap *mapP, const char *zeroStringP) -: cMenuEditItem(nameP) -{ - valueM = valueP; - mapM = mapP; - zeroStringM = zeroStringP; - Set(); -} - -void cMenuEditSatipItem::Set(void) -{ - const char *s = NULL; - int n = SatipMapToUser(*valueM, mapM, &s); - if (n == 0 && zeroStringM) - SetValue(zeroStringM); - else if (n >= 0) { - if (s) - SetValue(s); - else { - char buf[16]; - snprintf(buf, sizeof(buf), "%d", n); - SetValue(buf); - } - } - else - SetValue("???"); -} - -eOSState cMenuEditSatipItem::ProcessKey(eKeys keyP) -{ - eOSState state = cMenuEditItem::ProcessKey(keyP); - - if (state == osUnknown) { - int newValue = *valueM; - int n = SatipUserIndex(*valueM, mapM); - if (NORMALKEY(keyP) == kLeft) { // TODO might want to increase the delta if repeated quickly? - if (n-- > 0) - newValue = mapM[n].userValue; - } - else if (NORMALKEY(keyP) == kRight) { - if (mapM[++n].userValue >= 0) - newValue = mapM[n].userValue; - } - else - return state; - if (newValue != *valueM) { - *valueM = newValue; - Set(); - } - state = osContinue; - } - return state; -} - -// --- cSatipTransponderParameters -------------------------------------------- - -cSatipTransponderParameters::cSatipTransponderParameters(const char *parametersP) -: polarizationM('H'), - bandwidthM(8), - coderateHM(0), - systemM(0), - modulationM(999), - transmissionM(8), - guardM(999), - rollOffM(0), - streamIdM(0), - t2SystemIdM(0), - sisoMisoM(999), - pilotTonesM(0), - signalSourceM(1) -{ - Parse(parametersP); -} - -int cSatipTransponderParameters::PrintParameter(char *ptrP, char nameP, int valueP) const -{ - return (valueP >= 0 && valueP != 999) ? sprintf(ptrP, "%c%d", nameP, valueP) : 0; -} - -int cSatipTransponderParameters::PrintString(char *ptrP, int valueP, const tSatipParameterMap *mapP) -{ - int n = SatipUserIndex(valueP, mapP); - return (n >= 0) ? sprintf(ptrP, "&%s", tr(mapP[n].satipString)) : 0; -} - -cString cSatipTransponderParameters::UrlParameters(char typeP) -{ - char buffer[255]; - char *q = buffer; - *q = 0; -#define ST(s) if (strchr(s, typeP) && (strchr(s, '0' + systemM + 1) || strchr(s, '*'))) - ST("Z *") q += sprintf(q, "&src=%d", signalSourceM); - ST("Z *") q += sprintf(q, "&pol=%c", tolower(polarizationM)); - ST(" Y2") q += sprintf(q, "&plp=%d", streamIdM); - ST(" Y2") q += sprintf(q, "&t2id=%d", t2SystemIdM); - ST(" Y*") q += PrintString(q, bandwidthM, SatipBandwidthValues); - ST(" Y*") q += PrintString(q, guardM, SatipGuardValues); - ST("ZY*") q += PrintString(q, coderateHM, SatipCodeRateValues); - ST("Z 2") q += PrintString(q, pilotTonesM, SatipPilotTonesValues); - ST("Z 2") q += PrintString(q, modulationM, SatipModulationValues); - ST(" Y*") q += PrintString(q, modulationM, SatipModulationValues); - ST("Z 2") q += PrintString(q, rollOffM, SatipRollOffValues); - ST("Z *") q += PrintString(q, systemM, SatipSystemValuesSat); - ST(" Y*") q += PrintString(q, systemM, SatipSystemValuesTerr); - ST(" Y*") q += PrintString(q, transmissionM, SatipTransmissionValues); - ST(" Y2") q += PrintString(q, sisoMisoM, SatipSisoMisoValues); -#undef ST - return buffer; -} - -cString cSatipTransponderParameters::ToString(char typeP) const -{ - char buffer[64]; - char *q = buffer; - *q = 0; -#define ST(s) if (strchr(s, typeP) && (strchr(s, '0' + systemM + 1) || strchr(s, '*'))) - ST("Z *") q += sprintf(q, "%c", polarizationM); - ST(" Y*") q += PrintParameter(q, 'B', bandwidthM); - ST("ZY*") q += PrintParameter(q, 'C', coderateHM); - ST(" Y*") q += PrintParameter(q, 'G', guardM); - ST("Z 2") q += PrintParameter(q, 'M', modulationM); - ST(" Y*") q += PrintParameter(q, 'M', modulationM); - ST("Z 2") q += PrintParameter(q, 'N', pilotTonesM); - ST("Z 2") q += PrintParameter(q, 'O', rollOffM); - ST(" Y2") q += PrintParameter(q, 'P', streamIdM); - ST(" Y2") q += PrintParameter(q, 'Q', t2SystemIdM); - ST("ZY*") q += PrintParameter(q, 'S', systemM); - ST(" Y*") q += PrintParameter(q, 'T', transmissionM); - ST(" Y2") q += PrintParameter(q, 'X', sisoMisoM); - ST("Z *") q += PrintParameter(q, 'Z', signalSourceM); -#undef ST - return buffer; -} - -const char *cSatipTransponderParameters::ParseParameter(const char *strP, int &valueP) -{ - if (*++strP) { - char *p = NULL; - errno = 0; - int n = strtol(strP, &p, 10); - if (!errno && p != strP) { - valueP = n; - if (valueP >= 0) - return p; - } - } - error("invalid value for parameter '%c'", *(strP - 1)); - return NULL; -} - -bool cSatipTransponderParameters::Parse(const char *strP) -{ - while (strP && *strP) { - int ignoreThis; - switch (toupper(*strP)) { - case 'B': strP = ParseParameter(strP, bandwidthM); break; - case 'C': strP = ParseParameter(strP, coderateHM); break; - case 'G': strP = ParseParameter(strP, guardM); break; - case 'H': polarizationM = 'H'; strP++; break; - case 'L': polarizationM = 'L'; strP++; break; - case 'M': strP = ParseParameter(strP, modulationM); break; - case 'N': strP = ParseParameter(strP, pilotTonesM); break; - case 'O': strP = ParseParameter(strP, rollOffM); break; - case 'P': strP = ParseParameter(strP, streamIdM); break; - case 'Q': strP = ParseParameter(strP, t2SystemIdM); break; - case 'R': polarizationM = 'R'; strP++; break; - case 'S': strP = ParseParameter(strP, systemM); break; - case 'T': strP = ParseParameter(strP, transmissionM); break; - case 'V': polarizationM = 'V'; strP++; break; - case 'X': strP = ParseParameter(strP, sisoMisoM); break; - case 'Z': strP = ParseParameter(strP, signalSourceM); break; - case 'D': strP = ParseParameter(strP, ignoreThis); break; /* silently ignore coderate low priority */ - case 'I': strP = ParseParameter(strP, ignoreThis); break; /* silently ignore inversion */ - case 'Y': strP = ParseParameter(strP, ignoreThis); break; /* silently ignore hierarchy */ - default: esyslog("ERROR: unknown parameter key '%c'", *strP); - return false; - } - } - return true; -} - -// --- cSatipSourceParam ------------------------------------------------------ - -cSatipSourceParam::cSatipSourceParam(char sourceP, const char *descriptionP) -: cSourceParam(sourceP, descriptionP), - paramM(0), - nidM(0), - tidM(0), - ridM(0), - srateM(0), - dataM(), - stpM() -{ - debug("cSatipSourceParam::%s(%c, %s)", __FUNCTION__, sourceP, descriptionP); -} - -void cSatipSourceParam::SetData(cChannel *channelP) -{ - debug("cSatipSourceParam::%s(%s)", __FUNCTION__, channelP->Parameters()); - dataM = *channelP; - nidM = dataM.Nid(); - tidM = dataM.Tid(); - ridM = dataM.Rid(); - srateM = dataM.Srate(); - stpM.Parse(dataM.Parameters()); - paramM = 0; -} - -void cSatipSourceParam::GetData(cChannel *channelP) -{ - debug("cSatipSourceParam::%s(%s)", __FUNCTION__, channelP->Parameters()); - channelP->SetTransponderData(channelP->Source(), channelP->Frequency(), srateM, stpM.ToString(Source()), true); - channelP->SetId(nidM, tidM, channelP->Sid(), ridM); -} - -cOsdItem *cSatipSourceParam::GetOsdItem(void) -{ - char type = Source(); - const tSatipParameterMap *SatipSystemValues = type == 'Z' ? SatipSystemValuesSat : SatipSystemValuesTerr; -#define ST(s) if (strchr(s, type)) - switch (paramM++) { - case 0: return new cMenuEditIntItem( tr("Nid"), &nidM, 0); - case 1: return new cMenuEditIntItem( tr("Tid"), &tidM, 0); - case 2: return new cMenuEditIntItem( tr("Rid"), &ridM, 0); - case 3: ST("Z ") return new cMenuEditIntItem( trVDR("Srate"), &srateM); else return GetOsdItem(); - case 4: ST("Z ") return new cMenuEditIntItem( tr("SignalSource"), &stpM.signalSourceM, 1, 255); else return GetOsdItem(); - case 5: ST("Z ") return new cMenuEditChrItem( trVDR("Polarization"), &stpM.polarizationM, "HVLR"); else return GetOsdItem(); - case 6: ST("Z ") return new cMenuEditSatipItem(trVDR("Rolloff"), &stpM.rollOffM, SatipRollOffValues); else return GetOsdItem(); - case 7: ST("Z ") return new cMenuEditSatipItem( tr("PilotTones"), &stpM.pilotTonesM, SatipPilotTonesValues); else return GetOsdItem(); - case 8: ST("ZY") return new cMenuEditSatipItem(trVDR("System"), &stpM.systemM, SatipSystemValues); else return GetOsdItem(); - case 9: ST("ZY") return new cMenuEditSatipItem(trVDR("Modulation"), &stpM.modulationM, SatipModulationValues); else return GetOsdItem(); - case 10: ST("ZY") return new cMenuEditSatipItem(trVDR("CoderateH"), &stpM.coderateHM, SatipCodeRateValues); else return GetOsdItem(); - case 11: ST(" Y") return new cMenuEditSatipItem(trVDR("Bandwidth"), &stpM.bandwidthM, SatipBandwidthValues); else return GetOsdItem(); - case 12: ST(" Y") return new cMenuEditSatipItem(trVDR("Transmission"), &stpM.transmissionM, SatipTransmissionValues); else return GetOsdItem(); - case 13: ST(" Y") return new cMenuEditSatipItem(trVDR("Guard"), &stpM.guardM, SatipGuardValues); else return GetOsdItem(); - case 14: ST(" Y") return new cMenuEditIntItem( trVDR("StreamId"), &stpM.streamIdM, 0, 255); else return GetOsdItem(); - case 15: ST(" Y") return new cMenuEditIntItem( tr("T2SystemId"), &stpM.t2SystemIdM, 0, 65535); else return GetOsdItem(); - case 16: ST(" Y") return new cMenuEditSatipItem( tr("SISO/MISO"), &stpM.sisoMisoM, SatipSisoMisoValues); else return GetOsdItem(); - default: return NULL; - } -#undef ST - return NULL; -} diff --git a/source.h b/source.h deleted file mode 100644 index 0730c75..0000000 --- a/source.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - * source.h: SAT>IP plugin for the Video Disk Recorder - * - * See the README file for copyright information and how to reach the author. - * - */ - -#ifndef __SATIP_SOURCE_H -#define __SATIP_SOURCE_H - -#include -#include -#include "common.h" - -struct tSatipParameterMap { - int userValue; - const char *userString; - const char *satipString; -}; - -class cSatipTransponderParameters { - friend class cSatipSourceParam; - -private: - char polarizationM; - int bandwidthM; - int coderateHM; - int systemM; - int modulationM; - int transmissionM; - int guardM; - int rollOffM; - int streamIdM; - int t2SystemIdM; - int sisoMisoM; - int pilotTonesM; - int signalSourceM; - int PrintParameter(char *ptrP, char nameP, int valueP) const; - int PrintString(char *ptrP, int valueP, const tSatipParameterMap *mapP); - const char *ParseParameter(const char *strP, int &valueP); - -public: - cSatipTransponderParameters(const char *parametersP = NULL); - char Polarization(void) const { return polarizationM; } - int Bandwidth(void) const { return bandwidthM; } - int CoderateH(void) const { return coderateHM; } - int System(void) const { return systemM; } - int Modulation(void) const { return modulationM; } - int Transmission(void) const { return transmissionM; } - int Guard(void) const { return guardM; } - int RollOff(void) const { return rollOffM; } - int StreamId(void) const { return streamIdM; } - int T2SystemId(void) const { return t2SystemIdM; } - int SisoMiso(void) const { return sisoMisoM; } - int PilotTones(void) const { return pilotTonesM; } - int SignalSource(void) const { return signalSourceM; } - void SetPolarization(char polarizationP) { polarizationM = polarizationP; } - void SetBandwidth(int bandwidthP) { bandwidthM = bandwidthP; } - void SetCoderateH(int coderateHP) { coderateHM = coderateHP; } - void SetSystem(int systemP) { systemM = systemP; } - void SetModulation(int modulationP) { modulationM = modulationP; } - void SetTransmission(int transmissionP) { transmissionM = transmissionP; } - void SetGuard(int guardP) { guardM = guardP; } - void SetRollOff(int rollOffP) { rollOffM = rollOffP; } - void SetStreamId(int streamIdP) { streamIdM = streamIdP; } - void SetT2SystemId(int t2SystemIdP) { t2SystemIdM = t2SystemIdP; } - void SetSisoMiso(int sisoMisoP) { sisoMisoM = sisoMisoP; } - void SetPilotTones(int pilotTonesP) { pilotTonesM = pilotTonesP; } - void SetSignalSource(int signalSourceP) { signalSourceM = signalSourceP; } - cString UrlParameters(char typeP); - cString ToString(char typeP) const; - bool Parse(const char *strP); -}; - -class cSatipSourceParam : public cSourceParam -{ -private: - int paramM; - int nidM; - int tidM; - int ridM; - int srateM; - cChannel dataM; - cSatipTransponderParameters stpM; - -public: - cSatipSourceParam(char sourceP, const char *descriptionP); - virtual void SetData(cChannel *channelP); - virtual void GetData(cChannel *channelP); - virtual cOsdItem *GetOsdItem(void); -}; - -#endif // __SATIP_SOURCE_H diff --git a/tuner.c b/tuner.c index 76d00fc..04fd0bf 100644 --- a/tuner.c +++ b/tuner.c @@ -313,7 +313,7 @@ bool cSatipTuner::ValidateLatestResponse(void) void cSatipTuner::ParseReceptionParameters(const char *paramP) { - debug("cSatipTuner::%s(%s)", __FUNCTION__, paramP); + //debug("cSatipTuner::%s(%s)", __FUNCTION__, paramP); // DVB-S2: // ver=.;src=;tuner=,,,,,,,,,,,;pids=,..., // DVB-T2: @@ -380,7 +380,7 @@ bool cSatipTuner::SetSource(const char* addressP, const char *parameterP, const bool cSatipTuner::SetPid(int pidP, int typeP, bool onP) { - debug("cSatipTuner::%s(%d, %d, %d)", __FUNCTION__, pidP, typeP, onP); + //debug("cSatipTuner::%s(%d, %d, %d)", __FUNCTION__, pidP, typeP, onP); cMutexLock MutexLock(&mutexM); bool found = false; for (int i = 0; i < pidsM.Size(); ++i) { @@ -405,7 +405,7 @@ bool cSatipTuner::UpdatePids(void) { cMutexLock MutexLock(&mutexM); if (pidUpdateCacheM.TimedOut() && pidUpdatedM && pidsM.Size() && tunedM && handleM && !isempty(*streamAddrM) && (streamIdM > 0)) { - debug("cSatipTuner::%s()", __FUNCTION__); + //debug("cSatipTuner::%s()", __FUNCTION__); CURLcode res = CURLE_OK; //cString uri = cString::sprintf("rtsp://%s/stream=%d?%spids=%d", *streamAddrM, streamIdM, onP ? "add" : "del", pidP); cString uri = cString::sprintf("rtsp://%s/stream=%d?pids=", *streamAddrM, streamIdM);