|
MythTV
0.26-pre
|
00001 #include "ringbuffer.h" 00002 00003 class MTV_PUBLIC FileRingBuffer : public RingBuffer 00004 { 00005 friend class RingBuffer; 00006 public: 00007 ~FileRingBuffer(); 00008 00009 // Gets 00010 virtual bool IsOpen(void) const; 00011 virtual long long GetReadPosition(void) const; 00012 virtual long long GetRealFileSize(void) const; 00013 00014 // General Commands 00015 virtual bool OpenFile(const QString &lfilename, 00016 uint retry_ms = kDefaultOpenTimeout); 00017 virtual bool ReOpen(QString newFilename = ""); 00018 virtual long long Seek(long long pos, int whence, bool has_lock); 00019 00020 protected: 00021 FileRingBuffer(const QString &lfilename, 00022 bool write, bool readahead, int timeout_ms); 00023 00024 virtual int safe_read(void *data, uint sz) 00025 { 00026 if (remotefile) 00027 return safe_read(remotefile, data, sz); 00028 else if (fd2 >= 0) 00029 return safe_read(fd2, data, sz); 00030 00031 errno = EBADF; 00032 return -1; 00033 } 00034 int safe_read(int fd, void *data, uint sz); 00035 int safe_read(RemoteFile *rf, void *data, uint sz); 00036 };
1.7.6.1