Go to the documentation of this file.
28 #define LOC QString("EITScanner[%1]: ").arg(m_cardnum)
37 m_eventThread(new
MThread(
"EIT", this)),
45 LOG(VB_EIT, LOG_INFO,
LOC +
46 QString(
"Start EIT scanner thread for source %1 '%2'")
103 LOG(VB_EIT, LOG_INFO,
LOC +
104 QString(
"Added %1 EIT events in passive scan ").arg(
m_eitCount) +
113 const std::chrono::seconds eventTimeout = 60s;
118 if (noEvents && !scanTimeUp)
120 LOG(VB_EIT, LOG_INFO,
LOC +
121 QString(
"No new EIT events received in last %1 seconds ").arg(eventTimeout.count()) +
123 QString(
"on multiplex %4, move to next multiplex").arg(
m_mplexid));
131 if (!(*m_activeScanNextChan).isEmpty())
139 LOG(VB_EIT, LOG_DEBUG,
LOC +
140 QString(
"Next EIT active scan source %1 '%2' multiplex %3 chanid %4 channel %5")
191 QMutexLocker locker(&
m_lock);
205 LOG(VB_EIT, LOG_INFO,
LOC +
206 QString(
"Start EIT %1 scan source %2 '%3' multiplex %4 chanid %5 channel %6")
208 .arg(
m_mplexid).arg(chanid).arg(channum));
212 LOG(VB_EIT, LOG_INFO,
LOC +
213 QString(
"Failed to start EIT scan, invalid chanid %1 channum %2")
214 .arg(chanid).arg(channum));
223 QMutexLocker locker(&
m_lock);
228 LOG(VB_EIT, LOG_INFO,
LOC +
229 QString(
"Stop EIT scan source %1 '%2', added %3 EIT events")
255 QMutexLocker locker(&
m_lock);
267 "SELECT channum, MIN(chanid) "
268 "FROM channel, capturecard, videosource "
269 "WHERE capturecard.sourceid = channel.sourceid AND "
270 " videosource.sourceid = channel.sourceid AND "
271 " channel.deleted IS NULL AND "
272 " channel.mplexid IS NOT NULL AND "
273 " channel.visible > 0 AND "
274 " channel.useonairguide = 1 AND "
275 " channel.channum != '' AND "
276 " videosource.useeit = 1 AND "
277 " capturecard.cardid = :CARDID "
279 "ORDER BY capturecard.sourceid, mplexid, "
280 " atsc_major_chan, atsc_minor_chan ");
306 LOG(VB_EIT, LOG_INFO,
LOC +
307 QString(
"EIT scan channel table for source %1 '%2' with %3 multiplexes")
324 LOG(VB_EIT, LOG_INFO,
LOC +
325 QString(
"Start EIT active scan on source %1 '%2'")
335 QMutexLocker locker(&
m_lock);
345 LOG(VB_EIT, LOG_INFO,
LOC +
346 QString(
"Stop EIT active scan on source %1 '%2'")
bool isActive(void) const
bool next(void)
Wrap QSqlQuery::next() so we can display the query results.
QSqlQuery wrapper that fetches a DB connection from the connection pool.
std::chrono::milliseconds elapsed(void)
Returns milliseconds elapsed since last start() or restart()
static void WriteEITCache(void)
void RescheduleRecordings(void)
Tells scheduler about programming changes.
void start(QThread::Priority p=QThread::InheritPriority)
Tell MThread to start running the thread in the near future.
void StopEITEventProcessing(void)
Stops inserting Event Information Tables into DB.
static QString GetSourceName(uint sourceid)
volatile bool m_exitThread
A QElapsedTimer based timer to replace use of QTime as a timer.
void SetSourceID(uint sourceid)
bool wait(std::chrono::milliseconds time=std::chrono::milliseconds::max())
Wait for the MThread to exit, with a maximum timeout.
void StartEITEventProcessing(ChannelBase *channel, EITSource *eitSource)
Start inserting Event Information Tables from the multiplex we happen to be tuned to into the databas...
QDateTime m_activeScanNextTrig
QWaitCondition m_activeScanCond
uint GetSourceID(void) const
Returns current source id.
QVariant value(int i) const
bool isRunning(void) const
Returns true if start() or restart() has been called at least once since construction and since any c...
bool exec(void)
Wrap QSqlQuery::exec() so we can display SQL.
void start(void)
starts measuring elapsed time.
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
static uint GetMplexID(uint sourceid, const QString &channum)
virtual QString GetChannelName(void) const
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
virtual void SetEITRate(float rate)=0
void StopActiveScan(void)
Stop active EIT scan.
void RescheduleRecordings(void)
Tells scheduler about programming changes.
uint GetInputId(void) const
Returns the inputid.
static int GetChanID(int db_mplexid, int service_transport_id, int major_channel, int minor_channel, int program_number)
Abstract class providing a generic interface to tuning hardware.
static MSqlQueryInfo InitCon(ConnectionReuse _reuse=kNormalConnection)
Only use this in combination with MSqlQuery constructor.
static void DBError(const QString &where, const MSqlQuery &query)
void SetChannelID(uint channelid)
virtual void SetEITHelper(EITHelper *)=0
void StartActiveScan(TVRec *rec, std::chrono::seconds max_seconds_per_multiplex)
Start active EIT scan.
QWaitCondition m_exitThreadCond
std::chrono::seconds m_activeScanTrigTime
bool QueueEITChannelChange(const QString &name)
Queues up a channel change for the EITScanner.
volatile bool m_activeScan
void SetLanguagePreferences(const QStringList &langPref)
QStringList::iterator m_activeScanNextChan
uint ProcessEvents(void)
Get events from queue and insert into DB after processing.
void bindValue(const QString &placeholder, const QVariant &val)
Add a single binding.
QStringList iso639_get_language_list(void)
Returns list of three character ISO-639 language descriptors, starting with the most preferred.
void run(void) override
This runs the event loop for EITScanner until 'm_exitThread' is true.
This is the coordinating class of the Recorder Subsystem.
This is a wrapper around QThread that does several additional things.
static uint GetSourceID(uint inputid)
ISO 639-1 and ISO 639-2 support functions.
uint GetListSize(void) const
static void PruneEITCache(uint timestamp)
QStringList m_activeScanChannels
volatile bool m_activeScanStopped
uint32_t MythRandom()
generate 32 random bits
void TeardownAll(void)
Stop active scan, delete thread and delete eithelper.
bool prepare(const QString &query)
QSqlQuery::prepare() is not thread safe in Qt <= 3.3.2.
virtual int GetChanID(void) const