1 #ifndef __lib_base_filepush_h
2 #define __lib_base_filepush_h
4 #include <lib/base/thread.h>
5 #include <lib/base/ioprio.h>
6 #include <libsig_comp.h>
7 #include <lib/base/message.h>
9 #include <lib/base/rawfile.h>
11 class iFilePushScatterGather
14 virtual void getNextSourceSpan(off_t current_offset, size_t bytes_read, off_t &start, size_t &size)=0;
15 virtual ~iFilePushScatterGather() {}
18 class eFilePushThread: public eThread, public Object
22 eFilePushThread(int prio_class=IOPRIO_CLASS_BE, int prio_level=0, int blocksize=188);
25 void start(int sourcefd, int destfd);
26 int start(const char *filename, int destfd);
29 void seek(int whence, off_t where);
32 /* flushes the internal readbuffer */
34 void enablePVRCommit(int);
36 /* stream mode will wait on EOF until more data is available. */
37 void setStreamMode(int);
39 void setScatterGather(iFilePushScatterGather *);
41 enum { evtEOF, evtReadError, evtWriteError, evtUser };
42 Signal1<void,int> m_event;
44 void installSigUSR1Handler();
45 void before_set_thread_alive();
47 /* you can send private events if you want */
48 void sendEvent(int evt);
50 virtual int filterRecordData(const unsigned char *data, int len, size_t ¤t_span_remaining);
52 iFilePushScatterGather *m_sg;
54 unsigned char m_buffer[65536];
55 int m_buf_start, m_buf_end, m_filter_end;
57 int m_send_pvr_commit;
61 eRawFile m_raw_source;
63 eFixedMessagePump<int> m_messagepump;
65 void recvEvent(const int &evt);