vdr 2.7.6
cRecordingsHandler Class Reference

#include <recording.h>

Public Member Functions

 cRecordingsHandler (void)
 
virtual ~cRecordingsHandler () override
 
bool Add (int Usage, const char *FileNameSrc, const char *FileNameDst=NULL)
 
void Del (const char *FileName)
 
void DelAll (void)
 
int GetUsage (const char *FileName)
 
int GetRequiredDiskSpaceMB (const char *FileName=NULL)
 
bool Finished (bool &Error)
 
- Public Member Functions inherited from cThread
 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)
 

Protected Member Functions

virtual void Action (void) override
 
- Protected Member Functions inherited from cThread
void SetPriority (int Priority)
 
void SetIOPriority (int Priority)
 
void Lock (void)
 
void Unlock (void)
 
bool Running (void)
 
void Cancel (int WaitSeconds=0)
 

Private Member Functions

cRecordingsHandlerEntryGet (const char *FileName)
 

Private Attributes

cMutex mutex
 
cList< cRecordingsHandlerEntryoperations
 
bool finished
 
bool error
 

Additional Inherited Members

- Static Public Member Functions inherited from cThread
static tThreadId ThreadId (void)
 
static tThreadId IsMainThread (void)
 
static void SetMainThreadId (void)
 

Detailed Description

Definition at line 336 of file recording.h.

Constructor & Destructor Documentation

◆ cRecordingsHandler()

cRecordingsHandler::cRecordingsHandler ( void )

Definition at line 2125 of file recording.c.

References cThread::cThread(), error, and finished.

◆ ~cRecordingsHandler()

cRecordingsHandler::~cRecordingsHandler ( )
overridevirtual

Definition at line 2132 of file recording.c.

References cThread::Cancel().

Member Function Documentation

◆ Action()

void cRecordingsHandler::Action ( void )
overrideprotectedvirtual

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 2137 of file recording.c.

References error, LOCK_RECORDINGS_WRITE, mutex, operations, cThread::Running(), and cCondWait::SleepMs().

◆ Add()

bool cRecordingsHandler::Add ( int Usage,
const char * FileNameSrc,
const char * FileNameDst = NULL )

Adds the given FileNameSrc to the recordings handler for (later) processing.

Usage can be either ruCut, ruMove or ruCopy. FileNameDst is only applicable for ruMove and ruCopy. At any given time there can be only one operation for any FileNameSrc or FileNameDst in the list. An attempt to add a file name twice will result in an error. Returns true if the operation was successfully added to the list.

Definition at line 2175 of file recording.c.

References dsyslog, cCutter::EditedFileName(), esyslog, finished, Get(), mutex, operations, ruCopy, ruCut, ruMove, ruPending, and cThread::Start().

◆ Del()

void cRecordingsHandler::Del ( const char * FileName)

Deletes the given FileName from the list of operations.

If an action is already in progress, it will be terminated. FileName can be either the FileNameSrc or FileNameDst (if applicable) that was given when the operation was added with Add().

Definition at line 2206 of file recording.c.

References Get(), and mutex.

◆ DelAll()

void cRecordingsHandler::DelAll ( void )

Deletes/terminates all operations.

Definition at line 2213 of file recording.c.

References mutex, and operations.

◆ Finished()

bool cRecordingsHandler::Finished ( bool & Error)

Returns true if all operations in the list have been finished.

If there have been any errors, Errors will be set to true. This function will only return true once if the list of operations has actually become empty since the last call.

Definition at line 2246 of file recording.c.

References error, finished, mutex, and operations.

◆ Get()

cRecordingsHandlerEntry * cRecordingsHandler::Get ( const char * FileName)
private

Definition at line 2162 of file recording.c.

References operations, and ruCanceled.

Referenced by Add(), Del(), and GetUsage().

◆ GetRequiredDiskSpaceMB()

int cRecordingsHandler::GetRequiredDiskSpaceMB ( const char * FileName = NULL)

Returns the total disk space required to process all actions.

If FileName is given, only the drive that contains that file is taken into account.

Definition at line 2228 of file recording.c.

References DirSizeMB(), EntriesOnSameFileSystem(), FileSizeMBafterEdit(), operations, ruCanceled, ruCopy, ruCut, and ruMove.

◆ GetUsage()

int cRecordingsHandler::GetUsage ( const char * FileName)

Returns the usage type for the given FileName.

Definition at line 2220 of file recording.c.

References Get(), mutex, and ruNone.

Member Data Documentation

◆ error

bool cRecordingsHandler::error
private

Definition at line 341 of file recording.h.

Referenced by Action(), cRecordingsHandler(), and Finished().

◆ finished

bool cRecordingsHandler::finished
private

Definition at line 340 of file recording.h.

Referenced by Add(), cRecordingsHandler(), and Finished().

◆ mutex

cMutex cRecordingsHandler::mutex
private

Definition at line 338 of file recording.h.

Referenced by Action(), Add(), Del(), DelAll(), Finished(), and GetUsage().

◆ operations

cList<cRecordingsHandlerEntry> cRecordingsHandler::operations
private

Definition at line 339 of file recording.h.

Referenced by Action(), Add(), DelAll(), Finished(), Get(), and GetRequiredDiskSpaceMB().


The documentation for this class was generated from the following files: