8 #if HAVE_DVB_API_VERSION < 3
11 #include <linux/dvb/dmx.h>
16 #include <lib/base/eerror.h>
17 #include <lib/dvb/idvb.h>
18 #include <lib/dvb/demux.h>
19 #include <lib/dvb/esection.h>
20 #include <lib/dvb/decoder.h>
22 eDVBDemux::eDVBDemux(int adapter, int demux): adapter(adapter), demux(demux)
26 eDVBDemux::~eDVBDemux()
32 RESULT eDVBDemux::createSectionReader(eMainloop *context, ePtr<iDVBSectionReader> &reader)
35 reader = new eDVBSectionReader(this, context, res);
41 RESULT eDVBDemux::getMPEGDecoder(ePtr<iTSMPEGDecoder> &decoder)
43 decoder = new eTSMPEGDecoder(this, 0);
47 void eDVBSectionReader::data(int)
49 __u8 data[4096]; // max. section size
51 r = ::read(fd, data, 4096);
54 eWarning("ERROR reading section - %m\n");
59 // this check should never happen unless the driver is crappy!
61 if ((c = crc32((unsigned)-1, data, r)))
62 eFatal("crc32 failed! is %x\n", c);
67 eDVBSectionReader::eDVBSectionReader(eDVBDemux *demux, eMainloop *context, RESULT &res): demux(demux)
70 #if HAVE_DVB_API_VERSION < 3
71 sprintf(filename, "/dev/dvb/card%d/demux%d", demux->adapter, demux->demux);
73 sprintf(filename, "/dev/dvb/adapter%d/demux%d", demux->adapter, demux->demux);
75 fd = ::open(filename, O_RDWR);
79 notifier=new eSocketNotifier(context, fd, eSocketNotifier::Read);
80 CONNECT(notifier->activated, eDVBSectionReader::data);
89 DEFINE_REF(eDVBSectionReader)
91 eDVBSectionReader::~eDVBSectionReader()
99 RESULT eDVBSectionReader::start(const eDVBSectionFilterMask &mask)
105 #if HAVE_DVB_API_VERSION < 3
106 dmxSctFilterParams sct;
108 dmx_sct_filter_params sct;
112 #if HAVE_DVB_API_VERSION < 3
115 sct.flags = DMX_IMMEDIATE_START;
117 if (mask.flags & eDVBSectionFilterMask::rfCRC)
119 sct.flags |= DMX_CHECK_CRC;
124 memcpy(sct.filter.filter, mask.data, DMX_FILTER_SIZE);
125 memcpy(sct.filter.mask, mask.mask, DMX_FILTER_SIZE);
126 #if HAVE_DVB_API_VERSION >= 3
127 memcpy(sct.filter.mode, mask.mode, DMX_FILTER_SIZE);
130 res = ::ioctl(fd, DMX_SET_FILTER, &sct);
133 #if HAVE_DVB_API_VERSION < 3
134 res = ::ioctl(fd, DMX_SET_NEGFILTER_MASK, mask.mode);
137 res = ::ioctl(fd, DMX_START, 0);
148 RESULT eDVBSectionReader::stop()
153 ::ioctl(fd, DMX_STOP);
158 RESULT eDVBSectionReader::connectRead(const Slot1<void,const __u8*> &r, ePtr<eConnection> &conn)
160 conn = new eConnection(this, read.connect(r));