MythTV  master
mainvisual.h
Go to the documentation of this file.
1 // Copyright (c) 2000-2001 Brad Hughes <bhughes@trolltech.com>
2 //
3 // Use, modification and distribution is allowed without limitation,
4 // warranty, or liability of any kind.
5 //
6 
7 #ifndef MAINVISUAL_H
8 #define MAINVISUAL_H
9 
10 #include <vector>
11 
12 #include "constants.h"
13 
14 #include <QResizeEvent>
15 #include <QPaintEvent>
16 #include <QStringList>
17 #include <QHideEvent>
18 #include <QWidget>
19 #include <QPixmap>
20 #include <QTimer>
21 #include <QList>
22 
23 // MythTV headers
24 #include <visual.h>
25 
26 // MythMusic
27 #include "visualize.h"
28 
29 class MythUIVideo;
30 
31 // base class to handle things like frame rate...
32 class MainVisual : public QObject, public MythTV::Visual
33 {
34  Q_OBJECT
35 
36  public:
37  explicit MainVisual(MythUIVideo *visualizer);
38  ~MainVisual() override;
39 
40  VisualBase *visual(void) const { return m_vis; }
41  void setVisual(const QString &name);
42 
43  void stop(void);
44 
45  void resize(const QSize &size);
46 
47  void add(const void *buffer, unsigned long b_len, unsigned long timecode,
48  int source_channel, int bits_per_sample) override; // Visual
49  void prepare(void) override; // Visual
50 
51  void customEvent(QEvent *event) override; // QObject
52 
53  void setFrameRate(int newfps);
54  int frameRate(void) const { return m_fps; }
55 
56  QStringList getVisualizations(void) { return m_visualizers; }
57 
58  int getCurrentVisual(void) const { return m_currentVisualizer; }
59 
60  public slots:
61  void timeout();
62 
63  private:
65  QStringList m_visualizers;
67  VisualBase *m_vis {nullptr};
68  QPixmap m_pixmap;
69  QList<VisualNode*> m_nodes;
70  bool m_playing {false};
71  int m_fps {20};
73  QTimer *m_updateTimer {nullptr};
74 };
75 
76 #endif // MAINVISUAL_H
MainVisual::~MainVisual
~MainVisual() override
Definition: mainvisual.cpp:56
MainVisual::setFrameRate
void setFrameRate(int newfps)
VisualBase
Definition: visualize.h:73
MainVisual::customEvent
void customEvent(QEvent *event) override
Definition: mainvisual.cpp:255
MainVisual::m_fps
int m_fps
Definition: mainvisual.h:71
MainVisual::prepare
void prepare(void) override
Definition: mainvisual.cpp:138
SAMPLES_DEFAULT_SIZE
#define SAMPLES_DEFAULT_SIZE
Definition: visualize.h:46
MainVisual::setVisual
void setVisual(const QString &name)
Definition: mainvisual.cpp:80
MythTV::Visual
Definition: visual.h:17
MainVisual::m_samples
unsigned long m_samples
Definition: mainvisual.h:72
MainVisual::m_playing
bool m_playing
Definition: mainvisual.h:70
MainVisual::timeout
void timeout()
Definition: mainvisual.cpp:208
visualize.h
MainVisual::visual
VisualBase * visual(void) const
Definition: mainvisual.h:40
MainVisual::m_visualizerVideo
MythUIVideo * m_visualizerVideo
Definition: mainvisual.h:64
MainVisual::stop
void stop(void)
Definition: mainvisual.cpp:69
MainVisual::getVisualizations
QStringList getVisualizations(void)
Definition: mainvisual.h:56
MainVisual::getCurrentVisual
int getCurrentVisual(void) const
Definition: mainvisual.h:58
MainVisual
Definition: mainvisual.h:33
MainVisual::m_currentVisualizer
int m_currentVisualizer
Definition: mainvisual.h:66
MainVisual::frameRate
int frameRate(void) const
Definition: mainvisual.h:54
MythUIVideo
Video widget, displays raw image data.
Definition: mythuivideo.h:15
constants.h
MainVisual::m_updateTimer
QTimer * m_updateTimer
Definition: mainvisual.h:73
MainVisual::add
void add(const void *buffer, unsigned long b_len, unsigned long timecode, int source_channel, int bits_per_sample) override
Definition: mainvisual.cpp:147
MainVisual::m_nodes
QList< VisualNode * > m_nodes
Definition: mainvisual.h:69
MainVisual::resize
void resize(const QSize &size)
Definition: mainvisual.cpp:246
MainVisual::m_visualizers
QStringList m_visualizers
Definition: mainvisual.h:65
MainVisual::m_vis
VisualBase * m_vis
Definition: mainvisual.h:67
MainVisual::m_pixmap
QPixmap m_pixmap
Definition: mainvisual.h:68
MainVisual::MainVisual
MainVisual(MythUIVideo *visualizer)
Definition: mainvisual.cpp:34
visual.h