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 class QTcpSocket;
20 class QUdpSocket;
21 
22 using Params = QMap<QString, QString>;
23 
24 class CetonRTSP : QObject
25 {
26  Q_OBJECT
27 
28  public:
29  explicit CetonRTSP(const QString &ip, uint tuner, ushort port);
30  explicit CetonRTSP(const QUrl &url);
31  ~CetonRTSP() override;
32 
33  bool GetOptions(QStringList &options);
34  bool Describe(void);
35  bool Setup(ushort clientPort1, ushort clientPort2,
36  ushort &rtpPort, ushort &rtcpPort, uint32_t &ssrc);
37  bool Play(void);
38  bool Teardown(void);
39 
40  void StartKeepAlive(void);
41  void StopKeepAlive(void);
42 
43 protected:
44  bool ProcessRequest(
45  const QString &method, const QStringList *headers = nullptr,
46  bool use_control = false, bool waitforanswer = true,
47  const QString &alternative = QString());
48 
49  private:
50  static QStringList splitLines(const QByteArray &lines);
51  QString readParameters(const QString &key, Params &parameters);
52  QUrl GetBaseUrl(void);
53  void timerEvent(QTimerEvent *event) override; // QObject
54 
55  QTcpSocket *m_socket {nullptr};
57  QString m_sessionId {"0"};
60 
61  int m_responseCode {-1};
64  QByteArray m_responseContent;
65  int m_timeout {60};
66  int m_timer {0};
67  bool m_canGetParameter {false};
68 
69  static QMutex s_rtspMutex;
70 
71 };
72 
73 #endif // CETONRTSP_H
CetonRTSP::~CetonRTSP
~CetonRTSP() override
Definition: cetonrtsp.cpp:40
CetonRTSP::splitLines
static QStringList splitLines(const QByteArray &lines)
splitLines.
Definition: cetonrtsp.cpp:255
CetonRTSP::m_sessionId
QString m_sessionId
Definition: cetonrtsp.h:57
CetonRTSP::m_responseContent
QByteArray m_responseContent
Definition: cetonrtsp.h:64
CetonRTSP::Setup
bool Setup(ushort clientPort1, ushort clientPort2, ushort &rtpPort, ushort &rtcpPort, uint32_t &ssrc)
Definition: cetonrtsp.cpp:393
CetonRTSP::m_sequenceNumber
uint m_sequenceNumber
Definition: cetonrtsp.h:56
Params
QMap< QString, QString > Params
Definition: cetonrtsp.h:22
CetonRTSP::m_controlUrl
QUrl m_controlUrl
Definition: cetonrtsp.h:59
CetonRTSP::m_responseHeaders
Params m_responseHeaders
Definition: cetonrtsp.h:63
CetonRTSP::timerEvent
void timerEvent(QTimerEvent *event) override
Definition: cetonrtsp.cpp:492
CetonRTSP::GetBaseUrl
QUrl GetBaseUrl(void)
Return the base URL for the last DESCRIBE answer.
Definition: cetonrtsp.cpp:309
CetonRTSP::Play
bool Play(void)
Definition: cetonrtsp.cpp:449
CetonRTSP::CetonRTSP
CetonRTSP(const QString &ip, uint tuner, ushort port)
Definition: cetonrtsp.cpp:22
CetonRTSP::s_rtspMutex
static QMutex s_rtspMutex
Definition: cetonrtsp.h:69
CetonRTSP::m_timeout
int m_timeout
Definition: cetonrtsp.h:65
CetonRTSP::m_responseCode
int m_responseCode
Definition: cetonrtsp.h:61
CetonRTSP::Teardown
bool Teardown(void)
Definition: cetonrtsp.cpp:457
CetonRTSP::m_requestUrl
QUrl m_requestUrl
Definition: cetonrtsp.h:58
CetonRTSP::GetOptions
bool GetOptions(QStringList &options)
Definition: cetonrtsp.cpp:240
CetonRTSP::m_responseMessage
QString m_responseMessage
Definition: cetonrtsp.h:62
uint
unsigned int uint
Definition: compat.h:140
CetonRTSP::readParameters
QString readParameters(const QString &key, Params &parameters)
readParameters.
Definition: cetonrtsp.cpp:278
CetonRTSP::Describe
bool Describe(void)
Definition: cetonrtsp.cpp:322
CetonRTSP::StartKeepAlive
void StartKeepAlive(void)
Definition: cetonrtsp.cpp:472
CetonRTSP::ProcessRequest
bool ProcessRequest(const QString &method, const QStringList *headers=nullptr, bool use_control=false, bool waitforanswer=true, const QString &alternative=QString())
Definition: cetonrtsp.cpp:45
CetonRTSP
Definition: cetonrtsp.h:24
CetonRTSP::m_timer
int m_timer
Definition: cetonrtsp.h:66
CetonRTSP::m_canGetParameter
bool m_canGetParameter
Definition: cetonrtsp.h:67
CetonRTSP::StopKeepAlive
void StopKeepAlive(void)
Definition: cetonrtsp.cpp:482
CetonRTSP::m_socket
QTcpSocket * m_socket
Definition: cetonrtsp.h:55
build_compdb.options
options
Definition: build_compdb.py:11