Go to the documentation of this file.
10 #define LOC QString("%1 playlist: ").arg(m_parent->StreamURL().isEmpty() ? "Worker" : m_parent->StreamURL())
13 :
MThread(
"HLSPlaylist"), m_parent(parent)
15 LOG(VB_RECORD, LOG_DEBUG,
LOC +
"ctor");
20 LOG(VB_RECORD, LOG_DEBUG,
LOC +
"dtor");
25 LOG(VB_RECORD, LOG_INFO,
LOC +
"Cancel -- begin");
31 LOG(VB_RECORD, LOG_INFO,
LOC +
"Cancel -- end");
36 std::chrono::milliseconds wakeup = 1s;
39 LOG(VB_RECORD, LOG_INFO,
LOC +
"run -- begin");
50 std::chrono::milliseconds waittime = std::max(1000ms, wakeup);
51 LOG(VB_RECORD, (waittime > 12s ? LOG_INFO : LOG_DEBUG),
LOC +
52 QString(
"refreshing in %2ms")
53 .arg(waittime.count()));
62 LOG(VB_GENERAL, LOG_CRIT,
LOC +
"Fatal error detected");
67 LOG(VB_RECORD, LOG_INFO,
LOC +
"canceled");
75 LOG(VB_RECORD, LOG_INFO,
LOC +
76 QString(
"Playlist successfully downloaded. Buffered: %1%")
85 LOG(VB_RECORD, LOG_WARNING,
LOC +
86 QString(
"Playlist download failed -- Retry #%1, "
105 LOG(VB_RECORD, LOG_ERR,
LOC +
"Loading playlist failed. "
106 "Perform a complete reset.");
136 wakeup = std::chrono::milliseconds(
static_cast<int>(delay * wakeup.count()));
141 LOG(VB_RECORD, LOG_DEBUG,
LOC +
143 QString(
" wakeup:%1ms delay:%2").arg(wakeup.count()).arg(delay));
148 downloader->Cancel();
154 LOG(VB_RECORD, LOG_INFO,
LOC +
"run -- end");
bool FatalError(void) const
std::chrono::seconds TargetDuration(void) const
bool wait(std::chrono::milliseconds time=std::chrono::milliseconds::max())
Wait for the MThread to exit, with a maximum timeout.
int PlaylistRetryCount(void) const
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
void RunProlog(void)
Sets up a thread, call this if you reimplement run().
QWaitCondition m_waitcond
bool LoadMetaPlaylists(MythSingleDownload &downloader)
void EnableDebugging(void)
uint PercentBuffered(void) const
~HLSPlaylistWorker(void) override
void RunEpilog(void)
Cleans up a thread's resources, call this if you reimplement run().
const int PLAYLIST_FAILURE
void AllowPlaylistSwitch(void)
void PlaylistRetrying(void)
This is a wrapper around QThread that does several additional things.
HLSPlaylistWorker(HLSReader *parent)
void run() override
Runs the Qt event loop unless we have a QRunnable, in which case we run the runnable run instead.