MythTV  master
satiprtcppacket.cpp
Go to the documentation of this file.
1 #include "satiprtcppacket.h"
2 
4  : m_data(data)
5 {
6  parse();
7 }
8 
10 {
11  m_satipData = QString();
12 
13  uint pkt_length = m_data.length();
14  uint offset = 0;
15 
16  while (offset < pkt_length - 3)
17  {
18  auto type = (uint8_t)m_data[offset + 1];
19  uint16_t length = ((m_data[offset + 2] & 0xFF) << 8) | (m_data[offset + 3] & 0xFF);
20  length++;
21 
22  if (type == RTCP_TYPE_APP && offset + 15 < pkt_length)
23  {
24  if ((m_data[offset + 8] == 'S') && (m_data[offset + 9] == 'E') &&
25  (m_data[offset + 10] == 'S') && (m_data[offset + 11] == '1'))
26  {
27  uint16_t str_length = ((m_data[offset + 14] & 0xFF) << 8) | (m_data[offset + 15] & 0xFF);
28 
29  if (offset + 16 + str_length <= pkt_length)
30  {
31  QString str = QString::fromUtf8(m_data.data() + offset + 16, str_length);
32  m_satipData = str;
33  return;
34  }
35  }
36  }
37 
38  offset += length * 4;
39  }
40 }
RTCP_TYPE_APP
static constexpr uint8_t RTCP_TYPE_APP
Definition: satiprtcppacket.h:12
SatIPRTCPPacket::SatIPRTCPPacket
SatIPRTCPPacket(QByteArray &data)
Definition: satiprtcppacket.cpp:3
SatIPRTCPPacket::m_satipData
QString m_satipData
Definition: satiprtcppacket.h:27
SatIPRTCPPacket::m_data
QByteArray m_data
Definition: satiprtcppacket.h:26
uint
unsigned int uint
Definition: compat.h:81
SatIPRTCPPacket::parse
void parse()
Definition: satiprtcppacket.cpp:9
uint16_t
unsigned short uint16_t
Definition: iso6937tables.h:3
satiprtcppacket.h