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 
17 class NuppelVideoPlayer;
18 
20 {
22 
23  public:
24  CommBreakMap(void);
25 
26  bool HasMap(void) const { return m_hascommbreaktable; }
27 
29  void SetAutoCommercialSkip(CommSkipMode autoskip, uint64_t framesPlayed);
30 
31  int GetSkipCommercials(void) const { return m_skipcommercials; }
32  void SkipCommercials(int direction);
33 
34  void ResetLastSkip(void);
35  void SetTracker(uint64_t framesPlayed);
36  void GetMap(frm_dir_map_t &map) const;
37  void SetMap(const frm_dir_map_t &newMap, uint64_t framesPlayed);
38  void LoadMap(PlayerContext *player_ctx, uint64_t framesPlayed);
39 
40  bool IsInCommBreak(uint64_t frameNumber) const;
41  bool AutoCommercialSkip(uint64_t &jumpToFrame, uint64_t framesPlayed,
42  double video_frame_rate, uint64_t totalFrames,
43  QString &comm_msg);
44  bool DoSkipCommercials(uint64_t &jumpToFrame, uint64_t framesPlayed,
45  double video_frame_rate, uint64_t totalFrames,
46  QString &comm_msg);
47 
48  private:
49  void MergeShortCommercials(double video_frame_rate);
50 
51  mutable QMutex m_commBreakMapLock {QMutex::Recursive};
57  time_t m_lastCommSkipTime {0/*1970*/};
58  uint64_t m_lastCommSkipStart {0};
59  time_t m_lastSkipTime {0 /*1970*/};
60  bool m_hascommbreaktable {false};
62  int m_maxskip {3600};
63  int m_maxShortMerge {0};
65  frm_dir_map_t::Iterator m_commBreakIter;
66 };
67 
68 #endif // BREAKMAP_H
int m_commrewindamount
Definition: commbreakmap.h:54
CommSkipMode m_autocommercialskip
Definition: commbreakmap.h:53
bool HasMap(void) const
Definition: commbreakmap.h:26
time_t m_lastCommSkipTime
Definition: commbreakmap.h:57
void SkipCommercials(int direction)
uint64_t m_lastCommSkipStart
Definition: commbreakmap.h:58
void SetMap(const frm_dir_map_t &newMap, uint64_t framesPlayed)
int m_skipcommercials
Definition: commbreakmap.h:52
void SetAutoCommercialSkip(CommSkipMode autoskip, uint64_t framesPlayed)
QMap< uint64_t, MarkTypes > frm_dir_map_t
Frame # -> Mark map.
Definition: programtypes.h:81
QMutex m_commBreakMapLock
Definition: commbreakmap.h:51
void GetMap(frm_dir_map_t &map) const
void ResetLastSkip(void)
void SetTracker(uint64_t framesPlayed)
CommSkipMode
Definition: tv.h:130
int m_commnotifyamount
Definition: commbreakmap.h:55
bool AutoCommercialSkip(uint64_t &jumpToFrame, uint64_t framesPlayed, double video_frame_rate, uint64_t totalFrames, QString &comm_msg)
CommBreakMap(void)
Definition: commbreakmap.cpp:9
Q_DECLARE_TR_FUNCTIONS(CommBreakMap)
bool DoSkipCommercials(uint64_t &jumpToFrame, uint64_t framesPlayed, double video_frame_rate, uint64_t totalFrames, QString &comm_msg)
frm_dir_map_t::Iterator m_commBreakIter
Definition: commbreakmap.h:65
frm_dir_map_t m_commBreakMap
Definition: commbreakmap.h:64
int m_maxShortMerge
Definition: commbreakmap.h:63
bool m_hascommbreaktable
Definition: commbreakmap.h:60
QDateTime m_lastIgnoredManualSkip
Definition: commbreakmap.h:61
void MergeShortCommercials(double video_frame_rate)
CommSkipMode GetAutoCommercialSkip(void) const
int m_lastCommSkipDirection
Definition: commbreakmap.h:56
void LoadMap(PlayerContext *player_ctx, uint64_t framesPlayed)
int GetSkipCommercials(void) const
Definition: commbreakmap.h:31
time_t m_lastSkipTime
Definition: commbreakmap.h:59
bool IsInCommBreak(uint64_t frameNumber) const