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
13 #include "libmythbase/compat.h"
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};
56  time_t m_lastCommSkipTime {0/*1970*/};
57  uint64_t m_lastCommSkipStart {0};
58  time_t m_lastSkipTime {0 /*1970*/};
59  bool m_hascommbreaktable {false};
61  std::chrono::seconds m_maxskip {1h};
62  std::chrono::seconds m_maxShortMerge {0s};
64  frm_dir_map_t::Iterator m_commBreakIter;
65 };
66 
67 #endif // BREAKMAP_H
CommBreakMap::m_skipcommercials
int m_skipcommercials
Definition: commbreakmap.h:51
CommSkipMode
CommSkipMode
Definition: tv.h:130
CommBreakMap::m_lastSkipTime
time_t m_lastSkipTime
Definition: commbreakmap.h:58
tv.h
CommBreakMap::DoSkipCommercials
bool DoSkipCommercials(uint64_t &jumpToFrame, uint64_t framesPlayed, double video_frame_rate, uint64_t totalFrames, QString &comm_msg)
Definition: commbreakmap.cpp:249
CommBreakMap::SetTracker
void SetTracker(uint64_t framesPlayed)
Definition: commbreakmap.cpp:67
CommBreakMap::MergeShortCommercials
void MergeShortCommercials(double video_frame_rate)
Definition: commbreakmap.cpp:361
frm_dir_map_t
QMap< uint64_t, MarkTypes > frm_dir_map_t
Frame # -> Mark map.
Definition: programtypes.h:118
CommBreakMap::m_autocommercialskip
CommSkipMode m_autocommercialskip
Definition: commbreakmap.h:52
CommBreakMap::GetMap
void GetMap(frm_dir_map_t &map) const
Definition: commbreakmap.cpp:91
CommBreakMap::m_commnotifyamount
std::chrono::seconds m_commnotifyamount
Definition: commbreakmap.h:54
CommBreakMap::SetMap
void SetMap(const frm_dir_map_t &newMap, uint64_t framesPlayed)
Definition: commbreakmap.cpp:131
CommBreakMap::m_commBreakMapLock
QRecursiveMutex m_commBreakMapLock
Definition: commbreakmap.h:50
programtypes.h
CommBreakMap::m_lastCommSkipStart
uint64_t m_lastCommSkipStart
Definition: commbreakmap.h:57
CommBreakMap::ResetLastSkip
void ResetLastSkip(void)
Definition: commbreakmap.cpp:27
CommBreakMap::m_commBreakIter
frm_dir_map_t::Iterator m_commBreakIter
Definition: commbreakmap.h:64
CommBreakMap::SetAutoCommercialSkip
void SetAutoCommercialSkip(CommSkipMode autoskip, uint64_t framesPlayed)
Definition: commbreakmap.cpp:32
compat.h
CommBreakMap::LoadMap
void LoadMap(PlayerContext *player_ctx, uint64_t framesPlayed)
Definition: commbreakmap.cpp:50
CommBreakMap::m_lastIgnoredManualSkip
QDateTime m_lastIgnoredManualSkip
Definition: commbreakmap.h:60
CommBreakMap::IsInCommBreak
bool IsInCommBreak(uint64_t frameNumber) const
Definition: commbreakmap.cpp:98
CommBreakMap::GetSkipCommercials
int GetSkipCommercials(void) const
Definition: commbreakmap.h:30
CommBreakMap::m_lastCommSkipDirection
int m_lastCommSkipDirection
Definition: commbreakmap.h:55
CommBreakMap::m_lastCommSkipTime
time_t m_lastCommSkipTime
Definition: commbreakmap.h:56
CommBreakMap::m_maxShortMerge
std::chrono::seconds m_maxShortMerge
Definition: commbreakmap.h:62
CommBreakMap::GetAutoCommercialSkip
CommSkipMode GetAutoCommercialSkip(void) const
Definition: commbreakmap.cpp:21
CommBreakMap::m_maxskip
std::chrono::seconds m_maxskip
Definition: commbreakmap.h:61
CommBreakMap
Definition: commbreakmap.h:18
playercontext.h
CommBreakMap::AutoCommercialSkip
bool AutoCommercialSkip(uint64_t &jumpToFrame, uint64_t framesPlayed, double video_frame_rate, uint64_t totalFrames, QString &comm_msg)
Definition: commbreakmap.cpp:144
CommBreakMap::m_commBreakMap
frm_dir_map_t m_commBreakMap
Definition: commbreakmap.h:63
CommBreakMap::CommBreakMap
CommBreakMap(void)
Definition: commbreakmap.cpp:10
PlayerContext
Definition: playercontext.h:49
CommBreakMap::m_hascommbreaktable
bool m_hascommbreaktable
Definition: commbreakmap.h:59
kCommSkipOff
@ kCommSkipOff
Definition: tv.h:132
CommBreakMap::HasMap
bool HasMap(void) const
Definition: commbreakmap.h:25
CommBreakMap::m_commrewindamount
std::chrono::seconds m_commrewindamount
Definition: commbreakmap.h:53
CommBreakMap::SkipCommercials
void SkipCommercials(int direction)
Definition: commbreakmap.cpp:41