8 #if HAVE_DVB_API_VERSION < 3
10 #ifndef DMX_SET_NEGFILTER_MASK
11 #define DMX_SET_NEGFILTER_MASK _IOW('o',48,uint8_t *)
14 #include <linux/dvb/dmx.h>
19 #include <lib/base/eerror.h>
20 #include <lib/dvb/idvb.h>
21 #include <lib/dvb/demux.h>
22 #include <lib/dvb/esection.h>
23 #include <lib/dvb/decoder.h>
25 eDVBDemux::eDVBDemux(int adapter, int demux): adapter(adapter), demux(demux)
29 eDVBDemux::~eDVBDemux()
35 RESULT eDVBDemux::createSectionReader(eMainloop *context, ePtr<iDVBSectionReader> &reader)
38 reader = new eDVBSectionReader(this, context, res);
44 RESULT eDVBDemux::getMPEGDecoder(ePtr<iTSMPEGDecoder> &decoder)
46 decoder = new eTSMPEGDecoder(this, 0);
50 void eDVBSectionReader::data(int)
52 __u8 data[4096]; // max. section size
54 r = ::read(fd, data, 4096);
57 eWarning("ERROR reading section - %m\n");
62 // this check should never happen unless the driver is crappy!
64 if ((c = crc32((unsigned)-1, data, r)))
65 eFatal("crc32 failed! is %x\n", c);
70 eDVBSectionReader::eDVBSectionReader(eDVBDemux *demux, eMainloop *context, RESULT &res): demux(demux)
73 #if HAVE_DVB_API_VERSION < 3
74 sprintf(filename, "/dev/dvb/card%d/demux%d", demux->adapter, demux->demux);
76 sprintf(filename, "/dev/dvb/adapter%d/demux%d", demux->adapter, demux->demux);
78 fd = ::open(filename, O_RDWR);
80 eDebug("eDVBSectionReader has fd %d", fd);
84 notifier=new eSocketNotifier(context, fd, eSocketNotifier::Read);
85 CONNECT(notifier->activated, eDVBSectionReader::data);
94 DEFINE_REF(eDVBSectionReader)
96 eDVBSectionReader::~eDVBSectionReader()
104 RESULT eDVBSectionReader::start(const eDVBSectionFilterMask &mask)
110 #if HAVE_DVB_API_VERSION < 3
111 dmxSctFilterParams sct;
113 dmx_sct_filter_params sct;
117 #if HAVE_DVB_API_VERSION < 3
120 sct.flags = DMX_IMMEDIATE_START;
122 if (mask.flags & eDVBSectionFilterMask::rfCRC)
124 sct.flags |= DMX_CHECK_CRC;
129 memcpy(sct.filter.filter, mask.data, DMX_FILTER_SIZE);
130 memcpy(sct.filter.mask, mask.mask, DMX_FILTER_SIZE);
131 #if HAVE_DVB_API_VERSION >= 3
132 memcpy(sct.filter.mode, mask.mode, DMX_FILTER_SIZE);
135 res = ::ioctl(fd, DMX_SET_FILTER, &sct);
138 #if HAVE_DVB_API_VERSION < 3
139 res = ::ioctl(fd, DMX_SET_NEGFILTER_MASK, mask.mode);
142 res = ::ioctl(fd, DMX_START, 0);
153 RESULT eDVBSectionReader::stop()
158 ::ioctl(fd, DMX_STOP);
163 RESULT eDVBSectionReader::connectRead(const Slot1<void,const __u8*> &r, ePtr<eConnection> &conn)
165 conn = new eConnection(this, read.connect(r));