1 // $Id:TransportPacket.hh 560 2007-12-13 14:39:37Z tho $
4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 // Thorsten Horstmann <tho@berlios.de>
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.
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.
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.
24 \brief TransportPacket public header */
26 #ifndef HH_TransportPacket_
27 #define HH_TransportPacket_ 1
31 #include "../../Packets/Packets.hh"
33 //#include "TransportPacket.mpp"
34 ///////////////////////////////hh.p////////////////////////////////////////
38 /** \brief Parse a Transport Stream packet
40 Parser implementing the header of a MPEG Transport Stream packet.
42 \see TransportPacketType
44 struct TransportPacketParser : public PacketParserBase
46 # include SENF_FIXED_PARSER()
48 SENF_PARSER_FIELD ( sync_byte, UInt8Parser );
50 SENF_PARSER_BITFIELD ( transport_error_indicator, 1, bool );
51 SENF_PARSER_BITFIELD ( pusi, 1, bool );
52 SENF_PARSER_BITFIELD ( transport_priority, 1, bool );
53 SENF_PARSER_BITFIELD ( pid, 13, unsigned );
54 SENF_PARSER_BITFIELD ( transport_scrmbl_ctrl, 2, unsigned );
55 SENF_PARSER_BITFIELD ( adaptation_field_ctrl, 2, unsigned );
56 SENF_PARSER_BITFIELD ( continuity_counter, 4, unsigned );
58 SENF_PARSER_FINALIZE( TransportPacketParser );
60 void init_fields() const;
66 // UInt8Parser payload_pointer() const {
67 // return parse<UInt8Parser>( TransportPacketParser::fixed_bytes );
71 /** \brief Transport Stream packet
74 <tr style="text-align:center">
75 <th>Syntax</th><th>No. of bits</th></tr>
77 <td>transport_packet() {</td> <td></td>
80 <td style="padding-left:2em">\ref TransportPacketParser::sync_byte() "sync_byte"</td>
83 <td style="padding-left:2em">\ref TransportPacketParser::transport_error_indicator() "transport_error_indicator"</td>
86 <td style="padding-left:2em">\ref TransportPacketParser::pusi() "payload_uni_start_indicator"</td>
89 <td style="padding-left:2em">\ref TransportPacketParser::transport_priority() "transport_priority"</td>
92 <td style="padding-left:2em">\ref TransportPacketParser::pid() "PID"</td>
95 <td style="padding-left:2em">\ref TransportPacketParser::transport_scrmbl_ctrl() "transport_scrambling_control"</td>
98 <td style="padding-left:2em">\ref TransportPacketParser::adaptation_field_ctrl() "adaptation_field_control"</td>
101 <td style="padding-left:2em">\ref TransportPacketParser::continuity_counter() "continuity_counter"</td>
104 <td>}</td> <td></td></tr>
107 \par Packet type (typedef):
111 \ref TransportPacketParser
113 \ingroup protocolbundle_mpegdvb
115 struct TransportPacketType
116 : public PacketTypeBase,
117 public PacketTypeMixin<TransportPacketType>
119 typedef PacketTypeMixin<TransportPacketType> mixin;
120 typedef ConcretePacket<TransportPacketType> packet;
121 typedef TransportPacketParser parser;
123 using mixin::nextPacketRange;
125 using mixin::initSize;
127 static void dump(packet p, std::ostream & os);
128 static const byte SYNC_BYTE = 0x47;
131 /** \brief Transport packet typedef */
132 typedef ConcretePacket<TransportPacketType> TransportPacket;
136 ///////////////////////////////hh.e////////////////////////////////////////
137 //#include "TransportPacket.cci"
138 //#include "TransportPacket.ct"
139 //#include "TransportPacket.cti"
146 // c-file-style: "senf"
147 // indent-tabs-mode: nil
148 // ispell-local-dictionary: "american"
149 // compile-command: "scons -u test"
150 // comment-column: 40