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 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::DVBDemuxSectionSocketProtocol::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 f = open(devDemux.c_str(), O_RDONLY | O_NONBLOCK);
50 SENF_THROW_SYSTEM_EXCEPTION("Could not open demux device of DVB adapter ") << devDemux << ".";
55 prefix_ unsigned senf::DVBDemuxSectionSocketProtocol::available()
61 prefix_ void senf::DVBDemuxSectionSocketProtocol::setSectionFilter(unsigned short int pid, unsigned int timeout, unsigned int flags, unsigned char filter, unsigned char mask, unsigned char mode)
64 struct dmx_sct_filter_params sec_filter;
65 ::memset(&sec_filter, 0, sizeof(struct dmx_sct_filter_params));
68 sec_filter.filter.filter[0] = filter;
69 sec_filter.filter.mask[0] = mask;
70 sec_filter.filter.mode[0] = mode;
71 sec_filter.flags = flags;
73 if (::ioctl(fd(), DMX_SET_FILTER, filter) < 0)
74 SENF_THROW_SYSTEM_EXCEPTION("Could not set section filter of DVB adapter.");
77 // ----------------------------------------------------------------
79 prefix_ void senf::DVBDemuxPESSocketProtocol::init_client(unsigned short adapter, unsigned short device)
82 std::string devDemux = str( boost::format(
83 "/dev/dvb/adapter%d/demux%d") % adapter % device);
84 int f = open(devDemux.c_str(), O_RDONLY | O_NONBLOCK);
86 SENF_THROW_SYSTEM_EXCEPTION("Could not open demux device of DVB adapter ") << devDemux << ".";
90 prefix_ unsigned senf::DVBDemuxPESSocketProtocol::available()
96 prefix_ void senf::DVBDemuxPESSocketProtocol::setPESFilter(struct dmx_pes_filter_params *filter)
99 if (::ioctl(fd(), DMX_SET_PES_FILTER, filter) < 0)
100 SENF_THROW_SYSTEM_EXCEPTION("Could not set PES filter of DVB adapter.");
103 // ----------------------------------------------------------------
105 prefix_ void senf::DVBDvrSocketProtocol::init_client(unsigned short adapter, unsigned short device)
108 std::string devDvr = str( boost::format(
109 "/dev/dvb/adapter%d/dvr%d") % adapter % device);
110 int f = open(devDvr.c_str(), O_RDONLY | O_NONBLOCK);
112 SENF_THROW_SYSTEM_EXCEPTION("Could not open dvr device of DVB adapter ") << devDvr << ".";
116 prefix_ unsigned senf::DVBDvrSocketProtocol::available()
122 ///////////////////////////////cc.e////////////////////////////////////////
124 //#include "DVBDemuxHandles.mpp"
130 // c-file-style: "senf"
131 // indent-tabs-mode: nil
132 // ispell-local-dictionary: "american"
133 // compile-command: "scons -u test"
134 // comment-column: 40