vdr  2.0.6
videodir.h
Go to the documentation of this file.
1 /*
2  * videodir.h: Functions to maintain a distributed 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 2.3 2012/09/30 11:01:15 kls Exp $
8  */
9 
10 #ifndef __VIDEODIR_H
11 #define __VIDEODIR_H
12 
13 #include <stdlib.h>
14 #include "tools.h"
15 
16 extern const char *VideoDirectory;
17 
18 void SetVideoDirectory(const char *Directory);
19 cUnbufferedFile *OpenVideoFile(const char *FileName, int Flags);
21 bool RenameVideoFile(const char *OldName, const char *NewName);
22 bool RemoveVideoFile(const char *FileName);
23 bool VideoFileSpaceAvailable(int SizeMB);
24 int VideoDiskSpace(int *FreeMB = NULL, int *UsedMB = NULL); // returns the used disk space in percent
25 cString PrefixVideoFileName(const char *FileName, char Prefix);
26 void RemoveEmptyVideoDirectories(const char *IgnoreFiles[] = NULL);
27 bool IsOnVideoDirectoryFileSystem(const char *FileName);
28 
30 private:
31  static int state;
32  static time_t lastChecked;
33  static int usedPercent;
34  static int freeMB;
35  static int freeMinutes;
36 public:
37  static bool HasChanged(int &State);
43  static void ForceCheck(void) { lastChecked = 0; }
48  static cString String(void);
54  static int UsedPercent(void) { return usedPercent; }
57  static int FreeMB(void) { return freeMB; }
60  static int FreeMinutes(void) { return freeMinutes; }
65  };
66 
67 #endif //__VIDEODIR_H
static int usedPercent
Definition: videodir.h:33
bool RemoveVideoFile(const char *FileName)
Definition: videodir.c:171
int VideoDiskSpace(int *FreeMB=NULL, int *UsedMB=NULL)
Definition: videodir.c:191
static cString String(void)
Returns a localized string of the form "Disk nn% - hh:mm free".
Definition: videodir.c:284
bool VideoFileSpaceAvailable(int SizeMB)
Definition: videodir.c:176
cUnbufferedFile is used for large files that are mainly written or read in a streaming manner...
Definition: tools.h:408
cUnbufferedFile * OpenVideoFile(const char *FileName, int Flags)
Definition: videodir.c:111
const char * VideoDirectory
Definition: videodir.c:22
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:261
bool IsOnVideoDirectoryFileSystem(const char *FileName)
Definition: videodir.c:240
cString PrefixVideoFileName(const char *FileName, char Prefix)
Definition: videodir.c:212
void SetVideoDirectory(const char *Directory)
Definition: videodir.c:24
int CloseVideoFile(cUnbufferedFile *File)
Definition: videodir.c:152
static int freeMB
Definition: videodir.h:34
bool RenameVideoFile(const char *OldName, const char *NewName)
Definition: videodir.c:159
static int state
Definition: videodir.h:31
void RemoveEmptyVideoDirectories(const char *IgnoreFiles[]=NULL)
Definition: videodir.c:232
static int FreeMinutes(void)
Returns the number of minutes that can still be recorded on the video disk.
Definition: videodir.h:60
static void ForceCheck(void)
To avoid unnecessary load, the video disk usage is only actually checked every DISKSPACECHEK seconds...
Definition: videodir.h:43
static int freeMinutes
Definition: videodir.h:35
static time_t lastChecked
Definition: videodir.h:32
Definition: tools.h:166
static int FreeMB(void)
Returns the amount of free space on the video disk in MB.
Definition: videodir.h:57
static int UsedPercent(void)
Returns the used space of the video disk in percent.
Definition: videodir.h:54