summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CONTRIBUTORS2
-rw-r--r--HISTORY2
-rw-r--r--device.c4
-rw-r--r--device.h13
-rw-r--r--dvbdevice.c27
-rw-r--r--dvbdevice.h4
6 files changed, 40 insertions, 12 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index ed4a4904..0db5f2ab 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -1199,6 +1199,8 @@ Rolf Ahrenberg <Rolf.Ahrenberg@sci.fi>
for the "binary skip" patch
for adding support for LCN (Logical Channel Numbers)
for suggesting to change the naming of "binary skip mode" to "adaptive skip mode"
+ for adding a Status parameter to the interface of cDevice::SignalStats() and
+ cDvbDevice::SignalStats()
Ralf Klueber <ralf.klueber@vodafone.com>
for reporting a bug in cutting a recording if there is only a single editing mark
diff --git a/HISTORY b/HISTORY
index 79d170a7..5472efdb 100644
--- a/HISTORY
+++ b/HISTORY
@@ -9019,3 +9019,5 @@ Video Disk Recorder Revision History
Jessich).
- Changed the legacy delivery system name "DMBTH" to "DTMB", and added names for
DVBC_ANNEX_C and DVBC2.
+- Added a Status parameter to the interface of cDevice::SignalStats() and
+ cDvbDevice::SignalStats() (thanks to Rolf Ahrenberg).
diff --git a/device.c b/device.c
index 4a7a88e2..6a3ad6e7 100644
--- a/device.c
+++ b/device.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: device.c 4.18 2017/05/09 09:03:14 kls Exp $
+ * $Id: device.c 4.19 2017/05/09 11:24:47 kls Exp $
*/
#include "device.h"
@@ -750,7 +750,7 @@ const cPositioner *cDevice::Positioner(void) const
return NULL;
}
-bool cDevice::SignalStats(int &Valid, double *Strength, double *Cnr, double *BerPre, double *BerPost, double *Per) const
+bool cDevice::SignalStats(int &Valid, double *Strength, double *Cnr, double *BerPre, double *BerPost, double *Per, int *Status) const
{
return false;
}
diff --git a/device.h b/device.h
index 4796258b..f6aee4e9 100644
--- a/device.h
+++ b/device.h
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: device.h 4.8 2017/04/17 14:46:57 kls Exp $
+ * $Id: device.h 4.9 2017/05/09 11:24:47 kls Exp $
*/
#ifndef __DEVICE_H
@@ -112,6 +112,14 @@ public:
#define DTV_STAT_VALID_BERPRE 0x0004
#define DTV_STAT_VALID_BERPOST 0x0008
#define DTV_STAT_VALID_PER 0x0010
+#define DTV_STAT_VALID_STATUS 0x0020
+
+#define DTV_STAT_HAS_NONE 0x0000
+#define DTV_STAT_HAS_SIGNAL 0x0001
+#define DTV_STAT_HAS_CARRIER 0x0002
+#define DTV_STAT_HAS_VITERBI 0x0004
+#define DTV_STAT_HAS_SYNC 0x0008
+#define DTV_STAT_HAS_LOCK 0x0010
class cDevice : public cThread {
friend class cLiveSubtitle;
@@ -291,13 +299,14 @@ public:
///< move the satellite dish to the requested position (only applies to DVB-S
///< devices). If no positioner is involved, or this is not a DVB-S device,
///< NULL will be returned.
- virtual bool SignalStats(int &Valid, double *Strength = NULL, double *Cnr = NULL, double *BerPre = NULL, double *BerPost = NULL, double *Per = NULL) const;
+ virtual bool SignalStats(int &Valid, double *Strength = NULL, double *Cnr = NULL, double *BerPre = NULL, double *BerPost = NULL, double *Per = NULL, int *Status = NULL) const;
///< Returns statistics about the currently received signal (if available).
///< Strength is the signal strength in dBm (typical range -100dBm...0dBm).
///< Cnr is the carrier to noise ratio in dB (typical range 0dB...40dB).
///< BerPre is the bit error rate before the forward error correction (FEC).
///< BerPost is the bit error rate after the forward error correction (FEC).
///< Per is the block error rate after the forward error correction (FEC).
+ ///< Status is the masked frontend status (signal/carrier/viterbi/sync/lock).
///< Typical range for BerPre, BerPost and Per is 0...1.
///< If any of the given pointers is not NULL, the value of the respective signal
///< statistic is returned in it. Upon return, Valid holds a combination of
diff --git a/dvbdevice.c b/dvbdevice.c
index 489ac3cb..9e071067 100644
--- a/dvbdevice.c
+++ b/dvbdevice.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: dvbdevice.c 4.12 2017/05/09 09:44:10 kls Exp $
+ * $Id: dvbdevice.c 4.13 2017/05/09 11:50:38 kls Exp $
*/
#include "dvbdevice.h"
@@ -349,7 +349,7 @@ public:
void SetChannel(const cChannel *Channel);
bool Locked(int TimeoutMs = 0);
const cPositioner *Positioner(void) const { return positioner; }
- bool GetSignalStats(int &Valid, double *Strength = NULL, double *Cnr = NULL, double *BerPre = NULL, double *BerPost = NULL, double *Per = NULL) const;
+ bool GetSignalStats(int &Valid, double *Strength = NULL, double *Cnr = NULL, double *BerPre = NULL, double *BerPost = NULL, double *Per = NULL, int *Status = NULL) const;
int GetSignalStrength(void) const;
int GetSignalQuality(void) const;
};
@@ -574,14 +574,29 @@ bool cDvbTuner::GetFrontendStatus(fe_status_t &Status) const
}\
}
-bool cDvbTuner::GetSignalStats(int &Valid, double *Strength, double *Cnr, double *BerPre, double *BerPost, double *Per) const
+bool cDvbTuner::GetSignalStats(int &Valid, double *Strength, double *Cnr, double *BerPre, double *BerPost, double *Per, int *Status) const
{
ClearEventQueue();
+ fe_status_t FeStatus;
dtv_property Props[MAXFRONTENDCMDS];
dtv_properties CmdSeq;
memset(&Props, 0, sizeof(Props));
memset(&CmdSeq, 0, sizeof(CmdSeq));
CmdSeq.props = Props;
+ Valid = DTV_STAT_VALID_NONE;
+ if (ioctl(fd_frontend, FE_READ_STATUS, &FeStatus) != 0) {
+ esyslog("ERROR: frontend %d/%d: %m", adapter, frontend);
+ return false;
+ }
+ if (Status) {
+ *Status = DTV_STAT_HAS_NONE;
+ if (FeStatus & FE_HAS_SIGNAL) *Status |= DTV_STAT_HAS_SIGNAL;
+ if (FeStatus & FE_HAS_CARRIER) *Status |= DTV_STAT_HAS_CARRIER;
+ if (FeStatus & FE_HAS_VITERBI) *Status |= DTV_STAT_HAS_VITERBI;
+ if (FeStatus & FE_HAS_SYNC) *Status |= DTV_STAT_HAS_SYNC;
+ if (FeStatus & FE_HAS_LOCK) *Status |= DTV_STAT_HAS_LOCK;
+ Valid |= DTV_STAT_VALID_STATUS;
+ }
if (Strength) SETCMD(DTV_STAT_SIGNAL_STRENGTH, 0);
if (Cnr) SETCMD(DTV_STAT_CNR, 0);
if (BerPre) { SETCMD(DTV_STAT_PRE_ERROR_BIT_COUNT, 0);
@@ -594,7 +609,6 @@ bool cDvbTuner::GetSignalStats(int &Valid, double *Strength, double *Cnr, double
esyslog("ERROR: frontend %d/%d: %m", adapter, frontend);
return false;
}
- Valid = DTV_STAT_VALID_NONE;
int i = 0;
if (Strength) {
if (Props[i].u.st.len > 0) {
@@ -659,6 +673,7 @@ bool cDvbTuner::GetSignalStats(int &Valid, double *Strength, double *Cnr, double
}
#ifdef DEBUG_SIGNALSTATS
fprintf(stderr, "FE %d/%d: API5 %04X", adapter, frontend, Valid);
+ if ((Valid & DTV_STAT_VALID_STATUS) != 0) fprintf(stderr, " STAT=%04X", *Status);
if ((Valid & DTV_STAT_VALID_STRENGTH) != 0) fprintf(stderr, " STR=%1.1fdBm", *Strength);
if ((Valid & DTV_STAT_VALID_CNR) != 0) fprintf(stderr, " CNR=%1.1fdB", *Cnr);
if ((Valid & DTV_STAT_VALID_BERPRE) != 0) fprintf(stderr, " BERPRE=%1.1e", *BerPre);
@@ -1841,9 +1856,9 @@ const cPositioner *cDvbDevice::Positioner(void) const
return dvbTuner ? dvbTuner->Positioner() : NULL;
}
-bool cDvbDevice::SignalStats(int &Valid, double *Strength, double *Cnr, double *BerPre, double *BerPost, double *Per) const
+bool cDvbDevice::SignalStats(int &Valid, double *Strength, double *Cnr, double *BerPre, double *BerPost, double *Per, int *Status) const
{
- return dvbTuner ? dvbTuner->GetSignalStats(Valid, Strength, Cnr, BerPre, BerPost, Per) : false;
+ return dvbTuner ? dvbTuner->GetSignalStats(Valid, Strength, Cnr, BerPre, BerPost, Per, Status) : false;
}
int cDvbDevice::SignalStrength(void) const
diff --git a/dvbdevice.h b/dvbdevice.h
index edc94608..0490a44f 100644
--- a/dvbdevice.h
+++ b/dvbdevice.h
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: dvbdevice.h 4.3 2017/04/17 14:44:43 kls Exp $
+ * $Id: dvbdevice.h 4.4 2017/05/09 11:24:47 kls Exp $
*/
#ifndef __DVBDEVICE_H
@@ -244,7 +244,7 @@ public:
virtual bool ProvidesEIT(void) const;
virtual int NumProvidedSystems(void) const;
virtual const cPositioner *Positioner(void) const;
- virtual bool SignalStats(int &Valid, double *Strength = NULL, double *Cnr = NULL, double *BerPre = NULL, double *BerPost = NULL, double *Per = NULL) const;
+ virtual bool SignalStats(int &Valid, double *Strength = NULL, double *Cnr = NULL, double *BerPre = NULL, double *BerPost = NULL, double *Per = NULL, int *Status = NULL) const;
virtual int SignalStrength(void) const;
virtual int SignalQuality(void) const;
virtual const cChannel *GetCurrentlyTunedTransponder(void) const;