add eMainloop::reset to reset the app_quit_now flag in mainloop (to restart mainloops)
[enigma2.git] / lib / base / filepush.h
1 #ifndef __lib_base_filepush_h
2 #define __lib_base_filepush_h
3
4 #include <lib/base/thread.h>
5 #include <libsig_comp.h>
6 #include <lib/base/message.h>
7 #include <sys/types.h>
8 #include <lib/base/rawfile.h>
9
10 class iFilePushScatterGather
11 {
12 public:
13         virtual void getNextSourceSpan(off_t current_offset, size_t bytes_read, off_t &start, size_t &size)=0;
14         virtual ~iFilePushScatterGather() {}
15 };
16
17 class eFilePushThread: public eThread, public Object
18 {
19 public:
20         eFilePushThread();
21         void thread();
22         void stop();
23         void start(int sourcefd, int destfd);
24         int start(const char *filename, int destfd);
25         
26         void pause();
27         void seek(int whence, off_t where);
28         void resume();
29         
30                 /* flushes the internal readbuffer */ 
31         void flush();
32         void enablePVRCommit(int);
33         
34         void setScatterGather(iFilePushScatterGather *);
35         
36         enum { evtEOF, evtReadError, evtWriteError, evtUser };
37         Signal1<void,int> m_event;
38         
39                 /* you can send private events if you want */
40         void sendEvent(int evt);
41 protected:
42         virtual void filterRecordData(const unsigned char *data, int len);
43 private:
44         iFilePushScatterGather *m_sg;
45         int m_stop;
46         unsigned char m_buffer[65536];
47         int m_buf_start, m_buf_end;
48         int m_fd_dest;
49         int m_send_pvr_commit;
50         
51         eRawFile m_raw_source;
52         
53         eFixedMessagePump<int> m_messagepump;
54         
55         void recvEvent(const int &evt);
56 };
57
58 #endif