vdr  2.4.1
videodir.h
Go to the documentation of this file.
1 /*
2  * videodir.h: Functions to maintain the video directory
3  *
4  * See the main source file 'vdr.c' for copyright information and
5  * how to reach the author.
6  *
7  * $Id: videodir.h 4.1 2015/08/10 13:21:29 kls Exp $
8  */
9 
10 #ifndef __VIDEODIR_H
11 #define __VIDEODIR_H
12 
13 #include <stdlib.h>
14 #include "tools.h"
15 
17 private:
18  static cMutex mutex;
19  static cString name;
21  static cVideoDirectory *Current(void);
22 public:
23  cVideoDirectory(void);
24  virtual ~cVideoDirectory();
25  virtual int FreeMB(int *UsedMB = NULL);
29  virtual bool Register(const char *FileName);
40  virtual bool Rename(const char *OldName, const char *NewName);
47  virtual bool Move(const char *FromName, const char *ToName);
53  virtual bool Remove(const char *Name);
58  virtual void Cleanup(const char *IgnoreFiles[] = NULL);
64  virtual bool Contains(const char *Name);
73  static const char *Name(void);
74  static void SetName(const char *Name);
75  static void Destroy(void);
76  static cUnbufferedFile *OpenVideoFile(const char *FileName, int Flags);
77  static bool RenameVideoFile(const char *OldName, const char *NewName);
78  static bool MoveVideoFile(const char *FromName, const char *ToName);
79  static bool RemoveVideoFile(const char *FileName);
80  static bool VideoFileSpaceAvailable(int SizeMB);
81  static int VideoDiskSpace(int *FreeMB = NULL, int *UsedMB = NULL); // returns the used disk space in percent
82  static cString PrefixVideoFileName(const char *FileName, char Prefix);
83  static void RemoveEmptyVideoDirectories(const char *IgnoreFiles[] = NULL);
84  static bool IsOnVideoDirectoryFileSystem(const char *FileName);
85  };
86 
88 private:
89  static int state;
90  static time_t lastChecked;
91  static int usedPercent;
92  static int freeMB;
93  static int freeMinutes;
94 public:
95  static bool HasChanged(int &State);
101  static void ForceCheck(void) { lastChecked = 0; }
106  static cString String(void);
112  static int UsedPercent(void) { return usedPercent; }
115  static int FreeMB(void) { return freeMB; }
118  static int FreeMinutes(void) { return freeMinutes; }
123  };
124 
125 #endif //__VIDEODIR_H
cVideoDirectory::SetName
static void SetName(const char *Name)
Definition: videodir.c:65
cVideoDiskUsage::usedPercent
static int usedPercent
Definition: videodir.h:91
cVideoDirectory::MoveVideoFile
static bool MoveVideoFile(const char *FromName, const char *ToName)
Definition: videodir.c:132
cVideoDirectory::Remove
virtual bool Remove(const char *Name)
Removes the directory with the given Name and everything it contains.
Definition: videodir.c:105
cVideoDirectory::Name
static const char * Name(void)
Definition: videodir.c:60
cVideoDirectory::IsOnVideoDirectoryFileSystem
static bool IsOnVideoDirectoryFileSystem(const char *FileName)
Definition: videodir.c:189
cVideoDiskUsage
Definition: videodir.h:87
cVideoDiskUsage::HasChanged
static bool HasChanged(int &State)
Returns true if the usage of the video disk space has changed since the last call to this function wi...
Definition: videodir.c:205
cVideoDirectory::VideoFileSpaceAvailable
static bool VideoFileSpaceAvailable(int SizeMB)
Definition: videodir.c:142
cVideoDirectory::RenameVideoFile
static bool RenameVideoFile(const char *OldName, const char *NewName)
Definition: videodir.c:127
cVideoDirectory::~cVideoDirectory
virtual ~cVideoDirectory()
Definition: videodir.c:34
cVideoDirectory::FreeMB
virtual int FreeMB(int *UsedMB=NULL)
Returns the total amount (in MB) of free disk space for recording.
Definition: videodir.c:55
cVideoDirectory::Move
virtual bool Move(const char *FromName, const char *ToName)
Moves the directory FromName to the location ToName.
Definition: videodir.c:91
cVideoDirectory::Register
virtual bool Register(const char *FileName)
By default VDR assumes that the video directory consists of one large volume, on which it can store i...
Definition: videodir.c:70
cUnbufferedFile
cUnbufferedFile is used for large files that are mainly written or read in a streaming manner,...
Definition: tools.h:457
cMutex
Definition: thread.h:67
cVideoDiskUsage::freeMB
static int freeMB
Definition: videodir.h:92
cVideoDiskUsage::state
static int state
Definition: videodir.h:89
cVideoDiskUsage::String
static cString String(void)
Returns a localized string of the form "Disk nn% - hh:mm free".
Definition: videodir.c:229
cVideoDirectory::cVideoDirectory
cVideoDirectory(void)
Definition: videodir.c:26
cVideoDirectory
Definition: videodir.h:16
cVideoDirectory::Contains
virtual bool Contains(const char *Name)
Checks whether the directory Name is on the same file system as the video directory.
Definition: videodir.c:115
cVideoDirectory::VideoDiskSpace
static int VideoDiskSpace(int *FreeMB=NULL, int *UsedMB=NULL)
Definition: videodir.c:147
cVideoDirectory::RemoveVideoFile
static bool RemoveVideoFile(const char *FileName)
Definition: videodir.c:137
cVideoDirectory::OpenVideoFile
static cUnbufferedFile * OpenVideoFile(const char *FileName, int Flags)
Definition: videodir.c:120
cVideoDirectory::Rename
virtual bool Rename(const char *OldName, const char *NewName)
Renames the directory OldName to NewName.
Definition: videodir.c:81
cVideoDirectory::name
static cString name
Definition: videodir.h:19
cVideoDirectory::Cleanup
virtual void Cleanup(const char *IgnoreFiles[]=NULL)
Recursively removes all empty directories under the video directory.
Definition: videodir.c:110
cVideoDirectory::RemoveEmptyVideoDirectories
static void RemoveEmptyVideoDirectories(const char *IgnoreFiles[]=NULL)
Definition: videodir.c:184
cString
Definition: tools.h:176
cVideoDirectory::current
static cVideoDirectory * current
Definition: videodir.h:20
cVideoDiskUsage::lastChecked
static time_t lastChecked
Definition: videodir.h:90
cVideoDirectory::Current
static cVideoDirectory * Current(void)
Definition: videodir.c:41
cVideoDirectory::PrefixVideoFileName
static cString PrefixVideoFileName(const char *FileName, char Prefix)
Definition: videodir.c:164
cVideoDirectory::Destroy
static void Destroy(void)
Definition: videodir.c:50
tools.h
cVideoDirectory::mutex
static cMutex mutex
Definition: videodir.h:18
cVideoDiskUsage::freeMinutes
static int freeMinutes
Definition: videodir.h:93