MythTV  master
mythmediabuffer.h
Go to the documentation of this file.
1 #ifndef MYTHMEDIABUFFER_H
2 #define MYTHMEDIABUFFER_H
3 
4 // Qt
5 #include <QReadWriteLock>
6 #include <QWaitCondition>
7 #include <QString>
8 #include <QMutex>
9 #include <QMap>
10 
11 // MythTV
12 #include "mythtvexp.h"
13 #include "mythchrono.h"
14 #include "mythconfig.h"
15 #include "mthread.h"
16 
17 // FFmpeg
18 extern "C" {
19 #include "libavcodec/avcodec.h"
20 }
21 
22 // Size of PNG header plus one empty chunk
23 #define kReadTestSize 20
24 
25 // about one second at 35Mb
26 #define BUFFER_SIZE_MINIMUM (4 * 1024 * 1024)
27 #define BUFFER_FACTOR_NETWORK 2
28 #define BUFFER_FACTOR_BITRATE 2
29 #define BUFFER_FACTOR_MATROSKA 2
30 
31 #define DEFAULT_CHUNK_SIZE 32768
32 
33 class ThreadedFileWriter;
34 class MythDVDBuffer;
35 class MythBDBuffer;
36 class LiveTVChain;
37 class RemoteFile;
38 
40 {
48 };
49 
51 {
52  friend class MythInteractiveBuffer;
53 
54  public:
55  static MythMediaBuffer *Create(const QString &Filename, bool Write,
56  bool UseReadAhead = true,
57  std::chrono::milliseconds Timeout = kDefaultOpenTimeout,
58  bool StreamOnly = false);
59  ~MythMediaBuffer() override = 0;
60  MythBufferType GetType() const;
61 
62  static constexpr std::chrono::milliseconds kDefaultOpenTimeout { 2s };
63  static constexpr std::chrono::milliseconds kLiveTVOpenTimeout { 10s };
64  static QString BitrateToString (uint64_t Rate, bool Hz = false);
65  static void AVFormatInitNetwork (void);
66 
67  void SetOldFile (bool Old);
68  void UpdateRawBitrate (uint RawBitrate);
69  void UpdatePlaySpeed (float PlaySpeed);
70  void EnableBitrateMonitor (bool Enable);
71  void SetBufferSizeFactors (bool EstBitrate, bool Matroska);
72  void SetWaitForWrite (void);
73  QString GetSafeFilename (void);
74  QString GetFilename (void) const;
75  QString GetSubtitleFilename (void) const;
76  QString GetLastError (void) const;
77  bool GetCommsError (void) const;
78  void ResetCommsError (void);
79  bool GetStopReads (void) const;
80  QString GetDecoderRate (void);
81  QString GetStorageRate (void);
82  QString GetAvailableBuffer (void);
83  uint GetBufferSize (void) const;
84  bool IsNearEnd (double Framerate, uint Frames) const;
85  long long GetWritePosition (void) const;
86  long long GetRealFileSize (void) const;
87  bool IsDisc (void) const;
88  bool IsDVD (void) const;
89  bool IsBD (void) const;
90  const MythDVDBuffer *DVD (void) const;
91  MythDVDBuffer *DVD (void);
92  const MythBDBuffer *BD (void) const;
93  MythBDBuffer *BD (void);
94  int Read (void *Buffer, int Count);
95  int Peek (void *Buffer, int Count);
96  int Peek (std::vector<char>& Buffer);
97  void Reset (bool Full = false, bool ToAdjust = false, bool ResetInternal = false);
98  void Pause (void);
99  void Unpause (void);
100  void WaitForPause (void);
101  void Start (void);
102  void StopReads (void);
103  void StartReads (void);
104  long long Seek (long long Position, int Whence, bool HasLock = false);
105  long long SetAdjustFilesize (void);
106 
107  // LiveTV used utilities
108  int GetReadBufAvail (void) const;
109  bool SetReadInternalMode (bool Mode);
110  bool IsReadInternalMode (void) const;
111  bool LiveMode (void) const;
112  void SetLiveMode (LiveTVChain *Chain);
113  void IgnoreLiveEOF (bool Ignore);
114 
115  // ThreadedFileWriter proxies
116  int Write (const void *Buffer, uint Count);
117  bool IsIOBound (void) const;
118  void WriterFlush (void);
119  void Sync (void);
120  long long WriterSeek (long long Position, int Whence, bool HasLock = false);
121  bool WriterSetBlocking (bool Lock = true);
122 
123  virtual long long GetReadPosition (void) const = 0;
124  virtual bool IsOpen (void) const = 0;
125  virtual bool IsStreamed (void) { return LiveMode(); }
126  virtual bool IsSeekingAllowed (void) { return true; }
127  virtual bool IsBookmarkAllowed (void) { return true; }
128  virtual int BestBufferSize (void) { return DEFAULT_CHUNK_SIZE; }
129  virtual bool StartFromBeginning(void) { return true; }
130  virtual void IgnoreWaitStates (bool /*Ignore*/) { }
131  virtual bool IsInMenu (void) const { return false; }
132  virtual bool IsInStillFrame (void) const { return false; }
133  virtual bool IsInDiscMenuOrStillFrame(void) const { return IsInMenu() || IsInStillFrame(); }
134  virtual bool HandleAction (const QStringList &/*Action*/, mpeg::chrono::pts /*Pts*/) { return false; }
135  virtual bool OpenFile (const QString &Filename, std::chrono::milliseconds Retry = kDefaultOpenTimeout) = 0;
136  virtual bool ReOpen (const QString& /*Filename*/ = "") { return false; }
137 
138  protected:
139  explicit MythMediaBuffer(MythBufferType Type);
140 
141  void run(void) override;
142  void CreateReadAheadBuffer (void);
143  void CalcReadAheadThresh (void);
144  bool PauseAndWait (void);
145  int ReadPriv (void *Buffer, int Count, bool Peek);
146  int ReadDirect (void *Buffer, int Count, bool Peek);
147  bool WaitForReadsAllowed (void);
148  int WaitForAvail (int Count, std::chrono::milliseconds Timeout);
149  int ReadBufFree (void) const;
150  int ReadBufAvail (void) const;
151  void ResetReadAhead (long long NewInternal);
152  void KillReadAheadThread (void);
153  uint64_t UpdateDecoderRate (uint64_t Latest = 0);
154  uint64_t UpdateStorageRate (uint64_t Latest = 0);
155 
156  virtual int SafeRead (void *Buffer, uint Size) = 0;
157  virtual long long GetRealFileSizeInternal(void) const { return -1; }
158  virtual long long SeekInternal (long long Position, int Whence) = 0;
159 
160 
161  protected:
163 
164  mutable QReadWriteLock m_posLock;
165  long long m_readPos { 0 };
166  long long m_writePos { 0 };
167  long long m_internalReadPos { 0 };
168  long long m_ignoreReadPos { -1 };
169 
170  mutable QReadWriteLock m_rbrLock;
171  int m_rbrPos { 0 };
172 
173  mutable QReadWriteLock m_rbwLock;
174  int m_rbwPos { 0 };
175 
176  // note should not go under rwLock..
177  // this is used to break out of read_safe where rwLock is held
178  volatile bool m_stopReads {false};
179 
180  // unprotected (for debugging)
181  QString m_safeFilename;
182 
183  mutable QReadWriteLock m_rwLock;
184  QString m_filename;
186  QString m_lastError;
187  ThreadedFileWriter *m_tfw { nullptr };
188  int m_fd2 { -1 };
189  bool m_writeMode { false };
190  RemoteFile *m_remotefile { nullptr };
192  bool m_lowBuffers { false };
193  bool m_fileIsMatroska { false };
194  bool m_unknownBitrate { false };
195  bool m_startReadAhead { false };
196  char *m_readAheadBuffer { nullptr };
197  bool m_readAheadRunning { false };
198  bool m_reallyRunning { false };
199  bool m_requestPause { false };
200  bool m_paused { false };
201  bool m_ateof { false };
202  bool m_waitForWrite { false };
203  bool m_beingWritten { false };
204  bool m_readsAllowed { false };
205  bool m_readsDesired { false };
206  volatile bool m_recentSeek { true }; // not protected by rwLock
207  bool m_setSwitchToNext { false };
208  uint m_rawBitrate { 8000 };
209  float m_playSpeed { 1.0F };
210  int m_fillThreshold { 65536 };
211  int m_fillMin { -1 };
213  int m_wantToRead { 0 };
214  int m_numFailures { 0 }; // (see note 1)
215  bool m_commsError { false };
216  bool m_oldfile { false };
218  bool m_ignoreLiveEOF { false };
219  long long m_readAdjust { 0 };
220  int m_readOffset { 0 };
221  bool m_readInternalMode { false };
222  // End of section protected by rwLock
223 
224  bool m_bitrateMonitorEnabled { false };
226  QMap<std::chrono::milliseconds, uint64_t> m_decoderReads;
228  QMap<std::chrono::milliseconds, uint64_t> m_storageReads;
229 
230  // note 1: numfailures is modified with only a read lock in the
231  // read ahead thread, but this is safe since all other places
232  // that use it are protected by a write lock. But this is a
233  // fragile state of affairs and care must be taken when modifying
234  // code or locking around this variable.
235 
237  QWaitCondition m_generalWait; // protected by rwLock
238 
239  private:
240  bool m_bitrateInitialized { false };
241 };
242 #endif
MythMediaBuffer::BD
const MythBDBuffer * BD(void) const
Definition: mythmediabuffer.cpp:1834
BUFFER_SIZE_MINIMUM
#define BUFFER_SIZE_MINIMUM
Definition: mythmediabuffer.h:26
MythMediaBuffer::BestBufferSize
virtual int BestBufferSize(void)
Definition: mythmediabuffer.h:128
MythMediaBuffer::m_tfw
ThreadedFileWriter * m_tfw
Definition: mythmediabuffer.h:187
MythMediaBuffer::SetBufferSizeFactors
void SetBufferSizeFactors(bool EstBitrate, bool Matroska)
Tells RingBuffer that the raw bitrate may be inaccurate and the underlying container is matroska,...
Definition: mythmediabuffer.cpp:328
MythMediaBuffer::PauseAndWait
bool PauseAndWait(void)
Definition: mythmediabuffer.cpp:727
MythMediaBuffer::m_rbrPos
int m_rbrPos
Definition: mythmediabuffer.h:171
MythMediaBuffer::m_readAdjust
long long m_readAdjust
Definition: mythmediabuffer.h:219
MythMediaBuffer::ReOpen
virtual bool ReOpen(const QString &="")
Definition: mythmediabuffer.h:136
MythMediaBuffer::m_startReadAhead
bool m_startReadAhead
Definition: mythmediabuffer.h:195
MythMediaBuffer::Seek
long long Seek(long long Position, int Whence, bool HasLock=false)
Definition: mythmediabuffer.cpp:472
MythMediaBuffer::StopReads
void StopReads(void)
Definition: mythmediabuffer.cpp:662
MythMediaBuffer::UpdatePlaySpeed
void UpdatePlaySpeed(float PlaySpeed)
Set the play speed, to allow RingBuffer adjust effective bitrate.
Definition: mythmediabuffer.cpp:305
MythMediaBuffer::m_commsError
bool m_commsError
Definition: mythmediabuffer.h:215
MythMediaBuffer::m_oldfile
bool m_oldfile
Definition: mythmediabuffer.h:216
MythMediaBuffer::EnableBitrateMonitor
void EnableBitrateMonitor(bool Enable)
Definition: mythmediabuffer.cpp:313
kMythBufferDVD
@ kMythBufferDVD
Definition: mythmediabuffer.h:43
MythMediaBuffer::WriterSetBlocking
bool WriterSetBlocking(bool Lock=true)
Calls ThreadedFileWriter::SetBlocking(bool)
Definition: mythmediabuffer.cpp:1697
mythtvexp.h
MythMediaBuffer::GetWritePosition
long long GetWritePosition(void) const
Returns how far into a ThreadedFileWriter file we have written.
Definition: mythmediabuffer.cpp:1775
MythMediaBuffer::m_fd2
int m_fd2
Definition: mythmediabuffer.h:188
MythMediaBuffer::m_safeFilename
QString m_safeFilename
Definition: mythmediabuffer.h:181
MythMediaBuffer::GetDecoderRate
QString GetDecoderRate(void)
Definition: mythmediabuffer.cpp:1522
MythMediaBuffer::kLiveTVOpenTimeout
static constexpr std::chrono::milliseconds kLiveTVOpenTimeout
Definition: mythmediabuffer.h:63
MythMediaBuffer::CalcReadAheadThresh
void CalcReadAheadThresh(void)
Calculates m_fillMin, m_fillThreshold, and m_readBlockSize from the estimated effective bitrate of th...
Definition: mythmediabuffer.cpp:344
MythMediaBuffer::m_type
MythBufferType m_type
Definition: mythmediabuffer.h:162
kMythBufferBD
@ kMythBufferBD
Definition: mythmediabuffer.h:44
MythMediaBuffer::ReadDirect
int ReadDirect(void *Buffer, int Count, bool Peek)
Definition: mythmediabuffer.cpp:1245
RemoteFile
Definition: remotefile.h:17
MythMediaBuffer::Write
int Write(const void *Buffer, uint Count)
Writes buffer to ThreadedFileWriter::Write(const void*,uint)
Definition: mythmediabuffer.cpp:1613
MythMediaBuffer::m_readOffset
int m_readOffset
Definition: mythmediabuffer.h:220
MythMediaBuffer
Definition: mythmediabuffer.h:50
MythMediaBuffer::IgnoreWaitStates
virtual void IgnoreWaitStates(bool)
Definition: mythmediabuffer.h:130
MythMediaBuffer::IsDVD
bool IsDVD(void) const
Definition: mythmediabuffer.cpp:1819
MythMediaBuffer::Unpause
void Unpause(void)
Unpauses the read-ahead thread. Calls StartReads(void).
Definition: mythmediabuffer.cpp:697
MythMediaBuffer::GetSafeFilename
QString GetSafeFilename(void)
Definition: mythmediabuffer.cpp:1736
MythMediaBuffer::GetReadBufAvail
int GetReadBufAvail(void) const
Returns number of bytes available for reading from buffer.
Definition: mythmediabuffer.cpp:455
MythMediaBuffer::m_lastError
QString m_lastError
Definition: mythmediabuffer.h:186
MythMediaBuffer::m_generalWait
QWaitCondition m_generalWait
Condition to signal that the read ahead thread is running.
Definition: mythmediabuffer.h:237
MythMediaBuffer::HandleAction
virtual bool HandleAction(const QStringList &, mpeg::chrono::pts)
Definition: mythmediabuffer.h:134
MythMediaBuffer::ReadBufFree
int ReadBufFree(void) const
Returns number of bytes available for reading into buffer.
Definition: mythmediabuffer.cpp:444
MythInteractiveBuffer::SeekInternal
long long SeekInternal(long long Position, int Whence) override
Definition: mythinteractivebuffer.cpp:92
MythMediaBuffer::IsBD
bool IsBD(void) const
Definition: mythmediabuffer.cpp:1824
MythMediaBuffer::SetAdjustFilesize
long long SetAdjustFilesize(void)
Definition: mythmediabuffer.cpp:1152
MythMediaBuffer::IsInMenu
virtual bool IsInMenu(void) const
Definition: mythmediabuffer.h:131
MythBufferType
MythBufferType
Definition: mythmediabuffer.h:39
MythMediaBuffer::WaitForReadsAllowed
bool WaitForReadsAllowed(void)
Definition: mythmediabuffer.cpp:1180
MythMediaBuffer::UpdateRawBitrate
void UpdateRawBitrate(uint RawBitrate)
Set the raw bit rate, to allow RingBuffer adjust effective bitrate.
Definition: mythmediabuffer.cpp:277
kMythBufferHLS
@ kMythBufferHLS
Definition: mythmediabuffer.h:46
MythMediaBuffer::StartFromBeginning
virtual bool StartFromBeginning(void)
Definition: mythmediabuffer.h:129
MythMediaBuffer::BitrateToString
static QString BitrateToString(uint64_t Rate, bool Hz=false)
Definition: mythmediabuffer.cpp:1489
MythMediaBuffer::m_paused
bool m_paused
Definition: mythmediabuffer.h:200
MythMediaBuffer::m_decoderReadLock
QMutex m_decoderReadLock
Definition: mythmediabuffer.h:225
MythMediaBuffer::m_readsAllowed
bool m_readsAllowed
Definition: mythmediabuffer.h:204
MythMediaBuffer::GetStopReads
bool GetStopReads(void) const
Definition: mythmediabuffer.cpp:1767
MythMediaBuffer::GetBufferSize
uint GetBufferSize(void) const
Definition: mythmediabuffer.cpp:1542
MythMediaBuffer::WaitForAvail
int WaitForAvail(int Count, std::chrono::milliseconds Timeout)
Definition: mythmediabuffer.cpp:1209
MythMediaBuffer::m_rawBitrate
uint m_rawBitrate
Definition: mythmediabuffer.h:208
MythMediaBuffer::ReadPriv
int ReadPriv(void *Buffer, int Count, bool Peek)
When possible reads from the read-ahead buffer, otherwise reads directly from the device.
Definition: mythmediabuffer.cpp:1320
MythMediaBuffer::m_liveTVChain
LiveTVChain * m_liveTVChain
Definition: mythmediabuffer.h:217
MythInteractiveBuffer::GetReadPosition
long long GetReadPosition(void) const override
Definition: mythinteractivebuffer.cpp:87
MythMediaBuffer::GetFilename
QString GetFilename(void) const
Definition: mythmediabuffer.cpp:1728
MythMediaBuffer::GetRealFileSize
long long GetRealFileSize(void) const
Definition: mythmediabuffer.cpp:461
MythMediaBuffer::SetOldFile
void SetOldFile(bool Old)
Tell RingBuffer if this is an old file or not.
Definition: mythmediabuffer.cpp:1720
MythMediaBuffer::m_readPos
long long m_readPos
Definition: mythmediabuffer.h:165
MythMediaBuffer::m_beingWritten
bool m_beingWritten
Definition: mythmediabuffer.h:203
MythInteractiveBuffer::IsOpen
bool IsOpen(void) const override
Definition: mythinteractivebuffer.cpp:30
kMythBufferUnknown
@ kMythBufferUnknown
Definition: mythmediabuffer.h:41
MythMediaBuffer::WaitForPause
void WaitForPause(void)
Waits for Pause(void) to take effect.
Definition: mythmediabuffer.cpp:711
MythMediaBuffer::IsInDiscMenuOrStillFrame
virtual bool IsInDiscMenuOrStillFrame(void) const
Definition: mythmediabuffer.h:133
MythMediaBuffer::WriterSeek
long long WriterSeek(long long Position, int Whence, bool HasLock=false)
Calls ThreadedFileWriter::Seek(long long,int).
Definition: mythmediabuffer.cpp:1660
MythMediaBuffer::m_requestPause
bool m_requestPause
Definition: mythmediabuffer.h:199
MythMediaBuffer::m_readInternalMode
bool m_readInternalMode
Definition: mythmediabuffer.h:221
MythMediaBuffer::~MythMediaBuffer
~MythMediaBuffer() override=0
Deletes.
Definition: mythmediabuffer.cpp:217
MythMediaBuffer::GetSubtitleFilename
QString GetSubtitleFilename(void) const
Definition: mythmediabuffer.cpp:1741
MythMediaBuffer::m_remotefile
RemoteFile * m_remotefile
Definition: mythmediabuffer.h:190
MythMediaBuffer::UpdateStorageRate
uint64_t UpdateStorageRate(uint64_t Latest=0)
Definition: mythmediabuffer.cpp:1578
MythMediaBuffer::m_decoderReads
QMap< std::chrono::milliseconds, uint64_t > m_decoderReads
Definition: mythmediabuffer.h:226
MythMediaBuffer::ResetCommsError
void ResetCommsError(void)
Definition: mythmediabuffer.cpp:1762
MythMediaBuffer::IsIOBound
bool IsIOBound(void) const
MythMediaBuffer::m_writePos
long long m_writePos
Definition: mythmediabuffer.h:166
MythMediaBuffer::m_readBlockSize
int m_readBlockSize
Definition: mythmediabuffer.h:212
MythMediaBuffer::m_rbwLock
QReadWriteLock m_rbwLock
Definition: mythmediabuffer.h:173
MythMediaBuffer::GetCommsError
bool GetCommsError(void) const
Definition: mythmediabuffer.cpp:1757
MythMediaBuffer::m_waitForWrite
bool m_waitForWrite
Definition: mythmediabuffer.h:202
MythBDBuffer
Definition: mythbdbuffer.h:20
MythMediaBuffer::m_setSwitchToNext
bool m_setSwitchToNext
Definition: mythmediabuffer.h:207
DEFAULT_CHUNK_SIZE
#define DEFAULT_CHUNK_SIZE
Definition: mythmediabuffer.h:31
kMythBufferHTTP
@ kMythBufferHTTP
Definition: mythmediabuffer.h:45
MythMediaBuffer::m_readAheadBuffer
char * m_readAheadBuffer
Definition: mythmediabuffer.h:196
kMythBufferMHEG
@ kMythBufferMHEG
Definition: mythmediabuffer.h:47
MythMediaBuffer::m_numFailures
int m_numFailures
Definition: mythmediabuffer.h:214
MythMediaBuffer::m_bufferSize
uint m_bufferSize
Definition: mythmediabuffer.h:191
MythMediaBuffer::LiveMode
bool LiveMode(void) const
Returns true if this RingBuffer has been assigned a LiveTVChain.
Definition: mythmediabuffer.cpp:1787
MythMediaBuffer::m_lowBuffers
bool m_lowBuffers
Definition: mythmediabuffer.h:192
MythMediaBuffer::m_fillThreshold
int m_fillThreshold
Definition: mythmediabuffer.h:210
uint
unsigned int uint
Definition: compat.h:140
MythMediaBuffer::m_filename
QString m_filename
Definition: mythmediabuffer.h:184
MThread::run
virtual void run(void)
Runs the Qt event loop unless we have a QRunnable, in which case we run the runnable run instead.
Definition: mthread.cpp:318
MythMediaBuffer::CreateReadAheadBuffer
void CreateReadAheadBuffer(void)
Definition: mythmediabuffer.cpp:770
MythMediaBuffer::IgnoreLiveEOF
void IgnoreLiveEOF(bool Ignore)
Tells RingBuffer whether to ignore the end-of-file.
Definition: mythmediabuffer.cpp:1807
MythMediaBuffer::Read
int Read(void *Buffer, int Count)
This is the public method for reading from a file, it calls the appropriate read method if the file i...
Definition: mythmediabuffer.cpp:1475
ThreadedFileWriter
This class supports the writing of recordings to disk.
Definition: threadedfilewriter.h:42
MTV_PUBLIC
#define MTV_PUBLIC
Definition: mythtvexp.h:15
MythMediaBuffer::IsReadInternalMode
bool IsReadInternalMode(void) const
Definition: mythmediabuffer.cpp:541
MythMediaBuffer::m_rbrLock
QReadWriteLock m_rbrLock
Definition: mythmediabuffer.h:170
MythMediaBuffer::m_readsDesired
bool m_readsDesired
Definition: mythmediabuffer.h:205
MythMediaBuffer::WriterFlush
void WriterFlush(void)
Calls ThreadedFileWriter::Flush(void)
Definition: mythmediabuffer.cpp:1686
MythMediaBuffer::KillReadAheadThread
void KillReadAheadThread(void)
Stops the read-ahead thread, and waits for it to stop.
Definition: mythmediabuffer.cpp:646
MythMediaBuffer::AVFormatInitNetwork
static void AVFormatInitNetwork(void)
Definition: mythmediabuffer.cpp:1849
MythMediaBuffer::IsBookmarkAllowed
virtual bool IsBookmarkAllowed(void)
Definition: mythmediabuffer.h:127
MythMediaBuffer::m_playSpeed
float m_playSpeed
Definition: mythmediabuffer.h:209
Buffer
Definition: MythExternControl.h:36
MythMediaBuffer::m_recentSeek
volatile bool m_recentSeek
Definition: mythmediabuffer.h:206
MythMediaBuffer::m_ignoreLiveEOF
bool m_ignoreLiveEOF
Definition: mythmediabuffer.h:218
MythMediaBuffer::m_storageReadLock
QMutex m_storageReadLock
Definition: mythmediabuffer.h:227
MythMediaBuffer::m_unknownBitrate
bool m_unknownBitrate
Definition: mythmediabuffer.h:194
MythMediaBuffer::ResetReadAhead
void ResetReadAhead(long long NewInternal)
Restart the read-ahead thread at the 'newinternal' position.
Definition: mythmediabuffer.cpp:568
MythMediaBuffer::IsInStillFrame
virtual bool IsInStillFrame(void) const
Definition: mythmediabuffer.h:132
MythInteractiveBuffer::OpenFile
bool OpenFile(const QString &Url, std::chrono::milliseconds Retry=kDefaultOpenTimeout) override
Opens a BBC NetStream for reading.
Definition: mythinteractivebuffer.cpp:41
MythMediaBuffer::MythMediaBuffer
MythMediaBuffer(MythBufferType Type)
Definition: mythmediabuffer.cpp:196
MythMediaBuffer::SetReadInternalMode
bool SetReadInternalMode(bool Mode)
Definition: mythmediabuffer.cpp:516
MythMediaBuffer::m_fileIsMatroska
bool m_fileIsMatroska
Definition: mythmediabuffer.h:193
MythMediaBuffer::m_wantToRead
int m_wantToRead
Definition: mythmediabuffer.h:213
MythMediaBuffer::GetRealFileSizeInternal
virtual long long GetRealFileSizeInternal(void) const
Definition: mythmediabuffer.h:157
MythMediaBuffer::IsDisc
bool IsDisc(void) const
Definition: mythmediabuffer.cpp:1814
MythMediaBuffer::Start
void Start(void)
Starts the read-ahead thread.
Definition: mythmediabuffer.cpp:610
MThread
This is a wrapper around QThread that does several additional things.
Definition: mthread.h:48
MythMediaBuffer::GetAvailableBuffer
QString GetAvailableBuffer(void)
Definition: mythmediabuffer.cpp:1532
mythchrono.h
mthread.h
MythInteractiveBuffer
Definition: mythinteractivebuffer.h:9
MythMediaBuffer::ReadBufAvail
int ReadBufAvail(void) const
Returns number of bytes available for reading from buffer.
Definition: mythmediabuffer.cpp:548
MythMediaBuffer::Create
static MythMediaBuffer * Create(const QString &Filename, bool Write, bool UseReadAhead=true, std::chrono::milliseconds Timeout=kDefaultOpenTimeout, bool StreamOnly=false)
Creates a RingBuffer instance.
Definition: mythmediabuffer.cpp:97
MythMediaBuffer::m_bitrateInitialized
bool m_bitrateInitialized
Definition: mythmediabuffer.h:240
MythMediaBuffer::GetLastError
QString GetLastError(void) const
Definition: mythmediabuffer.cpp:1749
kMythBufferFile
@ kMythBufferFile
Definition: mythmediabuffer.h:42
mpeg::chrono::pts
std::chrono::duration< CHRONO_TYPE, std::ratio< 1, 90000 > > pts
Definition: mythchrono.h:55
MythMediaBuffer::m_reallyRunning
bool m_reallyRunning
Definition: mythmediabuffer.h:198
MythMediaBuffer::SetLiveMode
void SetLiveMode(LiveTVChain *Chain)
Assigns a LiveTVChain to this RingBuffer.
Definition: mythmediabuffer.cpp:1799
MythMediaBuffer::m_subtitleFilename
QString m_subtitleFilename
Definition: mythmediabuffer.h:185
MythMediaBuffer::m_writeMode
bool m_writeMode
Definition: mythmediabuffer.h:189
MythMediaBuffer::DVD
const MythDVDBuffer * DVD(void) const
Definition: mythmediabuffer.cpp:1829
MythMediaBuffer::m_posLock
QReadWriteLock m_posLock
Definition: mythmediabuffer.h:164
MythMediaBuffer::m_bitrateMonitorEnabled
bool m_bitrateMonitorEnabled
Definition: mythmediabuffer.h:224
MythInteractiveBuffer::SafeRead
int SafeRead(void *Buffer, uint Size) override
Definition: mythinteractivebuffer.cpp:137
MythMediaBuffer::Peek
int Peek(void *Buffer, int Count)
Definition: mythmediabuffer.cpp:1164
MythMediaBuffer::m_stopReads
volatile bool m_stopReads
Definition: mythmediabuffer.h:178
MythMediaBuffer::IsNearEnd
bool IsNearEnd(double Framerate, uint Frames) const
Definition: mythmediabuffer.cpp:405
MythMediaBuffer::IsStreamed
virtual bool IsStreamed(void)
Definition: mythmediabuffer.h:125
MythMediaBuffer::m_rwLock
QReadWriteLock m_rwLock
Definition: mythmediabuffer.h:183
MythMediaBuffer::StartReads
void StartReads(void)
Definition: mythmediabuffer.cpp:672
MythDVDBuffer
Definition: mythdvdbuffer.h:38
MythMediaBuffer::m_storageReads
QMap< std::chrono::milliseconds, uint64_t > m_storageReads
Definition: mythmediabuffer.h:228
MythMediaBuffer::m_ateof
bool m_ateof
Definition: mythmediabuffer.h:201
MythMediaBuffer::IsSeekingAllowed
virtual bool IsSeekingAllowed(void)
Definition: mythmediabuffer.h:126
MythMediaBuffer::kDefaultOpenTimeout
static constexpr std::chrono::milliseconds kDefaultOpenTimeout
Definition: mythmediabuffer.h:62
MythMediaBuffer::GetStorageRate
QString GetStorageRate(void)
Definition: mythmediabuffer.cpp:1527
MythMediaBuffer::UpdateDecoderRate
uint64_t UpdateDecoderRate(uint64_t Latest=0)
Definition: mythmediabuffer.cpp:1547
MythMediaBuffer::m_internalReadPos
long long m_internalReadPos
Definition: mythmediabuffer.h:167
MythMediaBuffer::Pause
void Pause(void)
Pauses the read-ahead thread. Calls StopReads(void).
Definition: mythmediabuffer.cpp:683
MythMediaBuffer::Sync
void Sync(void)
Calls ThreadedFileWriter::Sync(void)
Definition: mythmediabuffer.cpp:1650
MythMediaBuffer::m_rbwPos
int m_rbwPos
Definition: mythmediabuffer.h:174
MythMediaBuffer::m_ignoreReadPos
long long m_ignoreReadPos
Definition: mythmediabuffer.h:168
MythMediaBuffer::m_readAheadRunning
bool m_readAheadRunning
Definition: mythmediabuffer.h:197
MythMediaBuffer::Reset
void Reset(bool Full=false, bool ToAdjust=false, bool ResetInternal=false)
Resets the read-ahead thread and our position in the file.
Definition: mythmediabuffer.cpp:236
MythMediaBuffer::GetType
MythBufferType GetType() const
Definition: mythmediabuffer.cpp:202
MythMediaBuffer::m_fillMin
int m_fillMin
Definition: mythmediabuffer.h:211
LiveTVChain
Keeps track of recordings in a current LiveTV instance.
Definition: livetvchain.h:34
MythMediaBuffer::SetWaitForWrite
void SetWaitForWrite(void)
Definition: mythmediabuffer.cpp:318