PPI: BUGFIX: Duplicate connector registration
[senf.git] / Packets / MPEGDVBBundle / TransportPacket.cc
index 7901a02..514d95f 100644 (file)
@@ -1,9 +1,9 @@
 // $Id$
 //
 // Copyright (C) 2007
-// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
-// Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
-//     Thorsten Horstmann <thorsten.horstmann@fokus.fraunhofer.de>
+// Fraunhofer Institute for Open Communication Systems (FOKUS)
+// Competence Center NETwork research (NET), St. Augustin, GERMANY
+//     Thorsten Horstmann <tho@berlios.de>
 //
 // 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
 
 // Custom includes
 #include <iomanip>
+#include <boost/io/ios_state.hpp>
 
 #define prefix_
 ///////////////////////////////cc.p////////////////////////////////////////
 
+prefix_ void senf::TransportPacketParser::init_fields()
+    const
+{
+    sync_byte() = TransportPacketType::SYNC_BYTE;
+    transport_error_indicator() = 0;
+    transport_scrmbl_ctrl() = 0;
+    adaptation_field_ctrl() = 0x1u;
+}
+
+prefix_ senf::UInt8Parser senf::TransportPacketParser::pointer_field()
+    const
+{
+    return pointer_field_().get<1>(); 
+}
+
+prefix_ void senf::TransportPacketParser::setPUSI(bool pusi)
+    const
+{
+    if (pusi) pointer_field_().init<1>();
+    else      pointer_field_().init<0>();
+}
+            
 prefix_ void senf::TransportPacketType::dump(packet p, std::ostream & os)
 {
+    boost::io::ios_all_saver ias(os);
     os << "TransportPacket:\n"
        << std::hex
-       << "  syncByte: 0x" << unsigned(p->sync_byte()) << "\n"
-       << "  transport_error_indicator: 0x" << unsigned(p->transport_error_indicator()) << "\n"
-       << "  payload_unit_start_indicator (pusi): 0x" << unsigned(p->pusi()) << "\n"
-       << "  transport_priority: 0x" << unsigned(p->transport_priority()) << "\n"
+       <<     "  syncByte                : 0x" << unsigned(p->sync_byte()) << "\n"
+       <<     "  transport error ind.    : 0x" << unsigned(p->transport_error_indicator()) << "\n"
+       <<     "  payload unit start ind. : 0x" << unsigned(p->pusi()) << "\n"
+       <<     "  transport priority      : 0x" << unsigned(p->transport_priority()) << "\n"
        << std::dec
-       << "  pid: " << unsigned(p->pid()) << "\n"
+       <<     "  pid                     : " << unsigned(p->pid()) << "\n"
        << std::hex
-       << "  transport_scrambling_control: 0x" << unsigned(p->transport_scrmbl_ctrl()) << "\n"
-       << "  adaptation_field_control: 0x" << unsigned(p->adaptation_field_ctrl()) << "\n"
-       << "  continuity_counter: 0x" << unsigned(p->continuity_counter()) << "\n";
-//    if (p->pusi())
-//        os << "  payload_pointer: 0x" << unsigned(p->payload_pointer()) << "\n";
+       <<     "  transport scrambling c. : 0x" << unsigned(p->transport_scrmbl_ctrl()) << "\n"
+       <<     "  adaptation field ctrl   : 0x" << unsigned(p->adaptation_field_ctrl()) << "\n"
+       <<     "  continuity counter      : 0x" << unsigned(p->continuity_counter()) << "\n";
+    if (p->pusi())
+        os << "  pointer field           : 0x" << unsigned(p->pointer_field()) << "\n";
 }
 
 ///////////////////////////////cc.e////////////////////////////////////////