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 
21 // qt
22 //#include <QKeyEvent>
23 #include <QObject>
24 
25 // mythtv
26 #include <mythscreentype.h>
27 #include <mythuiimage.h>
28 #include <mythuitext.h>
29 #include <mythdialogbox.h>
30 
31 // mythzoneminder
32 #include "zmdefines.h"
33 
34 class Player
35 {
36  public:
37  Player(void) = default;
38  ~Player(void);
39 
40  void updateFrame(const uchar* buffer);
41  void updateStatus(void);
42  void updateCamera();
43 
44  void setMonitor(Monitor *mon);
45  void setWidgets(MythUIImage *image, MythUIText *status,
46  MythUIText *camera);
47 
48  Monitor *getMonitor(void) { return &m_monitor; }
49 
50  private:
54 
55  uchar *m_rgba {nullptr};
56 
58 };
59 
61 {
62  Q_OBJECT
63 
64  public:
65  explicit ZMLivePlayer(MythScreenStack *parent, bool isMiniPlayer = false);
66  ~ZMLivePlayer() override;
67 
68  bool Create(void) override; // MythScreenType
69  bool keyPressEvent(QKeyEvent *event) override; // MythScreenType
70  void customEvent(QEvent *event) override; // MythUIType
71 
72  void ShowMenu() override; // MythScreenType
73 
74  void setMonitorLayout(int layout, bool restore = false);
75 
76  protected slots:
77  void updateFrame(void);
78  bool initMonitorLayout(int layout);
79 
80  protected:
81  MythUIType* GetMythUIType(const QString &name, bool optional = false);
82  bool hideAll();
83  void stopPlayers(void);
84  void changePlayerMonitor(int playerNo);
85  void changeView(void);
86 
87  QTimer *m_frameTimer {nullptr};
88  bool m_paused {false};
89  int m_monitorLayout {1};
90  int m_monitorCount {0};
91 
92  std::vector<Player *> *m_players {nullptr};
93 
94  bool m_isMiniPlayer {false};
95  int m_alarmMonitor {-1};
96 };
97 
98 #endif
ZMLivePlayer::m_isMiniPlayer
bool m_isMiniPlayer
Definition: zmliveplayer.h:94
mythuitext.h
ZMLivePlayer::Create
bool Create(void) override
Definition: zmliveplayer.cpp:49
MythUIImage
Image widget, displays a single image or multiple images in sequence.
Definition: mythuiimage.h:98
ZMLivePlayer::hideAll
bool hideAll()
Definition: zmliveplayer.cpp:88
zmdefines.h
Player::m_frameImage
MythUIImage * m_frameImage
Definition: zmliveplayer.h:51
ZMLivePlayer::setMonitorLayout
void setMonitorLayout(int layout, bool restore=false)
Definition: zmliveplayer.cpp:389
ZMLivePlayer::m_paused
bool m_paused
Definition: zmliveplayer.h:88
mythdialogbox.h
MythScreenStack
Definition: mythscreenstack.h:16
ZMLivePlayer::~ZMLivePlayer
~ZMLivePlayer() override
Definition: zmliveplayer.cpp:160
MythScreenType
Screen in which all other widgets are contained and rendered.
Definition: mythscreentype.h:45
Player::updateStatus
void updateStatus(void)
Definition: zmliveplayer.cpp:505
ZMLivePlayer::keyPressEvent
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
Definition: zmliveplayer.cpp:189
Player::getMonitor
Monitor * getMonitor(void)
Definition: zmliveplayer.h:48
ZMLivePlayer::m_monitorLayout
int m_monitorLayout
Definition: zmliveplayer.h:89
ZMLivePlayer::m_alarmMonitor
int m_alarmMonitor
Definition: zmliveplayer.h:95
ZMLivePlayer::changeView
void changeView(void)
Definition: zmliveplayer.cpp:301
mythuiimage.h
ZMLivePlayer::changePlayerMonitor
void changePlayerMonitor(int playerNo)
Definition: zmliveplayer.cpp:309
Player::m_statusText
MythUIText * m_statusText
Definition: zmliveplayer.h:52
Player::updateCamera
void updateCamera()
Definition: zmliveplayer.cpp:520
ZMLivePlayer::ZMLivePlayer
ZMLivePlayer(MythScreenStack *parent, bool isMiniPlayer=false)
Definition: zmliveplayer.cpp:35
ZMLivePlayer::initMonitorLayout
bool initMonitorLayout(int layout)
Definition: zmliveplayer.cpp:143
ZMLivePlayer
Definition: zmliveplayer.h:61
Player::m_cameraText
MythUIText * m_cameraText
Definition: zmliveplayer.h:53
ZMLivePlayer::ShowMenu
void ShowMenu() override
Definition: zmliveplayer.cpp:237
ZMLivePlayer::m_frameTimer
QTimer * m_frameTimer
Definition: zmliveplayer.h:87
MythUIType
The base class on which all widgets and screens are based.
Definition: mythuitype.h:85
Player::m_monitor
Monitor m_monitor
Definition: zmliveplayer.h:57
Player::updateFrame
void updateFrame(const uchar *buffer)
Definition: zmliveplayer.cpp:495
MythUIText
All purpose text widget, displays a text string.
Definition: mythuitext.h:29
Player::setWidgets
void setWidgets(MythUIImage *image, MythUIText *status, MythUIText *camera)
Definition: zmliveplayer.cpp:479
ZMLivePlayer::stopPlayers
void stopPlayers(void)
Definition: zmliveplayer.cpp:384
ZMLivePlayer::m_players
std::vector< Player * > * m_players
Definition: zmliveplayer.h:92
Player::m_rgba
uchar * m_rgba
Definition: zmliveplayer.h:55
ZMLivePlayer::m_monitorCount
int m_monitorCount
Definition: zmliveplayer.h:90
ZMLivePlayer::customEvent
void customEvent(QEvent *event) override
Definition: zmliveplayer.cpp:273
Monitor
Definition: zmdefines.h:100
Player
Definition: zmliveplayer.h:35
Player::setMonitor
void setMonitor(Monitor *mon)
Definition: zmliveplayer.cpp:469
Player::Player
Player(void)=default
Player::~Player
~Player(void)
Definition: zmliveplayer.cpp:463
mythscreentype.h
ZMLivePlayer::updateFrame
void updateFrame(void)
Definition: zmliveplayer.cpp:345
ZMLivePlayer::GetMythUIType
MythUIType * GetMythUIType(const QString &name, bool optional=false)
Definition: zmliveplayer.cpp:78