MythTV  master
zmliveplayer.h
Go to the documentation of this file.
1 /* ============================================================
2  * This program is free software; you can redistribute it
3  * and/or modify it under the terms of the GNU General
4  * Public License as published bythe Free Software Foundation;
5  * either version 2, or (at your option)
6  * any later version.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * ============================================================ */
14 
15 #ifndef ZMLIVEPLAYER_H
16 #define ZMLIVEPLAYER_H
17 
18 // c++
19 #include <vector>
20 using namespace std;
21 
22 // qt
23 //#include <QKeyEvent>
24 #include <QObject>
25 
26 // mythtv
27 #include <mythscreentype.h>
28 #include <mythuiimage.h>
29 #include <mythuitext.h>
30 #include <mythdialogbox.h>
31 
32 // mythzoneminder
33 #include "zmdefines.h"
34 
35 class Player
36 {
37  public:
38  Player(void) = default;
39  ~Player(void);
40 
41  void updateFrame(const uchar* buffer);
42  void updateStatus(void);
43  void updateCamera();
44 
45  void setMonitor(Monitor *mon);
46  void setWidgets(MythUIImage *image, MythUIText *status,
47  MythUIText *camera);
48 
49  Monitor *getMonitor(void) { return &m_monitor; }
50 
51  private:
52  MythUIImage *m_frameImage {nullptr};
53  MythUIText *m_statusText {nullptr};
54  MythUIText *m_cameraText {nullptr};
55 
56  uchar *m_rgba {nullptr};
57 
59 };
60 
62 {
63  Q_OBJECT
64 
65  public:
66  ZMLivePlayer(MythScreenStack *parent, bool isMiniPlayer = false);
67  ~ZMLivePlayer();
68 
69  bool Create(void) override; // MythScreenType
70  bool keyPressEvent(QKeyEvent *) override; // MythScreenType
71  void customEvent(QEvent *event) override; // MythUIType
72 
73  void ShowMenu() override; // MythScreenType
74 
75  void setMonitorLayout(int layout, bool restore = false);
76 
77  protected slots:
78  void updateFrame(void);
79  bool initMonitorLayout(int layout);
80 
81  protected:
82  MythUIType* GetMythUIType(const QString &name, bool optional = false);
83  bool hideAll();
84  void stopPlayers(void);
85  void changePlayerMonitor(int playerNo);
86  void changeView(void);
87 
88  QTimer *m_frameTimer {nullptr};
89  bool m_paused {false};
90  int m_monitorLayout {1};
91  int m_monitorCount {0};
92 
93  vector<Player *> *m_players {nullptr};
94 
95  bool m_isMiniPlayer {false};
96  int m_alarmMonitor {-1};
97 };
98 
99 #endif
unsigned int slots[4]
Definition: element.c:38
All purpose text widget, displays a text string.
Definition: mythuitext.h:28
Image widget, displays a single image or multiple images in sequence.
Definition: mythuiimage.h:97
The base class on which all widgets and screens are based.
Definition: mythuitype.h:63
Monitor m_monitor
Definition: zmliveplayer.h:58
Monitor * getMonitor(void)
Definition: zmliveplayer.h:49
Screen in which all other widgets are contained and rendered.