MythTV  master
dvdstream.h
Go to the documentation of this file.
1 /* DVD stream
2  * Copyright 2011 Lawrence Rust <lvr at softsystem dot co dot uk>
3  */
4 #ifndef DVDSTREAM_H
5 #define DVDSTREAM_H
6 
7 #include <cstdint>
8 
9 #include <QString>
10 #include <QList>
11 
12 #include "ringbuffer.h"
13 
14 typedef struct dvd_reader_s dvd_reader_t;
15 
16 
21 {
22  Q_DISABLE_COPY(DVDStream);
23 
24 public:
25  explicit DVDStream(const QString&);
26  virtual ~DVDStream();
27 
28 public:
29  // RingBuffer methods
30  long long GetReadPosition(void) const override; // RingBuffer
31  bool IsOpen(void) const override; // RingBuffer
32  bool OpenFile(const QString &lfilename, uint retry_ms = 0) override; // RingBuffer
33 
34 protected:
35  int safe_read(void *data, uint size) override; // RingBuffer
36  long long SeekInternal(long long pos, int whence) override; // RingBuffer
37 
38  // Implementation
39 private:
40  dvd_reader_t *m_reader {nullptr};
41  uint32_t m_start {0};
42 
43  class BlockRange;
44  typedef QList<BlockRange> list_t;
45  list_t m_list; // List of possibly encryoted block ranges
46 
47  uint32_t m_pos {0}; // Current read position (blocks)
48  int m_title {-1}; // Last title decrypted
49 };
50 
51 #endif /* ndef DVDSTREAM_H */
virtual bool OpenFile(const QString &lfilename, uint retry_ms=kDefaultOpenTimeout)=0
Opens a file for reading.
unsigned int uint
Definition: compat.h:140
virtual long long SeekInternal(long long pos, int whence)=0
#define MTV_PUBLIC
Definition: mythtvexp.h:15
virtual bool IsOpen(void) const =0
Returns true if open for either reading or writing.
virtual long long GetReadPosition(void) const =0
Returns how far into the file we have read.
virtual int safe_read(void *data, uint sz)=0
list_t m_list
Definition: dvdstream.h:45
QList< BlockRange > list_t
Definition: dvdstream.h:43
struct dvd_reader_s dvd_reader_t
Definition: dvdstream.h:14
Implements a file/stream reader/writer.
Stream content from a DVD image file.
Definition: dvdstream.h:20