MythTV  master
icringbuffer.h
Go to the documentation of this file.
1 #ifndef ICRINGBUFFER_H
2 #define ICRINGBUFFER_H
3 
4 #include "ringbuffer.h"
5 
6 class NetStream;
7 
8 class ICRingBuffer : public RingBuffer
9 {
10  public:
12 
13  ICRingBuffer(const QString &url, RingBuffer *parent = nullptr);
14  virtual ~ICRingBuffer();
15 
16  // RingBuffer implementation
17  bool IsOpen(void) const override; // RingBuffer
18  long long GetReadPosition(void) const override; // RingBuffer
19  bool OpenFile(const QString &url,
20  uint retry_ms = kDefaultOpenTimeout) override; // RingBuffer
21  bool IsStreamed(void) override { return false; } // RingBuffer
22  bool IsSeekingAllowed(void) override { return true; } // RingBuffer
23  bool IsBookmarkAllowed(void) override { return false; } // RingBuffer
24 
25  protected:
26  int safe_read(void *data, uint sz) override; // RingBuffer
27  long long GetRealFileSizeInternal(void) const override; // RingBuffer
28  long long SeekInternal(long long pos, int whence) override; // RingBuffer
29 
30  // Operations
31  public:
32  // Take ownership of parent RingBuffer
33  RingBuffer *Take();
34 
35  private:
36  NetStream *m_stream {nullptr};
37  RingBuffer *m_parent {nullptr}; // parent RingBuffer
38 };
39 
40 #endif // ICRINGBUFFER_H
static const int kDefaultOpenTimeout
virtual ~ICRingBuffer()
NetStream * m_stream
Definition: icringbuffer.h:36
bool IsBookmarkAllowed(void) override
Definition: icringbuffer.h:23
bool IsStreamed(void) override
Definition: icringbuffer.h:21
bool IsSeekingAllowed(void) override
Definition: icringbuffer.h:22
unsigned int uint
Definition: compat.h:140
bool IsOpen(void) const override
Returns true if open for either reading or writing.
bool OpenFile(const QString &url, uint retry_ms=kDefaultOpenTimeout) override
Opens a BBC NetStream for reading.
ICRingBuffer(const QString &url, RingBuffer *parent=nullptr)
long long GetReadPosition(void) const override
Returns how far into the file we have read.
static enum RingBufferType const kRingBufferType
Definition: icringbuffer.h:11
long long GetRealFileSizeInternal(void) const override
long long SeekInternal(long long pos, int whence) override
RingBuffer * Take()
RingBuffer * m_parent
Definition: icringbuffer.h:37
Stream content from a URI.
Definition: netstream.h:30
Implements a file/stream reader/writer.
int safe_read(void *data, uint sz) override