10#include "libmythbase/mythconfig.h"
21#include "libavcodec/avcodec.h"
71#define DBG_SM(FUNC, MSG) LOG(VB_CHANNEL, LOG_DEBUG, \
72 QString("SigMon[%1](%2)::%3: %4").arg(m_inputid) \
73 .arg(m_channel->GetDevice(), FUNC, MSG))
93 [[maybe_unused]]
int db_cardnum,
99 if (cardtype ==
"GuaranteedToFail")
107 auto *dvbc =
dynamic_cast<DVBChannel*
>(channel);
115 else if ((cardtype.toUpper() ==
"HDPVR"))
117 auto *chan =
dynamic_cast<V4LChannel*
>(channel);
122 else if (cardtype.toUpper() ==
"V4L2ENC")
124 auto *chan =
dynamic_cast<V4LChannel*
>(channel);
132 else if (cardtype.toUpper() ==
"HDHOMERUN")
142 else if (cardtype.toUpper() ==
"SATIP")
151 else if (cardtype.toUpper() ==
"CETON")
161 else if (cardtype.toUpper() ==
"FREEBOX")
171 else if (cardtype.toUpper() ==
"VBOX")
181 else if (cardtype.toUpper() ==
"FIREWIRE")
191 else if (cardtype.toUpper() ==
"ASI")
193 auto *fc =
dynamic_cast<ASIChannel*
>(channel);
200 else if (cardtype.toUpper() ==
"EXTERNAL")
208 if (!signalMonitor && channel)
216 LOG(VB_GENERAL, LOG_ERR,
217 QString(
"Failed to create signal monitor in Init(%1, %2, 0x%3)")
218 .arg(cardtype).arg(db_cardnum).arg((uintptr_t)channel,0,16));
221 return signalMonitor;
237 bool _release_stream, uint64_t wait_for_mask)
240 m_inputid(_inputid), m_flags(wait_for_mask),
241 m_releaseStream(_release_stream),
242 m_signalLock (QCoreApplication::translate(
"(Common)",
"Signal Lock"),
243 "slock", 1,
true, 0, 1, 0ms),
244 m_signalStrength(QCoreApplication::translate(
"(Common)",
"Signal Power"),
245 "signal", 0,
true, 0, 100, 0ms),
246 m_scriptStatus (QCoreApplication::translate(
"(Common)",
"Script Status"),
247 "script", 3,
true, 0, 3, 0ms)
278 return (
m_flags & _flags) == _flags;
283 return (
m_flags & _flags) != 0U;
391 if (entry == listener)
401 std::vector<SignalMonitorListener*> new_listeners;
404 if (entry != listener)
405 new_listeners.push_back(entry);
426 listener->StatusSignalLock(val);
432 listener->StatusSignalStrength(val);
435 listener->StatusChannelTuned(val);
439 dvblistener->StatusSignalToNoise(val);
443 dvblistener->StatusBitErrorRate(val);
447 dvblistener->StatusUncorrectedBlocks(val);
451 dvblistener->StatusRotorPosition(val);
static bool IsDVBInputType(const QString &inputType)
Returns true iff the input_type is one of the DVB types.
Abstract class providing a generic interface to tuning hardware.
virtual bool IsExternalChannelChangeInUse(void)
uint GetScriptStatus(bool holding_lock=false)
Provides interface to the tuning hardware when using DVB drivers.
FirewireChannel Copyright (c) 2005 by Jim Westfall and Dave Abrahams Distributed as part of MythTV un...
This is a wrapper around QThread that does several additional things.
void RunProlog(void)
Sets up a thread, call this if you reimplement run().
void start(QThread::Priority p=QThread::InheritPriority)
Tell MThread to start running the thread in the near future.
void RunEpilog(void)
Cleans up a thread's resources, call this if you reimplement run().
bool wait(std::chrono::milliseconds time=std::chrono::milliseconds::max())
Wait for the MThread to exit, with a maximum timeout.
void dispatch(const MythEvent &event)
This class is used as a container for messages.
int GetValue() const
Returns the value.
QString GetName(void) const
Returns the long name of this value.
void SetValue(int _value)
QString GetStatus() const
Returns a signal monitor value as one long string.
Signal monitoring base class.
~SignalMonitor() override
Stops monitoring thread.
std::chrono::milliseconds m_updateRate
void RemoveListener(SignalMonitorListener *listener)
QRecursiveMutex m_statusLock
virtual void RemoveFlags(uint64_t _flags)
void SendMessageAllGood(void)
void AddListener(SignalMonitorListener *listener)
static SignalMonitor * Init(const QString &cardtype, int db_cardnum, ChannelBase *channel, bool release_stream)
SignalMonitorValue m_signalLock
std::vector< SignalMonitorListener * > m_listeners
void SendMessage(SignalMonitorMessageType type, const SignalMonitorValue &val)
virtual QStringList GetStatusList(void) const
Returns QStringList containing all signals and their current values.
SignalMonitorValue m_scriptStatus
bool HasFlags(uint64_t _flags) const
virtual void Stop()
Stop signal monitoring thread.
SignalMonitor(int, ChannelBase *, uint64_t, bool)=delete
virtual void EmitStatus(void)
static const uint64_t kSigMon_WaitForSig
QWaitCondition m_startStopWait
void run(void) override
Basic signal monitoring loop.
virtual void UpdateValues(void)
This should be overridden to actually do signal monitoring.
virtual void AddFlags(uint64_t _flags)
SignalMonitorValue m_signalStrength
virtual void Start()
Start signal monitoring thread.
volatile uint64_t m_flags
bool HasAnyFlag(uint64_t _flags) const
Implements tuning for TV cards using the V4L driver API, both versions 1 and 2.
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
#define DBG_SM(FUNC, MSG)
QString sm_flags_to_string(uint64_t flags)
@ kStatusUncorrectedBlocks
VERBOSE_PREAMBLE Most true