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 "libmyth/visual.h"
11#include "libmythtv/mythtvexp.h"
14
15#include "videovisualdefs.h"
16
17using namespace std::chrono_literals;
18
19#define DESC QString("Visualiser: ")
20
21class MythRender;
22class AudioPlayer;
23
25{
26 public:
27 VisualNode(short *l, short *r, unsigned long n, std::chrono::milliseconds timecode)
28 : m_left(l), m_right(r), m_length(n), m_offset(timecode) { }
29
31 {
32 delete [] m_left;
33 delete [] m_right;
34 }
35
36 short *m_left {nullptr};
37 short *m_right {nullptr};
39 std::chrono::milliseconds m_offset;
40};
41
43{
44 public:
45 static VideoVisual* Create(const QString &name,
46 AudioPlayer *audio, MythRender *render);
47 static QStringList GetVisualiserList(RenderType type);
48
49 VideoVisual(AudioPlayer *audio, MythRender *render);
50 ~VideoVisual() override;
51
52 bool NeedsPrepare() const { return m_needsPrepare; }
53 virtual void Prepare(const QRect /*Area*/) { }
54 virtual void Draw(QRect area, MythPainter *painter,
55 QPaintDevice* device) = 0;
56 virtual QString Name(void) = 0;
57
58 void add(const void *b, unsigned long b_len,
59 std::chrono::milliseconds timecode,
60 int c, int p) override; // Visual
61 void prepare() override; // Visual
62
63 protected:
64 VisualNode* GetNode(void);
65 void DeleteNodes(void);
66 std::chrono::milliseconds SetLastUpdate(void);
67
68 AudioPlayer *m_audio { nullptr };
69 bool m_needsPrepare { false };
70 bool m_disabled { false };
71 QRect m_area;
72 MythRender *m_render { nullptr };
73 QList<VisualNode*> m_nodes;
74 QDateTime m_lastUpdate;
75};
76
78{
79 public:
82 {
84 }
85 virtual ~VideoVisualFactory() = default;
86 virtual const QString &name(void) const = 0;
88 MythRender *render) const = 0;
90 {
92 }
94 {
96 }
98
99 protected:
102};
103#endif // VIDEOVISUAL_H
virtual void add(const void *b, unsigned long b_len, std::chrono::milliseconds timecode, int c, int p)=0
virtual void prepare()=0
VideoVisualFactory * m_nextVideoVisualFactory
Definition: videovisual.h:101
VideoVisualFactory * next() const
Definition: videovisual.h:93
virtual const QString & name(void) const =0
virtual VideoVisual * Create(AudioPlayer *audio, MythRender *render) const =0
static VideoVisualFactory * VideoVisualFactories()
Definition: videovisual.h:89
virtual ~VideoVisualFactory()=default
static VideoVisualFactory * g_videoVisualFactory
Definition: videovisual.h:100
virtual bool SupportedRenderer(RenderType type)=0
QDateTime m_lastUpdate
Definition: videovisual.h:74
bool NeedsPrepare() const
Definition: videovisual.h:52
QList< VisualNode * > m_nodes
Definition: videovisual.h:73
QRect m_area
Definition: videovisual.h:71
virtual void Draw(QRect area, MythPainter *painter, QPaintDevice *device)=0
virtual QString Name(void)=0
virtual void Prepare(const QRect)
Definition: videovisual.h:53
long m_length
Definition: videovisual.h:38
VisualNode(short *l, short *r, unsigned long n, std::chrono::milliseconds timecode)
Definition: videovisual.h:27
short * m_left
Definition: videovisual.h:36
short * m_right
Definition: videovisual.h:37
std::chrono::milliseconds m_offset
Definition: videovisual.h:39
RenderType
#define MTV_PUBLIC
Definition: mythtvexp.h:15