always use unsigned
[enigma2.git] / lib / base / filepush.h
index a419d7190e4f97305cca4f0e671e412248e1cd92..0749cd43d4b3f0c68b19c44e5afd37e7a06b088d 100644 (file)
@@ -2,15 +2,28 @@
 #define __lib_base_filepush_h
 
 #include <lib/base/thread.h>
+#include <lib/base/ioprio.h>
+#include <libsig_comp.h>
+#include <lib/base/message.h>
 #include <sys/types.h>
+#include <lib/base/rawfile.h>
 
-class eFilePushThread: public eThread
+class iFilePushScatterGather
 {
 public:
-       eFilePushThread();
+       virtual void getNextSourceSpan(off_t current_offset, size_t bytes_read, off_t &start, size_t &size)=0;
+       virtual ~iFilePushScatterGather() {}
+};
+
+class eFilePushThread: public eThread, public Object
+{
+       int prio_class, prio;
+public:
+       eFilePushThread(int prio_class=IOPRIO_CLASS_BE, int prio_level=0);
        void thread();
        void stop();
        void start(int sourcefd, int destfd);
+       int start(const char *filename, int destfd);
        
        void pause();
        void seek(int whence, off_t where);
@@ -18,12 +31,33 @@ public:
        
                /* flushes the internal readbuffer */ 
        void flush();
+       void enablePVRCommit(int);
+       
+       void setScatterGather(iFilePushScatterGather *);
        
+       enum { evtEOF, evtReadError, evtWriteError, evtUser };
+       Signal1<void,int> m_event;
+
+       void installSigUSR1Handler();
+       void before_set_thread_alive();
+
+               /* you can send private events if you want */
+       void sendEvent(int evt);
+protected:
+       virtual void filterRecordData(const unsigned char *data, int len);
 private:
+       iFilePushScatterGather *m_sg;
        int m_stop;
        unsigned char m_buffer[65536];
        int m_buf_start, m_buf_end;
-       int m_fd_source, m_fd_dest;
+       int m_fd_dest;
+       int m_send_pvr_commit;
+       
+       eRawFile m_raw_source;
+       
+       eFixedMessagePump<int> m_messagepump;
+       
+       void recvEvent(const int &evt);
 };
 
 #endif