X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=blobdiff_plain;f=lib%2Fbase%2Ffilepush.h;h=75df7ab7c63293f7e3fc9169e083dcbb48a44e5b;hp=a536df177693e999ed55f283a7b1192f61309b1e;hb=6855a6ae6701f8d29540551fcff971316b5d49f1;hpb=4934fe267ddc796ab220168ca6284872f0a5e3d0 diff --git a/lib/base/filepush.h b/lib/base/filepush.h index a536df1..75df7ab 100644 --- a/lib/base/filepush.h +++ b/lib/base/filepush.h @@ -2,25 +2,31 @@ #define __lib_base_filepush_h #include +#include #include #include #include +#include class iFilePushScatterGather { public: + virtual void getNextSourceSpan(off_t current_offset, size_t bytes_read, off_t &start, size_t &size)=0; virtual ~iFilePushScatterGather() {} - virtual void getNextSourceSpan(size_t bytes_read, off_t &start, size_t &size)=0; }; class eFilePushThread: public eThread, public Object { + int prio_class, prio; public: - eFilePushThread(); + eFilePushThread(int prio_class=IOPRIO_CLASS_BE, int prio_level=0, int blocksize=188); void thread(); void stop(); void start(int sourcefd, int destfd); - + int start(const char *filename, int destfd); + + void start(ePtr source, int destfd); + void pause(); void seek(int whence, off_t where); void resume(); @@ -29,22 +35,35 @@ public: void flush(); void enablePVRCommit(int); - void setSG(iFilePushScatterGather *); + /* stream mode will wait on EOF until more data is available. */ + void setStreamMode(int); - enum { evtEOF, evtReadError, evtWriteError }; - Signal1 m_event; + void setScatterGather(iFilePushScatterGather *); + enum { evtEOF, evtReadError, evtWriteError, evtUser }; + Signal1 m_event; + + void installSigUSR1Handler(); + void before_set_thread_alive(); + + /* you can send private events if you want */ + void sendEvent(int evt); +protected: + virtual int filterRecordData(const unsigned char *data, int len, size_t ¤t_span_remaining); 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_buf_start, m_buf_end, m_filter_end; + int m_fd_dest; int m_send_pvr_commit; - + int m_stream_mode; + int m_blocksize; + + ePtr m_raw_source; + eFixedMessagePump m_messagepump; - - void sendEvent(int evt); + void recvEvent(const int &evt); };