#include <DeviceReadBuffer.h>
This allows us to read the device regularly even in the presence of long blocking conditions on writing to disk or accessing the database.
Definition at line 31 of file DeviceReadBuffer.h.
Public Member Functions | |
| DeviceReadBuffer (ReaderPausedCB *callback, bool use_poll=true) | |
| ~DeviceReadBuffer () | |
| bool | Setup (const QString &streamName, int streamfd) |
| void | Start (void) |
| void | Reset (const QString &streamName, int streamfd) |
| void | Stop (void) |
| void | SetRequestPause (bool request) |
| bool | IsPaused (void) const |
| bool | WaitForUnpause (int timeout) |
| bool | IsErrored (void) const |
| bool | IsEOF (void) const |
| bool | IsRunning (void) const |
| uint | Read (unsigned char *buf, uint count) |
| Try to Read count bytes from into buffer. | |
Private Member Functions | |
| void | fill_ringbuffer (void) |
| void | SetPaused (bool) |
| void | IncrWritePointer (uint len) |
| void | IncrReadPointer (uint len) |
| bool | HandlePausing (void) |
| bool | Poll (void) const |
| uint | WaitForUnused (uint bytes_needed) const |
| uint | WaitForUsed (uint bytes_needed) const |
| bool | IsPauseRequested (void) const |
| bool | IsOpen (void) const |
| uint | GetUnused (void) const |
| uint | GetUsed (void) const |
| uint | GetContiguousUnused (void) const |
| bool | CheckForErrors (ssize_t read_len, uint &err_cnt) |
| void | ReportStats (void) |
Static Private Member Functions | |
| static void * | boot_ringbuffer (void *) |
Private Attributes | |
| QString | videodevice |
| int | _stream_fd |
| ReaderPausedCB * | readerPausedCB |
| pthread_t | thread |
| QMutex | lock |
| bool | run |
| bool | running |
| bool | eof |
| bool | error |
| bool | request_pause |
| bool | paused |
| bool | using_poll |
| size_t | size |
| size_t | used |
| size_t | dev_read_size |
| size_t | min_read |
| unsigned char * | buffer |
| unsigned char * | readPtr |
| unsigned char * | writePtr |
| unsigned char * | endPtr |
| QWaitCondition | pauseWait |
| QWaitCondition | unpauseWait |
| size_t | max_used |
| size_t | avg_used |
| size_t | avg_cnt |
| MythTimer | lastReport |
| DeviceReadBuffer::DeviceReadBuffer | ( | ReaderPausedCB * | callback, | |
| bool | use_poll = true | |||
| ) |
Definition at line 19 of file DeviceReadBuffer.cpp.
| DeviceReadBuffer::~DeviceReadBuffer | ( | ) |
Definition at line 41 of file DeviceReadBuffer.cpp.
| bool DeviceReadBuffer::Setup | ( | const QString & | streamName, | |
| int | streamfd | |||
| ) |
| void DeviceReadBuffer::Start | ( | void | ) |
| void DeviceReadBuffer::Reset | ( | const QString & | streamName, | |
| int | streamfd | |||
| ) |
| void DeviceReadBuffer::Stop | ( | void | ) |
Definition at line 117 of file DeviceReadBuffer.cpp.
Referenced by DVBStreamHandler::RunTS(), and DVBStreamHandler::Stop().
| void DeviceReadBuffer::SetRequestPause | ( | bool | request | ) |
| bool DeviceReadBuffer::IsPaused | ( | void | ) | const |
Definition at line 150 of file DeviceReadBuffer.cpp.
Referenced by HandlePausing(), and WaitForUnpause().
| bool DeviceReadBuffer::WaitForUnpause | ( | int | timeout | ) |
Definition at line 156 of file DeviceReadBuffer.cpp.
| bool DeviceReadBuffer::IsErrored | ( | void | ) | const [inline] |
| bool DeviceReadBuffer::IsEOF | ( | void | ) | const [inline] |
| bool DeviceReadBuffer::IsRunning | ( | void | ) | const |
Definition at line 169 of file DeviceReadBuffer.cpp.
Referenced by DVBStreamHandler::RunTS(), and Stop().
Try to Read count bytes from into buffer.
| buf | Buffer to put data in | |
| count | Number of bytes to attempt to read |
Definition at line 390 of file DeviceReadBuffer.cpp.
Referenced by DVBStreamHandler::RunTS().
| void * DeviceReadBuffer::boot_ringbuffer | ( | void * | arg | ) | [static, private] |
| void DeviceReadBuffer::fill_ringbuffer | ( | void | ) | [private] |
Definition at line 220 of file DeviceReadBuffer.cpp.
| void DeviceReadBuffer::SetPaused | ( | bool | val | ) | [private] |
| void DeviceReadBuffer::IncrWritePointer | ( | uint | len | ) | [private] |
| void DeviceReadBuffer::IncrReadPointer | ( | uint | len | ) | [private] |
| bool DeviceReadBuffer::HandlePausing | ( | void | ) | [private] |
| bool DeviceReadBuffer::Poll | ( | void | ) | const [private] |
| needed | Number of bytes we want to write |
Definition at line 432 of file DeviceReadBuffer.cpp.
Referenced by fill_ringbuffer().
| needed | Number of bytes we want to read |
Definition at line 458 of file DeviceReadBuffer.cpp.
Referenced by Read().
| bool DeviceReadBuffer::IsPauseRequested | ( | void | ) | const [private] |
Definition at line 163 of file DeviceReadBuffer.cpp.
Referenced by HandlePausing(), Poll(), and WaitForUnused().
| bool DeviceReadBuffer::IsOpen | ( | void | ) | const [inline, private] |
Definition at line 67 of file DeviceReadBuffer.h.
Referenced by fill_ringbuffer(), Poll(), and WaitForUnused().
| uint DeviceReadBuffer::GetUnused | ( | void | ) | const [private] |
| uint DeviceReadBuffer::GetUsed | ( | void | ) | const [private] |
| uint DeviceReadBuffer::GetContiguousUnused | ( | void | ) | const [private] |
| void DeviceReadBuffer::ReportStats | ( | void | ) | [private] |
QString DeviceReadBuffer::videodevice [private] |
Definition at line 75 of file DeviceReadBuffer.h.
Referenced by HandlePausing(), Reset(), and Setup().
int DeviceReadBuffer::_stream_fd [private] |
Definition at line 76 of file DeviceReadBuffer.h.
Referenced by CheckForErrors(), fill_ringbuffer(), HandlePausing(), IsOpen(), Poll(), Reset(), and Setup().
ReaderPausedCB* DeviceReadBuffer::readerPausedCB [private] |
pthread_t DeviceReadBuffer::thread [private] |
QMutex DeviceReadBuffer::lock [mutable, private] |
Definition at line 82 of file DeviceReadBuffer.h.
Referenced by CheckForErrors(), fill_ringbuffer(), GetContiguousUnused(), GetUnused(), GetUsed(), IncrReadPointer(), IncrWritePointer(), IsPaused(), IsPauseRequested(), IsRunning(), ReportStats(), Reset(), SetPaused(), SetRequestPause(), Setup(), Start(), Stop(), and WaitForUsed().
bool DeviceReadBuffer::run [private] |
Definition at line 83 of file DeviceReadBuffer.h.
Referenced by fill_ringbuffer(), Poll(), Stop(), and WaitForUnused().
bool DeviceReadBuffer::running [private] |
Definition at line 84 of file DeviceReadBuffer.h.
Referenced by fill_ringbuffer(), IsRunning(), Start(), and WaitForUsed().
bool DeviceReadBuffer::eof [private] |
Definition at line 85 of file DeviceReadBuffer.h.
Referenced by CheckForErrors(), IsEOF(), Setup(), and WaitForUsed().
bool DeviceReadBuffer::error [private] |
Definition at line 86 of file DeviceReadBuffer.h.
Referenced by CheckForErrors(), IsErrored(), Setup(), and WaitForUsed().
bool DeviceReadBuffer::request_pause [private] |
Definition at line 87 of file DeviceReadBuffer.h.
Referenced by IsPauseRequested(), SetRequestPause(), Setup(), and WaitForUsed().
bool DeviceReadBuffer::paused [private] |
Definition at line 88 of file DeviceReadBuffer.h.
Referenced by IsPaused(), SetPaused(), and Setup().
bool DeviceReadBuffer::using_poll [private] |
size_t DeviceReadBuffer::size [private] |
Definition at line 91 of file DeviceReadBuffer.h.
Referenced by GetUnused(), ReportStats(), and Setup().
size_t DeviceReadBuffer::used [private] |
Definition at line 92 of file DeviceReadBuffer.h.
Referenced by GetUnused(), GetUsed(), IncrReadPointer(), IncrWritePointer(), Reset(), Setup(), and WaitForUsed().
size_t DeviceReadBuffer::dev_read_size [private] |
size_t DeviceReadBuffer::min_read [private] |
unsigned char* DeviceReadBuffer::buffer [private] |
Definition at line 95 of file DeviceReadBuffer.h.
Referenced by IncrReadPointer(), IncrWritePointer(), Reset(), Setup(), and ~DeviceReadBuffer().
unsigned char* DeviceReadBuffer::readPtr [private] |
Definition at line 96 of file DeviceReadBuffer.h.
Referenced by IncrReadPointer(), Read(), Reset(), and Setup().
unsigned char* DeviceReadBuffer::writePtr [private] |
Definition at line 97 of file DeviceReadBuffer.h.
Referenced by fill_ringbuffer(), GetContiguousUnused(), IncrWritePointer(), Reset(), and Setup().
unsigned char* DeviceReadBuffer::endPtr [private] |
Definition at line 98 of file DeviceReadBuffer.h.
Referenced by GetContiguousUnused(), IncrReadPointer(), IncrWritePointer(), Read(), and Setup().
QWaitCondition DeviceReadBuffer::pauseWait [private] |
QWaitCondition DeviceReadBuffer::unpauseWait [private] |
size_t DeviceReadBuffer::max_used [private] |
Definition at line 104 of file DeviceReadBuffer.h.
Referenced by IncrWritePointer(), ReportStats(), and Setup().
size_t DeviceReadBuffer::avg_used [private] |
Definition at line 105 of file DeviceReadBuffer.h.
Referenced by IncrWritePointer(), ReportStats(), and Setup().
size_t DeviceReadBuffer::avg_cnt [private] |
Definition at line 106 of file DeviceReadBuffer.h.
Referenced by IncrWritePointer(), ReportStats(), and Setup().
MythTimer DeviceReadBuffer::lastReport [private] |
1.5.5