MythTV  master
CommDetector2.h
Go to the documentation of this file.
1 #ifndef _COMMDETECTOR2_H_
2 #define _COMMDETECTOR2_H_
3 
4 // C++ headers
5 #include <vector>
6 using namespace std;
7 
8 // Qt headers
9 #include <QDateTime>
10 
11 // MythTV headers
12 #include "programinfo.h"
13 
14 // Commercial Flagging headers
15 #include "CommDetectorBase.h"
16 #include "FrameAnalyzer.h"
17 
18 class MythPlayer;
19 class TemplateFinder;
20 class TemplateMatcher;
21 class BlankFrameDetector;
23 
24 namespace commDetector2 {
25 
26 QString debugDirectory(int chanid, const QDateTime& recstartts);
27 void createDebugDirectory(const QString& dirname, const QString& comment);
28 QString frameToTimestamp(long long frameno, float fps);
29 QString frameToTimestampms(long long frameno, float fps);
30 QString strftimeval(const struct timeval *tv);
31 
32 }; /* namespace */
33 
34 typedef vector<FrameAnalyzer*> FrameAnalyzerItem;
35 typedef vector<FrameAnalyzerItem> FrameAnalyzerList;
36 
38 {
39  public:
41  SkipType commDetectMethod,
42  bool showProgress, bool fullSpeed, MythPlayer* player,
43  int chanid, QDateTime startts, QDateTime endts,
44  QDateTime recstartts, QDateTime recendts, bool useDB);
45  bool go(void) override; // CommDetectorBase
46  void GetCommercialBreakList(frm_dir_map_t &marks) override; // CommDetectorBase
47  void recordingFinished(long long totalFileSize) override; // CommDetectorBase
48  void requestCommBreakMapUpdate(void) override; // CommDetectorBase
49  void PrintFullMap(ostream &out, const frm_dir_map_t *comm_breaks,
50  bool verbose) const override; // CommDetectorBase
51 
52  private:
53  virtual ~CommDetector2() = default;
54 
55  void reportState(int elapsedms, long long frameno, long long nframes,
56  unsigned int passno, unsigned int npasses);
57  int computeBreaks(long long nframes);
58 
59  private:
60  enum SkipTypes m_commDetectMethod;
61  bool m_showProgress {false};
62  bool m_fullSpeed {false};
63  MythPlayer *m_player {nullptr};
64  QDateTime m_startts;
65  QDateTime m_endts;
66  QDateTime m_recstartts;
67  QDateTime m_recendts;
68 
69  /* current state */
70  bool m_isRecording {false};
71  bool m_sendBreakMapUpdates {false};
72  bool m_breakMapUpdateRequested {false};
73  bool m_finished {false};
74 
75  long long m_currentFrameNumber {0};
76  FrameAnalyzerList m_frameAnalyzers; /* one list per scan of file */
77  FrameAnalyzerList::iterator m_currentPass;
79 
81 
82  TemplateFinder *m_logoFinder {nullptr};
83  TemplateMatcher *m_logoMatcher {nullptr};
84  BlankFrameDetector *m_blankFrameDetector {nullptr};
85  SceneChangeDetector *m_sceneChangeDetector {nullptr};
86 
87  QString m_debugdir;
88 };
89 
90 #endif /* !_COMMDETECTOR2_H_ */
91 
92 /* vim: set expandtab tabstop=4 shiftwidth=4: */
SkipTypes
This is used as a bitmask.
Definition: programtypes.h:91
vector< FrameAnalyzerItem > FrameAnalyzerList
Definition: CommDetector2.h:35
FrameAnalyzer::FrameMap m_breaks
Definition: CommDetector2.h:80
QString frameToTimestamp(long long frameno, float fps)
vector< FrameAnalyzer * > FrameAnalyzerItem
Definition: CommDetector2.h:32
QDateTime m_recstartts
Definition: CommDetector2.h:66
QString m_debugdir
Definition: CommDetector2.h:87
QMap< uint64_t, MarkTypes > frm_dir_map_t
Frame # -> Mark map.
Definition: programtypes.h:81
FrameAnalyzerItem m_finishedAnalyzers
Definition: CommDetector2.h:78
QDateTime m_recendts
Definition: CommDetector2.h:67
QString debugDirectory(int chanid, const QDateTime &recstartts)
Abstract base class for all CommDetectors.
QDateTime m_endts
Definition: CommDetector2.h:65
QDateTime m_startts
Definition: CommDetector2.h:64
static struct mark marks[16]
FrameAnalyzerList m_frameAnalyzers
Definition: CommDetector2.h:76
void createDebugDirectory(const QString &dirname, const QString &comment)
FrameAnalyzerList::iterator m_currentPass
Definition: CommDetector2.h:77
QString frameToTimestampms(long long frameno, float fps)
QString strftimeval(const struct timeval *tv)
QMap< long long, long long > FrameMap
Definition: FrameAnalyzer.h:44
enum SkipTypes SkipType
This is used as a bitmask.