X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=blobdiff_plain;f=lib%2Fbase%2Frawfile.h;h=7b736a33afc258db8f938fdba140451092c2dd33;hp=5d15e85dbc5dd4e0a74f50461f61e653cf596c53;hb=9d9d69d8242d27915c95cb794bd4e7a93759b6db;hpb=8ef240801bf66e543cdea9df3b32fc09cebcc7e5 diff --git a/lib/base/rawfile.h b/lib/base/rawfile.h index 5d15e85..7b736a3 100644 --- a/lib/base/rawfile.h +++ b/lib/base/rawfile.h @@ -2,29 +2,38 @@ #define __lib_base_rawfile_h #include +#include -class eRawFile +class eRawFile: public iTsSource { + DECLARE_REF(eRawFile); + eSingleLock m_lock; public: eRawFile(); ~eRawFile(); - - int open(const char *filename); + int open(const char *filename, int cached = 0); void setfd(int fd); - off_t lseek(off_t offset, int whence); int close(); - ssize_t read(void *buf, size_t count); /* NOTE: you must be able to handle short reads! */ + + // iTsSource + off_t lseek(off_t offset, int whence); + ssize_t read(off_t offset, void *buf, size_t count); off_t length(); int valid(); private: - int m_fd; + int m_fd; /* for uncached */ + FILE *m_file; /* for cached */ + int m_cached; std::string m_basename; - off_t m_splitsize, m_totallength, m_current_offset, m_base_offset; + off_t m_splitsize, m_totallength, m_current_offset, m_base_offset, m_last_offset; int m_nrfiles; void scan(); int m_current_file; int switchOffset(off_t off); - int openFile(int nr); + + off_t lseek_internal(off_t offset, int whence); + FILE *openFileCached(int nr); + int openFileUncached(int nr); }; #endif