vdr  2.0.4
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 cString NewVideoFileName(const char *FileName, const char *NewDirName);
27 void RemoveEmptyVideoDirectories(const char *IgnoreFiles[] = NULL);
28 bool IsOnVideoDirectoryFileSystem(const char *FileName);
29 
31 private:
32  static int state;
33  static time_t lastChecked;
34  static int usedPercent;
35  static int freeMB;
36  static int freeMinutes;
37 public:
38  static bool HasChanged(int &State);
44  static void ForceCheck(void) { lastChecked = 0; }
49  static cString String(void);
55  static int UsedPercent(void) { return usedPercent; }
58  static int FreeMB(void) { return freeMB; }
61  static int FreeMinutes(void) { return freeMinutes; }
66  };
67 
68 #endif //__VIDEODIR_H
static int usedPercent
Definition: videodir.h:34
cString NewVideoFileName(const char *FileName, const char *NewDirName)
Definition: videodir.c:232
bool RemoveVideoFile(const char *FileName)
Definition: videodir.c:171
static cString String(void)
Returns a localized string of the form &quot;Disk nn% - hh:mm free&quot;.
Definition: videodir.c:300
void SetVideoDirectory(const char *Directory)
Definition: videodir.c:24
bool VideoFileSpaceAvailable(int SizeMB)
Definition: videodir.c:176
const char * VideoDirectory
Definition: videodir.c:22
cUnbufferedFile * OpenVideoFile(const char *FileName, int Flags)
Definition: videodir.c:111
void RemoveEmptyVideoDirectories(const char *IgnoreFiles[])
Definition: videodir.c:248
cUnbufferedFile is used for large files that are mainly written or read in a streaming manner...
Definition: tools.h:408
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:277
static int freeMB
Definition: videodir.h:35
int VideoDiskSpace(int *FreeMB, int *UsedMB)
Definition: videodir.c:191
cString PrefixVideoFileName(const char *FileName, char Prefix)
Definition: videodir.c:212
static int state
Definition: videodir.h:32
bool IsOnVideoDirectoryFileSystem(const char *FileName)
Definition: videodir.c:256
int CloseVideoFile(cUnbufferedFile *File)
Definition: videodir.c:152
static int FreeMinutes(void)
Returns the number of minutes that can still be recorded on the video disk.
Definition: videodir.h:61
bool RenameVideoFile(const char *OldName, const char *NewName)
Definition: videodir.c:159
static void ForceCheck(void)
To avoid unnecessary load, the video disk usage is only actually checked every DISKSPACECHEK seconds...
Definition: videodir.h:44
static int freeMinutes
Definition: videodir.h:36
static time_t lastChecked
Definition: videodir.h:33
Definition: tools.h:166
static int FreeMB(void)
Returns the amount of free space on the video disk in MB.
Definition: videodir.h:58
static int UsedPercent(void)
Returns the used space of the video disk in percent.
Definition: videodir.h:55