Support scrambled playback.
[vuplus_dvbapp] / lib / base / rawfile.h
1 #ifndef __lib_base_rawfile_h
2 #define __lib_base_rawfile_h
3
4 #include <string>
5 #include <lib/base/itssource.h>
6
7 class eRawFile: public iTsSource
8 {
9         DECLARE_REF(eRawFile);
10         eSingleLock m_lock;
11 public:
12         eRawFile();
13         ~eRawFile();
14         int open(const char *filename, int cached = 0);
15         void setfd(int fd);
16         int close();
17
18         // iTsSource
19         off_t lseek(off_t offset, int whence);
20         ssize_t read(off_t offset, void *buf, size_t count);
21         off_t length();
22         off_t offset();
23         int valid();
24 private:
25         int m_fd;     /* for uncached */
26         FILE *m_file; /* for cached */
27         int m_cached;
28         std::string m_basename;
29         off_t m_splitsize, m_totallength, m_current_offset, m_base_offset, m_last_offset;
30         int m_nrfiles;
31         void scan();
32         int m_current_file;
33         int switchOffset(off_t off);
34
35         off_t lseek_internal(off_t offset, int whence);
36         FILE *openFileCached(int nr);
37         int openFileUncached(int nr);
38 };
39
40 #endif