12#define LOC QString("PlayerOverlay: ")
17 m_osd(MainWindow, Tv, nullptr, m_painter)
20 qRegisterMetaType<MythOverlayState>();
87 map.insert(
"message_text", Message);
97 info.text.insert(
"title", title);
115 const QString& Value,
int Type,
const QString& Units,
119 info.values.insert(
"position", Position);
120 info.values.insert(
"relposition", Position);
121 info.text.insert(
"title", Title);
122 info.text.insert(
"description", Desc);
123 info.text.insert(
"value", Value);
124 info.text.insert(
"units", Units);
134 Info.
text.insert(
"chapteridx", QString());
135 Info.
text.insert(
"totalchapters", QString());
136 Info.
text.insert(
"titleidx", QString());
137 Info.
text.insert(
"totaltitles", QString());
138 Info.
text.insert(
"angleidx", QString());
139 Info.
text.insert(
"totalangles", QString());
140 Info.
values.insert(
"position", 0);
141 Info.
values.insert(
"progbefore", 0);
142 Info.
values.insert(
"progafter", 0);
144 std::chrono::seconds playbackLen = 0s;
145 bool fixed_playbacklen =
false;
153 fixed_playbacklen =
true;
163 if (chapter && chapters > 1)
165 Info.
text[
"chapteridx"] = QString::number(chapter + 1);
166 Info.
text[
"totalchapters"] = QString::number(chapters);
171 if (title && titles > 1)
173 Info.
text[
"titleidx"] = QString::number(title + 1);
174 Info.
text[
"totaltitles"] = QString::number(titles);
179 if (angle && angles > 1)
181 Info.
text[
"angleidx"] = QString::number(angle + 1);
182 Info.
text[
"totalangles"] = QString::number(angles);
187 for (
int i = 0; i < 2 ; ++i)
189 bool honorCutList = (i > 0);
190 bool stillFrame =
false;
193 QString relPrefix = (honorCutList ?
"rel" :
"");
194 if (!fixed_playbacklen)
198 stillFrame = (secsplayed < 0s);
199 playbackLen = std::max(playbackLen, 0s);
200 secsplayed =
std::clamp(secsplayed, 0s, playbackLen);
201 std::chrono::seconds secsbehind = std::max((playbackLen - secsplayed), 0s);
203 if (playbackLen > 0s)
204 pos =
static_cast<int>(1000.0F * secsplayed.count() / playbackLen.count());
206 Info.
values.insert(relPrefix +
"secondsplayed",
static_cast<int>(secsplayed.count()));
207 Info.
values.insert(relPrefix +
"totalseconds",
static_cast<int>(playbackLen.count()));
208 Info.
values[relPrefix +
"position"] = pos;
221 QString fmt = (playbackLen >= 1h) ?
"H:mm:ss" :
"m:ss";
225 if (secsbehind >= 1h)
227 else if (secsbehind >= 1min)
230 text3 = tr(
"%n second(s)",
"",
static_cast<int>(secsbehind.count()));
233 QString desc = stillFrame ? tr(
"Still Frame") : tr(
"%1 of %2").arg(text1, text2);
234 Info.
text[relPrefix +
"description"] = desc;
235 Info.
text[relPrefix +
"playedtime"] = text1;
236 Info.
text[relPrefix +
"totaltime"] = text2;
237 Info.
text[relPrefix +
"remainingtime"] = islive ? QString() : text3;
238 Info.
text[relPrefix +
"behindtime"] = islive ? text3 : QString();
245 QDateTime recordedtime =
247 Info.
text[relPrefix +
"recordedtime"] = recordedtime.toLocalTime().toString(dtformat);
252 LOG(VB_OSD, LOG_INFO,
LOC +
253 QString(
" playbackLen:%1").arg(playbackLen.count()) +
254 QString(
" secsplayed:%1").arg(secsplayed.count()));
262 LOG(VB_PLAYBACK, LOG_DEBUG,
LOC + QString(
"GetSecondsPlayed: framesPlayed %1, honorCutList %2, pos %3")
std::chrono::seconds GetLengthAtCurPos(void)
QString GetSetting(const QString &key, const QString &defaultval="")
virtual void UpdateSliderInfo(osdInfo &Info, bool PaddedFields=false)
void ChangeOSDPositionUpdates(bool Enable)
std::chrono::seconds GetSecondsPlayed(bool HonorCutList)
void OverlayStateChanged(MythOverlayState OverlayState)
std::chrono::seconds GetTotalSeconds(bool HonorCutList) const
virtual std::chrono::milliseconds GetTotalMilliseconds(bool HonorCutList) const
QTimer m_positionUpdateTimer
virtual std::chrono::milliseconds GetMillisecondsPlayed(bool HonorCutList)
void UpdateOSDPosition()
Update the OSD status/position window.
void UpdateOSDMessage(const QString &Message)
MythPlayerOverlayUI(MythMainWindow *MainWindow, TV *Tv, PlayerContext *Context, PlayerFlags Flags)
void SetOSDStatus(const QString &Title, OSDTimeout Timeout)
void EditingChanged(bool Editing)
void BrowsingChanged(bool Browsing)
void UpdateOSDStatus(osdInfo &Info, int Type, OSDTimeout Timeout)
QRecursiveMutex m_osdLock
virtual int GetNumAngles(void) const
virtual int GetNumTitles(void) const
virtual int GetCurrentAngle(void) const
virtual int GetNumChapters(void)
virtual int GetCurrentTitle(void) const
virtual int GetCurrentChapter(void)
bool IsWatchingInprogress(void) const
PlayerContext * m_playerCtx
std::chrono::milliseconds TranslatePositionFrameToMs(uint64_t position, bool use_cutlist) const
void SetValues(const QString &Window, const QHash< QString, int > &Map, OSDTimeout Timeout)
void ResetWindow(const QString &Window)
void SetFunctionalWindow(const QString &Window, enum OSDFunctionalType Type)
bool IsWindowVisible(const QString &Window)
void Embed(bool Embedding)
void SetText(const QString &Window, const InfoMap &Map, OSDTimeout Timeout)
void HideAll(bool KeepSubs=true, MythScreenType *Except=nullptr, bool DropNotification=false)
TVState GetState(void) const
QDateTime m_playingRecStart
void HideAll(bool KeepSubs=true, MythScreenType *Except=nullptr, bool DropNotification=false)
void EmbedPlayback(bool Embed, const QRect &Rect={})
void OverlayStateChanged(MythOverlayState OverlayState)
void ChangeOSDMessage(const QString &Message)
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
QHash< QString, QString > InfoMap
QString formatTime(std::chrono::milliseconds msecs, QString fmt)
Format a milliseconds time value.
static constexpr const char * OSD_WIN_STATUS
@ kOSDFunctionalType_Default
static constexpr const char * OSD_WIN_MESSAGE
static eu8 clamp(eu8 value, eu8 low, eu8 high)
QHash< QString, int > values
@ kState_WatchingPreRecorded
Watching Pre-recorded is a TV only state for when we are watching a pre-existing recording.
@ kState_WatchingRecording
Watching Recording is the state for when we are watching an in progress recording,...