MythTV  master
mythraopdevice.h
Go to the documentation of this file.
1 #ifndef MYTHRAOPDEVICE_H
2 #define MYTHRAOPDEVICE_H
3 
4 #include <QObject>
5 #if QT_VERSION < QT_VERSION_CHECK(5,14,0)
6 #include <QMutex>
7 #else
8 #include <QRecursiveMutex>
9 #endif
10 
11 #include "libmythbase/serverpool.h"
12 #include "libmythtv/mythtvexp.h"
13 
14 class MThread;
15 class BonjourRegister;
16 class MythRAOPConnection;
17 
18 static constexpr int RAOP_PORT_RANGE { 100 };
19 
21 {
22  Q_OBJECT
23 
24  public:
25  static bool Create(void);
26  static void Cleanup(void);
27  static MythRAOPDevice *RAOPSharedInstance(void) { return gMythRAOPDevice; }
28 
30  void DeleteAllClients(MythRAOPConnection *keep);
31 
32  public slots:
33  void TVPlaybackStarting(void);
34 
35  private slots:
36  void Start();
37  void Stop();
38  void newRaopConnection(QTcpSocket *client);
39  void deleteClient();
40 
41  private:
42  ~MythRAOPDevice(void) override;
43  void Teardown(void);
44  bool RegisterForBonjour(void);
45 
46  // Globals
48 #if QT_VERSION < QT_VERSION_CHECK(5,14,0)
49  static QMutex *gMythRAOPDeviceMutex;
50 #else
51  static QRecursiveMutex *gMythRAOPDeviceMutex;
52 #endif
54 
55  // Members
56  QString m_name {"MythTV"};
57  QByteArray m_hardwareId;
58  BonjourRegister *m_bonjour {nullptr};
59  bool m_valid {false};
60 #if QT_VERSION < QT_VERSION_CHECK(5,14,0)
61  QMutex *m_lock {nullptr};
62 #else
63  QRecursiveMutex *m_lock {nullptr};
64 #endif
65  int m_setupPort {5000};
66  int m_basePort {0};
67  QList<MythRAOPConnection*> m_clients;
68 };
69 
70 
71 #endif // MYTHRAOPDEVICE_H
ServerPool
Manages a collection of sockets listening on different ports.
Definition: serverpool.h:59
mythtvexp.h
BonjourRegister
Definition: bonjourregister.h:11
MythRAOPDevice
Definition: mythraopdevice.h:20
MythRAOPDevice::gMythRAOPDeviceMutex
static QRecursiveMutex * gMythRAOPDeviceMutex
Definition: mythraopdevice.h:51
MythRAOPDevice::gMythRAOPDevice
static MythRAOPDevice * gMythRAOPDevice
Definition: mythraopdevice.h:47
MythRAOPDevice::m_clients
QList< MythRAOPConnection * > m_clients
Definition: mythraopdevice.h:67
RAOP_PORT_RANGE
static constexpr int RAOP_PORT_RANGE
Definition: mythraopdevice.h:18
MTV_PUBLIC
#define MTV_PUBLIC
Definition: mythtvexp.h:15
MythRAOPDevice::m_hardwareId
QByteArray m_hardwareId
Definition: mythraopdevice.h:57
MythRAOPDevice::RAOPSharedInstance
static MythRAOPDevice * RAOPSharedInstance(void)
Definition: mythraopdevice.h:27
serverpool.h
MThread
This is a wrapper around QThread that does several additional things.
Definition: mthread.h:48
MythRAOPConnection
Definition: mythraopconnection.h:46
MythRAOPDevice::gMythRAOPDeviceThread
static MThread * gMythRAOPDeviceThread
Definition: mythraopdevice.h:53