X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=blobdiff_plain;f=lib%2Fdvb%2Fdemux.cpp;h=73cedc36fe3321f20b7253e889e84354a4763e47;hp=22b09ffe32e29cbdcae44dd02d2aefc3f039bed2;hb=0fb354eb517927bd6c8465523800e6ee398a1db7;hpb=fa458113395a4b8da3954b656dbe6c55b30f224a diff --git a/lib/dvb/demux.cpp b/lib/dvb/demux.cpp index 22b09ff..73cedc3 100644 --- a/lib/dvb/demux.cpp +++ b/lib/dvb/demux.cpp @@ -144,12 +144,15 @@ RESULT eDVBDemux::getSTC(pts_t &pts, int num) if (ioctl(fd, DMX_GET_STC, &stc) < 0) { + eDebug("DMX_GET_STC failed!"); ::close(fd); return -1; } pts = stc.stc; + eDebug("DMX_GET_STC - %lld", pts); + ::close(fd); return 0; } @@ -302,7 +305,7 @@ void eDVBPESReader::data(int) return; if(r < 0) { - if (errno == EAGAIN) /* ok */ + if (errno == EAGAIN || errno == EINTR) /* ok */ return; eWarning("ERROR reading PES (fd=%d) - %m", m_fd); return; @@ -405,7 +408,7 @@ public: void saveTimingInformation(const std::string &filename); protected: - void filterRecordData(const unsigned char *data, int len); + int filterRecordData(const unsigned char *data, int len, size_t ¤t_span_remaining); private: eMPEGStreamParserTS m_ts_parser; eMPEGStreamInformation m_stream_info; @@ -429,11 +432,13 @@ void eDVBRecordFileThread::saveTimingInformation(const std::string &filename) m_stream_info.save(filename.c_str()); } -void eDVBRecordFileThread::filterRecordData(const unsigned char *data, int len) +int eDVBRecordFileThread::filterRecordData(const unsigned char *data, int len, size_t ¤t_span_remaining) { m_ts_parser.parseData(m_current_offset, data, len); m_current_offset += len; + + return len; } DEFINE_REF(eDVBTSRecorder); @@ -627,10 +632,18 @@ 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; + bool retry=false; + 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; } @@ -643,8 +656,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;