lib/dvb/dvb.cpp: allow non relative seeking even without valid decoding demux here
[vuplus_dvbapp] / lib / dvb / dvb.cpp
index 76f6899..17712dd 100644 (file)
@@ -1324,16 +1324,6 @@ void eDVBChannel::getNextSourceSpan(off_t current_offset, size_t bytes_read, off
                return;
        }
 
-       m_cue->m_lock.RdLock();
-       if (!m_cue->m_decoding_demux)
-       {
-               start = current_offset;
-               size = max;
-               eDebug("getNextSourceSpan, no decoding demux. forcing normal play");
-               m_cue->m_lock.Unlock();
-               return;
-       }
-
        if (m_skipmode_n)
        {
                eDebug("skipmode %d:%d (x%d)", m_skipmode_m, m_skipmode_n, m_skipmode_frames);
@@ -1341,7 +1331,6 @@ void eDVBChannel::getNextSourceSpan(off_t current_offset, size_t bytes_read, off
        }
 
        eDebug("getNextSourceSpan, current offset is %08llx, m_skipmode_m = %d!", current_offset, m_skipmode_m);
-       
        int frame_skip_success = 0;
 
        if (m_skipmode_m)
@@ -1386,6 +1375,8 @@ void eDVBChannel::getNextSourceSpan(off_t current_offset, size_t bytes_read, off
                }
        }
 
+       m_cue->m_lock.RdLock();
+
        while (!m_cue->m_seek_requests.empty())
        {
                std::pair<int, pts_t> seek = m_cue->m_seek_requests.front();
@@ -1410,6 +1401,13 @@ void eDVBChannel::getNextSourceSpan(off_t current_offset, size_t bytes_read, off
                                eDebug("decoder getPTS failed, can't seek relative");
                                continue;
                        }
+                       if (!m_cue->m_decoding_demux)
+                       {
+                               eDebug("getNextSourceSpan, no decoding demux. couldn't seek to %llx... ignore request!", pts);
+                               start = current_offset;
+                               size = max;
+                               continue;
+                       }
                        if (getCurrentPosition(m_cue->m_decoding_demux, now, 1))
                        {
                                eDebug("seekTo: getCurrentPosition failed!");
@@ -1462,12 +1460,7 @@ void eDVBChannel::getNextSourceSpan(off_t current_offset, size_t bytes_read, off
                        continue;
                }
                
-               size_t iframe_len;
-                       /* try to align to iframe */
-               int direction = pts < 0 ? -1 : 1;
-               m_tstools.findFrame(offset, iframe_len, direction);
-
-               eDebug("ok, resolved skip (rel: %d, diff %lld), now at %08llx (skipped additional %d frames due to iframe re-align)", relative, pts, offset, direction);
+               eDebug("ok, resolved skip (rel: %d, diff %lld), now at %08llx", relative, pts, offset);
                current_offset = align(offset, blocksize); /* in case tstools return non-aligned offset */
        }