MythTV  master
videovisual.h
Go to the documentation of this file.
1 #ifndef VIDEOVISUAL_H
2 #define VIDEOVISUAL_H
3 
4 #include <cstdint>
5 
6 #include <QRect>
7 #include <QList>
8 #include <QDateTime>
9 
10 #include "mythtvexp.h"
11 #include "mythlogging.h"
12 #include "visual.h"
13 #include "mythrender_base.h"
14 #include "mythpainter.h"
15 #include "videovisualdefs.h"
16 
17 #define DESC QString("Visualiser: ")
18 
19 class MythRender;
20 class AudioPlayer;
21 
23 {
24  public:
25  VisualNode(short *l, short *r, unsigned long n, unsigned long o)
26  : m_left(l), m_right(r), m_length(n), m_offset(o) { }
27 
29  {
30  delete [] m_left;
31  delete [] m_right;
32  }
33 
34  short *m_left {nullptr};
35  short *m_right {nullptr};
36  long m_length;
37  long m_offset;
38 };
39 
41 {
42  public:
43  static bool CanVisualise(AudioPlayer *audio, MythRender *render);
44  static VideoVisual* Create(const QString &name,
45  AudioPlayer *audio, MythRender *render);
46  static QStringList GetVisualiserList(RenderType type);
47 
48  VideoVisual(AudioPlayer *audio, MythRender *render);
49  ~VideoVisual() override;
50 
51  virtual void Draw(const QRect &area, MythPainter *painter,
52  QPaintDevice* device) = 0;
53  virtual QString Name(void) = 0;
54 
55  void add(const void *b, unsigned long b_len, unsigned long w, int c, int p) override; // Visual
56  void prepare() override; // Visual
57 
58  protected:
59  VisualNode* GetNode(void);
60  void DeleteNodes(void);
61  int64_t SetLastUpdate(void);
62 
63  AudioPlayer *m_audio {nullptr};
64  bool m_disabled {false};
65  QRect m_area;
66  MythRender *m_render {nullptr};
67  QList<VisualNode*> m_nodes;
68  QDateTime m_lastUpdate;
69 };
70 
72 {
73  public:
75  {
77  g_videoVisualFactory = this;
78  }
79  virtual ~VideoVisualFactory() = default;
80  virtual const QString &name(void) const = 0;
81  virtual VideoVisual* Create(AudioPlayer *audio,
82  MythRender *render) const = 0;
84  {
85  return g_videoVisualFactory;
86  }
88  {
90  }
91  virtual bool SupportedRenderer(RenderType type) = 0;
92 
93  protected:
96 };
97 #endif // VIDEOVISUAL_H
virtual void add(const void *b, unsigned long b_len, unsigned long w, int c, int p)=0
QDateTime m_lastUpdate
Definition: videovisual.h:68
virtual const QString & name(void) const =0
long m_offset
Definition: videovisual.h:37
virtual VideoVisual * Create(AudioPlayer *audio, MythRender *render) const =0
virtual void prepare()=0
short * m_right
Definition: videovisual.h:35
QList< VisualNode * > m_nodes
Definition: videovisual.h:67
virtual bool SupportedRenderer(RenderType type)=0
VideoVisualFactory * m_nextVideoVisualFactory
Definition: videovisual.h:95
VideoVisualFactory * next() const
Definition: videovisual.h:87
#define MTV_PUBLIC
Definition: mythtvexp.h:15
static VideoVisualFactory * g_videoVisualFactory
Definition: videovisual.h:94
virtual ~VideoVisualFactory()=default
long m_length
Definition: videovisual.h:36
VisualNode(short *l, short *r, unsigned long n, unsigned long o)
Definition: videovisual.h:25
RenderType
static VideoVisualFactory * VideoVisualFactories()
Definition: videovisual.h:83
QRect m_area
Definition: videovisual.h:65
short * m_left
Definition: videovisual.h:34