vdr 2.7.3
cVideoDirectory Class Reference

#include <videodir.h>

Public Member Functions

 cVideoDirectory (void)
 
virtual ~cVideoDirectory ()
 
virtual int FreeMB (int *UsedMB=NULL)
 
virtual bool Register (const char *FileName)
 
virtual bool Rename (const char *OldName, const char *NewName)
 
virtual bool Move (const char *FromName, const char *ToName)
 
virtual bool Remove (const char *Name)
 
virtual void Cleanup (const char *IgnoreFiles[]=NULL)
 
virtual bool Contains (const char *Name)
 

Static Public Member Functions

static const char * Name (void)
 
static void SetName (const char *Name)
 
static void Destroy (void)
 
static cUnbufferedFileOpenVideoFile (const char *FileName, int Flags)
 
static bool RenameVideoFile (const char *OldName, const char *NewName)
 
static bool MoveVideoFile (const char *FromName, const char *ToName)
 
static bool RemoveVideoFile (const char *FileName)
 
static bool VideoFileSpaceAvailable (int SizeMB)
 
static int VideoDiskSpace (int *FreeMB=NULL, int *UsedMB=NULL)
 
static cString PrefixVideoFileName (const char *FileName, char Prefix)
 
static void RemoveEmptyVideoDirectories (const char *IgnoreFiles[]=NULL)
 
static bool IsOnVideoDirectoryFileSystem (const char *FileName)
 

Static Private Member Functions

static cVideoDirectoryCurrent (void)
 

Static Private Attributes

static cMutex mutex
 
static cString name
 
static cVideoDirectorycurrent = NULL
 

Detailed Description

Definition at line 16 of file videodir.h.

Constructor & Destructor Documentation

◆ cVideoDirectory()

cVideoDirectory::cVideoDirectory ( void )

Definition at line 26 of file videodir.c.

References current, cMutex::Lock(), mutex, and cMutex::Unlock().

Referenced by Current().

◆ ~cVideoDirectory()

cVideoDirectory::~cVideoDirectory ( )
virtual

Definition at line 34 of file videodir.c.

References current, cMutex::Lock(), mutex, and cMutex::Unlock().

Member Function Documentation

◆ Cleanup()

void cVideoDirectory::Cleanup ( const char * IgnoreFiles[] = NULL)
virtual

Recursively removes all empty directories under the video directory.

If IgnoreFiles is given, the file names in this (NULL terminated) array are ignored when checking whether a directory is empty. These are typically "dot files", like e.g. ".sort". The default implementation calls RemoveEmptyDirectories().

Definition at line 115 of file videodir.c.

References Name(), and RemoveEmptyDirectories().

Referenced by RemoveEmptyVideoDirectories().

◆ Contains()

bool cVideoDirectory::Contains ( const char * Name)
virtual

Checks whether the directory Name is on the same file system as the video directory.

Name is the full path name of a recording's '*.rec' directory. This function is usually called when an ongoing recording is about to run out of disk space, and an existing (old) recording needs to be deleted. It shall make sure that deleting this old recording will actually free up space in the video directory, and not on some other device that just happens to be mounted. The default implementation calls EntriesOnSameFileSystem().

Definition at line 120 of file videodir.c.

References EntriesOnSameFileSystem(), and Name().

Referenced by IsOnVideoDirectoryFileSystem().

◆ Current()

◆ Destroy()

void cVideoDirectory::Destroy ( void )
static

Definition at line 50 of file videodir.c.

References current.

Referenced by main().

◆ FreeMB()

int cVideoDirectory::FreeMB ( int * UsedMB = NULL)
virtual

Returns the total amount (in MB) of free disk space for recording.

If UsedMB is given, it returns the amount of disk space in use by existing recordings (or anything else) on that disk.

Definition at line 55 of file videodir.c.

References FreeDiskSpaceMB(), and Name().

Referenced by VideoDiskSpace(), and VideoFileSpaceAvailable().

◆ IsOnVideoDirectoryFileSystem()

bool cVideoDirectory::IsOnVideoDirectoryFileSystem ( const char * FileName)
static

Definition at line 194 of file videodir.c.

References Contains(), and Current().

Referenced by cRecording::IsOnVideoDirectoryFileSystem().

◆ Move()

bool cVideoDirectory::Move ( const char * FromName,
const char * ToName )
virtual

Moves the directory FromName to the location ToName.

FromName is the full path name of a recording's '.rec' directory. ToName has the same '.rec' part as FromName, but a different directory path above it. Returns true if the operation was successful. The default implementation just calls the system's rename() function.

Definition at line 91 of file videodir.c.

