MythTV  master
cetonrtsp.h
Go to the documentation of this file.
1 
7 #ifndef CETONRTSP_H
8 #define CETONRTSP_H
9 
10 #include <cstdint>
11 
12 #include <QObject>
13 #include <QMap>
14 #include <QString>
15 #include <QMutex>
16 #include <QUrl>
17 #include <QTimerEvent>
18 
19 using namespace std::chrono_literals;
20 
21 class QTcpSocket;
22 class QUdpSocket;
23 
24 using Params = QMap<QString, QString>;
25 
26 class CetonRTSP : QObject
27 {
28  Q_OBJECT
29 
30  public:
31  explicit CetonRTSP(const QString &ip, uint tuner, ushort port);
32  explicit CetonRTSP(const QUrl &url);
33  ~CetonRTSP() override;
34 
35  bool GetOptions(QStringList &options);
36  bool Describe(void);
37  bool Setup(ushort clientPort1, ushort clientPort2,
38  ushort &rtpPort, ushort &rtcpPort, uint32_t &ssrc);
39  bool Play(void);
40  bool Teardown(void);
41 
42  void StartKeepAlive(void);
43  void StopKeepAlive(void);
44 
45 protected:
46  bool ProcessRequest(
47  const QString &method, const QStringList *headers = nullptr,
48  bool use_control = false, bool waitforanswer = true,
49  const QString &alternative = QString());
50 
51  private:
52  static QStringList splitLines(const QByteArray &lines);
53  QString readParameters(const QString &key, Params &parameters);
54  QUrl GetBaseUrl(void);
55  void timerEvent(QTimerEvent *event) override; // QObject
56 
57  QTcpSocket *m_socket {nullptr};
58  uint m_sequenceNumber {0};
59  QString m_sessionId {"0"};
62 
63  int m_responseCode {-1};
66  QByteArray m_responseContent;
67  std::chrono::seconds m_timeout {60s};
68  int m_timer {0};
69  bool m_canGetParameter {false};
70 
71  static QMutex s_rtspMutex;
72 
73 };
74 
75 #endif // CETONRTSP_H
CetonRTSP::m_responseContent
QByteArray m_responseContent
Definition: cetonrtsp.h:66
Params
QMap< QString, QString > Params
Definition: cetonrtsp.h:24
CetonRTSP::m_controlUrl
QUrl m_controlUrl
Definition: cetonrtsp.h:61
CetonRTSP::m_responseHeaders
Params m_responseHeaders
Definition: cetonrtsp.h:65
CetonRTSP::s_rtspMutex
static QMutex s_rtspMutex
Definition: cetonrtsp.h:71
CetonRTSP::m_requestUrl
QUrl m_requestUrl
Definition: cetonrtsp.h:60
CetonRTSP::m_responseMessage
QString m_responseMessage
Definition: cetonrtsp.h:64
music163.headers
dictionary headers
Definition: music163.py:26
uint
unsigned int uint
Definition: compat.h:81
CetonRTSP
Definition: cetonrtsp.h:26
build_compdb.options
options
Definition: build_compdb.py:11