X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/e5107b2bd4b6167a39e4574769a0d992082296d5..a29bbc0a4ee2eb5f0d86407088380de9887359a0:/lib/dvb/demux.cpp diff --git a/lib/dvb/demux.cpp b/lib/dvb/demux.cpp index 931c6c71..29bbf264 100644 --- a/lib/dvb/demux.cpp +++ b/lib/dvb/demux.cpp @@ -76,11 +76,12 @@ RESULT eDVBDemux::setSourceFrontend(int fenum) { #if HAVE_DVB_API_VERSION >= 3 int fd = openDemux(); - int n = DMX_SOURCE_FRONT0 + fenum; int res = ::ioctl(fd, DMX_SET_SOURCE, &n); if (res) eDebug("DMX_SET_SOURCE failed! - %m"); + else + source = fenum; ::close(fd); return res; #endif @@ -93,6 +94,7 @@ RESULT eDVBDemux::setSourcePVR(int pvrnum) int fd = openDemux(); int n = DMX_SOURCE_DVR0 + pvrnum; int res = ::ioctl(fd, DMX_SET_SOURCE, &n); + source = -1; ::close(fd); return res; #endif @@ -632,10 +634,17 @@ RESULT eDVBTSRecorder::startPID(int pid) } m_pids[pid] = fd; #else - if (::ioctl(m_source_fd, DMX_ADD_PID, pid)) - perror("DMX_ADD_PID"); - else - m_pids[pid] = 1; + while(true) { + if (::ioctl(m_source_fd, DMX_ADD_PID, pid) < 0) { + perror("DMX_ADD_PID"); + if (errno == EAGAIN || errno == EINTR) { + eDebug("retry!"); + continue; + } + } else + m_pids[pid] = 1; + break; + } #endif return 0; } @@ -648,8 +657,16 @@ void eDVBTSRecorder::stopPID(int pid) #else if (m_pids[pid] != -1) { - if (::ioctl(m_source_fd, DMX_REMOVE_PID, pid)) - perror("DMX_REMOVE_PID"); + while(true) { + if (::ioctl(m_source_fd, DMX_REMOVE_PID, pid) < 0) { + perror("DMX_REMOVE_PID"); + if (errno == EAGAIN || errno == EINTR) { + eDebug("retry!"); + continue; + } + } + break; + } } #endif m_pids[pid] = -1;