MythTV master
commbreakmap.h
Go to the documentation of this file.
1#ifndef BREAKMAP_H
2#define BREAKMAP_H
3
4#include <cstdint>
5
6// Qt headers
7#include <QtGlobal>
8#include <QRecursiveMutex>
9#include <QMap>
10#include <QCoreApplication>
11
12// MythTV headers
15#include "libmythtv/tv.h"
17
19{
20 Q_DECLARE_TR_FUNCTIONS(CommBreakMap)
21
22 public:
23 CommBreakMap(void);
24
25 bool HasMap(void) const { return m_hascommbreaktable; }
26
28 void SetAutoCommercialSkip(CommSkipMode autoskip, uint64_t framesPlayed);
29
30 int GetSkipCommercials(void) const { return m_skipcommercials; }
31 void SkipCommercials(int direction);
32
33 void ResetLastSkip(void);
34 void SetTracker(uint64_t framesPlayed);
35 void GetMap(frm_dir_map_t &map) const;
36 void SetMap(const frm_dir_map_t &newMap, uint64_t framesPlayed);
37 void LoadMap(PlayerContext *player_ctx, uint64_t framesPlayed);
38
39 bool IsInCommBreak(uint64_t frameNumber) const;
40 bool AutoCommercialSkip(uint64_t &jumpToFrame, uint64_t framesPlayed,
41 double video_frame_rate, uint64_t totalFrames,
42 QString &comm_msg);
43 bool DoSkipCommercials(uint64_t &jumpToFrame, uint64_t framesPlayed,
44 double video_frame_rate, uint64_t totalFrames,
45 QString &comm_msg);
46
47 private:
48 void MergeShortCommercials(double video_frame_rate);
49
50 mutable QRecursiveMutex m_commBreakMapLock;
53 std::chrono::seconds m_commrewindamount {0s};
54 std::chrono::seconds m_commnotifyamount {0s};
60 static constexpr std::chrono::seconds kSkipBackWindow {5s};
61 uint64_t m_lastCommSkipStart {0};
67 static constexpr std::chrono::seconds kAutoSkipDeadZone {3s};
68 bool m_hascommbreaktable {false};
70 std::chrono::seconds m_maxskip {1h};
71 std::chrono::seconds m_maxShortMerge {0s};
73 frm_dir_map_t::Iterator m_commBreakIter;
74};
75
76#endif // BREAKMAP_H
frm_dir_map_t m_commBreakMap
Definition: commbreakmap.h:72
std::chrono::seconds m_maxShortMerge
Definition: commbreakmap.h:71
QRecursiveMutex m_commBreakMapLock
Definition: commbreakmap.h:50
CommSkipMode GetAutoCommercialSkip(void) const
bool IsInCommBreak(uint64_t frameNumber) const
SystemTime m_lastSkipTime
This is separate from m_lastCommSkipTime so a manual seek does not trigger the kSkipBackWindow code.
Definition: commbreakmap.h:65
SystemTime m_lastCommSkipTime
Definition: commbreakmap.h:56
int m_lastCommSkipDirection
Definition: commbreakmap.h:55
QDateTime m_lastIgnoredManualSkip
Definition: commbreakmap.h:69
void ResetLastSkip(void)
CommBreakMap(void)
bool DoSkipCommercials(uint64_t &jumpToFrame, uint64_t framesPlayed, double video_frame_rate, uint64_t totalFrames, QString &comm_msg)
void SetMap(const frm_dir_map_t &newMap, uint64_t framesPlayed)
void SetTracker(uint64_t framesPlayed)
void LoadMap(PlayerContext *player_ctx, uint64_t framesPlayed)
bool HasMap(void) const
Definition: commbreakmap.h:25
bool m_hascommbreaktable
Definition: commbreakmap.h:68
void MergeShortCommercials(double video_frame_rate)
std::chrono::seconds m_commnotifyamount
Definition: commbreakmap.h:54
std::chrono::seconds m_commrewindamount
Definition: commbreakmap.h:53
static constexpr std::chrono::seconds kSkipBackWindow
Time after a commercial skip that skipping back will skip to the start of the just skipped commercial...
Definition: commbreakmap.h:60
uint64_t m_lastCommSkipStart
Definition: commbreakmap.h:61
bool AutoCommercialSkip(uint64_t &jumpToFrame, uint64_t framesPlayed, double video_frame_rate, uint64_t totalFrames, QString &comm_msg)
void SetAutoCommercialSkip(CommSkipMode autoskip, uint64_t framesPlayed)
int GetSkipCommercials(void) const
Definition: commbreakmap.h:30
static constexpr std::chrono::seconds kAutoSkipDeadZone
Time after any seek that an automatic commercial skip will not occur.
Definition: commbreakmap.h:67
CommSkipMode m_autocommercialskip
Definition: commbreakmap.h:52
frm_dir_map_t::Iterator m_commBreakIter
Definition: commbreakmap.h:73
std::chrono::seconds m_maxskip
Definition: commbreakmap.h:70
void GetMap(frm_dir_map_t &map) const
int m_skipcommercials
Definition: commbreakmap.h:51
void SkipCommercials(int direction)
std::chrono::time_point< SystemClock > SystemTime
Definition: mythchrono.h:67
QMap< uint64_t, MarkTypes > frm_dir_map_t
Frame # -> Mark map.
Definition: programtypes.h:117
CommSkipMode
Definition: tv.h:134
@ kCommSkipOff
Definition: tv.h:135