MistServer  2.5.3-Pro-19-gf5e75b1 ( Generic_64)
rtp.h
Go to the documentation of this file.
1 #pragma once
2 #include <string>
3 #include <vector>
4 #include <set>
5 #include <iostream>
6 #include <iomanip>
7 #include <cstdio>
8 #include <stdint.h>
9 #include <sstream>
10 #include <deque>
11 #include <algorithm>
12 #include "socket.h"
13 #include "json.h"
14 #include "dtsc.h"
15 #include "mp4.h"
16 #include "mp4_generic.h"
17 
19 namespace RTP {
20 
21  extern unsigned int MAX_SEND;
22 
24  class Packet {
25  private:
26  bool managed;
27  char * data;
28  unsigned int datalen;
30  int sentBytes;//Because ugly is beautiful
31  inline void htobll(char * p, long long val);
32  public:
33  static double startRTCP;
34  unsigned int getHsize() const;
35  unsigned int getVersion() const;
36  unsigned int getPadding() const;
37  unsigned int getExtension() const;
38  unsigned int getContribCount() const;
39  unsigned int getMarker() const;
40  unsigned int getPayloadType() const;
41  unsigned int getSequence() const;
42  unsigned int getTimeStamp() const;
43  void setSequence(unsigned int seq);
44  unsigned int getSSRC() const;
45  void setSSRC(unsigned long ssrc);
46 
47  void setTimestamp(unsigned int t);
48  void increaseSequence();
49  void sendH264(void * socket, void callBack(void *, char *, unsigned int, unsigned int), const char * payload, unsigned int payloadlen, unsigned int channel);
50  void sendData(void * socket, void callBack(void *, char *, unsigned int, unsigned int), const char * payload, unsigned int payloadlen, unsigned int channel, std::string codec);
51  void sendRTCP(long long & connectedAt, void * socket, unsigned int tid, DTSC::Meta & metadata, void callBack(void *, char *, unsigned int, unsigned int));
52 
53 
54  Packet();
55  Packet(unsigned int pt, unsigned int seq, unsigned int ts, unsigned int ssr, unsigned int csrcCount = 0);
56  Packet(const Packet & o);
57  void operator=(const Packet & o);
58  ~Packet();
59  Packet(const char * dat, unsigned int len);
60  char * getData();
61  };
62 
63 }
Class for storage of meta data.
Definition: dtsc.h:337
unsigned int getVersion() const
Definition: rtp.cpp:15
int sentBytes
Definition: rtp.h:30
int sentPackets
Definition: rtp.h:29
unsigned int getSSRC() const
Definition: rtp.cpp:47
unsigned int MAX_SEND
Definition: rtp.cpp:9
~Packet()
Definition: rtp.cpp:226
unsigned int getContribCount() const
Definition: rtp.cpp:27
Packet()
Definition: rtp.cpp:179
unsigned int getSequence() const
Definition: rtp.cpp:39
void htobll(char *p, long long val)
Stores a long long (64 bits) value of val in network order to the pointer p.
Definition: rtp.cpp:132
char * data
The actual RTP packet that is being sent.
Definition: rtp.h:27
void sendH264(void *socket, void callBack(void *, char *, unsigned int, unsigned int), const char *payload, unsigned int payloadlen, unsigned int channel)
Definition: rtp.cpp:71
bool managed
Definition: rtp.h:26
static double startRTCP
Definition: rtp.h:33
unsigned int getPadding() const
Definition: rtp.cpp:19
char * getData()
Definition: rtp.cpp:51
This class is used to make RTP packets. Currently, H264, and AAC are supported. RTP mechanisms...
Definition: rtp.h:24
void increaseSequence()
Definition: rtp.cpp:67
void sendData(void *socket, void callBack(void *, char *, unsigned int, unsigned int), const char *payload, unsigned int payloadlen, unsigned int channel, std::string codec)
Definition: rtp.cpp:110
void sendRTCP(long long &connectedAt, void *socket, unsigned int tid, DTSC::Meta &metadata, void callBack(void *, char *, unsigned int, unsigned int))
Definition: rtp.cpp:145
void setSequence(unsigned int seq)
Definition: rtp.cpp:59
void setTimestamp(unsigned int t)
Definition: rtp.cpp:55
unsigned int datalen
Size of rtp packet.
Definition: rtp.h:28
unsigned int getPayloadType() const
Definition: rtp.cpp:35
This namespace holds all RTP-parsing and sending related functionality.
Definition: rtp.cpp:7
unsigned int getTimeStamp() const
Definition: rtp.cpp:43
unsigned int getExtension() const
Definition: rtp.cpp:23
void operator=(const Packet &o)
Definition: rtp.cpp:213
unsigned int getMarker() const
Definition: rtp.cpp:31
void setSSRC(unsigned long ssrc)
Definition: rtp.cpp:63
unsigned int getHsize() const
Definition: rtp.cpp:11
ts
Definition: CMakeLists.txt:323