X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=blobdiff_plain;f=lib%2Fdvb%2Fdemux.cpp;h=0c736c55c23e1cfc55de9e1f0a2c5a793b01a22b;hp=081059b95bc8a5bd949493930d8e940a2732f8f8;hb=1b50c31e8c9a2d690500feac0065fd1ace941c80;hpb=e246e0ded446974b388f1e819bdbdb446ae4429f diff --git a/lib/dvb/demux.cpp b/lib/dvb/demux.cpp index 081059b..0c736c5 100644 --- a/lib/dvb/demux.cpp +++ b/lib/dvb/demux.cpp @@ -648,18 +648,36 @@ RESULT eDVBTSRecorder::setBoundary(off_t max) RESULT eDVBTSRecorder::stop() { + int state=3; + for (std::map::iterator i(m_pids.begin()); i != m_pids.end(); ++i) stopPID(i->first); if (!m_running) return -1; + +#if HAVE_DVB_API_VERSION >= 5 + /* workaround for record thread stop */ + if (::ioctl(m_source_fd, DMX_STOP) < 0) + perror("DMX_STOP"); + else + state &= ~1; + + if (::close(m_source_fd) < 0) + perror("close"); + else + state &= ~2; +#endif + m_thread->stop(); - - close(m_source_fd); + + if (state & 3) + ::close(m_source_fd); + + m_running = 0; m_source_fd = -1; - + m_thread->stopSaveMetaInformation(); - return 0; }