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 
7 // Qt headers
8 #include <QDateTime>
9 
10 // MythTV headers
11 #include "programinfo.h"
12 
13 // Commercial Flagging headers
14 #include "CommDetectorBase.h"
15 #include "FrameAnalyzer.h"
16 
17 class MythCommFlagPlayer;
18 class TemplateFinder;
19 class TemplateMatcher;
20 class BlankFrameDetector;
22 
23 namespace commDetector2 {
24 
25 QString debugDirectory(int chanid, const QDateTime& recstartts);
26 void createDebugDirectory(const QString& dirname, const QString& comment);
27 QString frameToTimestamp(long long frameno, float fps);
28 QString frameToTimestampms(long long frameno, float fps);
29 QString strftimeval(const struct timeval *tv);
30 
31 }; /* namespace */
32 
33 using FrameAnalyzerItem = std::vector<FrameAnalyzer*>;
34 using FrameAnalyzerList = std::vector<FrameAnalyzerItem>;
35 
37 {
38  public:
40  SkipType commDetectMethod,
41  bool showProgress, bool fullSpeed, MythCommFlagPlayer* player,
42  int chanid, QDateTime startts, QDateTime endts,
43  QDateTime recstartts, QDateTime recendts, bool useDB);
44  bool go(void) override; // CommDetectorBase
45  void GetCommercialBreakList(frm_dir_map_t &marks) override; // CommDetectorBase
46  void recordingFinished(long long totalFileSize) override; // CommDetectorBase
47  void requestCommBreakMapUpdate(void) override; // CommDetectorBase
48  void PrintFullMap(std::ostream &out, const frm_dir_map_t *comm_breaks,
49  bool verbose) const override; // CommDetectorBase
50 
51  private:
52  ~CommDetector2() override = default;
53 
54  void reportState(int elapsedms, long long frameno, long long nframes,
55  unsigned int passno, unsigned int npasses);
56  int computeBreaks(long long nframes);
57 
58  private:
60  bool m_showProgress {false};
61  bool m_fullSpeed {false};
63  QDateTime m_startts;
64  QDateTime m_endts;
65  QDateTime m_recstartts;
66  QDateTime m_recendts;
67 
68  /* current state */
69  bool m_isRecording {false};
70  bool m_sendBreakMapUpdates {false};
72  bool m_finished {false};
73 
74  long long m_currentFrameNumber {0};
75  FrameAnalyzerList m_frameAnalyzers; /* one list per scan of file */
76  FrameAnalyzerList::iterator m_currentPass;
78 
80 
85 
86  QString m_debugdir;
87 };
88 
89 #endif /* !COMMDETECTOR2_H */
90 
91 /* vim: set expandtab tabstop=4 shiftwidth=4: */
CommDetectorBase
Abstract base class for all CommDetectors.
Definition: CommDetectorBase.h:27
CommDetector2::m_endts
QDateTime m_endts
Definition: CommDetector2.h:64
SceneChangeDetector
Definition: SceneChangeDetector.h:18
commDetector2::strftimeval
QString strftimeval(const struct timeval *tv)
Definition: CommDetector2.cpp:270
CommDetector2::m_showProgress
bool m_showProgress
Definition: CommDetector2.h:60
CommDetector2::reportState
void reportState(int elapsedms, long long frameno, long long nframes, unsigned int passno, unsigned int npasses)
Definition: CommDetector2.cpp:376
CommDetector2::go
bool go(void) override
Definition: CommDetector2.cpp:470
CommDetector2::recordingFinished
void recordingFinished(long long totalFileSize) override
Definition: CommDetector2.cpp:761
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:79
CommDetector2::requestCommBreakMapUpdate
void requestCommBreakMapUpdate(void) override
Definition: CommDetector2.cpp:770
CommDetector2::m_recstartts
QDateTime m_recstartts
Definition: CommDetector2.h:65
CommDetector2::m_player
MythCommFlagPlayer * m_player
Definition: CommDetector2.h:62
CommDetector2::m_finished
bool m_finished
Definition: CommDetector2.h:72
CommDetector2::m_finishedAnalyzers
FrameAnalyzerItem m_finishedAnalyzers
Definition: CommDetector2.h:77
commDetector2::createDebugDirectory
void createDebugDirectory(const QString &dirname, const QString &comment)
Definition: CommDetector2.cpp:230
commDetector2::debugDirectory
QString debugDirectory(int chanid, const QDateTime &recstartts)
Definition: CommDetector2.cpp:196
CommDetector2::computeBreaks
int computeBreaks(long long nframes)
Definition: CommDetector2.cpp:420
TemplateFinder
Definition: TemplateFinder.h:31
programinfo.h
CommDetector2::CommDetector2
CommDetector2(SkipType commDetectMethod, bool showProgress, bool fullSpeed, MythCommFlagPlayer *player, int chanid, QDateTime startts, QDateTime endts, QDateTime recstartts, QDateTime recendts, bool useDB)
Definition: CommDetector2.cpp:280
CommDetector2::PrintFullMap
void PrintFullMap(std::ostream &out, const frm_dir_map_t *comm_breaks, bool verbose) const override
Definition: CommDetector2.cpp:806
FrameAnalyzerItem
std::vector< FrameAnalyzer * > FrameAnalyzerItem
Definition: CommDetector2.h:33
CommDetector2::m_startts
QDateTime m_startts
Definition: CommDetector2.h:63
MythCommFlagPlayer
Definition: mythcommflagplayer.h:26
CommDetector2::GetCommercialBreakList
void GetCommercialBreakList(frm_dir_map_t &marks) override
Definition: CommDetector2.cpp:694
FrameAnalyzer.h
CommDetector2::m_currentFrameNumber
long long m_currentFrameNumber
Definition: CommDetector2.h:74
CommDetector2::m_frameAnalyzers
FrameAnalyzerList m_frameAnalyzers
Definition: CommDetector2.h:75
CommDetector2::m_sceneChangeDetector
SceneChangeDetector * m_sceneChangeDetector
Definition: CommDetector2.h:84
CommDetector2::m_sendBreakMapUpdates
bool m_sendBreakMapUpdates
Definition: CommDetector2.h:70
FrameAnalyzerList
std::vector< FrameAnalyzerItem > FrameAnalyzerList
Definition: CommDetector2.h:34
BlankFrameDetector
Definition: BlankFrameDetector.h:16
CommDetector2::m_logoMatcher
TemplateMatcher * m_logoMatcher
Definition: CommDetector2.h:82
CommDetector2::m_currentPass
FrameAnalyzerList::iterator m_currentPass
Definition: CommDetector2.h:76
CommDetector2::m_recendts
QDateTime m_recendts
Definition: CommDetector2.h:66
CommDetector2::m_logoFinder
TemplateFinder * m_logoFinder
Definition: CommDetector2.h:81
CommDetector2::m_commDetectMethod
SkipType m_commDetectMethod
Definition: CommDetector2.h:59
commDetector2
Definition: CommDetector2.cpp:194
marks
static const std::array< const mark, 16 > marks
Definition: lang.cpp:22
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:262
commDetector2::frameToTimestamp
QString frameToTimestamp(long long frameno, float fps)
Definition: CommDetector2.cpp:254
CommDetector2::m_fullSpeed
bool m_fullSpeed
Definition: CommDetector2.h:61
CommDetectorBase.h
CommDetector2::m_blankFrameDetector
BlankFrameDetector * m_blankFrameDetector
Definition: CommDetector2.h:83
CommDetector2::~CommDetector2
~CommDetector2() override=default
CommDetector2::m_isRecording
bool m_isRecording
Definition: CommDetector2.h:69
TemplateMatcher
Definition: TemplateMatcher.h:32
CommDetector2
Definition: CommDetector2.h:37
CommDetector2::m_debugdir
QString m_debugdir
Definition: CommDetector2.h:86
CommDetector2::m_breakMapUpdateRequested
bool m_breakMapUpdateRequested
Definition: CommDetector2.h:71