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