References cRecordingsHandler::Add(), dsyslog, EntriesOnSameFileSystem(), cRecordingUserCommand::InvokeCommand(), LOG_ERROR_STR, RecordingsHandler, RUC_MOVEDRECORDING, RUC_RENAMEDRECORDING, ruMove, and strgetbefore().

Referenced by MoveVideoFile().

◆ MoveVideoFile()

bool cVideoDirectory::MoveVideoFile ( const char * FromName,
const char * ToName )
static

Definition at line 137 of file videodir.c.

References Current(), and Move().

Referenced by cRecording::ChangeName().

◆ Name()

◆ OpenVideoFile()

cUnbufferedFile * cVideoDirectory::OpenVideoFile ( const char * FileName,
int Flags )
static

Definition at line 125 of file videodir.c.

References cUnbufferedFile::Create(), Current(), and Register().

Referenced by cFileName::Open().

◆ PrefixVideoFileName()

cString cVideoDirectory::PrefixVideoFileName ( const char * FileName,
char Prefix )
static

Definition at line 169 of file videodir.c.

Referenced by cRecording::PrefixFileName().

◆ Register()

bool cVideoDirectory::Register ( const char * FileName)
virtual

By default VDR assumes that the video directory consists of one large volume, on which it can store its recordings.

A derived cVideoDirectory may, for instance, use several separate disks to store recordings. The given FileName is the full path name (including the video directory) of a recording file ('*.ts') that is about to be opened for writing. If the actual file shall be put on an other disk, the derived cVideoDirectory should create a symbolic link from the given FileName to the other location. Returns true if the operation was successful. The default implementation just checks whether the incoming file name really is under the video directory.

Definition at line 70 of file videodir.c.

References esyslog, and Name().

Referenced by OpenVideoFile().

◆ Remove()

bool cVideoDirectory::Remove ( const char * Name)
virtual

Removes the directory with the given Name and everything it contains.

Name is a full path name that begins with the name of the video directory. Returns true if the operation was successful. The default implementation calls RemoveFileOrDir().

Definition at line 110 of file videodir.c.

References Name(), and RemoveFileOrDir().

Referenced by RemoveVideoFile().

◆ RemoveEmptyVideoDirectories()

void cVideoDirectory::RemoveEmptyVideoDirectories ( const char * IgnoreFiles[] = NULL)
static

Definition at line 189 of file videodir.c.

References Cleanup(), and Current().

Referenced by cRemoveDeletedRecordingsThread::Action().

◆ RemoveVideoFile()

bool cVideoDirectory::RemoveVideoFile ( const char * FileName)
static

Definition at line 142 of file videodir.c.

References Current(), and Remove().

Referenced by cRecording::Delete(), cRecording::Remove(), and cCutter::Start().

◆ Rename()

bool cVideoDirectory::Rename ( const char * OldName,
const char * NewName )
virtual

Renames the directory OldName to NewName.

OldName and NewName are full path names that begin with the name of the video directory and end with '.rec' or '.del'. Only the base name (the rightmost component) of the two names may be different. Returns true if the operation was successful. The default implementation just calls the system's rename() function.

Definition at line 81 of file videodir.c.

References dsyslog, and LOG_ERROR_STR.

Referenced by RenameVideoFile().

◆ RenameVideoFile()

bool cVideoDirectory::RenameVideoFile ( const char * OldName,
const char * NewName )
static

Definition at line 132 of file videodir.c.

References Current(), and Rename().

Referenced by cRecording::ChangePriorityLifetime(), cRecording::Delete(), and cRecording::Undelete().

◆ SetName()

void cVideoDirectory::SetName ( const char * Name)
static

Definition at line 65 of file videodir.c.

References Name(), and name.

Referenced by main().

◆ VideoDiskSpace()

int cVideoDirectory::VideoDiskSpace ( int * FreeMB = NULL,
int * UsedMB = NULL )
static

◆ VideoFileSpaceAvailable()

bool cVideoDirectory::VideoFileSpaceAvailable ( int SizeMB)
static

Definition at line 147 of file videodir.c.

References Current(), and FreeMB().

Referenced by AssertFreeDiskSpace().

Member Data Documentation

◆ current

cVideoDirectory * cVideoDirectory::current = NULL
staticprivate

Definition at line 20 of file videodir.h.

Referenced by Current(), cVideoDirectory(), Destroy(), and ~cVideoDirectory().

◆ mutex

cMutex cVideoDirectory::mutex
staticprivate

Definition at line 18 of file videodir.h.

Referenced by Current(), cVideoDirectory(), and ~cVideoDirectory().

◆ name

cString cVideoDirectory::name
staticprivate

Definition at line 19 of file videodir.h.

Referenced by Name(), and SetName().


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