Go to the documentation of this file.
10 #define LOC QString("PlayerOverlay: ")
15 m_osd(MainWindow, Tv, nullptr, m_painter)
18 qRegisterMetaType<MythOverlayState>();
85 map.insert(
"message_text", Message);
95 info.text.insert(
"title", title);
113 const QString& Value,
int Type,
const QString& Units,
117 info.values.insert(
"position", Position);
118 info.values.insert(
"relposition", Position);
119 info.text.insert(
"title", Title);
120 info.text.insert(
"description", Desc);
121 info.text.insert(
"value", Value);
122 info.text.insert(
"units", Units);
132 Info.
text.insert(
"chapteridx", QString());
133 Info.
text.insert(
"totalchapters", QString());
134 Info.
text.insert(
"titleidx", QString());
135 Info.
text.insert(
"totaltitles", QString());
136 Info.
text.insert(
"angleidx", QString());
137 Info.
text.insert(
"totalangles", QString());
138 Info.
values.insert(
"position", 0);
139 Info.
values.insert(
"progbefore", 0);
140 Info.
values.insert(
"progafter", 0);
142 std::chrono::seconds playbackLen = 0s;
143 bool fixed_playbacklen =
false;
151 fixed_playbacklen =
true;
161 if (chapter && chapters > 1)
163 Info.
text[
"chapteridx"] = QString::number(chapter + 1);
164 Info.
text[
"totalchapters"] = QString::number(chapters);
169 if (title && titles > 1)
171 Info.
text[
"titleidx"] = QString::number(title + 1);
172 Info.
text[
"totaltitles"] = QString::number(titles);
177 if (angle && angles > 1)
179 Info.
text[
"angleidx"] = QString::number(angle + 1);
180 Info.
text[
"totalangles"] = QString::number(angles);
185 for (
int i = 0; i < 2 ; ++i)
187 bool honorCutList = (i > 0);
188 bool stillFrame =
false;
191 QString relPrefix = (honorCutList ?
"rel" :
"");
192 if (!fixed_playbacklen)
196 stillFrame = (secsplayed < 0s);
197 playbackLen = std::max(playbackLen, 0s);
198 secsplayed =
std::clamp(secsplayed, 0s, playbackLen);
199 std::chrono::seconds secsbehind = std::max((playbackLen - secsplayed), 0s);
201 if (playbackLen > 0s)
202 pos =
static_cast<int>(1000.0F * secsplayed.count() / playbackLen.count());
204 Info.
values.insert(relPrefix +
"secondsplayed",
static_cast<int>(secsplayed.count()));
205 Info.
values.insert(relPrefix +
"totalseconds",
static_cast<int>(playbackLen.count()));
206 Info.
values[relPrefix +
"position"] = pos;
219 QString fmt = (playbackLen >= 1h) ?
"H:mm:ss" :
"m:ss";
223 if (secsbehind >= 1h)
225 else if (secsbehind >= 1min)
228 text3 = tr(
"%n second(s)",
"",
static_cast<int>(secsbehind.count()));
231 QString desc = stillFrame ? tr(
"Still Frame") : tr(
"%1 of %2").arg(text1, text2);
232 Info.
text[relPrefix +
"description"] = desc;
233 Info.
text[relPrefix +
"playedtime"] = text1;
234 Info.
text[relPrefix +
"totaltime"] = text2;
235 Info.
text[relPrefix +
"remainingtime"] = islive ? QString() : text3;
236 Info.
text[relPrefix +
"behindtime"] = islive ? text3 : QString();
242 QDateTime recordedtime =
244 Info.
text[relPrefix +
"recordedtime"] = recordedtime.toLocalTime().toString(dtformat);
249 LOG(VB_OSD, LOG_INFO,
LOC +
250 QString(
" playbackLen:%1").arg(playbackLen.count()) +
251 QString(
" secsplayed:%1").arg(secsplayed.count()));
259 LOG(VB_PLAYBACK, LOG_DEBUG,
LOC + QString(
"GetSecondsPlayed: framesPlayed %1, honorCutList %2, pos %3")
std::chrono::seconds GetSecondsPlayed(bool HonorCutList)
TVState GetState(void) const
void OverlayStateChanged(MythOverlayState OverlayState)
virtual int GetNumAngles(void) const
bool IsWindowVisible(const QString &Window)
void BrowsingChanged(bool Browsing)
void ChangeOSDMessage(const QString &Message)
QDateTime m_playingRecStart
virtual int GetNumTitles(void) const
void ResetWindow(const QString &Window)
QString formatTime(std::chrono::milliseconds msecs, QString fmt)
Format a milliseconds time value.
virtual std::chrono::milliseconds GetTotalMilliseconds(bool HonorCutList) const
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
void HideAll(bool KeepSubs=true, MythScreenType *Except=nullptr, bool DropNotification=false)
void SetText(const QString &Window, const InfoMap &Map, OSDTimeout Timeout)
std::chrono::seconds GetTotalSeconds(bool HonorCutList) const
void EditingChanged(bool Editing)
void SetOSDStatus(const QString &Title, OSDTimeout Timeout)
static constexpr const char * OSD_WIN_MESSAGE
QHash< QString, QString > InfoMap
void UpdateOSDMessage(const QString &Message)
static constexpr const char * OSD_WIN_STATUS
void OverlayStateChanged(MythOverlayState OverlayState)
virtual std::chrono::milliseconds GetMillisecondsPlayed(bool HonorCutList)
QHash< QString, int > values
void ChangeOSDPositionUpdates(bool Enable)
void UpdateOSDPosition()
Update the OSD status/position window.
MythPlayerOverlayUI(MythMainWindow *MainWindow, TV *Tv, PlayerContext *Context, PlayerFlags Flags)
void HideAll(bool KeepSubs=true, MythScreenType *Except=nullptr, bool DropNotification=false)
void SetFunctionalWindow(const QString &Window, enum OSDFunctionalType Type)
PlayerContext * m_playerCtx
QTimer m_positionUpdateTimer
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
virtual int GetCurrentAngle(void) const
static eu8 clamp(eu8 value, eu8 low, eu8 high)
std::chrono::milliseconds TranslatePositionFrameToMs(uint64_t position, bool use_cutlist) const
virtual int GetNumChapters(void)
virtual int GetCurrentTitle(void) const
@ kState_WatchingPreRecorded
Watching Pre-recorded is a TV only state for when we are watching a pre-existing recording.
bool IsWatchingInprogress(void) const
QRecursiveMutex m_osdLock
void EmbedPlayback(bool Embed, const QRect &Rect={})
void UpdateOSDStatus(osdInfo &Info, int Type, enum OSDTimeout Timeout)
void SetValues(const QString &Window, const QHash< QString, int > &Map, OSDTimeout Timeout)
std::chrono::seconds GetLengthAtCurPos(void)
void Embed(bool Embedding)
virtual void UpdateSliderInfo(osdInfo &Info, bool PaddedFields=false)
@ kOSDFunctionalType_Default
QString GetSetting(const QString &key, const QString &defaultval="")
virtual int GetCurrentChapter(void)