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
|
- Reverted the change from version 1.5.7 that made all logging go to LOG_ERR (thanks
|
||||||
to Christopher Reimer).
|
to Christopher Reimer).
|
||||||
- Added Begin/EndSegmentTransfer() to the EPG handler interface (thanks to Jörg Wendel).
|
- 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
|
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
|
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.
|
half an hour of SD video data, or 10 minutes of HD video.
|
||||||
|
Either use one of today's large terabyte disks (preferably with a backup disk
|
||||||
If you have more than one disk and don't want to combine them to form
|
in a RAID-1 array), or use something like "mhddfs" to group several disks
|
||||||
one large logical volume, you can set up several video directories as
|
into one large volume.
|
||||||
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".
|
|
||||||
|
|
||||||
Note that you should not copy any non-VDR files into the video directory,
|
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
|
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
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* 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"
|
#include "videodir.h"
|
||||||
@ -19,6 +19,8 @@
|
|||||||
#include "recording.h"
|
#include "recording.h"
|
||||||
#include "tools.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;
|
const char *VideoDirectory = VIDEODIR;
|
||||||
|
|
||||||
void SetVideoDirectory(const char *Directory)
|
void SetVideoDirectory(const char *Directory)
|
||||||
@ -27,43 +29,60 @@ void SetVideoDirectory(const char *Directory)
|
|||||||
}
|
}
|
||||||
|
|
||||||
class cVideoDirectory {
|
class cVideoDirectory {
|
||||||
|
#ifdef DEPRECATED_DISTRIBUTED_VIDEODIR
|
||||||
private:
|
private:
|
||||||
char *name, *stored, *adjusted;
|
char *name, *stored, *adjusted;
|
||||||
int length, number, digits;
|
int length, number, digits;
|
||||||
|
#endif
|
||||||
public:
|
public:
|
||||||
cVideoDirectory(void);
|
cVideoDirectory(void);
|
||||||
~cVideoDirectory();
|
~cVideoDirectory();
|
||||||
int FreeMB(int *UsedMB = NULL);
|
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; }
|
const char *Stored(void) { return stored; }
|
||||||
int Length(void) { return length; }
|
int Length(void) { return length; }
|
||||||
bool IsDistributed(void) { return name != NULL; }
|
bool IsDistributed(void) { return name != NULL; }
|
||||||
bool Next(void);
|
bool Next(void);
|
||||||
void Store(void);
|
void Store(void);
|
||||||
const char *Adjust(const char *FileName);
|
const char *Adjust(const char *FileName);
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
cVideoDirectory::cVideoDirectory(void)
|
cVideoDirectory::cVideoDirectory(void)
|
||||||
{
|
{
|
||||||
|
#ifdef DEPRECATED_DISTRIBUTED_VIDEODIR
|
||||||
length = strlen(VideoDirectory);
|
length = strlen(VideoDirectory);
|
||||||
name = (VideoDirectory[length - 1] == '0') ? strdup(VideoDirectory) : NULL;
|
name = (VideoDirectory[length - 1] == '0') ? strdup(VideoDirectory) : NULL;
|
||||||
stored = adjusted = NULL;
|
stored = adjusted = NULL;
|
||||||
number = -1;
|
number = -1;
|
||||||
digits = 0;
|
digits = 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
cVideoDirectory::~cVideoDirectory()
|
cVideoDirectory::~cVideoDirectory()
|
||||||
{
|
{
|
||||||
|
#ifdef DEPRECATED_DISTRIBUTED_VIDEODIR
|
||||||
free(name);
|
free(name);
|
||||||
free(stored);
|
free(stored);
|
||||||
free(adjusted);
|
free(adjusted);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int cVideoDirectory::FreeMB(int *UsedMB)
|
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)
|
bool cVideoDirectory::Next(void)
|
||||||
{
|
{
|
||||||
if (name) {
|
if (name) {
|
||||||
@ -107,6 +126,7 @@ const char *cVideoDirectory::Adjust(const char *FileName)
|
|||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
cUnbufferedFile *OpenVideoFile(const char *FileName, int Flags)
|
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?
|
errno = ENOENT; // must set 'errno' - any ideas for a better value?
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
#ifdef DEPRECATED_DISTRIBUTED_VIDEODIR
|
||||||
// Are we going to create a new file?
|
// Are we going to create a new file?
|
||||||
if ((Flags & O_CREAT) != 0) {
|
if ((Flags & O_CREAT) != 0) {
|
||||||
cVideoDirectory Dir;
|
cVideoDirectory Dir;
|
||||||
@ -143,6 +164,7 @@ cUnbufferedFile *OpenVideoFile(const char *FileName, int Flags)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
cUnbufferedFile *File = cUnbufferedFile::Create(ActualFileName, Flags, DEFFILEMODE);
|
cUnbufferedFile *File = cUnbufferedFile::Create(ActualFileName, Flags, DEFFILEMODE);
|
||||||
if (ActualFileName != FileName)
|
if (ActualFileName != FileName)
|
||||||
free((char *)ActualFileName);
|
free((char *)ActualFileName);
|
||||||
@ -176,6 +198,7 @@ bool RemoveVideoFile(const char *FileName)
|
|||||||
bool VideoFileSpaceAvailable(int SizeMB)
|
bool VideoFileSpaceAvailable(int SizeMB)
|
||||||
{
|
{
|
||||||
cVideoDirectory Dir;
|
cVideoDirectory Dir;
|
||||||
|
#ifdef DEPRECATED_DISTRIBUTED_VIDEODIR
|
||||||
if (Dir.IsDistributed()) {
|
if (Dir.IsDistributed()) {
|
||||||
if (Dir.FreeMB() >= SizeMB * 2) // base directory needs additional space
|
if (Dir.FreeMB() >= SizeMB * 2) // base directory needs additional space
|
||||||
return true;
|
return true;
|
||||||
@ -185,6 +208,7 @@ bool VideoFileSpaceAvailable(int SizeMB)
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return Dir.FreeMB() >= SizeMB;
|
return Dir.FreeMB() >= SizeMB;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,11 +217,15 @@ int VideoDiskSpace(int *FreeMB, int *UsedMB)
|
|||||||
int free = 0, used = 0;
|
int free = 0, used = 0;
|
||||||
int deleted = DeletedRecordings.TotalFileSizeMB();
|
int deleted = DeletedRecordings.TotalFileSizeMB();
|
||||||
cVideoDirectory Dir;
|
cVideoDirectory Dir;
|
||||||
|
#ifdef DEPRECATED_DISTRIBUTED_VIDEODIR
|
||||||
do {
|
do {
|
||||||
|
#endif
|
||||||
int u;
|
int u;
|
||||||
free += Dir.FreeMB(&u);
|
free += Dir.FreeMB(&u);
|
||||||
used += u;
|
used += u;
|
||||||
|
#ifdef DEPRECATED_DISTRIBUTED_VIDEODIR
|
||||||
} while (Dir.Next());
|
} while (Dir.Next());
|
||||||
|
#endif
|
||||||
if (deleted > used)
|
if (deleted > used)
|
||||||
deleted = used; // let's not get beyond 100%
|
deleted = used; // let's not get beyond 100%
|
||||||
free += deleted;
|
free += deleted;
|
||||||
@ -232,18 +260,26 @@ cString PrefixVideoFileName(const char *FileName, char Prefix)
|
|||||||
void RemoveEmptyVideoDirectories(const char *IgnoreFiles[])
|
void RemoveEmptyVideoDirectories(const char *IgnoreFiles[])
|
||||||
{
|
{
|
||||||
cVideoDirectory Dir;
|
cVideoDirectory Dir;
|
||||||
|
#ifdef DEPRECATED_DISTRIBUTED_VIDEODIR
|
||||||
do {
|
do {
|
||||||
|
#endif
|
||||||
RemoveEmptyDirectories(Dir.Name(), false, IgnoreFiles);
|
RemoveEmptyDirectories(Dir.Name(), false, IgnoreFiles);
|
||||||
|
#ifdef DEPRECATED_DISTRIBUTED_VIDEODIR
|
||||||
} while (Dir.Next());
|
} while (Dir.Next());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsOnVideoDirectoryFileSystem(const char *FileName)
|
bool IsOnVideoDirectoryFileSystem(const char *FileName)
|
||||||
{
|
{
|
||||||
cVideoDirectory Dir;
|
cVideoDirectory Dir;
|
||||||
|
#ifdef DEPRECATED_DISTRIBUTED_VIDEODIR
|
||||||
do {
|
do {
|
||||||
|
#endif
|
||||||
if (EntriesOnSameFileSystem(Dir.Name(), FileName))
|
if (EntriesOnSameFileSystem(Dir.Name(), FileName))
|
||||||
return true;
|
return true;
|
||||||
|
#ifdef DEPRECATED_DISTRIBUTED_VIDEODIR
|
||||||
} while (Dir.Next());
|
} while (Dir.Next());
|
||||||
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user