+ if (m_buf_end == 0)
+ {
+ /* on EOF, try COMMITting once. */
+ if (m_send_pvr_commit && !already_empty)
+ {
+ eDebug("sending PVR commit");
+ already_empty = 1;
+ if (::ioctl(m_fd_dest, PVR_COMMIT) < 0 && errno == EINTR)
+ continue;
+ eDebug("commit done");
+ /* well check again */
+ continue;
+ }
+
+ /* in stream_mode, we are sending EOF events
+ over and over until somebody responds.
+
+ in stream_mode, think of evtEOF as "buffer underrun occured". */
+ sendEvent(evtEOF);
+
+ if (m_stream_mode)
+ {
+ eDebug("reached EOF, but we are in stream mode. delaying 1 second.");
+ sleep(1);
+ continue;
+ }
+#if 0
+ eDebug("FILEPUSH: end-of-file! (currently unhandled)");
+ if (!m_raw_source.lseek(0, SEEK_SET))
+ {
+ eDebug("(looping)");
+ continue;
+ }
+#endif
+ break;
+ } else
+ {
+ source_pos += m_buf_end;
+ bytes_read += m_buf_end;
+ if (m_sg)
+ current_span_remaining -= m_buf_end;
+ already_empty = 0;
+ }
+// printf("FILEPUSH: read %d bytes\n", m_buf_end);