vdr 2.7.2
|
#include <device.h>
Public Member Functions | |
cTSBuffer (int File, int Size, int DeviceNumber) | |
virtual | ~cTSBuffer () |
uchar * | Get (int *Available=NULL, bool CheckAvailable=false) |
void | Skip (int Count) |
![]() | |
cThread (const char *Description=NULL, bool LowPriority=false) | |
virtual | ~cThread () |
void | SetDescription (const char *Description,...) __attribute__((format(printf |
void bool | Start (void) |
bool | Active (void) |
Private Member Functions | |
virtual void | Action (void) |
Private Attributes | |
int | f |
int | deviceNumber |
int | delivered |
cRingBufferLinear * | ringBuffer |
Additional Inherited Members | |
![]() | |
static tThreadId | ThreadId (void) |
static tThreadId | IsMainThread (void) |
static void | SetMainThreadId (void) |
![]() | |
void | SetPriority (int Priority) |
void | SetIOPriority (int Priority) |
void | Lock (void) |
void | Unlock (void) |
bool | Running (void) |
void | Cancel (int WaitSeconds=0) |
Derived cDevice classes that can receive channels will have to provide Transport Stream (TS) packets one at a time.
cTSBuffer implements a simple buffer that allows the device to read a larger amount of data from the driver with each call to Read(), thus avoiding the overhead of getting each TS packet separately from the driver. It also makes sure the returned data points to a TS packet and automatically re-synchronizes after broken packets.
cTSBuffer::cTSBuffer | ( | int | File, |
int | Size, | ||
int | DeviceNumber ) |
Definition at line 1922 of file device.c.
References delivered, deviceNumber, f, ringBuffer, cThread::SetDescription(), cRingBuffer::SetIoThrottle(), cRingBuffer::SetTimeouts(), cThread::Start(), and TS_SIZE.
|
virtual |
Definition at line 1934 of file device.c.
References cThread::Cancel(), and ringBuffer.
|
privatevirtual |
A derived cThread class must implement the code it wants to execute as a separate thread in this function.
If this is a loop, it must check Running() repeatedly to see whether it's time to stop.
Implements cThread.
Definition at line 1940 of file device.c.
References deviceNumber, esyslog, f, FATALERRNO, LOG_ERROR, cPoller::Poll(), cRingBufferLinear::Read(), ringBuffer, cThread::Running(), and cCondWait::SleepMs().
uchar * cTSBuffer::Get | ( | int * | Available = NULL, |
bool | CheckAvailable = false ) |
Returns a pointer to the first TS packet in the buffer.
If Available is given, it will return the total number of consecutive bytes pointed to in the buffer. It is guaranteed that the returned pointer points to a TS_SYNC_BYTE and that there are at least TS_SIZE bytes in the buffer. Otherwise NULL will be returned and the value in Available (if given) is undefined. Each call to Get() returns a pointer to the next TS packet in the buffer. If CheckAvailable is true, the buffer will be checked whether it contains at least TS_SIZE bytes before trying to get any data from it. Otherwise, if the buffer is empty, this function will wait a little while for the buffer to be filled again.
Definition at line 1963 of file device.c.
References cRingBufferLinear::Available(), cRingBufferLinear::Del(), delivered, deviceNumber, esyslog, cRingBufferLinear::Get(), ringBuffer, TS_SIZE, and TS_SYNC_BYTE.
Referenced by cDvbDevice::GetTSPacket().
void cTSBuffer::Skip | ( | int | Count | ) |
If after a call to Get() more or less than TS_SIZE of the available data has been processed, a call to Skip() with the number of processed bytes will disable the automatic incrementing of the data pointer as described in Get() and skip the given number of bytes instead.
Count may be 0 if the caller wants the previous TS packet to be delivered again in the next call to Get().
Definition at line 1993 of file device.c.
References delivered.
Referenced by cDvbDevice::GetTSPacket().
|
private |
Definition at line 893 of file device.h.
Referenced by cTSBuffer(), Get(), and Skip().
|
private |
Definition at line 892 of file device.h.
Referenced by Action(), cTSBuffer(), and Get().
|
private |
Definition at line 891 of file device.h.
Referenced by Action(), and cTSBuffer().
|
private |
Definition at line 894 of file device.h.
Referenced by Action(), cTSBuffer(), Get(), and ~cTSBuffer().