Fixed whitespace in all files (no tabs)
[senf.git] / Packets / RTPPacket.cc
1 // $Id$
2 //
3 // Copyright (C) 2006
4 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
5 // Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
6 //     Stefan Bund <stefan.bund@fokus.fraunhofer.de>
7 //
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
12 //
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 // GNU General Public License for more details.
17 //
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the
20 // Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22
23 // Definition of non-inline non-template functions
24
25 #include "RTPPacket.hh"
26 //#include "RTPPacket.ih"
27
28 // Custom includes
29
30 #define prefix_
31 ///////////////////////////////cc.p////////////////////////////////////////
32
33
34 prefix_ void senf::RTPPacket::v_nextInterpreter()
35     const
36 {
37
38     if(extension()){
39         Packet::registerInterpreter<RTPUnknownExtensionPacket>(begin()+bytes(),end());
40     }else{
41
42         int paddingOctets = 0;
43         if(padding()){
44             paddingOctets = paddingOctet();
45         }
46         registerInterpreter(payloadType(),begin()+bytes(),end()-paddingOctets);
47     }
48 }
49
50 prefix_ void senf::RTPPacket::v_finalize()
51 {}
52
53 prefix_ void senf::RTPPacket::v_dump(std::ostream & os)
54     const
55 {
56     os << "RTP:\n"
57        << "  version       : " << version() << "\n"
58        << "  padding       : " << padding() << "\n"
59        << "  extension     : " << extension() << "\n"
60        << "  csrc count    : " << csrcCount() << "\n"
61        << "  marker        : " << marker() << "\n"
62        << "  payload type  : " << payloadType() << "\n"
63        << "  sequence nr   : " << seqNumber() << "\n"
64        << "  timestamp     : " << timestamp() << "\n"
65        << "  ssrc          : " << ssrc() << "\n"
66        << "  csrc list     : <not shown>\n";
67 }
68
69 prefix_ void senf::RTPExtensionBasePacket::v_nextInterpreter()
70     const
71 {
72
73     // We don't want to inherit Parse_RTPExtensionBase to avoid
74     // virtual inheritance problems. Since we need the size of the
75     // extension, we just allocate ourselves a ExtensionBase parser
76
77     Parse_RTPExtensionBase<iterator> p (begin());
78     if (!p.check(begin(),end()))
79         throw TruncatedPacketException();
80
81     int paddingOctets = 0;
82     if(get_prev<RTPPacket>()->padding()){
83         paddingOctets = get_prev<RTPPacket>()->paddingOctet();
84     }
85     registerInterpreter(get_prev<RTPPacket>()->payloadType(),begin()+p.bytes(),end()-paddingOctets);
86 }
87
88 prefix_ void senf::RTPExtensionBasePacket::v_dump(std::ostream & os)
89     const
90 {
91     os << "RTP extension packet:\n"
92        << "  content not shown\n";
93 }
94
95 prefix_ void senf::RTPUnknownExtensionPacket::v_finalize()
96 {}
97
98 ///////////////////////////////cc.e////////////////////////////////////////
99 #undef prefix_
100
101 \f
102 // Local Variables:
103 // mode: c++
104 // fill-column: 100
105 // c-file-style: "senf"
106 // indent-tabs-mode: nil
107 // ispell-local-dictionary: "american"
108 // End: