Go to the documentation of this file.
9 #include <sys/select.h>
24 #define LOC QString("V4L2SigMon[%1](%2): ").arg(m_inputid).arg(m_channel->GetDevice())
45 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"ctor");
50 LOG(VB_GENERAL, LOG_ERR,
LOC +
"ctor -- Open failed");
58 LOG(VB_CHANNEL, LOG_INFO,
LOC + QString(
"%1 stream.")
59 .arg(
m_isTS ?
"Transport" :
"Program"));
67 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"dtor");
78 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"Stop() -- begin");
84 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"Stop() -- end");
125 LOG(VB_CHANNEL, LOG_INFO,
LOC + QString(
"isLocked: %1").arg(isLocked));
146 chn->GetAudioDevice().toInt(),
m_inputid);
149 LOG(VB_GENERAL, LOG_ERR,
LOC +
150 "V4L2encSignalMonitor -- failed to start StreamHandler.");
166 LOG(VB_CHANNEL, LOG_INFO,
LOC +
167 "GetSignalStrengthPercent() -- v4l2 device not open");
198 LOG(VB_CHANNEL, LOG_INFO,
LOC +
199 QString(
"Resolution already stable at %1 x %2")
200 .arg(width).arg(height));
203 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Device wedged?");
211 LOG(VB_CHANNEL, LOG_INFO, QString(
"Resolution %1 x %2")
212 .arg(width).arg(height));
219 LOG(VB_CHANNEL, LOG_INFO, QString(
"Resolution stable at %1 x %2")
220 .arg(width).arg(height));
234 LOG(VB_CHANNEL, LOG_WARNING,
"Waiting for valid resolution");
static void Return(V4L2encStreamHandler *&ref, int inputid)
std::chrono::milliseconds elapsed(void)
Returns milliseconds elapsed since last start() or restart()
void RemoveFlags(uint64_t _flags) override
bool GetResolution(int &width, int &height) const
void SetValue(int _value)
bool HasError(void) const
static const uint64_t kDTVSigMon_WaitForMGT
void stop(void)
Stops timer, next call to isRunning() will return false and any calls to elapsed() or restart() will ...
~V4L2encSignalMonitor() override
Stops signal monitoring and table monitoring threads.
bool isRunning(void) const
Returns true if start() or restart() has been called at least once since construction and since any c...
MPEGStreamData * GetStreamData()
Returns the MPEG stream data if it exists.
void start(void)
starts measuring elapsed time.
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
bool HasAnyFlag(uint64_t _flags) const
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
virtual void RemoveListener(MPEGStreamData *data)
QRecursiveMutex m_statusLock
SignalMonitorValue m_scriptStatus
SignalMonitorValue m_signalStrength
static const uint64_t kDVBSigMon_WaitForPos
Wait for rotor to complete turning the antenna.
int StableResolution(void)
Wait for a stable signal.
SignalMonitorValue m_signalLock
void SendMessageAllGood(void)
static const uint64_t kDTVSigMon_WaitForPMT
static const uint64_t kDTVSigMon_WaitForPAT
static const uint64_t kDTVSigMon_WaitForNIT
bool Open(const QString &dev_name, const QString &vbi_dev_name="")
virtual void EmitStatus(void)
static const uint64_t kDTVSigMon_WaitForSDT
virtual void UpdateValues(void)
This should be overridden to actually do signal monitoring.
V4L2encStreamHandler * m_streamHandler
void SetRange(int _min, int _max)
Sets the minimum and maximum values.
bool IsGood() const
Returns true if the value is equal to the threshold, or on the right side of the threshold (depends o...
V4L2encSignalMonitor(void)
void Stop(void) override
Stop signal monitoring and table monitoring threads.
This class is intended to detect the presence of needed tables.
virtual QString GetDevice(void) const
Returns String representing device, useful for debugging.
virtual void AddListener(MPEGStreamData *data, bool allow_section_reader=false, bool needs_buffering=false, const QString &output_file=QString())
static V4L2encStreamHandler * Get(const QString &devname, int audioinput, int inputid)
int GetStreamType(void) const
virtual void Stop()
Stop signal monitoring thread.
void UpdateValues(void) override
Fills in frontend stats and emits status Qt signals.
std::chrono::milliseconds m_stableTime
Implements tuning for TV cards using the V4L driver API, both versions 1 and 2.
bool IsAllGood(void) const override
static const uint64_t kDTVSigMon_WaitForVCT
int GetSignalStrength(void) const