--- /dev/null
+Import('env')
+import SENFSCons, glob
+
+###########################################################################
+
+sources = SENFSCons.GlobSources()
+
+SENFSCons.StandardTargets(env)
+
+SENFSCons.Object(env,
+ target = 'psi2ts.o',
+ sources = sources,
+ LIBS = ['senf'])
--- /dev/null
+// $Id: main.test.cc 206 2007-02-20 14:20:52Z g0dil $
+//
+// Copyright (C) 2006
+// 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
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the
+// Free Software Foundation, Inc.,
+// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+// Definition of non-inline non-template functions
+
+//#include "test.hh"
+//#include "test.ih"
+
+// Custom includes
+#define BOOST_AUTO_TEST_MAIN
+#include "../../Utils/auto_unit_test.hh"
+#include <boost/test/test_tools.hpp>
+
+#define prefix_
+///////////////////////////////cc.p////////////////////////////////////////
+
+
+///////////////////////////////cc.e////////////////////////////////////////
+#undef prefix_
+
+\f
+// Local Variables:
+// mode: c++
+// fill-column: 100
+// c-file-style: "senf"
+// indent-tabs-mode: nil
+// ispell-local-dictionary: "american"
+// compile-command: "scons -u test"
+// comment-column: 40
+// End:
--- /dev/null
+// $Id: Example.cc 661 2008-02-05 09:53:54Z tho $
+//
+// Copyright (C) 2008
+// 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
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the
+// Free Software Foundation, Inc.,
+// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+/** \file
+ \brief psi2ts.cc non-inline non-template implementation */
+
+#include "psi2ts.hh"
+//#include "psi2ts.ih"
+
+// Custom includes
+
+//#include "psi2ts.cc.mpp"
+#define prefix_
+///////////////////////////////cc.p////////////////////////////////////////
+
+namespace {
+ template <class InputIterator, class Distance>
+ void advance_max(InputIterator& i, Distance n, InputIterator& i_end)
+ {
+ Distance d = std::min( std::distance(i, i_end), n);
+ std::advance( i, d);
+ }
+}
+
+
+prefix_ Psi2TsModule::Psi2TsModule()
+{
+ continuity_counter_ = 0;
+ state_ = IDLE;
+ route( input, output );
+ input.onRequest( &Psi2TsModule::onRequest );
+}
+
+prefix_ void Psi2TsModule::onRequest()
+{
+ senf::PacketData & section = input.read().data();
+ iterator sec_end = section.end();
+ iterator begin = section.begin();
+ iterator end = section.begin();
+ advance_max( end, 184, sec_end);
+
+ do {
+ senf::TransportPacket tsPacket (senf::TransportPacket::create());
+ tsPacket->continuity_counter() = next_continuity_counter();
+ if (state_ == IDLE) {
+ state_ = PROC;
+ tsPacket->pusi() = true;
+ }
+ senf::DataPacket::createAfter( tsPacket, boost::make_iterator_range(begin, end));
+ tsPacket.finalize();
+ advance_max( begin, 184, sec_end);
+ advance_max( end, 184, sec_end);
+ } while (begin != end);
+ state_ = IDLE;
+}
+
+prefix_ unsigned Psi2TsModule::next_continuity_counter()
+{
+ continuity_counter_ = (continuity_counter_ + 1) % 16;
+ return continuity_counter_;
+}
+
+
+///////////////////////////////cc.e////////////////////////////////////////
+#undef prefix_
+//#include "psi2ts.cc.mpp"
+
+\f
+// Local Variables:
+// mode: c++
+// fill-column: 100
+// comment-column: 40
+// c-file-style: "senf"
+// indent-tabs-mode: nil
+// ispell-local-dictionary: "american"
+// compile-command: "scons -u test"
+// End:
--- /dev/null
+// $Id: Example.hh 661 2008-02-05 09:53:54Z tho $
+//
+// Copyright (C) 2008
+// 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
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the
+// Free Software Foundation, Inc.,
+// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+/** \file
+ \brief psi2ts.hh public header */
+
+#ifndef HH_psi2ts_
+#define HH_psi2ts_ 1
+
+// Custom includes
+#include <senf/PPI/PPI.hh>
+#include <senf/PPI/Module.hh>
+#include <senf/PPI/Connectors.hh>
+#include <senf/Packets/PacketData.hh>
+#include <senf/Packets/MPEGDVBBundle/TransportPacket.hh>
+
+//#include "psi2ts.mpp"
+///////////////////////////////hh.p////////////////////////////////////////
+
+class Psi2TsModule
+ : public senf::ppi::module::Module
+{
+ SENF_PPI_MODULE(Psi2TsModule);
+
+public:
+ senf::ppi::connector::PassiveInput<> input;
+ senf::ppi::connector::ActiveOutput<senf::TransportPacket> output;
+ Psi2TsModule();
+ void onRequest();
+
+private:
+ enum state {IDLE, PROC, WAIT};
+ typedef senf::PacketData::iterator iterator;
+ unsigned continuity_counter_;
+ unsigned next_continuity_counter();
+ state state_;
+
+};
+
+
+///////////////////////////////hh.e////////////////////////////////////////
+//#include "psi2ts.cci"
+//#include "psi2ts.ct"
+//#include "psi2ts.cti"
+#endif
+
+\f
+// Local Variables:
+// mode: c++
+// fill-column: 100
+// comment-column: 40
+// c-file-style: "senf"
+// indent-tabs-mode: nil
+// ispell-local-dictionary: "american"
+// compile-command: "scons -u test"
+// End:
--- /dev/null
+// $Id: Example.test.cc 698 2008-02-18 13:41:37Z tho $
+//
+// Copyright (C) 2008
+// 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
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the
+// Free Software Foundation, Inc.,
+// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+/** \file
+ \brief psi2ts unit tests */
+
+// Custom includes
+#include "psi2ts.hh"
+
+#include "../../Utils/auto_unit_test.hh"
+#include <boost/test/test_tools.hpp>
+
+#define prefix_
+///////////////////////////////cc.p////////////////////////////////////////
+BOOST_AUTO_UNIT_TEST(one_section_to_one_transportpacket)
+{
+ BOOST_CHECK_EQUAL(1, 1+0);
+}
+
+///////////////////////////////cc.e////////////////////////////////////////
+#undef prefix_
+
+\f
+// Local Variables:
+// mode: c++
+// fill-column: 100
+// comment-column: 40
+// c-file-style: "senf"
+// indent-tabs-mode: nil
+// ispell-local-dictionary: "american"
+// compile-command: "scons -u test"
+// End: