MythTV  master
SceneChangeDetector.h
Go to the documentation of this file.
1 /*
2  * SceneChangeDetector
3  *
4  * Detect scene changes based on histogram analysis.
5  */
6 
7 #ifndef __SCENECHANGEDETECTOR_H__
8 #define __SCENECHANGEDETECTOR_H__
9 
10 #include <QString>
11 
12 #include "FrameAnalyzer.h"
13 
14 using AVFrame = struct AVFrame;
15 class HistogramAnalyzer;
16 
18 {
19 public:
20  SceneChangeDetector(HistogramAnalyzer *ha, const QString& debugdir);
21  virtual void deleteLater(void);
22 
23  /* FrameAnalyzer interface. */
24  const char *name(void) const override // FrameAnalyzer
25  { return "SceneChangeDetector"; }
27  long long nframes) override; // FrameAnalyzer
28  enum analyzeFrameResult analyzeFrame(const VideoFrame *frame,
29  long long frameno, long long *pNextFrame) override; // FrameAnalyzer
30  int finished(long long nframes, bool final) override; // FrameAnalyzer
31  int reportTime(void) const override; // FrameAnalyzer
32  FrameMap GetMap(unsigned int /*index*/) const override // FrameAnalyzer
33  { return m_changeMap; }
34 
35  /* SceneChangeDetector interface. */
36  const FrameAnalyzer::FrameMap *getChanges(void) const { return &m_changeMap; }
37 
39  unsigned char color;
40  unsigned char frequency;
41  };
42  using SceneChangeData = scenechange_data[UCHAR_MAX + 1];
43 
44  protected:
45  ~SceneChangeDetector(void) override = default;
46 
47  private:
49  float m_fps {0.0F};
50 
51  /* per-frame info */
53  unsigned short *m_scDiff {nullptr};
54 
56 
57  /* Debugging */
58  int m_debugLevel {0};
59  QString m_debugData; /* filename */
60  bool m_debugSceneChange {false};
61  bool m_sceneChangeDone {false};
62 };
63 
64 #endif /* !__SCENECHANGEDETECTOR_H__ */
65 
66 /* vim: set expandtab tabstop=4 shiftwidth=4: */
67 
SceneChangeDetector(HistogramAnalyzer *ha, const QString &debugdir)
HistogramAnalyzer * m_histogramAnalyzer
virtual void deleteLater(void)
struct AVFrame AVFrame
int reportTime(void) const override
FrameMap GetMap(unsigned int) const override
enum analyzeFrameResult analyzeFrame(const VideoFrame *frame, long long frameno, long long *pNextFrame) override
enum analyzeFrameResult MythPlayerInited(MythPlayer *player, long long nframes) override
const char * name(void) const override
const FrameAnalyzer::FrameMap * getChanges(void) const
~SceneChangeDetector(void) override=default
scenechange_data[UCHAR_MAX+1] SceneChangeData
QMap< long long, long long > FrameMap
Definition: FrameAnalyzer.h:43
int finished(long long nframes, bool final) override
SceneChangeData * m_scData
FrameAnalyzer::FrameMap m_changeMap
unsigned short * m_scDiff