jrtplib  3.6.0
rtprawpacket.h
Go to the documentation of this file.
1 /*
2 
3  This file is a part of JRTPLIB
4  Copyright (c) 1999-2006 Jori Liesenborgs
5 
6  Contact: jori.liesenborgs@gmail.com
7 
8  This library was developed at the "Expertisecentrum Digitale 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 RTPRAWPACKET_H
38 
39 #define RTPRAWPACKET_H
40 
41 #include "rtpconfig.h"
42 #include "rtptimeutilities.h"
43 #include "rtpaddress.h"
44 #include "rtptypes.h"
45 #include "rtpmemoryobject.h"
46 
48 class RTPRawPacket : public RTPMemoryObject
49 {
50 public:
58  RTPRawPacket(uint8_t *data,size_t datalen,RTPAddress *address,RTPTime &recvtime,bool rtp,RTPMemoryManager *mgr = 0);
59  ~RTPRawPacket();
60 
62  uint8_t *GetData() { return packetdata; }
63 
65  size_t GetDataLength() const { return packetdatalength; }
66 
68  RTPTime GetReceiveTime() const { return receivetime; }
69 
71  const RTPAddress *GetSenderAddress() const { return senderaddress; }
72 
74  bool IsRTP() const { return isrtp; }
75 
83  void ZeroData() { packetdata = 0; packetdatalength = 0; }
84 private:
85  uint8_t *packetdata;
86  size_t packetdatalength;
87  RTPTime receivetime;
88  RTPAddress *senderaddress;
89  bool isrtp;
90 };
91 
92 inline RTPRawPacket::RTPRawPacket(uint8_t *data,size_t datalen,RTPAddress *address,RTPTime &recvtime,bool rtp,RTPMemoryManager *mgr):receivetime(recvtime),RTPMemoryObject(mgr)
93 {
94  packetdata = data;
95  packetdatalength = datalen;
96  senderaddress = address;
97  isrtp = rtp;
98 }
99 
100 inline RTPRawPacket::~RTPRawPacket()
101 {
102  if (packetdata)
103  RTPDeleteByteArray(packetdata,GetMemoryManager());
104  if (senderaddress)
105  RTPDelete(senderaddress,GetMemoryManager());
106 }
107 
108 #endif // RTPRAWPACKET_H
109 
uint8_t * GetData()
Returns the pointer to the data which is contained in this packet.
Definition: rtprawpacket.h:62
A memory manager.
Definition: rtpmemorymanager.h:144
This class is used to specify wallclock time, delay intervals etc.
Definition: rtptimeutilities.h:77
This class is used by the transmission component to store the incoming RTP and RTCP data in...
Definition: rtprawpacket.h:48
size_t GetDataLength() const
Returns the length of the packet described by this instance.
Definition: rtprawpacket.h:65
RTPTime GetReceiveTime() const
Returns the time at which this packet was received.
Definition: rtprawpacket.h:68
bool IsRTP() const
Returns true if this data is RTP data, false if it is RTCP data.
Definition: rtprawpacket.h:74
This class is an abstract class which is used to specify destinations, multicast groups etc...
Definition: rtpaddress.h:47
const RTPAddress * GetSenderAddress() const
Returns the address stored in this packet.
Definition: rtprawpacket.h:71
RTPRawPacket(uint8_t *data, size_t datalen, RTPAddress *address, RTPTime &recvtime, bool rtp, RTPMemoryManager *mgr=0)
Creates an instance which stores data from data with length datalen.
Definition: rtprawpacket.h:92
void ZeroData()
Sets the pointer to the data stored in this packet to zero.
Definition: rtprawpacket.h:83