X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/6a1fc924eb21f22f9b522df233a9a98d4c5bdca7..e1342ca063df18d3b933420150d06b86ea506bb3:/lib/dvb/demux.cpp diff --git a/lib/dvb/demux.cpp b/lib/dvb/demux.cpp index d2a2a545..6753f2f2 100644 --- a/lib/dvb/demux.cpp +++ b/lib/dvb/demux.cpp @@ -1,4 +1,3 @@ -#include #include #include #include @@ -6,12 +5,23 @@ #include #include - #if HAVE_DVB_API_VERSION < 3 #include + #ifndef DMX_SET_NEGFILTER_MASK #define DMX_SET_NEGFILTER_MASK _IOW('o',48,uint8_t *) #endif + +#ifndef DMX_GET_STC + struct dmx_stc + { + unsigned int num; /* input : which STC? O..N */ + unsigned int base; /* output: divisor for stc to get 90 kHz clock */ + unsigned long long stc; /* output: src in 'base'*90 kHz units */ + }; + #define DMX_GET_STC _IOR('o', 50, struct dmx_stc) +#endif + #else #include #endif @@ -24,6 +34,7 @@ #include #include #include +#include eDVBDemux::eDVBDemux(int adapter, int demux): adapter(adapter), demux(demux) { @@ -49,18 +60,29 @@ DEFINE_REF(eDVBDemux) RESULT eDVBDemux::setSourceFrontend(int fenum) { +#if HAVE_DVB_API_VERSION >= 3 int fd = openDemux(); - int res = ::ioctl(fd, DMX_SET_SOURCE, DMX_SOURCE_FRONT0 + fenum); + + int n = DMX_SOURCE_FRONT0 + fenum; + int res = ::ioctl(fd, DMX_SET_SOURCE, &n); + if (res) + eDebug("DMX_SET_SOURCE failed! - %m"); ::close(fd); return res; +#endif + return 0; } RESULT eDVBDemux::setSourcePVR(int pvrnum) { +#if HAVE_DVB_API_VERSION >= 3 int fd = openDemux(); - int res = ::ioctl(fd, DMX_SET_SOURCE, DMX_SOURCE_DVR0 + pvrnum); + int n = DMX_SOURCE_DVR0 + pvrnum; + int res = ::ioctl(fd, DMX_SET_SOURCE, &n); ::close(fd); return res; +#endif + return 0; } RESULT eDVBDemux::createSectionReader(eMainloop *context, ePtr &reader) @@ -86,7 +108,7 @@ RESULT eDVBDemux::getMPEGDecoder(ePtr &decoder) return 0; } -RESULT eDVBDemux::getSTC(pts_t &pts) +RESULT eDVBDemux::getSTC(pts_t &pts, int num) { int fd = openDemux(); @@ -94,7 +116,7 @@ RESULT eDVBDemux::getSTC(pts_t &pts) return -ENODEV; struct dmx_stc stc; - stc.num = 0; + stc.num = num; stc.base = 1; if (ioctl(fd, DMX_GET_STC, &stc) < 0) @@ -246,14 +268,52 @@ RESULT eDVBSectionReader::connectRead(const Slot1 &r, ePtrm_dvr_busy = 1; } @@ -318,11 +378,11 @@ RESULT eDVBTSRecorder::removePID(int pid) return 0; } -RESULT eDVBTSRecorder::setFormat(int format) +RESULT eDVBTSRecorder::setTimingPID(int pid) { if (m_running) return -1; - m_format = format; + m_thread->setTimingPID(pid); return 0; } @@ -332,6 +392,11 @@ RESULT eDVBTSRecorder::setTargetFD(int fd) return 0; } +RESULT eDVBTSRecorder::setTargetFilename(const char *filename) +{ + m_target_filename = filename; +} + RESULT eDVBTSRecorder::setBoundary(off_t max) { return -1; // not yet implemented @@ -348,6 +413,9 @@ RESULT eDVBTSRecorder::stop() close(m_source_fd); + if (m_target_filename != "") + m_thread->saveTimingInformation(m_target_filename + ".ap"); + return 0; } @@ -396,6 +464,7 @@ RESULT eDVBTSRecorder::startPID(int pid) void eDVBTSRecorder::stopPID(int pid) { - ::close(m_pids[pid]); + if (m_pids[pid] != -1) + ::close(m_pids[pid]); m_pids[pid] = -1; }