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 using FrameAnalyzerItem = vector<FrameAnalyzer*>;
35 using FrameAnalyzerList = vector<FrameAnalyzerItem>;
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  ~CommDetector2() override = 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:
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: */
CommDetectorBase
Abstract base class for all CommDetectors. Please use the CommDetectFactory to make actual instances.
Definition: CommDetectorBase.h:28
CommDetector2::m_endts
QDateTime m_endts
Definition: CommDetector2.h:65
SceneChangeDetector
Definition: SceneChangeDetector.h:18
commDetector2::strftimeval
QString strftimeval(const struct timeval *tv)
Definition: CommDetector2.cpp:271
FrameAnalyzer::FrameMap
QMap< long long, long long > FrameMap
Definition: FrameAnalyzer.h:45
frm_dir_map_t
QMap< uint64_t, MarkTypes > frm_dir_map_t
Frame # -> Mark map.
Definition: programtypes.h:82
CommDetector2::m_breaks
FrameAnalyzer::FrameMap m_breaks
Definition: CommDetector2.h:80
CommDetector2::m_recstartts
QDateTime m_recstartts
Definition: CommDetector2.h:66
MythPlayer
Definition: mythplayer.h:165
CommDetector2::m_finishedAnalyzers
FrameAnalyzerItem m_finishedAnalyzers
Definition: CommDetector2.h:78
commDetector2::createDebugDirectory
void createDebugDirectory(const QString &dirname, const QString &comment)
Definition: CommDetector2.cpp:231
commDetector2::debugDirectory
QString debugDirectory(int chanid, const QDateTime &recstartts)
Definition: CommDetector2.cpp:197
TemplateFinder
Definition: TemplateFinder.h:31
programinfo.h
FrameAnalyzerList
vector< FrameAnalyzerItem > FrameAnalyzerList
Definition: CommDetector2.h:35
CommDetector2::m_startts
QDateTime m_startts
Definition: CommDetector2.h:64
FrameAnalyzer.h
CommDetector2::m_frameAnalyzers
FrameAnalyzerList m_frameAnalyzers
Definition: CommDetector2.h:76
BlankFrameDetector
Definition: BlankFrameDetector.h:16
CommDetector2::m_currentPass
FrameAnalyzerList::iterator m_currentPass
Definition: CommDetector2.h:77
marks
static struct mark marks[16]
CommDetector2::m_recendts
QDateTime m_recendts
Definition: CommDetector2.h:67
CommDetector2::m_commDetectMethod
SkipType m_commDetectMethod
Definition: CommDetector2.h:60
commDetector2
Definition: CommDetector2.cpp:195
SkipType
SkipType
This is used as a bitmask.
Definition: programtypes.h:92
hardwareprofile.distros.mythtv_data.makeopts.verbose
verbose
Definition: makeopts.py:60
commDetector2::frameToTimestampms
QString frameToTimestampms(long long frameno, float fps)
Definition: CommDetector2.cpp:263
commDetector2::frameToTimestamp
QString frameToTimestamp(long long frameno, float fps)
Definition: CommDetector2.cpp:255
CommDetectorBase.h
FrameAnalyzerItem
vector< FrameAnalyzer * > FrameAnalyzerItem
Definition: CommDetector2.h:34
CommDetector2::~CommDetector2
~CommDetector2() override=default
TemplateMatcher
Definition: TemplateMatcher.h:32
CommDetector2
Definition: CommDetector2.h:38
CommDetector2::m_debugdir
QString m_debugdir
Definition: CommDetector2.h:87