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

Switched to standard 'S' and 'T' sources.

Added a new OperationMode setup parameter.
Added new SVDRP commands.
This commit is contained in:
Rolf Ahrenberg 2014-03-10 21:21:08 +02:00
parent 476f8be52b
commit 8c05ce31f9
19 changed files with 416 additions and 728 deletions

View File

@ -6,3 +6,9 @@ VDR Plugin 'satip' Revision History
- Initial revision. - Initial revision.
- Added German translation (Thanks to Frank Neumann). - 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.

View File

@ -77,8 +77,8 @@ all-redirect: all
### The object files (add further files here): ### The object files (add further files here):
OBJS = $(PLUGIN).o common.o config.o device.o discover.o \ OBJS = $(PLUGIN).o common.o config.o device.o discover.o param.o \
sectionfilter.o setup.o socket.o source.o statistics.o tuner.o sectionfilter.o setup.o socket.o statistics.o tuner.o
### The main target: ### The main target:

136
README
View File

@ -32,9 +32,35 @@ Installation:
tar -xzf /put/your/path/here/vdr-satip-X.Y.Z.tgz tar -xzf /put/your/path/here/vdr-satip-X.Y.Z.tgz
make -C satip-X.Y.Z install 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: 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 from VDR's EIT background scanning, set
this option to "no". this option to "no".
- Disabled filters = none Certain section filters might cause some - Disabled filters = none Certain section filters might cause some
@ -57,108 +83,6 @@ Information menu:
- [Yellow:Filters] Opens the section filter statistics page. - [Yellow:Filters] Opens the section filter statistics page.
- [Blue:Bits/bytes] Toggles between bits and bytes mode. - [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: Notes:
- The stream id "-1" states about unsuccessful tuning. This might be a - 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 - If the plugin doesn't detect your SAT>IP network device, make sure
your setup doesn't have firewalled the UDP port 1900. 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: Acknowledgements:
- Big thanks to Digital Devices GmbH for providing the Octopus Net - Big thanks to Digital Devices GmbH for providing the Octopus Net

View File

@ -11,7 +11,8 @@
cSatipConfig SatipConfig; cSatipConfig SatipConfig;
cSatipConfig::cSatipConfig(void) cSatipConfig::cSatipConfig(void)
: eitScanM(1), : operatingModeM(OPERATING_MODE_LOW),
eitScanM(1),
useBytesM(1) useBytesM(1)
{ {
for (unsigned int i = 0; i < ARRAY_SIZE(disabledFiltersM); ++i) for (unsigned int i = 0; i < ARRAY_SIZE(disabledFiltersM); ++i)

View File

@ -14,19 +14,34 @@
class cSatipConfig class cSatipConfig
{ {
private: private:
unsigned int operatingModeM;
unsigned int eitScanM; unsigned int eitScanM;
unsigned int useBytesM; unsigned int useBytesM;
int disabledFiltersM[SECTION_FILTER_TABLE_SIZE]; int disabledFiltersM[SECTION_FILTER_TABLE_SIZE];
char configDirectoryM[PATH_MAX]; char configDirectoryM[PATH_MAX];
public: public:
enum {
OPERATING_MODE_OFF = 0,
OPERATING_MODE_LOW,
OPERATING_MODE_NORMAL,
OPERATING_MODE_HIGH,
NUMBER_OF_OPERATING_MODES
};
cSatipConfig(); 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 GetEITScan(void) const { return eitScanM; }
unsigned int GetUseBytes(void) const { return useBytesM; } unsigned int GetUseBytes(void) const { return useBytesM; }
const char *GetConfigDirectory(void) const { return configDirectoryM; } const char *GetConfigDirectory(void) const { return configDirectoryM; }
unsigned int GetDisabledFiltersCount(void) const; unsigned int GetDisabledFiltersCount(void) const;
int GetDisabledFilters(unsigned int indexP) const; int GetDisabledFilters(unsigned int indexP) const;
void SetOperatingMode(unsigned int operatingModeP) { operatingModeM = operatingModeP; }
void SetEITScan(unsigned int onOffP) { eitScanM = onOffP; } void SetEITScan(unsigned int onOffP) { eitScanM = onOffP; }
void SetUseBytes(unsigned int onOffP) { useBytesM = onOffP; } void SetUseBytes(unsigned int onOffP) { useBytesM = onOffP; }
void SetConfigDirectory(const char *directoryP); void SetConfigDirectory(const char *directoryP);

View File

@ -7,7 +7,7 @@
#include "config.h" #include "config.h"
#include "discover.h" #include "discover.h"
#include "source.h" #include "param.h"
#include "device.h" #include "device.h"
#define SATIP_MAX_DEVICES MAXDEVICES #define SATIP_MAX_DEVICES MAXDEVICES
@ -49,8 +49,6 @@ cSatipDevice::~cSatipDevice()
bool cSatipDevice::Initialize(unsigned int deviceCountP) bool cSatipDevice::Initialize(unsigned int deviceCountP)
{ {
debug("cSatipDevice::%s(%u)", __FUNCTION__, 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) if (deviceCountP > SATIP_MAX_DEVICES)
deviceCountP = SATIP_MAX_DEVICES; deviceCountP = SATIP_MAX_DEVICES;
for (unsigned int i = 0; i < deviceCountP; ++i) for (unsigned int i = 0; i < deviceCountP; ++i)
@ -158,6 +156,12 @@ cString cSatipDevice::DeviceName(void) const
return deviceNameM; return deviceNameM;
} }
bool cSatipDevice::AvoidRecording(void) const
{
//debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM);
return SatipConfig.IsOperatingModeLow();
}
int cSatipDevice::SignalStrength(void) const int cSatipDevice::SignalStrength(void) const
{ {
//debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM); //debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM);
@ -173,12 +177,7 @@ int cSatipDevice::SignalQuality(void) const
bool cSatipDevice::ProvidesSource(int sourceP) const bool cSatipDevice::ProvidesSource(int sourceP) const
{ {
debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM); debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM);
int model = 0; return (!SatipConfig.IsOperatingModeOff() && !!cSatipDiscover::GetInstance()->GetServer(sourceP));
if (cSource::IsType(sourceP, 'Z'))
model |= cSatipServer::eSatipModelTypeDVBS2;
if (cSource::IsType(sourceP, 'Y'))
model |= cSatipServer::eSatipModelTypeDVBT2 | cSatipServer::eSatipModelTypeDVBT;
return !!cSatipDiscover::GetInstance()->GetServer(model);
} }
bool cSatipDevice::ProvidesTransponder(const cChannel *channelP) const bool cSatipDevice::ProvidesTransponder(const cChannel *channelP) const
@ -230,7 +229,18 @@ bool cSatipDevice::ProvidesEIT(void) const
int cSatipDevice::NumProvidedSystems(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 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) bool cSatipDevice::SetChannelDevice(const cChannel *channelP, bool liveViewP)
{ {
if (channelP) { if (channelP) {
cSatipTransponderParameters stp(channelP->Parameters()); cDvbTransponderParameters dtp(channelP->Parameters());
cString params = stp.UrlParameters(cSource::ToChar(channelP->Source())); cString params = GetTransponderUrlParameters(channelP);
if (isempty(params)) {
error("Unrecognized SAT>IP channel parameters: %s", channelP->Parameters());
return false;
}
cString address; cString address;
int mode = 0; cSatipServer *server = cSatipDiscover::GetInstance()->GetServer(channelP->Source(), dtp.System());
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);
if (!server) { if (!server) {
debug("cSatipDevice::%s(%u): no suitable server found", __FUNCTION__, deviceIndexM); debug("cSatipDevice::%s(%u): no suitable server found", __FUNCTION__, deviceIndexM);
return false; return false;
} }
address = server->Address(); 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)) { if (pTunerM && pTunerM->SetSource(*address, *params, deviceIndexM)) {
deviceNameM = cString::sprintf("%s %d %s:%s:%s", *DeviceType(), deviceIndexM, server->Address(), server->Model(), server->Description()); deviceNameM = cString::sprintf("%s %d %s:%s:%s", *DeviceType(), deviceIndexM, server->Address(), server->Model(), server->Description());
channelM = *channelP; channelM = *channelP;

View File

@ -56,6 +56,7 @@ private:
public: public:
virtual cString DeviceType(void) const; virtual cString DeviceType(void) const;
virtual cString DeviceName(void) const; virtual cString DeviceName(void) const;
virtual bool AvoidRecording(void) const;
virtual int SignalStrength(void) const; virtual int SignalStrength(void) const;
virtual int SignalQuality(void) const; virtual int SignalQuality(void) const;

View File

@ -241,12 +241,21 @@ bool cSatipDiscover::IsValidServer(cSatipServer *serverP)
return false; 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); 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)) { for (cSatipServer *srv = serversM->First(); srv; srv = serversM->Next(srv)) {
if (srv->Match(modelP)) if (srv->Match(model))
return srv; return srv;
} }
return NULL; return NULL;
@ -275,9 +284,11 @@ int cSatipDiscover::NumProvidedSystems(void)
cMutexLock MutexLock(&mutexM); cMutexLock MutexLock(&mutexM);
int count = 0; int count = 0;
for (cSatipServer *srv = serversM->First(); srv; srv = serversM->Next(srv)) { for (cSatipServer *srv = serversM->First(); srv; srv = serversM->Next(srv)) {
count += srv->Satellite(); // DVB-S*: qpsk, 8psk
count += srv->Terrestrial(); count += srv->Satellite() * 4;
count += srv->Terrestrial2(); // DVB-T*: qpsk, qam16, qam64, qam256
count += (srv->Terrestrial2() ? srv->Terrestrial2() : srv->Terrestrial()) * 4;
} }
count = 1;
return count; return count;
} }

View File

@ -120,7 +120,7 @@ public:
static void Destroy(void); static void Destroy(void);
virtual ~cSatipDiscover(); virtual ~cSatipDiscover();
bool IsValidServer(cSatipServer *serverP); bool IsValidServer(cSatipServer *serverP);
cSatipServer *GetServer(int modelP); cSatipServer *GetServer(int sourceP, int systemP = -1);
cSatipServers *GetServers(void); cSatipServers *GetServers(void);
cString GetServerList(void); cString GetServerList(void);
int NumProvidedSystems(void); int NumProvidedSystems(void);

168
param.c Normal file
View File

@ -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 <ctype.h>
#include <vdr/dvbdevice.h>
#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;
}

15
param.h Normal file
View File

@ -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

View File

@ -5,10 +5,10 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: vdr-satip 0.0.1\n" "Project-Id-Version: vdr-satip 0.0.2\n"
"Report-Msgid-Bugs-To: <see README>\n" "Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2014-03-08 03:08+0200\n" "POT-Creation-Date: 2014-03-15 03:15+0200\n"
"PO-Revision-Date: 2014-03-08 03:08+0200\n" "PO-Revision-Date: 2014-03-15 03:15+0200\n"
"Last-Translator: Frank Neumann <fnu@yavdr.org>\n" "Last-Translator: Frank Neumann <fnu@yavdr.org>\n"
"Language-Team: German <vdr@linuxtv.org>\n" "Language-Team: German <vdr@linuxtv.org>\n"
"Language: de\n" "Language: de\n"
@ -43,9 +43,6 @@ msgstr "SAT>IP Geräte"
msgid "SAT>IP Device" msgid "SAT>IP Device"
msgstr "SAT>IP Gerät" msgstr "SAT>IP Gerät"
msgid "Button$Scan"
msgstr "Starte Kanalsuche"
msgid "SAT>IP Information" msgid "SAT>IP Information"
msgstr "SAT>IP Informationen" msgstr "SAT>IP Informationen"
@ -64,6 +61,36 @@ msgstr "Bits/Bytes"
msgid "SAT>IP information not available!" msgid "SAT>IP information not available!"
msgstr "Keine SAT>IP Informationen verfügbar!" 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" msgid "Enable EPG scanning"
msgstr "Aktiviere EPG Aktualisierung" msgstr "Aktiviere EPG Aktualisierung"
@ -76,7 +103,6 @@ msgstr ""
"\n" "\n"
"Diese Einstellung schaltet die automatische EIT Aktualisierung für alle SAT>IP Geräte." "Diese Einstellung schaltet die automatische EIT Aktualisierung für alle SAT>IP Geräte."
msgid "Disabled filters" msgid "Disabled filters"
msgstr "Deaktivierte Filter" msgstr "Deaktivierte Filter"
@ -103,39 +129,3 @@ msgstr "Aktive SAT>IP Geräte:"
msgid "Help" msgid "Help"
msgstr "Hilfe" 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"

View File

@ -5,10 +5,10 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: vdr-satip 0.0.1\n" "Project-Id-Version: vdr-satip 0.0.2\n"
"Report-Msgid-Bugs-To: <see README>\n" "Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2014-03-08 03:08+0200\n" "POT-Creation-Date: 2014-03-15 03:15+0200\n"
"PO-Revision-Date: 2014-03-08 03:08+0200\n" "PO-Revision-Date: 2014-03-15 03:15+0200\n"
"Last-Translator: Rolf Ahrenberg\n" "Last-Translator: Rolf Ahrenberg\n"
"Language-Team: Finnish <vdr@linuxtv.org>\n" "Language-Team: Finnish <vdr@linuxtv.org>\n"
"Language: fi\n" "Language: fi\n"
@ -43,9 +43,6 @@ msgstr "SAT>IP-laitteet"
msgid "SAT>IP Device" msgid "SAT>IP Device"
msgstr "SAT>IP-laite" msgstr "SAT>IP-laite"
msgid "Button$Scan"
msgstr "Kanavahaku"
msgid "SAT>IP Information" msgid "SAT>IP Information"
msgstr "SAT>IP-tiedot" msgstr "SAT>IP-tiedot"
@ -64,6 +61,35 @@ msgstr "Bitit/tavut"
msgid "SAT>IP information not available!" msgid "SAT>IP information not available!"
msgstr "SAT>IP-tietoja ei saatavilla!" 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" msgid "Enable EPG scanning"
msgstr "Käytä ohjelmaoppaan taustapäivitystä" msgstr "Käytä ohjelmaoppaan taustapäivitystä"
@ -102,39 +128,3 @@ msgstr "Aktiiviset SAT>IP-laitteet:"
msgid "Help" msgid "Help"
msgstr "Opaste" 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"

28
satip.c
View File

@ -21,7 +21,7 @@
#define GITVERSION "" #define GITVERSION ""
#endif #endif
const char VERSION[] = "0.0.1" GITVERSION; const char VERSION[] = "0.0.2" GITVERSION;
static const char DESCRIPTION[] = trNOOP("SAT>IP Devices"); static const char DESCRIPTION[] = trNOOP("SAT>IP Devices");
class cPluginSatip : public cPlugin { class cPluginSatip : public cPlugin {
@ -194,6 +194,8 @@ bool cPluginSatip::SetupParse(const char *nameP, const char *valueP)
{ {
debug("cPluginSatip::%s()", __FUNCTION__); debug("cPluginSatip::%s()", __FUNCTION__);
// Parse your own setup parameters and store their values. // Parse your own setup parameters and store their values.
if (!strcasecmp(nameP, "OperatingMode"))
SatipConfig.SetOperatingMode(atoi(valueP));
if (!strcasecmp(nameP, "EnableEITScan")) if (!strcasecmp(nameP, "EnableEITScan"))
SatipConfig.SetEITScan(atoi(valueP)); SatipConfig.SetEITScan(atoi(valueP));
else if (!strcasecmp(nameP, "DisabledFilters")) { else if (!strcasecmp(nameP, "DisabledFilters")) {
@ -229,6 +231,8 @@ const char **cPluginSatip::SVDRPHelpPages(void)
" Lists active SAT>IP servers.\n", " Lists active SAT>IP servers.\n",
"CONT\n" "CONT\n"
" Shows SAT>IP device count.\n", " Shows SAT>IP device count.\n",
"OPER\n"
" Toggles operating mode of SAT>IP devices.\n",
NULL NULL
}; };
return HelpPages; return HelpPages;
@ -284,6 +288,28 @@ cString cPluginSatip::SVDRPCommand(const char *commandP, const char *optionP, in
else if (strcasecmp(commandP, "CONT") == 0) { else if (strcasecmp(commandP, "CONT") == 0) {
return cString::sprintf("SAT>IP device count: %u", cSatipDevice::Count()); 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; return NULL;
} }

52
setup.c
View File

@ -14,9 +14,9 @@
#include "discover.h" #include "discover.h"
#include "setup.h" #include "setup.h"
// --- cSatipMenuScan --------------------------------------------------------- // --- cSatipServerInfo -------------------------------------------------------
class cSatipMenuScan : public cOsdMenu class cSatipServerInfo : public cOsdMenu
{ {
private: private:
enum { enum {
@ -26,13 +26,13 @@ private:
cTimeMs timeoutM; cTimeMs timeoutM;
public: public:
cSatipMenuScan(cSatipServer *serverP); cSatipServerInfo(cSatipServer *serverP);
virtual ~cSatipMenuScan(); virtual ~cSatipServerInfo();
virtual void Display(void); virtual void Display(void);
virtual eOSState ProcessKey(eKeys keyP); virtual eOSState ProcessKey(eKeys keyP);
}; };
cSatipMenuScan::cSatipMenuScan(cSatipServer *serverP) cSatipServerInfo::cSatipServerInfo(cSatipServer *serverP)
: cOsdMenu(tr("SAT>IP Device")), : cOsdMenu(tr("SAT>IP Device")),
textM("") textM("")
{ {
@ -45,14 +45,14 @@ cSatipMenuScan::cSatipMenuScan(cSatipServer *serverP)
if (serverP->Description()) if (serverP->Description())
textM = cString::sprintf("%s\nDescription:\t%s", *textM, 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(); cOsdMenu::Display();
DisplayMenu()->SetText(textM, true); DisplayMenu()->SetText(textM, true);
@ -60,7 +60,7 @@ void cSatipMenuScan::Display(void)
cStatus::MsgOsdTextItem(textM); cStatus::MsgOsdTextItem(textM);
} }
eOSState cSatipMenuScan::ProcessKey(eKeys keyP) eOSState cSatipServerInfo::ProcessKey(eKeys keyP)
{ {
eOSState state = cOsdMenu::ProcessKey(keyP); eOSState state = cOsdMenu::ProcessKey(keyP);
@ -75,7 +75,7 @@ eOSState cSatipMenuScan::ProcessKey(eKeys keyP)
return state; return state;
} }
// --- cSatipMenuInfo --------------------------------------------------------- // --- cSatipServerItem -------------------------------------------------------
class cSatipServerItem : public cOsdItem { class cSatipServerItem : public cOsdItem {
private: private:
@ -203,10 +203,15 @@ eOSState cSatipMenuInfo::ProcessKey(eKeys keyP)
cSatipPluginSetup::cSatipPluginSetup() cSatipPluginSetup::cSatipPluginSetup()
: deviceCountM(0), : deviceCountM(0),
operatingModeM(SatipConfig.GetOperatingMode()),
eitScanM(SatipConfig.GetEITScan()), eitScanM(SatipConfig.GetEITScan()),
numDisabledFiltersM(SatipConfig.GetDisabledFiltersCount()) numDisabledFiltersM(SatipConfig.GetDisabledFiltersCount())
{ {
debug("cSatipPluginSetup::%s()", __FUNCTION__); 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) if (numDisabledFiltersM > SECTION_FILTER_TABLE_SIZE)
numDisabledFiltersM = SECTION_FILTER_TABLE_SIZE; numDisabledFiltersM = SECTION_FILTER_TABLE_SIZE;
for (int i = 0; i < SECTION_FILTER_TABLE_SIZE; ++i) { for (int i = 0; i < SECTION_FILTER_TABLE_SIZE; ++i) {
@ -225,17 +230,21 @@ void cSatipPluginSetup::Setup(void)
Clear(); Clear();
helpM.Clear(); helpM.Clear();
Add(new cMenuEditBoolItem(tr("Enable EPG scanning"), &eitScanM)); Add(new cMenuEditStraItem(tr("Operating mode"), &operatingModeM, ELEMENTS(operatingModeTextsM), operatingModeTextsM));
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.")); 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"))); if (operatingModeM) {
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.")); 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 cMenuEditIntItem(tr("Disabled filters"), &numDisabledFiltersM, 0, SECTION_FILTER_TABLE_SIZE, tr("none")));
Add(new cMenuEditStraItem(*cString::sprintf(" %s %d", tr("Filter"), i + 1), &disabledFilterIndexesM[i], SECTION_FILTER_TABLE_SIZE, disabledFilterNamesM)); 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."));
helpM.Append(tr("Define an ill-behaving filter to be blacklisted."));
}
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)); Add(new cOsdItem(tr("Active SAT>IP devices:"), osUnknown, false));
helpM.Append(""); helpM.Append("");
@ -258,7 +267,7 @@ eOSState cSatipPluginSetup::ChannelScan(void)
cSatipServerItem *item = reinterpret_cast<cSatipServerItem *>(Get(Current())); cSatipServerItem *item = reinterpret_cast<cSatipServerItem *>(Get(Current()));
if (item && cSatipDiscover::GetInstance()->IsValidServer(item->Server())) if (item && cSatipDiscover::GetInstance()->IsValidServer(item->Server()))
return AddSubMenu(new cSatipMenuScan(item->Server())); return AddSubMenu(new cSatipServerInfo(item->Server()));
return osContinue; return osContinue;
} }
@ -275,6 +284,7 @@ eOSState cSatipPluginSetup::ShowInfo(void)
eOSState cSatipPluginSetup::ProcessKey(eKeys keyP) eOSState cSatipPluginSetup::ProcessKey(eKeys keyP)
{ {
bool hadSubMenu = HasSubMenu(); bool hadSubMenu = HasSubMenu();
int oldOperatingMode = operatingModeM;
int oldNumDisabledFilters = numDisabledFiltersM; int oldNumDisabledFilters = numDisabledFiltersM;
eOSState state = cMenuSetupPage::ProcessKey(keyP); eOSState state = cMenuSetupPage::ProcessKey(keyP);
@ -295,7 +305,7 @@ eOSState cSatipPluginSetup::ProcessKey(eKeys keyP)
if ((keyP == kNone) && (cSatipDiscover::GetInstance()->GetServers()->Count() != deviceCountM)) if ((keyP == kNone) && (cSatipDiscover::GetInstance()->GetServers()->Count() != deviceCountM))
Setup(); Setup();
if ((keyP != kNone) && (numDisabledFiltersM != oldNumDisabledFilters)) { if ((keyP != kNone) && ((numDisabledFiltersM != oldNumDisabledFilters) || (operatingModeM != oldOperatingMode))) {
while ((numDisabledFiltersM < oldNumDisabledFilters) && (oldNumDisabledFilters > 0)) while ((numDisabledFiltersM < oldNumDisabledFilters) && (oldNumDisabledFilters > 0))
disabledFilterIndexesM[--oldNumDisabledFilters] = -1; disabledFilterIndexesM[--oldNumDisabledFilters] = -1;
Setup(); Setup();
@ -326,9 +336,11 @@ void cSatipPluginSetup::StoreFilters(const char *nameP, int *valuesP)
void cSatipPluginSetup::Store(void) void cSatipPluginSetup::Store(void)
{ {
// Store values into setup.conf // Store values into setup.conf
SetupStore("OperatingMode", operatingModeM);
SetupStore("EnableEITScan", eitScanM); SetupStore("EnableEITScan", eitScanM);
StoreFilters("DisabledFilters", disabledFilterIndexesM); StoreFilters("DisabledFilters", disabledFilterIndexesM);
// Update global config // Update global config
SatipConfig.SetOperatingMode(operatingModeM);
SatipConfig.SetEITScan(eitScanM); SatipConfig.SetEITScan(eitScanM);
for (int i = 0; i < SECTION_FILTER_TABLE_SIZE; ++i) for (int i = 0; i < SECTION_FILTER_TABLE_SIZE; ++i)
SatipConfig.SetDisabledFilters(i, disabledFilterIndexesM[i]); SatipConfig.SetDisabledFilters(i, disabledFilterIndexesM[i]);

View File

@ -16,6 +16,8 @@ class cSatipPluginSetup : public cMenuSetupPage
{ {
private: private:
int deviceCountM; int deviceCountM;
int operatingModeM;
const char *operatingModeTextsM[4];
int eitScanM; int eitScanM;
int numDisabledFiltersM; int numDisabledFiltersM;
int disabledFilterIndexesM[SECTION_FILTER_TABLE_SIZE]; int disabledFilterIndexesM[SECTION_FILTER_TABLE_SIZE];

384
source.c
View File

@ -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 <ctype.h>
#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;
}

View File

@ -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 <vdr/menuitems.h>
#include <vdr/sourceparams.h>
#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

View File

@ -313,7 +313,7 @@ bool cSatipTuner::ValidateLatestResponse(void)
void cSatipTuner::ParseReceptionParameters(const char *paramP) void cSatipTuner::ParseReceptionParameters(const char *paramP)
{ {
debug("cSatipTuner::%s(%s)", __FUNCTION__, paramP); //debug("cSatipTuner::%s(%s)", __FUNCTION__, paramP);
// DVB-S2: // DVB-S2:
// ver=<major>.<minor>;src=<srcID>;tuner=<feID>,<level>,<lock>,<quality>,<frequency>,<polarisation>,<system>,<type>,<pilots>,<roll_off>,<symbol_rate>,<fec_inner>;pids=<pid0>,...,<pidn> // ver=<major>.<minor>;src=<srcID>;tuner=<feID>,<level>,<lock>,<quality>,<frequency>,<polarisation>,<system>,<type>,<pilots>,<roll_off>,<symbol_rate>,<fec_inner>;pids=<pid0>,...,<pidn>
// DVB-T2: // 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) 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); cMutexLock MutexLock(&mutexM);
bool found = false; bool found = false;
for (int i = 0; i < pidsM.Size(); ++i) { for (int i = 0; i < pidsM.Size(); ++i) {
@ -405,7 +405,7 @@ bool cSatipTuner::UpdatePids(void)
{ {
cMutexLock MutexLock(&mutexM); cMutexLock MutexLock(&mutexM);
if (pidUpdateCacheM.TimedOut() && pidUpdatedM && pidsM.Size() && tunedM && handleM && !isempty(*streamAddrM) && (streamIdM > 0)) { if (pidUpdateCacheM.TimedOut() && pidUpdatedM && pidsM.Size() && tunedM && handleM && !isempty(*streamAddrM) && (streamIdM > 0)) {
debug("cSatipTuner::%s()", __FUNCTION__); //debug("cSatipTuner::%s()", __FUNCTION__);
CURLcode res = CURLE_OK; 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?%spids=%d", *streamAddrM, streamIdM, onP ? "add" : "del", pidP);
cString uri = cString::sprintf("rtsp://%s/stream=%d?pids=", *streamAddrM, streamIdM); cString uri = cString::sprintf("rtsp://%s/stream=%d?pids=", *streamAddrM, streamIdM);