MythTV  master
avfringbuffer.h
Go to the documentation of this file.
1 #ifndef _AVFRINGBUFFER_H_
2 #define _AVFRINGBUFFER_H_
3 
4 #include "ringbuffer.h"
5 
6 extern "C" {
7 #include "libavformat/avformat.h"
8 #include "libavformat/url.h"
9 }
10 
11 extern URLProtocol AVF_RingBuffer_Protocol;
12 
14 {
15 public:
16  explicit AVFRingBuffer(RingBuffer *rbuffer = nullptr)
17  : m_rbuffer(rbuffer) { }
18  void SetRingBuffer(RingBuffer *rbuffer)
19  {
20  m_rbuffer = rbuffer;
21  }
23  {
24  return m_rbuffer;
25  }
26  static URLProtocol *GetRingBufferURLProtocol(void);
27  static int AVF_Write_Packet(void *opaque, uint8_t *buf, int buf_size);
28  static int AVF_Read_Packet(void *opaque, uint8_t *buf, int buf_size);
29  static int64_t AVF_Seek_Packet(void *opaque, int64_t offset, int whence);
30  static int AVF_Open(URLContext *h, const char *filename, int flags);
31  static int AVF_Read(URLContext *h, uint8_t *buf, int buf_size);
32  static int AVF_Write(URLContext *h, const uint8_t *buf, int buf_size);
33  static int64_t AVF_Seek(URLContext *h, int64_t offset, int whence);
34  static int AVF_Close(URLContext *h);
35  void SetInInit(bool state);
36  bool IsInInit(void) { return m_initState; }
37 
38 private:
39  RingBuffer *m_rbuffer {nullptr};
40  bool m_initState {true};
42  static URLProtocol s_avfrURL;
43 };
44 
45 #endif
46 
47 /* vim: set expandtab tabstop=4 shiftwidth=4: */
void SetInInit(bool state)
static int64_t AVF_Seek_Packet(void *opaque, int64_t offset, int whence)
static URLProtocol s_avfrURL
Definition: avfringbuffer.h:42
AVFRingBuffer(RingBuffer *rbuffer=nullptr)
Definition: avfringbuffer.h:16
void SetRingBuffer(RingBuffer *rbuffer)
Definition: avfringbuffer.h:18
static int AVF_Write(URLContext *h, const uint8_t *buf, int buf_size)
static int AVF_Read(URLContext *h, uint8_t *buf, int buf_size)
static int AVF_Close(URLContext *h)
static int AVF_Read_Packet(void *opaque, uint8_t *buf, int buf_size)
URLProtocol AVF_RingBuffer_Protocol
RingBuffer * GetRingBuffer(void)
Definition: avfringbuffer.h:22
static URLProtocol * GetRingBufferURLProtocol(void)
static bool s_avfrProtocolInitialised
Definition: avfringbuffer.h:41
static int AVF_Write_Packet(void *opaque, uint8_t *buf, int buf_size)
bool IsInInit(void)
Definition: avfringbuffer.h:36
RingBuffer * m_rbuffer
Definition: avfringbuffer.h:39
static int AVF_Open(URLContext *h, const char *filename, int flags)
Implements a file/stream reader/writer.
static int64_t AVF_Seek(URLContext *h, int64_t offset, int whence)