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))
101 if (cardtype ==
"GuaranteedToFail")
109 auto *dvbc =
dynamic_cast<DVBChannel*
>(channel);
117 else if ((cardtype.toUpper() ==
"HDPVR"))
119 auto *chan =
dynamic_cast<V4LChannel*
>(channel);
124 else if (cardtype.toUpper() ==
"V4L2ENC")
126 auto *chan =
dynamic_cast<V4LChannel*
>(channel);
133 #ifdef USING_HDHOMERUN
134 else if (cardtype.toUpper() ==
"HDHOMERUN")
144 else if (cardtype.toUpper() ==
"SATIP")
153 else if (cardtype.toUpper() ==
"CETON")
163 else if (cardtype.toUpper() ==
"FREEBOX")
173 else if (cardtype.toUpper() ==
"VBOX")
182 #ifdef USING_FIREWIRE
183 else if (cardtype.toUpper() ==
"FIREWIRE")
193 else if (cardtype.toUpper() ==
"ASI")
195 auto *fc =
dynamic_cast<ASIChannel*
>(channel);
202 else if (cardtype.toUpper() ==
"EXTERNAL")
210 if (!signalMonitor && channel)
218 LOG(VB_GENERAL, LOG_ERR,
219 QString(
"Failed to create signal monitor in Init(%1, %2, 0x%3)")
220 .arg(cardtype).arg(db_cardnum).arg((
long)channel,0,16));
223 return signalMonitor;
239 bool _release_stream, uint64_t wait_for_mask)
242 m_inputid(_inputid), m_flags(wait_for_mask),
243 m_releaseStream(_release_stream),
244 m_signalLock (QCoreApplication::translate(
"(Common)",
"Signal Lock"),
245 "slock", 1,
true, 0, 1, 0ms),
246 m_signalStrength(QCoreApplication::translate(
"(Common)",
"Signal Power"),
247 "signal", 0,
true, 0, 100, 0ms),
248 m_scriptStatus (QCoreApplication::translate(
"(Common)",
"Script Status"),
249 "script", 3,
true, 0, 3, 0ms)
280 return (
m_flags & _flags) == _flags;
285 return (
m_flags & _flags) != 0U;
393 if (entry == listener)
403 std::vector<SignalMonitorListener*> new_listeners;
406 if (entry != listener)
407 new_listeners.push_back(entry);
428 listener->StatusSignalLock(val);
434 listener->StatusSignalStrength(val);
437 listener->StatusChannelTuned(val);
441 dvblistener->StatusSignalToNoise(val);
445 dvblistener->StatusBitErrorRate(val);
449 dvblistener->StatusUncorrectedBlocks(val);
453 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().
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)
@ kStatusUncorrectedBlocks
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