MythTV  master
commbreakmap.h
Go to the documentation of this file.
1 #ifndef BREAKMAP_H
2 #define BREAKMAP_H
3 
4 // MythTV headers
5 #include "tv.h"
6 #include "programtypes.h"
7 #include "playercontext.h"
8 
9 // Qt headers
10 #include <QMutex>
11 #include <QMap>
12 #include <QCoreApplication>
13 
14 #include <cstdint>
15 #include "compat.h"
16 
18 {
19  Q_DECLARE_TR_FUNCTIONS(CommBreakMap)
20 
21  public:
22  CommBreakMap(void);
23 
24  bool HasMap(void) const { return m_hascommbreaktable; }
25 
27  void SetAutoCommercialSkip(CommSkipMode autoskip, uint64_t framesPlayed);
28 
29  int GetSkipCommercials(void) const { return m_skipcommercials; }
30  void SkipCommercials(int direction);
31 
32  void ResetLastSkip(void);
33  void SetTracker(uint64_t framesPlayed);
34  void GetMap(frm_dir_map_t &map) const;
35  void SetMap(const frm_dir_map_t &newMap, uint64_t framesPlayed);
36  void LoadMap(PlayerContext *player_ctx, uint64_t framesPlayed);
37 
38  bool IsInCommBreak(uint64_t frameNumber) const;
39  bool AutoCommercialSkip(uint64_t &jumpToFrame, uint64_t framesPlayed,
40  double video_frame_rate, uint64_t totalFrames,
41  QString &comm_msg);
42  bool DoSkipCommercials(uint64_t &jumpToFrame, uint64_t framesPlayed,
43  double video_frame_rate, uint64_t totalFrames,
44  QString &comm_msg);
45 
46  private:
47  void MergeShortCommercials(double video_frame_rate);
48 
49  mutable QMutex m_commBreakMapLock {QMutex::Recursive};
55  time_t m_lastCommSkipTime {0/*1970*/};
56  uint64_t m_lastCommSkipStart {0};
57  time_t m_lastSkipTime {0 /*1970*/};
58  bool m_hascommbreaktable {false};
60  int m_maxskip {3600};
61  int m_maxShortMerge {0};
63  frm_dir_map_t::Iterator m_commBreakIter;
64 };
65 
66 #endif // BREAKMAP_H
CommBreakMap::m_skipcommercials
int m_skipcommercials
Definition: commbreakmap.h:50
CommSkipMode
CommSkipMode
Definition: tv.h:131
CommBreakMap::m_lastSkipTime
time_t m_lastSkipTime
Definition: commbreakmap.h:57
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:251
CommBreakMap::SetTracker
void SetTracker(uint64_t framesPlayed)
Definition: commbreakmap.cpp:68
CommBreakMap::MergeShortCommercials
void MergeShortCommercials(double video_frame_rate)
Definition: commbreakmap.cpp:363
frm_dir_map_t
QMap< uint64_t, MarkTypes > frm_dir_map_t
Frame # -> Mark map.
Definition: programtypes.h:82
CommBreakMap::m_autocommercialskip
CommSkipMode m_autocommercialskip
Definition: commbreakmap.h:51
CommBreakMap::GetMap
void GetMap(frm_dir_map_t &map) const
Definition: commbreakmap.cpp:92
CommBreakMap::m_commnotifyamount
int m_commnotifyamount
Definition: commbreakmap.h:53
CommBreakMap::SetMap
void SetMap(const frm_dir_map_t &newMap, uint64_t framesPlayed)
Definition: commbreakmap.cpp:132
programtypes.h
CommBreakMap::m_lastCommSkipStart
uint64_t m_lastCommSkipStart
Definition: commbreakmap.h:56
CommBreakMap::ResetLastSkip
void ResetLastSkip(void)
Definition: commbreakmap.cpp:28
CommBreakMap::m_commBreakIter
frm_dir_map_t::Iterator m_commBreakIter
Definition: commbreakmap.h:63
CommBreakMap::SetAutoCommercialSkip
void SetAutoCommercialSkip(CommSkipMode autoskip, uint64_t framesPlayed)
Definition: commbreakmap.cpp:33
compat.h
CommBreakMap::m_maxShortMerge
int m_maxShortMerge
Definition: commbreakmap.h:61
CommBreakMap::LoadMap
void LoadMap(PlayerContext *player_ctx, uint64_t framesPlayed)
Definition: commbreakmap.cpp:51
CommBreakMap::m_lastIgnoredManualSkip
QDateTime m_lastIgnoredManualSkip
Definition: commbreakmap.h:59
CommBreakMap::IsInCommBreak
bool IsInCommBreak(uint64_t frameNumber) const
Definition: commbreakmap.cpp:99
CommBreakMap::m_commrewindamount
int m_commrewindamount
Definition: commbreakmap.h:52
CommBreakMap::GetSkipCommercials
int GetSkipCommercials(void) const
Definition: commbreakmap.h:29
CommBreakMap::m_lastCommSkipDirection
int m_lastCommSkipDirection
Definition: commbreakmap.h:54
CommBreakMap::m_lastCommSkipTime
time_t m_lastCommSkipTime
Definition: commbreakmap.h:55
CommBreakMap::GetAutoCommercialSkip
CommSkipMode GetAutoCommercialSkip(void) const
Definition: commbreakmap.cpp:22
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:145
CommBreakMap::m_commBreakMap
frm_dir_map_t m_commBreakMap
Definition: commbreakmap.h:62
CommBreakMap::CommBreakMap
CommBreakMap(void)
Definition: commbreakmap.cpp:10
CommBreakMap::m_commBreakMapLock
QMutex m_commBreakMapLock
Definition: commbreakmap.h:49
PlayerContext
Definition: playercontext.h:49
CommBreakMap::m_hascommbreaktable
bool m_hascommbreaktable
Definition: commbreakmap.h:58
kCommSkipOff
@ kCommSkipOff
Definition: tv.h:132
CommBreakMap::m_maxskip
int m_maxskip
Definition: commbreakmap.h:60
CommBreakMap::HasMap
bool HasMap(void) const
Definition: commbreakmap.h:24
CommBreakMap::SkipCommercials
void SkipCommercials(int direction)
Definition: commbreakmap.cpp:42