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
VisualNode::~VisualNode
~VisualNode()
Definition: videovisual.h:28
VideoVisualFactory::VideoVisualFactories
static VideoVisualFactory * VideoVisualFactories()
Definition: videovisual.h:83
MythTV::Visual::prepare
virtual void prepare()=0
VideoVisualFactory::g_videoVisualFactory
static VideoVisualFactory * g_videoVisualFactory
Definition: videovisual.h:94
VideoVisual::m_lastUpdate
QDateTime m_lastUpdate
Definition: videovisual.h:68
AudioPlayer
Definition: audioplayer.h:27
VisualNode
Definition: videovisual.h:23
mythtvexp.h
VideoVisual::m_nodes
QList< VisualNode * > m_nodes
Definition: videovisual.h:67
VideoVisual::Name
virtual QString Name(void)=0
VisualNode::m_offset
long m_offset
Definition: videovisual.h:37
VisualNode::m_left
short * m_left
Definition: videovisual.h:34
MythTV::Visual
Definition: visual.h:17
mythrender_base.h
mythlogging.h
hardwareprofile.config.p
p
Definition: config.py:33
VisualNode::m_right
short * m_right
Definition: videovisual.h:35
VideoVisualFactory::VideoVisualFactory
VideoVisualFactory()
Definition: videovisual.h:74
VideoVisualFactory::SupportedRenderer
virtual bool SupportedRenderer(RenderType type)=0
VideoVisualFactory
Definition: videovisual.h:72
VideoVisualFactory::next
VideoVisualFactory * next() const
Definition: videovisual.h:87
VideoVisualFactory::~VideoVisualFactory
virtual ~VideoVisualFactory()=default
RenderType
RenderType
Definition: mythrender_base.h:15
mythpainter.h
VisualNode::VisualNode
VisualNode(short *l, short *r, unsigned long n, unsigned long o)
Definition: videovisual.h:25
MTV_PUBLIC
#define MTV_PUBLIC
Definition: mythtvexp.h:15
VideoVisualFactory::name
virtual const QString & name(void) const =0
VisualNode::m_length
long m_length
Definition: videovisual.h:36
MythRender
Definition: mythrender_base.h:23
MythPainter
Definition: mythpainter.h:33
VideoVisualFactory::Create
virtual VideoVisual * Create(AudioPlayer *audio, MythRender *render) const =0
MythTV::Visual::add
virtual void add(const void *b, unsigned long b_len, unsigned long w, int c, int p)=0
VideoVisual
Definition: videovisual.h:41
VideoVisual::Draw
virtual void Draw(const QRect &area, MythPainter *painter, QPaintDevice *device)=0
VideoVisual::m_area
QRect m_area
Definition: videovisual.h:65
VideoVisualFactory::m_nextVideoVisualFactory
VideoVisualFactory * m_nextVideoVisualFactory
Definition: videovisual.h:95
videovisualdefs.h
visual.h