SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
rtpinternalsourcedata.h
Go to the documentation of this file.
1 /*
2 
3  This file is a part of JRTPLIB
4  Copyright (c) 1999-2017 Jori Liesenborgs
5 
6  Contact: jori.liesenborgs@gmail.com
7 
8  This library was developed at the Expertise Centre for Digital Media
9  (http://www.edm.uhasselt.be), a research center of the Hasselt University
10  (http://www.uhasselt.be). The library is based upon work done for
11  my thesis at the School for Knowledge Technology (Belgium/The Netherlands).
12 
13  Permission is hereby granted, free of charge, to any person obtaining a
14  copy of this software and associated documentation files (the "Software"),
15  to deal in the Software without restriction, including without limitation
16  the rights to use, copy, modify, merge, publish, distribute, sublicense,
17  and/or sell copies of the Software, and to permit persons to whom the
18  Software is furnished to do so, subject to the following conditions:
19 
20  The above copyright notice and this permission notice shall be included
21  in all copies or substantial portions of the Software.
22 
23  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
29  IN THE SOFTWARE.
30 
31  */
32 
37 #ifndef RTPINTERNALSOURCEDATA_H
38 
39 #define RTPINTERNALSOURCEDATA_H
40 
41 #include "rtpconfig.h"
42 #include "rtpsourcedata.h"
43 #include "rtpaddress.h"
44 #include "rtptimeutilities.h"
45 #include "rtpsources.h"
46 
47 #include "export.h"
48 
49 namespace qrtplib
50 {
51 
53 {
54 public:
57 
58  int ProcessRTPPacket(RTPPacket *rtppack, const RTPTime &receivetime, bool *stored, RTPSources *sources);
59  void ProcessSenderInfo(const RTPNTPTime &ntptime, uint32_t rtptime, uint32_t packetcount, uint32_t octetcount, const RTPTime &receivetime)
60  {
61  SRprevinf = SRinf;
62  SRinf.Set(ntptime, rtptime, packetcount, octetcount, receivetime);
63  stats.SetLastMessageTime(receivetime);
64  }
65  void ProcessReportBlock(uint8_t fractionlost, int32_t lostpackets, uint32_t exthighseqnr, uint32_t jitter, uint32_t lsr, uint32_t dlsr, const RTPTime &receivetime)
66  {
67  RRprevinf = RRinf;
68  RRinf.Set(fractionlost, lostpackets, exthighseqnr, jitter, lsr, dlsr, receivetime);
69  stats.SetLastMessageTime(receivetime);
70  }
71  void UpdateMessageTime(const RTPTime &receivetime)
72  {
73  stats.SetLastMessageTime(receivetime);
74  }
75  int ProcessSDESItem(uint8_t sdesid, const uint8_t *data, std::size_t itemlen, const RTPTime &receivetime, bool *cnamecollis);
76 #ifdef RTP_SUPPORT_SDESPRIV
77  int ProcessPrivateSDESItem(const uint8_t *prefix, std::size_t prefixlen, const uint8_t *value, std::size_t valuelen, const RTPTime &receivetime);
78 #endif // RTP_SUPPORT_SDESPRIV
79  int ProcessBYEPacket(const uint8_t *reason, std::size_t reasonlen, const RTPTime &receivetime);
80 
81  int SetRTPDataAddress(const RTPAddress *a);
82  int SetRTCPDataAddress(const RTPAddress *a);
83 
85  {
86  issender = false;
87  }
89  {
90  if (!ownssrc)
91  return;
93  issender = true;
94  stats.SetLastRTPPacketTime(t);
95  stats.SetLastMessageTime(t);
96  }
97  void SetOwnSSRC()
98  {
99  ownssrc = true;
100  validated = true;
101  }
102  void SetCSRC()
103  {
104  validated = true;
105  iscsrc = true;
106  }
107  void ClearNote()
108  {
109  SDESinf.SetNote(0, 0);
110  }
111 
112 };
113 
115 {
116  if (a == 0)
117  {
118  if (rtpaddr)
119  {
120  delete rtpaddr;
121  rtpaddr = 0;
122  }
123  }
124  else
125  {
126  RTPAddress *newaddr = a->CreateCopy();
127  if (newaddr == 0)
128  return ERR_RTP_OUTOFMEM;
129 
130  if (rtpaddr && a != rtpaddr)
131  delete rtpaddr;
132  rtpaddr = newaddr;
133  }
134  isrtpaddrset = true;
135  return 0;
136 }
137 
139 {
140  if (a == 0)
141  {
142  if (rtcpaddr)
143  {
144  delete rtcpaddr;
145  rtcpaddr = 0;
146  }
147  }
148  else
149  {
150  RTPAddress *newaddr = a->CreateCopy();
151  if (newaddr == 0)
152  return ERR_RTP_OUTOFMEM;
153 
154  if (rtcpaddr && a != rtcpaddr)
155  delete rtcpaddr;
156  rtcpaddr = newaddr;
157  }
158  isrtcpaddrset = true;
159  return 0;
160 }
161 
162 } // end namespace
163 
164 #endif // RTPINTERNALSOURCEDATA_H
165 
RTPAddress * CreateCopy() const
Definition: rtpaddress.cpp:38
int SetRTCPDataAddress(const RTPAddress *a)
#define QRTPLIB_API
Definition: export.h:112
unsigned int uint32_t
Definition: rtptypes_win.h:46
unsigned char uint8_t
Definition: rtptypes_win.h:42
void UpdateMessageTime(const RTPTime &receivetime)
void ProcessSenderInfo(const RTPNTPTime &ntptime, uint32_t rtptime, uint32_t packetcount, uint32_t octetcount, const RTPTime &receivetime)
int int32_t
Definition: rtptypes_win.h:45
static RTPTime CurrentTime()
#define ERR_RTP_OUTOFMEM
Definition: rtperrors.h:53
void ProcessReportBlock(uint8_t fractionlost, int32_t lostpackets, uint32_t exthighseqnr, uint32_t jitter, uint32_t lsr, uint32_t dlsr, const RTPTime &receivetime)
int SetRTPDataAddress(const RTPAddress *a)