vdr  2.2.0
Public Member Functions | Static Public Member Functions | Static Private Member Functions | Static Private Attributes | List of all members
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 cString name
 
static cVideoDirectorycurrent = NULL
 

Detailed Description

Definition at line 16 of file videodir.h.

Constructor & Destructor Documentation

cVideoDirectory::cVideoDirectory ( void  )

Definition at line 25 of file videodir.c.

References current.

Referenced by Current().

cVideoDirectory::~cVideoDirectory ( )
virtual

Definition at line 31 of file videodir.c.

References current.

Member Function Documentation

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 103 of file videodir.c.

References Name(), and RemoveEmptyDirectories().

Referenced by RemoveEmptyVideoDirectories().

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 108 of file videodir.c.

References EntriesOnSameFileSystem(), and Name().

Referenced by IsOnVideoDirectoryFileSystem().

cVideoDirectory * cVideoDirectory::Current ( void  )
staticprivate
void cVideoDirectory::Destroy ( void  )
static

Definition at line 43 of file videodir.c.

References current.

Referenced by main().

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 48 of file videodir.c.

References FreeDiskSpaceMB(), and Name().

Referenced by cVideoDiskUsage::HasChanged(), VideoDiskSpace(), and VideoFileSpaceAvailable().

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

Definition at line 181 of file videodir.c.

References Contains(), and Current().

Referenced by cRecording::IsOnVideoDirectoryFileSystem().

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 84 of file videodir.c.

References cRecordingsHandler::Add(), dsyslog, EntriesOnSameFileSystem(), LOG_ERROR_STR, RecordingsHandler, and ruMove.

Referenced by MoveVideoFile().

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

Definition at line 125 of file videodir.c.

References Current(), and Move().

Referenced by cRecording::ChangeName().

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

Definition at line 113 of file videodir.c.

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

Referenced by cFileName::Open().

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

Definition at line 156 of file videodir.c.

Referenced by cRecording::PrefixFileName().

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 63 of file videodir.c.

References esyslog, and Name().

Referenced by OpenVideoFile().

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 98 of file videodir.c.

References RemoveFileOrDir().

Referenced by RemoveVideoFile().

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

Definition at line 176 of file videodir.c.

References Cleanup(), and Current().

Referenced by cRemoveDeletedRecordingsThread::Action().

bool cVideoDirectory::RemoveVideoFile ( const char *  FileName)
static
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 74 of file videodir.c.

References dsyslog, and LOG_ERROR_STR.

Referenced by RenameVideoFile().

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

Definition at line 120 of file videodir.c.

References Current(), and Rename().

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

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

Definition at line 58 of file videodir.c.

References name, and Name().

Referenced by main().

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

Definition at line 135 of file videodir.c.

References Current(), and FreeMB().

Referenced by AssertFreeDiskSpace().

Member Data Documentation

cVideoDirectory * cVideoDirectory::current = NULL
staticprivate

Definition at line 19 of file videodir.h.

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

cString cVideoDirectory::name
staticprivate

Definition at line 18 of file videodir.h.

Referenced by Name(), and SetName().


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