Go to the documentation of this file.
8 #define LOC QString("CommBreakMap: ")
12 m_commrewindamount(
gCoreContext->GetDurSetting<std::chrono::seconds>(
"CommRewindAmount",0s)),
13 m_commnotifyamount(
gCoreContext->GetDurSetting<std::chrono::seconds>(
"CommNotifyAmount",0s)),
15 m_maxskip(
gCoreContext->GetDurSetting<std::chrono::seconds>(
"MaximumCommercialSkip", 1h)),
16 m_maxShortMerge(
gCoreContext->GetDurSetting<std::chrono::seconds>(
"MergeShortCommBreaks", 0s)),
17 m_commBreakIter(m_commBreakMap.end())
84 LOG(VB_COMMFLAG, LOG_INFO,
LOC +
85 QString(
"new commBreakIter = %1 @ frame %2, framesPlayed = %3")
104 frm_dir_map_t::const_iterator it =
m_commBreakMap.find(frameNumber);
111 if (it.key() > frameNumber)
134 LOG(VB_COMMFLAG, LOG_INFO,
LOC +
135 QString(
"Setting New Commercial Break List, old size %1, new %2")
145 uint64_t framesPlayed,
146 double video_frame_rate,
147 uint64_t totalFrames,
180 LOG(VB_COMMFLAG, LOG_INFO,
LOC +
181 QString(
"AutoCommercialSkip(), current framesPlayed %1, commBreakIter "
182 "frame %2, incrementing commBreakIter")
191 LOG(VB_COMMFLAG, LOG_INFO,
LOC +
"AutoCommercialSkip(), at end of "
192 "commercial break list, will not skip.");
198 LOG(VB_COMMFLAG, LOG_INFO,
LOC +
"AutoCommercialSkip(), new "
199 "commBreakIter mark is another start, "
207 LOG(VB_COMMFLAG, LOG_INFO,
LOC +
"AutoCommercialSkip(), skipping would "
208 "take us to the end of the file, will "
213 LOG(VB_COMMFLAG, LOG_INFO,
LOC +
214 QString(
"AutoCommercialSkip(), new commBreakIter frame %1")
217 auto skipped_seconds = std::chrono::seconds((
int)((
m_commBreakIter.key() -
218 framesPlayed) / video_frame_rate));
223 comm_msg = tr(
"Skip %1").arg(skipTime);
228 comm_msg = tr(
"Commercial: %1").arg(skipTime);
234 LOG(VB_COMMFLAG, LOG_INFO,
LOC +
235 QString(
"AutoCommercialSkip(), auto-skipping to frame %1")
250 uint64_t framesPlayed,
251 double video_frame_rate,
252 uint64_t totalFrames, QString &comm_msg)
258 comm_msg = tr(
"Skipping Back.");
276 comm_msg = tr(
"Start of program.");
283 (((totalFrames) != 0U) &&
286 comm_msg = tr(
"At End, cannot Skip.");
295 (int64_t)framesPlayed) / video_frame_rate);
298 if (skipped_seconds > -3)
302 comm_msg = tr(
"Start of program.");
312 auto skipped_seconds = std::chrono::seconds((
int)(framediff / video_frame_rate));
325 (((totalFrames) != 0U) &&
329 comm_msg = tr(
"At End, cannot Skip.");
338 auto skipped_seconds = std::chrono::seconds((
int)(framediff / video_frame_rate));
345 comm_msg = tr(
"Too Far %1").arg(skipTime);
351 comm_msg = tr(
"Skip %1").arg(skipTime);
357 jumpToFrame = jumpto;
void UnlockPlayingInfo(const char *file, int line) const
bool DoSkipCommercials(uint64_t &jumpToFrame, uint64_t framesPlayed, double video_frame_rate, uint64_t totalFrames, QString &comm_msg)
void SetTracker(uint64_t framesPlayed)
void MergeShortCommercials(double video_frame_rate)
QMap< uint64_t, MarkTypes > frm_dir_map_t
Frame # -> Mark map.
QString formatTime(std::chrono::milliseconds msecs, QString fmt)
Format a milliseconds time value.
CommSkipMode m_autocommercialskip
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
void GetMap(frm_dir_map_t &map) const
std::chrono::seconds m_commnotifyamount
void SetMap(const frm_dir_map_t &newMap, uint64_t framesPlayed)
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
QRecursiveMutex m_commBreakMapLock
uint64_t m_lastCommSkipStart
frm_dir_map_t::Iterator m_commBreakIter
ProgramInfo * m_playingInfo
Currently playing info.
void SetAutoCommercialSkip(CommSkipMode autoskip, uint64_t framesPlayed)
void LockPlayingInfo(const char *file, int line) const
void LoadMap(PlayerContext *player_ctx, uint64_t framesPlayed)
QDateTime m_lastIgnoredManualSkip
bool IsInCommBreak(uint64_t frameNumber) const
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
int m_lastCommSkipDirection
time_t m_lastCommSkipTime
std::chrono::seconds m_maxShortMerge
CommSkipMode GetAutoCommercialSkip(void) const
std::chrono::seconds m_maxskip
std::chrono::seconds secsInPast(const QDateTime &past)
bool AutoCommercialSkip(uint64_t &jumpToFrame, uint64_t framesPlayed, double video_frame_rate, uint64_t totalFrames, QString &comm_msg)
frm_dir_map_t m_commBreakMap
void QueryCommBreakList(frm_dir_map_t &frames) const
std::chrono::seconds m_commrewindamount
void SkipCommercials(int direction)