4 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
5 // Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
6 // Thorsten Horstmann <thorsten.horstmann@fokus.fraunhofer.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 DVBDemuxHandles non-inline non-template implementation */
26 #include "DVBDemuxHandles.hh"
27 //#include "DVBDemuxHandles.ih"
30 #include <boost/format.hpp>
31 #include <sys/socket.h>
32 #include <sys/ioctl.h>
34 #include "../../../Utils/Exception.hh"
36 //#include "DVBDemuxHandles.mpp"
38 ///////////////////////////////cc.p////////////////////////////////////////
40 ///////////////////////////////////////////////////////////////////////////
41 // senf::DVBDemuxHandles
43 prefix_ void senf::DVBDemuxSectionProtocol::init_client(unsigned short adapter, unsigned short device)
46 std::string devDemux = str( boost::format(
47 "/dev/dvb/adapter%d/demux%d") % adapter % device);
48 int fd = open(devDemux.c_str(), O_RDONLY | O_NONBLOCK);
50 throw SystemException(errno);
54 prefix_ unsigned senf::DVBDemuxSectionProtocol::available()
60 prefix_ std::auto_ptr<senf::SocketProtocol> senf::DVBDemuxSectionProtocol::clone()
63 return std::auto_ptr<SocketProtocol>(new DVBDemuxSectionProtocol());
66 prefix_ void senf::DVBDemuxSectionProtocol::setSectionFilter(struct dmx_sct_filter_params *filter)
69 if (::ioctl(body().fd(), DMX_SET_FILTER, filter) < 0)
70 throw SystemException(errno);
73 // ----------------------------------------------------------------
75 prefix_ void senf::DVBDemuxPESProtocol::init_client(unsigned short adapter, unsigned short device)
78 std::string devDemux = str( boost::format(
79 "/dev/dvb/adapter%d/demux%d") % adapter % device);
80 int fd = open(devDemux.c_str(), O_RDONLY | O_NONBLOCK);
82 throw SystemException(errno);
86 prefix_ unsigned senf::DVBDemuxPESProtocol::available()
92 prefix_ std::auto_ptr<senf::SocketProtocol> senf::DVBDemuxPESProtocol::clone()
95 return std::auto_ptr<SocketProtocol>(new DVBDemuxPESProtocol());
98 prefix_ void senf::DVBDemuxPESProtocol::setPESFilter(struct dmx_pes_filter_params *filter)
101 if (::ioctl(body().fd(), DMX_SET_PES_FILTER, filter) < 0)
102 throw SystemException(errno);
105 // ----------------------------------------------------------------
107 prefix_ void senf::DVBDvrProtocol::init_client(unsigned short adapter, unsigned short device)
110 std::string devDvr = str( boost::format(
111 "/dev/dvb/adapter%d/dvr%d") % adapter % device);
112 int fd = open(devDvr.c_str(), O_RDONLY | O_NONBLOCK);
114 throw SystemException(errno);
118 prefix_ unsigned senf::DVBDvrProtocol::available()
124 prefix_ std::auto_ptr<senf::SocketProtocol> senf::DVBDvrProtocol::clone()
127 return std::auto_ptr<SocketProtocol>(new DVBDvrProtocol());
130 ///////////////////////////////cc.e////////////////////////////////////////
132 //#include "DVBDemuxHandles.mpp"
138 // c-file-style: "senf"
139 // indent-tabs-mode: nil
140 // ispell-local-dictionary: "american"
141 // compile-command: "scons -u test"
142 // comment-column: 40