X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Packets%2FMPEGDVBBundle%2FTransportPacket.hh;h=38200d523778fdd4cfd262c4fdc0de20a522060b;hb=81f84badf27b66dbadec9890646ca1193e998505;hp=83406f5fdd2d0afafb43e3b8a6bd1a9fef26ac46;hpb=bbff2057f39e475b00e598cae018c68db0e16a82;p=senf.git diff --git a/Packets/MPEGDVBBundle/TransportPacket.hh b/Packets/MPEGDVBBundle/TransportPacket.hh index 83406f5..38200d5 100644 --- a/Packets/MPEGDVBBundle/TransportPacket.hh +++ b/Packets/MPEGDVBBundle/TransportPacket.hh @@ -1,9 +1,9 @@ -// $Id$ +// $Id:TransportPacket.hh 560 2007-12-13 14:39:37Z tho $ // // Copyright (C) 2007 -// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) -// Kompetenzzentrum fuer Satelitenkommunikation (SatCom) -// Thorsten Horstmann +// Fraunhofer Institute for Open Communication Systems (FOKUS) +// Competence Center NETwork research (NET), St. Augustin, GERMANY +// Thorsten Horstmann // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -23,11 +23,10 @@ /** \file \brief TransportPacket public header */ -#ifndef HH_TransportPacket_ -#define HH_TransportPacket_ 1 +#ifndef HH_SENF_Packets_MPEGDVBBundle_TransportPacket_ +#define HH_SENF_Packets_MPEGDVBBundle_TransportPacket_ 1 // Custom includes -#include #include "../../Packets/Packets.hh" //#include "TransportPacket.mpp" @@ -38,28 +37,37 @@ namespace senf { /** \brief Parse a Transport Stream packet Parser implementing the header of a MPEG Transport Stream packet. + \image html TransportPacket.png \see TransportPacketType */ - struct Parse_TransportPacket : public PacketParserBase + struct TransportPacketParser : public PacketParserBase { -# include SENF_FIXED_PARSER() +# include SENF_PARSER() - SENF_PARSER_FIELD ( sync_byte , Parse_UInt8 ); + SENF_PARSER_FIELD ( sync_byte, UInt8Parser ); + + SENF_PARSER_BITFIELD ( transport_error_indicator, 1, bool ); + SENF_PARSER_BITFIELD_RO ( pusi, 1, bool ); + SENF_PARSER_BITFIELD ( transport_priority, 1, bool ); + SENF_PARSER_BITFIELD ( pid, 13, unsigned ); + SENF_PARSER_BITFIELD ( transport_scrmbl_ctrl, 2, unsigned ); + SENF_PARSER_BITFIELD ( adaptation_field_ctrl, 2, unsigned ); + SENF_PARSER_BITFIELD ( continuity_counter, 4, unsigned ); + + SENF_PARSER_PRIVATE_VARIANT ( pointer_field_, pusi, + (senf::VoidPacketParser) (UInt8Parser) ); - SENF_PARSER_BITFIELD ( transport_error_indicator , 1 , bool ); - SENF_PARSER_BITFIELD ( pusi , 1 , bool ); - SENF_PARSER_BITFIELD ( transport_priority , 1 , bool ); - SENF_PARSER_BITFIELD ( pid , 13 , unsigned ); - SENF_PARSER_BITFIELD ( transport_scrmbl_ctrl , 2 , unsigned ); - SENF_PARSER_BITFIELD ( adaptation_field_ctrl , 2 , unsigned ); - SENF_PARSER_BITFIELD ( continuity_counter , 4 , unsigned ); - - SENF_PARSER_FINALIZE( Parse_TransportPacket ); - -// Parse_UInt8 payload_pointer() const { -// return parse( Parse_TransportPacket::fixed_bytes ); -// } + SENF_PARSER_FINALIZE( TransportPacketParser ); + + UInt8Parser pointer_field() const; + void init_fields() const; + void setPUSI(bool pusi) const; + + SENF_PARSER_INIT() { + defaultInit(); + init_fields(); + } }; /** \brief Transport Stream packet @@ -71,28 +79,28 @@ namespace senf { transport_packet() { - \ref Parse_TransportPacket::sync_byte() "sync_byte" + \ref TransportPacketParser::sync_byte() "sync_byte" 8 - \ref Parse_TransportPacket::transport_error_indicator() "transport_error_indicator" + \ref TransportPacketParser::transport_error_indicator() "transport_error_indicator" 1 - \ref Parse_TransportPacket::pusi() "payload_uni_start_indicator" + \ref TransportPacketParser::pusi() "payload_uni_start_indicator" 1 - \ref Parse_TransportPacket::transport_priority() "transport_priority" + \ref TransportPacketParser::transport_priority() "transport_priority" 1 - \ref Parse_TransportPacket::pid() "PID" + \ref TransportPacketParser::pid() "PID" 13 - \ref Parse_TransportPacket::transport_scrmbl_ctrl() "transport_scrambling_control" + \ref TransportPacketParser::transport_scrmbl_ctrl() "transport_scrambling_control" 2 - \ref Parse_TransportPacket::adaptation_field_ctrl() "adaptation_field_control" + \ref TransportPacketParser::adaptation_field_ctrl() "adaptation_field_control" 2 - \ref Parse_TransportPacket::continuity_counter() "continuity_counter" + \ref TransportPacketParser::continuity_counter() "continuity_counter" 4 } @@ -102,7 +110,7 @@ namespace senf { \ref TransportPacket \par Fields: - \ref Parse_TransportPacket + \ref TransportPacketParser \ingroup protocolbundle_mpegdvb */ @@ -110,22 +118,23 @@ namespace senf { : public PacketTypeBase, public PacketTypeMixin { +#ifndef DOXYGEN typedef PacketTypeMixin mixin; - typedef ConcretePacket packet; - typedef Parse_TransportPacket parser; +#endif + typedef ConcretePacket packet; ///< Transport packet typedef + typedef TransportPacketParser parser; ///< typedef to the parser of Transport packet using mixin::nextPacketRange; using mixin::init; using mixin::initSize; + /** \brief Dump given Transport packet in readable form to given output stream */ static void dump(packet p, std::ostream & os); + static const byte SYNC_BYTE = 0x47; }; /** \brief Transport packet typedef */ - typedef TransportPacketType::packet TransportPacket; - - #define TRANSPORT_PACKET_SYNC_BYTE 0x47 - + typedef ConcretePacket TransportPacket; }