mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
The code for distributing recordings over several video directories is now deprecated and disabled by default
This commit is contained in:
parent
f0537ea0f1
commit
a0f63d40c6
14
HISTORY
14
HISTORY
@ -7885,3 +7885,17 @@ Video Disk Recorder Revision History
|
||||
- Reverted the change from version 1.5.7 that made all logging go to LOG_ERR (thanks
|
||||
to Christopher Reimer).
|
||||
- Added Begin/EndSegmentTransfer() to the EPG handler interface (thanks to Jörg Wendel).
|
||||
- The code for distributing recordings over several video directories is now
|
||||
deprecated and disabled by default.
|
||||
You can re-enable this feature by removing the comment sign ('//') from the beginning
|
||||
of the line
|
||||
//#define DEPRECATED_DISTRIBUTED_VIDEODIR // Code enclosed with this macro is ...
|
||||
in the file videodir.c. Note, though, that this can only be a temporary workaround.
|
||||
This feature will be completely removed in one of the next developer versions.
|
||||
Distributing the video directory over several disks was a useful feature in times
|
||||
when disks were still relatively small, but it also caused serious problems in case
|
||||
one of the disks failed. Nowadays hard disks come in sizes measured in terabytes,
|
||||
and tools like "mhddfs" can be used to combine several disks to form one large volume.
|
||||
A recommended method for a relatively safe disk setup in a VDR system is to use two
|
||||
1TB (or larger) disks and use them as a RAID-1 (mirrored). That way, if one disk
|
||||
fails, you can replace it without data loss.
|
||||
|
35
INSTALL
35
INSTALL
@ -325,38 +325,9 @@ Note that the file system need not be 64-bit proof, since the 'vdr'
|
||||
program splits video files into chunks of about 2GB. You should use
|
||||
a disk with several gigabytes of free space. One GB can store roughly
|
||||
half an hour of SD video data, or 10 minutes of HD video.
|
||||
|
||||
If you have more than one disk and don't want to combine them to form
|
||||
one large logical volume, you can set up several video directories as
|
||||
mount points for these disks. All of these directories must have the
|
||||
same basic name and must end with a numeric part, which starts at 0 for
|
||||
the main directory and has increasing values for the rest of the
|
||||
directories. For example
|
||||
|
||||
/srv/vdr/video0
|
||||
/srv/vdr/video1
|
||||
/srv/vdr/video2
|
||||
|
||||
would be a setup with three directories. You can use more than one
|
||||
numeric digit:
|
||||
|
||||
/mnt/MyVideos/vdr.00
|
||||
/mnt/MyVideos/vdr.01
|
||||
/mnt/MyVideos/vdr.02
|
||||
...
|
||||
/mnt/MyVideos/vdr.11
|
||||
|
||||
would set up twelve disks (wow, what a machine that would be!).
|
||||
|
||||
To use such a multi directory setup, you need to add the '-v' option
|
||||
with the name of the basic directory when running 'vdr':
|
||||
|
||||
vdr -v /srv/vdr/video0
|
||||
|
||||
WARNING: Using multiple disks to form one large video directory this way
|
||||
is deprecated and will be removed from VDR in a future version! Either
|
||||
use one of today's large terabyte disks (preferably with a backup disk
|
||||
in a RAID-1 array), or use something like "mhddfs".
|
||||
Either use one of today's large terabyte disks (preferably with a backup disk
|
||||
in a RAID-1 array), or use something like "mhddfs" to group several disks
|
||||
into one large volume.
|
||||
|
||||
Note that you should not copy any non-VDR files into the video directory,
|
||||
since this might cause a lot of unnecessary disk access when VDR cleans up those
|
||||
|
42
videodir.c
42
videodir.c
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: videodir.c 2.4 2012/09/30 12:06:33 kls Exp $
|
||||
* $Id: videodir.c 3.1 2013/08/23 12:28:06 kls Exp $
|
||||
*/
|
||||
|
||||
#include "videodir.h"
|
||||
@ -19,6 +19,8 @@
|
||||
#include "recording.h"
|
||||
#include "tools.h"
|
||||
|
||||
//#define DEPRECATED_DISTRIBUTED_VIDEODIR // Code enclosed with this macro is deprecated and will be removed in a future version
|
||||
|
||||
const char *VideoDirectory = VIDEODIR;
|
||||
|
||||
void SetVideoDirectory(const char *Directory)
|
||||
@ -27,43 +29,60 @@ void SetVideoDirectory(const char *Directory)
|
||||
}
|
||||
|
||||
class cVideoDirectory {
|
||||
#ifdef DEPRECATED_DISTRIBUTED_VIDEODIR
|
||||
private:
|
||||
char *name, *stored, *adjusted;
|
||||
int length, number, digits;
|
||||
#endif
|
||||
public:
|
||||
cVideoDirectory(void);
|
||||
~cVideoDirectory();
|
||||
int FreeMB(int *UsedMB = NULL);
|
||||
const char *Name(void) { return name ? name : VideoDirectory; }
|
||||
const char *Name(void) { return
|
||||
#ifdef DEPRECATED_DISTRIBUTED_VIDEODIR
|
||||
name ? name :
|
||||
#endif
|
||||
VideoDirectory; }
|
||||
#ifdef DEPRECATED_DISTRIBUTED_VIDEODIR
|
||||
const char *Stored(void) { return stored; }
|
||||
int Length(void) { return length; }
|
||||
bool IsDistributed(void) { return name != NULL; }
|
||||
bool Next(void);
|
||||
void Store(void);
|
||||
const char *Adjust(const char *FileName);
|
||||
#endif
|
||||
};
|
||||
|
||||
cVideoDirectory::cVideoDirectory(void)
|
||||
{
|
||||
#ifdef DEPRECATED_DISTRIBUTED_VIDEODIR
|
||||
length = strlen(VideoDirectory);
|
||||
name = (VideoDirectory[length - 1] == '0') ? strdup(VideoDirectory) : NULL;
|
||||
stored = adjusted = NULL;
|
||||
number = -1;
|
||||
digits = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
cVideoDirectory::~cVideoDirectory()
|
||||
{
|
||||
#ifdef DEPRECATED_DISTRIBUTED_VIDEODIR
|
||||
free(name);
|
||||
free(stored);
|
||||
free(adjusted);
|
||||
#endif
|
||||
}
|
||||
|
||||
int cVideoDirectory::FreeMB(int *UsedMB)
|
||||
{
|
||||
return FreeDiskSpaceMB(name ? name : VideoDirectory, UsedMB);
|
||||
return FreeDiskSpaceMB(
|
||||
#ifdef DEPRECATED_DISTRIBUTED_VIDEODIR
|
||||
name ? name :
|
||||
#endif
|
||||
VideoDirectory, UsedMB);
|
||||
}
|
||||
|
||||
#ifdef DEPRECATED_DISTRIBUTED_VIDEODIR
|
||||
bool cVideoDirectory::Next(void)
|
||||
{
|
||||
if (name) {
|
||||
@ -107,6 +126,7 @@ const char *cVideoDirectory::Adjust(const char *FileName)
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
cUnbufferedFile *OpenVideoFile(const char *FileName, int Flags)
|
||||
{
|
||||
@ -118,6 +138,7 @@ cUnbufferedFile *OpenVideoFile(const char *FileName, int Flags)
|
||||
errno = ENOENT; // must set 'errno' - any ideas for a better value?
|
||||
return NULL;
|
||||
}
|
||||
#ifdef DEPRECATED_DISTRIBUTED_VIDEODIR
|
||||
// Are we going to create a new file?
|
||||
if ((Flags & O_CREAT) != 0) {
|
||||
cVideoDirectory Dir;
|
||||
@ -143,6 +164,7 @@ cUnbufferedFile *OpenVideoFile(const char *FileName, int Flags)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
cUnbufferedFile *File = cUnbufferedFile::Create(ActualFileName, Flags, DEFFILEMODE);
|
||||
if (ActualFileName != FileName)
|
||||
free((char *)ActualFileName);
|
||||
@ -176,6 +198,7 @@ bool RemoveVideoFile(const char *FileName)
|
||||
bool VideoFileSpaceAvailable(int SizeMB)
|
||||
{
|
||||
cVideoDirectory Dir;
|
||||
#ifdef DEPRECATED_DISTRIBUTED_VIDEODIR
|
||||
if (Dir.IsDistributed()) {
|
||||
if (Dir.FreeMB() >= SizeMB * 2) // base directory needs additional space
|
||||
return true;
|
||||
@ -185,6 +208,7 @@ bool VideoFileSpaceAvailable(int SizeMB)
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
return Dir.FreeMB() >= SizeMB;
|
||||
}
|
||||
|
||||
@ -193,11 +217,15 @@ int VideoDiskSpace(int *FreeMB, int *UsedMB)
|
||||
int free = 0, used = 0;
|
||||
int deleted = DeletedRecordings.TotalFileSizeMB();
|
||||
cVideoDirectory Dir;
|
||||
#ifdef DEPRECATED_DISTRIBUTED_VIDEODIR
|
||||
do {
|
||||
#endif
|
||||
int u;
|
||||
free += Dir.FreeMB(&u);
|
||||
used += u;
|
||||
#ifdef DEPRECATED_DISTRIBUTED_VIDEODIR
|
||||
} while (Dir.Next());
|
||||
#endif
|
||||
if (deleted > used)
|
||||
deleted = used; // let's not get beyond 100%
|
||||
free += deleted;
|
||||
@ -232,18 +260,26 @@ cString PrefixVideoFileName(const char *FileName, char Prefix)
|
||||
void RemoveEmptyVideoDirectories(const char *IgnoreFiles[])
|
||||
{
|
||||
cVideoDirectory Dir;
|
||||
#ifdef DEPRECATED_DISTRIBUTED_VIDEODIR
|
||||
do {
|
||||
#endif
|
||||
RemoveEmptyDirectories(Dir.Name(), false, IgnoreFiles);
|
||||
#ifdef DEPRECATED_DISTRIBUTED_VIDEODIR
|
||||
} while (Dir.Next());
|
||||
#endif
|
||||
}
|
||||
|
||||
bool IsOnVideoDirectoryFileSystem(const char *FileName)
|
||||
{
|
||||
cVideoDirectory Dir;
|
||||
#ifdef DEPRECATED_DISTRIBUTED_VIDEODIR
|
||||
do {
|
||||
#endif
|
||||
if (EntriesOnSameFileSystem(Dir.Name(), FileName))
|
||||
return true;
|
||||
#ifdef DEPRECATED_DISTRIBUTED_VIDEODIR
|
||||
} while (Dir.Next());
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user