Merge branch 'bug_245_record_playback_fixes' into experimental
[enigma2.git] / lib / base / rawfile.h
1 #ifndef __lib_base_rawfile_h
2 #define __lib_base_rawfile_h
3
4 #include <string>
5
6 class eRawFile
7 {
8 public:
9         eRawFile();
10         ~eRawFile();
11         
12         int open(const char *filename, int cached = 0);
13         void setfd(int fd);
14         off_t lseek(off_t offset, int whence);
15         int close();
16         ssize_t read(void *buf, size_t count); /* NOTE: you must be able to handle short reads! */
17         off_t length();
18         int valid();
19 private:
20         int m_fd;     /* for uncached */
21         FILE *m_file; /* for cached */
22         
23         int m_cached;
24         std::string m_basename;
25         off_t m_splitsize, m_totallength, m_current_offset, m_base_offset, m_last_offset;
26         int m_nrfiles;
27         void scan();
28         int m_current_file;
29         int switchOffset(off_t off);
30         FILE *openFileCached(int nr);
31         int openFileUncached(int nr);
32 };
33
34 #endif