MythTV  master
streamingringbuffer.h
Go to the documentation of this file.
1 #ifndef STREAMINGRINGBUFFER_H
2 #define STREAMINGRINGBUFFER_H
3 
4 #include "ringbuffer.h"
5 
6 extern "C" {
7 #include "libavformat/avformat.h"
8 #include "libavformat/url.h"
9 }
10 
12 {
13  public:
14  explicit StreamingRingBuffer(const QString &lfilename);
15  virtual ~StreamingRingBuffer();
16 
17  // RingBuffer implementation
18  bool IsOpen(void) const override; // RingBuffer
19  long long GetReadPosition(void) const override; // RingBuffer
20  bool OpenFile(const QString &lfilename,
21  uint retry_ms = kDefaultOpenTimeout) override; // RingBuffer
22  bool IsStreamed(void) override { return m_streamed; } // RingBuffer
23  bool IsSeekingAllowed(void) override { return m_allowSeeks; } // RingBuffer
24  bool IsBookmarkAllowed(void) override { return false; } // RingBuffer
25 
26  protected:
27  int safe_read(void *data, uint sz) override; // RingBuffer
28  long long GetRealFileSizeInternal(void) const override; // RingBuffer
29  long long SeekInternal(long long pos, int whence) override; // RingBuffer
30 
31  private:
32  URLContext *m_context {nullptr};
33  bool m_streamed {true};
34  bool m_allowSeeks {false};
35 };
36 
37 #endif // STREAMINGRINGBUFFER_H
static const int kDefaultOpenTimeout
long long GetReadPosition(void) const override
Returns how far into the file we have read.
bool IsOpen(void) const override
Returns true if open for either reading or writing.
unsigned int uint
Definition: compat.h:140
bool IsBookmarkAllowed(void) override
bool IsSeekingAllowed(void) override
int safe_read(void *data, uint sz) override
bool IsStreamed(void) override
StreamingRingBuffer(const QString &lfilename)
long long SeekInternal(long long pos, int whence) override
bool OpenFile(const QString &lfilename, uint retry_ms=kDefaultOpenTimeout) override
Opens a network stream for reading.
Implements a file/stream reader/writer.
long long GetRealFileSizeInternal(void) const override