MythTV  master
fileringbuffer.h
Go to the documentation of this file.
1 // Qt headers
2 #include <QCoreApplication>
3 
4 // MythTV headers
5 #include "ringbuffer.h"
6 
8 {
9  Q_DECLARE_TR_FUNCTIONS(FileRingBuffer)
10 
11  friend class RingBuffer;
12  public:
13  ~FileRingBuffer();
14 
15  // Gets
16  bool IsOpen(void) const override; // RingBuffer
17  long long GetReadPosition(void) const override; // RingBuffer
18 
19  // General Commands
20  bool OpenFile(const QString &lfilename,
21  uint retry_ms = kDefaultOpenTimeout) override; // RingBuffer
22  bool ReOpen(QString newFilename = "") override; // RingBuffer
23 
24  protected:
25  FileRingBuffer(const QString &lfilename,
26  bool write, bool readahead, int timeout_ms);
27 
28  int safe_read(void *data, uint sz) override // RingBuffer
29  {
30  if (m_remotefile)
31  return safe_read(m_remotefile, data, sz);
32  else if (m_fd2 >= 0)
33  return safe_read(m_fd2, data, sz);
34 
35  errno = EBADF;
36  return -1;
37  }
38  int safe_read(int fd, void *data, uint sz);
39  int safe_read(RemoteFile *rf, void *data, uint sz);
40  long long GetRealFileSizeInternal(void) const override; // RingBuffer
41  long long SeekInternal(long long pos, int whence) override; // RingBuffer
42 };
def write(text, progress=True)
Definition: mythburn.py:279
virtual long long SeekInternal(long long pos, int whence)=0
static ssize_t safe_read(int filedes, void *buffer, size_t size)
Definition: dvbci.cpp:83
#define MTV_PUBLIC
Definition: mythtvexp.h:15
unsigned int uint
Definition: compat.h:140
virtual int safe_read(void *data, uint sz)=0
Implements a file/stream reader/writer.
virtual long long GetRealFileSizeInternal(void) const