|
vdr 2.8.3
|
#include "recording.h"#include <ctype.h>#include <dirent.h>#include <errno.h>#include <fcntl.h>#include <inttypes.h>#include <math.h>#include <stdio.h>#include <string.h>#include <sys/stat.h>#include <unistd.h>#include "channels.h"#include "cutter.h"#include "i18n.h"#include "interface.h"#include "menu.h"#include "ringbuffer.h"#include "skins.h"#include "svdrp.h"#include "tools.h"#include "videodir.h"Go to the source code of this file.
Classes | |
| class | cRemoveDeletedRecordingsThread |
| struct | tCharExchange |
| class | cVideoDirectoryScannerThread |
| class | cDirCopier |
| class | cRecordingsHandlerEntry |
| class | cIndexFileGenerator |
Macros | |
| #define | __STDC_FORMAT_MACROS |
| #define | SUMMARYFALLBACK |
| #define | RECEXT ".rec" |
| #define | DELEXT ".del" |
| #define | DATAFORMATPES "%4d-%02d-%02d.%02d%*c%02d.%02d.%02d" RECEXT |
| #define | NAMEFORMATPES "%s/%s/" "%4d-%02d-%02d.%02d.%02d.%02d.%02d" RECEXT |
| #define | DATAFORMATTS "%4d-%02d-%02d.%02d.%02d.%d-%d" RECEXT |
| #define | NAMEFORMATTS "%s/%s/" DATAFORMATTS |
| #define | RESUMEFILESUFFIX "/resume%s%s" |
| #define | SUMMARYFILESUFFIX "/summary.vdr" |
| #define | INFOFILESUFFIX "/info" |
| #define | MARKSFILESUFFIX "/marks" |
| #define | SORTMODEFILE ".sort" |
| #define | TIMERRECFILE ".timer" |
| #define | MINDISKSPACE 1024 |
| #define | REMOVECHECKDELTA 60 |
| #define | DELETEDLIFETIME 300 |
| #define | DISKCHECKDELTA 100 |
| #define | REMOVELATENCY 10 |
| #define | MARKSUPDATEDELTA 10 |
| #define | MAXREMOVETIME 10 |
| #define | MAX_LINK_LEVEL 6 |
| #define | LIMIT_SECS_PER_MB_RADIO 5 |
| #define | RESUME_NOT_INITIALIZED (-2) |
| #define | IFG_BUFFER_SIZE KILOBYTE(100) |
| #define | INDEXFILESUFFIX "/index" |
| #define | MAXINDEXCATCHUP 8 |
| #define | INDEXCATCHUPWAIT 100 |
| #define | MAXWAITFORINDEXFILE 10 |
| #define | INDEXFILECHECKINTERVAL 500 |
| #define | INDEXFILETESTINTERVAL 10 |
| #define | MAXFILESPERRECORDINGPES 255 |
| #define | RECORDFILESUFFIXPES "/%03d.vdr" |
| #define | MAXFILESPERRECORDINGTS 65535 |
| #define | RECORDFILESUFFIXTS "/%05d.ts" |
| #define | RECORDFILESUFFIXLEN 20 |
Functions | |
| void | RemoveDeletedRecordings (void) |
| void | AssertFreeDiskSpace (int Priority, bool Force) |
| bool | NeedsConversion (const char *p) |
| char * | ExchangeChars (char *s, bool ToFileSystem) |
| char * | LimitNameLengths (char *s, int PathMax, int NameMax) |
| static bool | StillRecording (const char *Directory) |
| struct | __attribute__ ((packed)) |
| bool | GenerateIndex (const char *FileName) |
| static const char * | SkipFuzzyChars (const char *s) |
| cString | IndexToHMSF (int Index, bool WithFrame, double FramesPerSecond) |
| int | HMSFToIndex (const char *HMSF, double FramesPerSecond) |
| int | SecondsToFrames (int Seconds, double FramesPerSecond) |
| int | ReadFrame (cUnbufferedFile *f, uchar *b, int Length, int Max) |
| bool | HasRecordingsSortMode (const char *Directory) |
| void | GetRecordingsSortMode (const char *Directory) |
| void | SetRecordingsSortMode (const char *Directory, eRecordingsSortMode SortMode) |
| void | IncRecordingsSortMode (const char *Directory) |
| void | SetRecordingTimerId (const char *Directory, const char *TimerId) |
| cString | GetRecordingTimerId (const char *Directory) |
| void | ClrRecordingTimerId (const char *Directory) |
| int | FileSizeMBafterEdit (const char *FileName) |
| bool | EnoughFreeDiskSpaceForEdit (const char *FileName) |
Variables | |
| int | DirectoryPathMax = PATH_MAX - 1 |
| int | DirectoryNameMax = NAME_MAX |
| bool | DirectoryEncoding = false |
| int | InstanceId = 0 |
| static cRemoveDeletedRecordingsThread | RemoveDeletedRecordingsThread |
| tCharExchange | CharExchange [] |
| const char * | InvalidChars = "\"\\/:*?|<>#" |
| cRecordingsHandler | RecordingsHandler |
| double | MarkFramesPerSecond = DEFAULTFRAMESPERSECOND |
| cMutex | MutexMarkFramesPerSecond |
| cDoneRecordings | DoneRecordingsPattern |
| static const char * | FuzzyChars = " -:/" |
| eRecordingsSortMode | RecordingsSortMode = rsmTime |
| #define __STDC_FORMAT_MACROS |
Definition at line 15 of file recording.c.
| #define DATAFORMATPES "%4d-%02d-%02d.%02d%*c%02d.%02d.%02d" RECEXT |
Definition at line 46 of file recording.c.
Referenced by cRecording::cRecording().
| #define DATAFORMATTS "%4d-%02d-%02d.%02d.%02d.%d-%d" RECEXT |
Definition at line 48 of file recording.c.
Referenced by cRecording::cRecording().
| #define DELETEDLIFETIME 300 |
Definition at line 64 of file recording.c.
Referenced by cRecording::RetentionExpired().
| #define DELEXT ".del" |
Definition at line 36 of file recording.c.
Referenced by cRecordings::DelByName(), cRecording::Delete(), cRecording::Remove(), cVideoDirectoryScannerThread::ScanVideoDir(), and cRecording::Undelete().
| #define DISKCHECKDELTA 100 |
Definition at line 65 of file recording.c.
Referenced by AssertFreeDiskSpace().
| #define IFG_BUFFER_SIZE KILOBYTE(100) |
Definition at line 2690 of file recording.c.
Referenced by cIndexFileGenerator::Action().
| #define INDEXCATCHUPWAIT 100 |
Definition at line 2885 of file recording.c.
Referenced by cIndexFile::CatchUp().
| #define INDEXFILECHECKINTERVAL 500 |
Definition at line 2913 of file recording.c.
Referenced by cIndexFile::cIndexFile(), and GenerateIndex().
| #define INDEXFILESUFFIX "/index" |
Definition at line 2881 of file recording.c.
| #define INDEXFILETESTINTERVAL 10 |
Definition at line 2914 of file recording.c.
Referenced by cIndexFile::cIndexFile().
| #define INFOFILESUFFIX "/info" |
Definition at line 55 of file recording.c.
| #define LIMIT_SECS_PER_MB_RADIO 5 |
Definition at line 72 of file recording.c.
Referenced by cRecordings::MBperMinute().
| #define MARKSFILESUFFIX "/marks" |
Definition at line 56 of file recording.c.
| #define MARKSUPDATEDELTA 10 |
Definition at line 67 of file recording.c.
| #define MAX_LINK_LEVEL 6 |
Definition at line 70 of file recording.c.
Referenced by cVideoDirectoryScannerThread::ScanVideoDir().
| #define MAXFILESPERRECORDINGPES 255 |
Definition at line 3302 of file recording.c.
| #define MAXFILESPERRECORDINGTS 65535 |
Definition at line 3304 of file recording.c.
Referenced by cFileName::GetLastPatPmtVersions(), and cFileName::SetOffset().
| #define MAXINDEXCATCHUP 8 |
Definition at line 2884 of file recording.c.
Referenced by cIndexFile::CatchUp().
| #define MAXREMOVETIME 10 |
Definition at line 68 of file recording.c.
Referenced by cRemoveDeletedRecordingsThread::Action().
| #define MAXWAITFORINDEXFILE 10 |
Definition at line 2912 of file recording.c.
Referenced by cIndexFile::cIndexFile().
| #define MINDISKSPACE 1024 |
Definition at line 61 of file recording.c.
Referenced by AssertFreeDiskSpace(), and EnoughFreeDiskSpaceForEdit().
| #define NAMEFORMATPES "%s/%s/" "%4d-%02d-%02d.%02d.%02d.%02d.%02d" RECEXT |
Definition at line 47 of file recording.c.
Referenced by cRecording::FileName().
| #define NAMEFORMATTS "%s/%s/" DATAFORMATTS |
Definition at line 49 of file recording.c.
Referenced by cRecording::FileName().
| #define RECEXT ".rec" |
Definition at line 35 of file recording.c.
Referenced by cRecordings::DelByName(), cRecording::Delete(), cVideoDirectoryScannerThread::ScanVideoDir(), and cRecording::Undelete().
| #define RECORDFILESUFFIXLEN 20 |
Definition at line 3306 of file recording.c.
Referenced by cFileName::cFileName().
| #define RECORDFILESUFFIXPES "/%03d.vdr" |
Definition at line 3303 of file recording.c.
| #define RECORDFILESUFFIXTS "/%05d.ts" |
Definition at line 3305 of file recording.c.
Referenced by cFileName::GetLastPatPmtVersions(), and cFileName::SetOffset().
| #define REMOVECHECKDELTA 60 |
Definition at line 63 of file recording.c.
Referenced by RemoveDeletedRecordings().
| #define REMOVELATENCY 10 |
Definition at line 66 of file recording.c.
Referenced by AssertFreeDiskSpace().
| #define RESUME_NOT_INITIALIZED (-2) |
Definition at line 242 of file recording.c.
Referenced by cResumeFile::cResumeFile(), cResumeFile::FileTime(), cResumeFile::Index(), and cResumeFile::Reset().
| #define RESUMEFILESUFFIX "/resume%s%s" |
Definition at line 51 of file recording.c.
| #define SORTMODEFILE ".sort" |
Definition at line 58 of file recording.c.
Referenced by cRemoveDeletedRecordingsThread::Action(), GetRecordingsSortMode(), HasRecordingsSortMode(), and SetRecordingsSortMode().
| #define SUMMARYFALLBACK |
Definition at line 33 of file recording.c.
| #define SUMMARYFILESUFFIX "/summary.vdr" |
Definition at line 53 of file recording.c.
| #define TIMERRECFILE ".timer" |
Definition at line 59 of file recording.c.
Referenced by cRemoveDeletedRecordingsThread::Action(), GetRecordingTimerId(), SetRecordingTimerId(), and StillRecording().
| struct __attribute__ | ( | (packed) | ) |
Definition at line 2715 of file recording.c.
| void AssertFreeDiskSpace | ( | int | Priority = 0, |
| bool | Force = false ) |
The special Priority value -1 means that we shall get rid of any deleted recordings faster than normal (because we're cutting).
If Force is true, the check will be done even if the timeout hasn't expired yet.
Definition at line 152 of file recording.c.
References AssertFreeDiskSpace(), cRecording::Delete(), cRecording::Deleted(), DISKCHECKDELTA, cRecording::IsEdited(), cRecording::IsOnVideoDirectoryFileSystem(), isyslog, cRecording::Lifetime(), cLockFile::Lock(), LOCK_DELETEDRECORDINGS_READ, LOCK_DELETEDRECORDINGS_WRITE, LOCK_RECORDINGS_WRITE, MAXLIFETIME, MINDISKSPACE, mtWarning, Mutex, cVideoDirectory::Name(), cListObject::Next(), cRecording::Priority(), cSkins::QueueMessage(), cRecording::Remove(), REMOVELATENCY, SECSINDAY, Skins, cRecording::Start(), tr, cRecordings::Update(), and cVideoDirectory::VideoFileSpaceAvailable().
Referenced by AssertFreeDiskSpace(), main(), cCuttingThread::ProcessSequence(), and cRecordControls::Start().
| void ClrRecordingTimerId | ( | const char * | Directory | ) |
Definition at line 3679 of file recording.c.
References ClrRecordingTimerId(), dsyslog, GetRecordingTimerId(), SetRecordingTimerId(), Setup, and cSetup::SVDRPHostName.
Referenced by ClrRecordingTimerId(), and cVideoDirectoryScannerThread::ScanVideoDir().
| bool EnoughFreeDiskSpaceForEdit | ( | const char * | FileName | ) |
Definition at line 3709 of file recording.c.
References DirSizeMB(), cCutter::EditedFileName(), EnoughFreeDiskSpaceForEdit(), FileSizeMBafterEdit(), cRecordingsHandler::GetRequiredDiskSpaceMB(), MINDISKSPACE, RecordingsHandler, and cVideoDirectory::VideoDiskSpace().
Referenced by cMenuRecordingEdit::Action(), cSVDRPServer::CmdEDIT(), cReplayControl::EditCut(), and EnoughFreeDiskSpaceForEdit().
| char * ExchangeChars | ( | char * | s, |
| bool | ToFileSystem ) |
Definition at line 757 of file recording.c.
References tCharExchange::a, CharExchange, DirectoryEncoding, esyslog, ExchangeChars(), FOLDERDELIMCHAR, and NeedsConversion().
Referenced by cRecording::cRecording(), cMenuRecordings::DirectoryName(), ExchangeChars(), and cRecording::FileName().
| int FileSizeMBafterEdit | ( | const char * | FileName | ) |
Definition at line 3694 of file recording.c.
References DirSizeMB(), FileSizeMBafterEdit(), max(), cRecording::NumFrames(), and cRecording::NumFramesAfterEdit().
Referenced by EnoughFreeDiskSpaceForEdit(), FileSizeMBafterEdit(), and cRecordingsHandler::GetRequiredDiskSpaceMB().
| bool GenerateIndex | ( | const char * | FileName | ) |
Generates the index of the existing recording with the given FileName.
An existing index file will be removed before a new one is generated.
Definition at line 3273 of file recording.c.
References cThread::Active(), AddDirectory(), cIndexFileGenerator::cIndexFileGenerator(), DirectoryOk(), GenerateIndex(), INDEXFILECHECKINTERVAL, INDEXFILESUFFIX, cRecording::IsPesRecording(), cRecording::Name(), and cCondWait::SleepMs().
Referenced by GenerateIndex(), GenerateIndex(), and main().
| void GetRecordingsSortMode | ( | const char * | Directory | ) |
Definition at line 3616 of file recording.c.
References AddDirectory(), constrain(), cSetup::DefaultSortModeRec, GetRecordingsSortMode(), RecordingsSortMode, rsmTime, Setup, and SORTMODEFILE.
Referenced by GetRecordingsSortMode(), IncRecordingsSortMode(), and cMenuRecordings::Set().
| cString GetRecordingTimerId | ( | const char * | Directory | ) |
Definition at line 3664 of file recording.c.
References AddDirectory(), GetRecordingTimerId(), stripspace(), and TIMERRECFILE.
Referenced by ClrRecordingTimerId(), GetRecordingTimerId(), and TimerStillRecording().
| bool HasRecordingsSortMode | ( | const char * | Directory | ) |
Definition at line 3611 of file recording.c.
References AddDirectory(), HasRecordingsSortMode(), and SORTMODEFILE.
Referenced by HasRecordingsSortMode().
| int HMSFToIndex | ( | const char * | HMSF, |
| double | FramesPerSecond ) |
Definition at line 3575 of file recording.c.
References HMSFToIndex().
Referenced by cSVDRPServer::CmdPLAY(), HMSFToIndex(), and cMark::Parse().
| void IncRecordingsSortMode | ( | const char * | Directory | ) |
Definition at line 3635 of file recording.c.
References GetRecordingsSortMode(), IncRecordingsSortMode(), RecordingsSortMode, rsmTime, and SetRecordingsSortMode().
Referenced by IncRecordingsSortMode(), and cMenuRecordings::Sort().
| cString IndexToHMSF | ( | int | Index, |
| bool | WithFrame, | ||
| double | FramesPerSecond ) |
Definition at line 3559 of file recording.c.
References IndexToHMSF(), and cString::sprintf().
Referenced by cDvbPlayer::Action(), IndexToHMSF(), cReplayControl::ShowProgress(), and cMark::ToText().
| char * LimitNameLengths | ( | char * | s, |
| int | PathMax, | ||
| int | NameMax ) |
Definition at line 828 of file recording.c.
References FOLDERDELIMCHAR, LimitNameLengths(), NeedsConversion(), and Utf8CharLen().
Referenced by cRecording::FileName(), and LimitNameLengths().
| bool NeedsConversion | ( | const char * | p | ) |
Definition at line 750 of file recording.c.
References DirectoryEncoding, FOLDERDELIMCHAR, InvalidChars, and NeedsConversion().
Referenced by ExchangeChars(), LimitNameLengths(), and NeedsConversion().
| int ReadFrame | ( | cUnbufferedFile * | f, |
| uchar * | b, | ||
| int | Length, | ||
| int | Max ) |
Definition at line 3593 of file recording.c.
References esyslog, LOG_ERROR, cUnbufferedFile::Read(), and ReadFrame().
Referenced by cRecorder::GetLastPts(), cDvbPlayer::Goto(), cCuttingThread::LoadFrame(), and ReadFrame().
| void RemoveDeletedRecordings | ( | void | ) |
Definition at line 135 of file recording.c.
References cThread::Active(), LOCK_DELETEDRECORDINGS_READ, cListObject::Next(), REMOVECHECKDELTA, RemoveDeletedRecordings(), RemoveDeletedRecordingsThread, and cThread::Start().
Referenced by main(), and RemoveDeletedRecordings().
| int SecondsToFrames | ( | int | Seconds, |
| double | FramesPerSecond ) |
Definition at line 3586 of file recording.c.
References SecondsToFrames().
Referenced by cReplayControl::EditTest(), cReplayControl::MarkJump(), SecondsToFrames(), cDvbPlayer::SkipSeconds(), and cReplayControl::TimeSearchProcess().
| void SetRecordingsSortMode | ( | const char * | Directory, |
| eRecordingsSortMode | SortMode ) |
Definition at line 3627 of file recording.c.
References AddDirectory(), SetRecordingsSortMode(), SORTMODEFILE, and cString::sprintf().
Referenced by IncRecordingsSortMode(), and SetRecordingsSortMode().
| void SetRecordingTimerId | ( | const char * | Directory, |
| const char * | TimerId ) |
Definition at line 3646 of file recording.c.
References AddDirectory(), dsyslog, LOG_ERROR_STR, SetRecordingTimerId(), and TIMERRECFILE.
Referenced by cIndexFileGenerator::Action(), ClrRecordingTimerId(), cRecordControl::cRecordControl(), cRecordingTimerId::cRecordingTimerId(), SetRecordingTimerId(), cCutter::Start(), cCutter::Stop(), cRecordControl::Stop(), and cRecordingTimerId::~cRecordingTimerId().
|
static |
Definition at line 3529 of file recording.c.
References FuzzyChars, and SkipFuzzyChars().
Referenced by cDoneRecordings::Contains(), and SkipFuzzyChars().
|
static |
Definition at line 1542 of file recording.c.
References AddDirectory(), StillRecording(), and TIMERRECFILE.
Referenced by cIndexFile::CatchUp(), cIndexFile::cIndexFile(), cRecording::FileSizeMB(), cRecording::NumFrames(), and StillRecording().
| tCharExchange CharExchange[] |
Definition at line 737 of file recording.c.
Referenced by ExchangeChars().
| bool DirectoryEncoding = false |
Definition at line 76 of file recording.c.
Referenced by ExchangeChars(), main(), and NeedsConversion().
| int DirectoryNameMax = NAME_MAX |
Definition at line 75 of file recording.c.
Referenced by cRecording::FileName(), and main().
| int DirectoryPathMax = PATH_MAX - 1 |
Definition at line 74 of file recording.c.
Referenced by cRecording::FileName(), and main().
| cDoneRecordings DoneRecordingsPattern |
Definition at line 3466 of file recording.c.
Referenced by main(), cTimer::Matches(), and cRecordControl::Stop().
|
static |
Definition at line 3527 of file recording.c.
Referenced by SkipFuzzyChars().
| int InstanceId = 0 |
Definition at line 77 of file recording.c.
Referenced by cRecording::cRecording(), and main().
| const char* InvalidChars = "\"\\/:*?|<>#" |
Definition at line 748 of file recording.c.
Referenced by NeedsConversion().
| double MarkFramesPerSecond = DEFAULTFRAMESPERSECOND |
Definition at line 2423 of file recording.c.
Referenced by cMark::Parse(), and cMarks::Update().
| cMutex MutexMarkFramesPerSecond |
Definition at line 2424 of file recording.c.
Referenced by cMarks::Update().
| cRecordingsHandler RecordingsHandler |
Definition at line 2268 of file recording.c.
Referenced by cMenuRecordingEdit::Action(), cSVDRPServer::CmdEDIT(), cShutdownHandler::ConfirmRestart(), cShutdownHandler::ConfirmShutdown(), cMenuRecordings::Delete(), cReplayControl::EditCut(), EnoughFreeDiskSpaceForEdit(), cRecording::IsInUse(), main(), cVideoDirectory::Move(), cMenuMain::ProcessKey(), cMenuRecordings::Set(), and cMenuMain::Update().
| eRecordingsSortMode RecordingsSortMode = rsmTime |
Definition at line 3609 of file recording.c.
Referenced by GetRecordingsSortMode(), IncRecordingsSortMode(), cMenuRecordings::Set(), and cRecording::SortName().
|
static |
Definition at line 131 of file recording.c.
Referenced by RemoveDeletedRecordings().