Go to the documentation of this file.
20 #include "libavcodec/avcodec.h"
36 #ifdef USING_HDHOMERUN
70 #define DBG_SM(FUNC, MSG) LOG(VB_CHANNEL, LOG_DEBUG, \
71 QString("SigMon[%1](%2)::%3: %4").arg(m_inputid) \
72 .arg(m_channel->GetDevice(), FUNC, MSG))
92 [[maybe_unused]]
int db_cardnum,
98 if (cardtype ==
"GuaranteedToFail")
106 auto *dvbc =
dynamic_cast<DVBChannel*
>(channel);
114 else if ((cardtype.toUpper() ==
"HDPVR"))
116 auto *chan =
dynamic_cast<V4LChannel*
>(channel);
121 else if (cardtype.toUpper() ==
"V4L2ENC")
123 auto *chan =
dynamic_cast<V4LChannel*
>(channel);
130 #ifdef USING_HDHOMERUN
131 else if (cardtype.toUpper() ==
"HDHOMERUN")
141 else if (cardtype.toUpper() ==
"SATIP")
150 else if (cardtype.toUpper() ==
"CETON")
160 else if (cardtype.toUpper() ==
"FREEBOX")
170 else if (cardtype.toUpper() ==
"VBOX")
179 #ifdef USING_FIREWIRE
180 else if (cardtype.toUpper() ==
"FIREWIRE")
190 else if (cardtype.toUpper() ==
"ASI")
192 auto *fc =
dynamic_cast<ASIChannel*
>(channel);
199 else if (cardtype.toUpper() ==
"EXTERNAL")
207 if (!signalMonitor && channel)
215 LOG(VB_GENERAL, LOG_ERR,
216 QString(
"Failed to create signal monitor in Init(%1, %2, 0x%3)")
217 .arg(cardtype).arg(db_cardnum).arg((uintptr_t)channel,0,16));
220 return signalMonitor;
236 bool _release_stream, uint64_t wait_for_mask)
239 m_inputid(_inputid), m_flags(wait_for_mask),
240 m_releaseStream(_release_stream),
241 m_signalLock (QCoreApplication::translate(
"(Common)",
"Signal Lock"),
242 "slock", 1,
true, 0, 1, 0ms),
243 m_signalStrength(QCoreApplication::translate(
"(Common)",
"Signal Power"),
244 "signal", 0,
true, 0, 100, 0ms),
245 m_scriptStatus (QCoreApplication::translate(
"(Common)",
"Script Status"),
246 "script", 3,
true, 0, 3, 0ms)
277 return (
m_flags & _flags) == _flags;
282 return (
m_flags & _flags) != 0U;
390 if (entry == listener)
400 std::vector<SignalMonitorListener*> new_listeners;
403 if (entry != listener)
404 new_listeners.push_back(entry);
425 listener->StatusSignalLock(val);
431 listener->StatusSignalStrength(val);
434 listener->StatusChannelTuned(val);
438 dvblistener->StatusSignalToNoise(val);
442 dvblistener->StatusBitErrorRate(val);
446 dvblistener->StatusUncorrectedBlocks(val);
450 dvblistener->StatusRotorPosition(val);
volatile uint64_t m_flags
void start(QThread::Priority p=QThread::InheritPriority)
Tell MThread to start running the thread in the near future.
void SetValue(int _value)
QString GetStatus() const
Returns a signal monitor value as one long string.
bool wait(std::chrono::milliseconds time=std::chrono::milliseconds::max())
Wait for the MThread to exit, with a maximum timeout.
This class is used as a container for messages.
void SendMessage(SignalMonitorMessageType type, const SignalMonitorValue &val)
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
void RunProlog(void)
Sets up a thread, call this if you reimplement run().
QString GetName(void) const
Returns the long name of this value.
bool HasAnyFlag(uint64_t _flags) const
virtual void AddFlags(uint64_t _flags)
VERBOSE_PREAMBLE Most true
static const uint64_t kSigMon_WaitForSig
QRecursiveMutex m_statusLock
SignalMonitorValue m_scriptStatus
int GetValue() const
Returns the value.
virtual void RemoveFlags(uint64_t _flags)
SignalMonitorValue m_signalStrength
Abstract class providing a generic interface to tuning hardware.
QString sm_flags_to_string(uint64_t flags)
SignalMonitorValue m_signalLock
std::chrono::milliseconds m_updateRate
void run(void) override
Basic signal monitoring loop.
void SendMessageAllGood(void)
FirewireChannel Copyright (c) 2005 by Jim Westfall and Dave Abrahams Distributed as part of MythTV un...
~SignalMonitor() override
Stops monitoring thread.
virtual void EmitStatus(void)
virtual void UpdateValues(void)
This should be overridden to actually do signal monitoring.
virtual bool IsExternalChannelChangeInUse(void)
void RunEpilog(void)
Cleans up a thread's resources, call this if you reimplement run().
@ kStatusUncorrectedBlocks
static bool IsDVBInputType(const QString &inputType)
Returns true iff the input_type is one of the DVB types.
QWaitCondition m_startStopWait
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
Signal monitoring base class.
static SignalMonitor * Init(const QString &cardtype, int db_cardnum, ChannelBase *channel, bool release_stream)
uint GetScriptStatus(bool holding_lock=false)
Provides interface to the tuning hardware when using DVB drivers.
bool HasFlags(uint64_t _flags) const
void AddListener(SignalMonitorListener *listener)
void RemoveListener(SignalMonitorListener *listener)
This is a wrapper around QThread that does several additional things.
virtual void Start()
Start signal monitoring thread.
std::vector< SignalMonitorListener * > m_listeners
virtual QStringList GetStatusList(void) const
Returns QStringList containing all signals and their current values.
#define DBG_SM(FUNC, MSG)
virtual void Stop()
Stop signal monitoring thread.
Implements tuning for TV cards using the V4L driver API, both versions 1 and 2.
void dispatch(const MythEvent &event)
SignalMonitor(int, ChannelBase *, uint64_t, bool)=delete