RTPPacket.cc
Go to the documentation of this file.
1 //
2 // Copyright (c) 2020 Fraunhofer Institute for Applied Information Technology (FIT)
3 // Network Research Group (NET)
4 // Schloss Birlinghoven, 53754 Sankt Augustin, GERMANY
5 // Contact: support@wiback.org
6 //
7 // This file is part of the SENF code tree.
8 // It is licensed under the 3-clause BSD License (aka New BSD License).
9 // See LICENSE.txt in the top level directory for details or visit
10 // https://opensource.org/licenses/BSD-3-Clause
11 //
12 
13 
17 #include "RTPPacket.hh"
18 
19 // Custom includes
20 
21 #define prefix_
22 //-/////////////////////////////////////////////////////////////////////////////////////////////////
23 
25 
26 struct pt_item
27 {
28  int pt;
29  std::string name;
30 };
31 
32 static pt_item ptList[] = {
33  {0,"PCMU"},{1,"1016"},{2,"G721"},{3,"GSM"},
34  {5,"DVI8"},{6,"DVI16"},{7,"LPC"},{8,"PCMA"},
35  {9,"G722"},{10,"L16"},{11,"L16S"},{14,"MPA"},
36  {25,"CELB"},{26,"JPEG"},{31,"H261"},{32,"MPV"},
37  {33,"MP2T"},{34,"263"},{110,"MPEG AAC"},{111,"11L16"},
38  {112,"11L16S"},{113,"22L16"},{114,"22L16S"},{115,"32L16"},
39  {116,"32L16S"},{127,"HTML"},{-1,""}
40 };
41 
42 static std::string ptName(int pt)
43 {
44  int n = 0;
45  while (ptList[n].pt != -1){
46  if (ptList[n].pt == pt)
47  return ptList[n].name;
48  ++n;
49  }
50 
51  return "UNKNOWN";
52 }
53 
54 prefix_ void senf::RTPPacketType::dump(packet p, std::ostream & os)
55 {
56  os << "Real Time Protocol:\n"
57  << senf::fieldName("version") << p->version() << "\n"
58  << senf::fieldName("padding") << p->padding() << "\n"
59  << senf::fieldName("extension") << p->extension() << "\n"
60  << senf::fieldName("contributing source cnt") << p->csrcCount() << "\n"
61  << senf::fieldName("marker") << p->marker() << "\n"
62  << senf::fieldName("payload type") << p->payloadType() << " "
63  << ptName(p->payloadType() ) <<"\n"
64  << senf::fieldName("sequence number") << p->seqNumber() << "\n"
65  << senf::fieldName("timestamp") << p->timeStamp() << "\n"
66  << senf::fieldName("sync source id") << p->synSourceId() << "\n";
67 }
68 
69 //-/////////////////////////////////////////////////////////////////////////////////////////////////
70 #undef prefix_
static void dump(packet p, std::ostream &os)
Definition: RTPPacket.cc:54
std::string fieldName(std::string const &s)
Definition: DumpFormat.cc:28
std::string name
Definition: RTPPacket.cc:29
RTPPacket public header.
Protocol specific packet handle.
Definition: Packet.hh:87
SENF_PACKET_INSTANTIATE_TEMPLATE(senf::RTPPacket)
#define prefix_
Definition: RTPPacket.cc:21
int pt
Definition: RTPPacket.cc:28