vdr
2.2.0
|
#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 "remux.h"
#include "ringbuffer.h"
#include "skins.h"
#include "tools.h"
#include "videodir.h"
Go to the source code of this file.
Classes | |
class | cRemoveDeletedRecordingsThread |
struct | tCharExchange |
class | cDirCopier |
class | cRecordingsHandlerEntry |
class | cIndexFileGenerator |
struct | tIndexPes |
struct | tIndexTs |
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 | MINDISKSPACE 1024 |
#define | REMOVECHECKDELTA 60 |
#define | DELETEDLIFETIME 300 |
#define | DISKCHECKDELTA 100 |
#define | REMOVELATENCY 10 |
#define | MARKSUPDATEDELTA 10 |
#define | MININDEXAGE 3600 |
#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 | |
cRecordings | DeletedRecordings (true) |
void | RemoveDeletedRecordings (void) |
void | AssertFreeDiskSpace (int Priority, bool Force) |
void | ClearVanishedRecordings (void) |
bool | NeedsConversion (const char *p) |
char * | ExchangeChars (char *s, bool ToFileSystem) |
char * | LimitNameLengths (char *s, int PathMax, int NameMax) |
bool | GenerateIndex (const char *FileName, bool Update) |
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) |
Variables | |
int | DirectoryPathMax = PATH_MAX - 1 |
int | DirectoryNameMax = NAME_MAX |
bool | DirectoryEncoding = false |
int | InstanceId = 0 |
static cRecordings | VanishedRecordings |
static cRemoveDeletedRecordingsThread | RemoveDeletedRecordingsThread |
tCharExchange | CharExchange [] |
const char * | InvalidChars = "\"\\/:*?|<>#" |
cRecordings | Recordings |
cRecordingsHandler | RecordingsHandler |
double | MarkFramesPerSecond = DEFAULTFRAMESPERSECOND |
cMutex | MutexMarkFramesPerSecond |
eRecordingsSortMode | RecordingsSortMode = rsmName |
#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 63 of file recording.c.
Referenced by cRemoveDeletedRecordingsThread::Action(), and RemoveDeletedRecordings().
#define DELEXT ".del" |
Definition at line 36 of file recording.c.
Referenced by cRecordings::DelByName(), cRecording::Delete(), cRecording::Remove(), cRecordings::ScanVideoDir(), and cRecording::Undelete().
#define DISKCHECKDELTA 100 |
Definition at line 64 of file recording.c.
Referenced by AssertFreeDiskSpace().
#define IFG_BUFFER_SIZE KILOBYTE(100) |
Definition at line 2246 of file recording.c.
Referenced by cIndexFileGenerator::Action().
#define INDEXCATCHUPWAIT 100 |
Definition at line 2423 of file recording.c.
Referenced by cIndexFile::CatchUp().
#define INDEXFILECHECKINTERVAL 500 |
Definition at line 2447 of file recording.c.
Referenced by cIndexFile::cIndexFile(), and GenerateIndex().
#define INDEXFILESUFFIX "/index" |
Definition at line 2419 of file recording.c.
Referenced by GenerateIndex(), and cIndexFile::IndexFileName().
#define INDEXFILETESTINTERVAL 10 |
Definition at line 2448 of file recording.c.
Referenced by cIndexFile::cIndexFile().
#define INFOFILESUFFIX "/info" |
Definition at line 55 of file recording.c.
Referenced by cRecording::cRecording(), cRecordingInfo::cRecordingInfo(), cRecordingInfo::SetFileName(), and cRecording::WriteInfo().
#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.
Referenced by cMarks::Load(), and cMarks::MarksFileName().
#define MARKSUPDATEDELTA 10 |
Definition at line 66 of file recording.c.
#define MAX_LINK_LEVEL 6 |
Definition at line 70 of file recording.c.
Referenced by cRecordings::ScanVideoDir().
#define MAXFILESPERRECORDINGPES 255 |
Definition at line 2807 of file recording.c.
Referenced by cFileName::SetOffset().
#define MAXFILESPERRECORDINGTS 65535 |
Definition at line 2809 of file recording.c.
Referenced by cFileName::GetLastPatPmtVersions(), and cFileName::SetOffset().
#define MAXINDEXCATCHUP 8 |
Definition at line 2422 of file recording.c.
#define MAXREMOVETIME 10 |
Definition at line 68 of file recording.c.
Referenced by cRemoveDeletedRecordingsThread::Action().
#define MAXWAITFORINDEXFILE 10 |
Definition at line 2446 of file recording.c.
Referenced by cIndexFile::cIndexFile().
#define MINDISKSPACE 1024 |
Definition at line 60 of file recording.c.
Referenced by AssertFreeDiskSpace().
#define MININDEXAGE 3600 |
Definition at line 67 of file recording.c.
Referenced by cIndexFile::cIndexFile(), cRecording::FileSizeMB(), and cRecording::NumFrames().
#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 cRecording::Delete(), cRecordings::ScanVideoDir(), and cRecording::Undelete().
#define RECORDFILESUFFIXLEN 20 |
Definition at line 2811 of file recording.c.
Referenced by cFileName::cFileName().
#define RECORDFILESUFFIXPES "/%03d.vdr" |
Definition at line 2808 of file recording.c.
Referenced by cFileName::SetOffset().
#define RECORDFILESUFFIXTS "/%05d.ts" |
Definition at line 2810 of file recording.c.
Referenced by cFileName::GetLastPatPmtVersions(), and cFileName::SetOffset().
#define REMOVECHECKDELTA 60 |
Definition at line 62 of file recording.c.
Referenced by RemoveDeletedRecordings().
#define REMOVELATENCY 10 |
Definition at line 65 of file recording.c.
Referenced by AssertFreeDiskSpace().
#define RESUME_NOT_INITIALIZED (-2) |
Definition at line 559 of file recording.c.
Referenced by cRecording::cRecording(), cRecording::GetResume(), and cRecording::ResetResume().
#define RESUMEFILESUFFIX "/resume%s%s" |
Definition at line 51 of file recording.c.
Referenced by cResumeFile::cResumeFile().
#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.
Referenced by cRecording::cRecording().
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 149 of file recording.c.
References cListBase::Count(), cListBase::Del(), cRecording::Delete(), DeletedRecordings(), DISKCHECKDELTA, cList< T >::First(), cRecording::IsEdited(), cRecording::IsOnVideoDirectoryFileSystem(), isyslog, cRecording::Lifetime(), cLockFile::Lock(), MAXLIFETIME, MINDISKSPACE, mtWarning, cVideoDirectory::Name(), cList< T >::Next(), cRecording::Priority(), cSkins::QueueMessage(), Recordings, cRecording::Remove(), REMOVELATENCY, SECSINDAY, Skins, cRecording::Start(), tr, cRecordings::Update(), and cVideoDirectory::VideoFileSpaceAvailable().
Referenced by cRecordControl::Process(), cCuttingThread::ProcessSequence(), and cRecordControls::Start().
void ClearVanishedRecordings | ( | void | ) |
Definition at line 232 of file recording.c.
References cListBase::Clear(), and Recordings.
Referenced by main().
cRecordings DeletedRecordings | ( | true | ) |
char* ExchangeChars | ( | char * | s, |
bool | ToFileSystem | ||
) |
Definition at line 582 of file recording.c.
References tCharExchange::a, DirectoryEncoding, esyslog, FOLDERDELIMCHAR, and NeedsConversion().
Referenced by cMenuRecordingEdit::Action(), cSVDRP::CmdCPYR(), cRecording::cRecording(), cMenuRecordings::DirectoryName(), cRecording::FileName(), and cFileName::Number().
bool GenerateIndex | ( | const char * | FileName, |
bool | Update = false |
||
) |
Generates the index of the existing recording with the given FileName.
If Update is true, an existing index file will be checked whether it is complete, and will be updated if it isn't. Otherwise an existing index file will be removed before a new one is generated.
Definition at line 2777 of file recording.c.
References cThread::Active(), AddDirectory(), DirectoryOk(), INDEXFILECHECKINTERVAL, cIndexFile::IndexFileName(), INDEXFILESUFFIX, cRecording::IsPesRecording(), cRecording::Name(), and cCondWait::SleepMs().
Referenced by main(), and cFileName::Number().
void GetRecordingsSortMode | ( | const char * | Directory | ) |
Definition at line 3028 of file recording.c.
References AddDirectory(), constrain(), cIndexFile::f, RecordingsSortMode, rsmName, rsmTime, and SORTMODEFILE.
Referenced by IncRecordingsSortMode(), and cMenuRecordings::Set().
bool HasRecordingsSortMode | ( | const char * | Directory | ) |
Definition at line 3023 of file recording.c.
References AddDirectory(), and SORTMODEFILE.
Referenced by cRecordControl::cRecordControl().
int HMSFToIndex | ( | const char * | HMSF, |
double | FramesPerSecond | ||
) |
Definition at line 2987 of file recording.c.
References cIndexFile::f.
Referenced by cSVDRP::CmdPLAY(), cFileName::Number(), and cMark::Parse().
void IncRecordingsSortMode | ( | const char * | Directory | ) |
Definition at line 3047 of file recording.c.
References GetRecordingsSortMode(), RecordingsSortMode, rsmTime, and SetRecordingsSortMode().
Referenced by cMenuRecordings::Sort().
cString IndexToHMSF | ( | int | Index, |
bool | WithFrame, | ||
double | FramesPerSecond | ||
) |
Definition at line 2971 of file recording.c.
References cIndexFile::f, and cString::sprintf().
Referenced by cDvbPlayer::Action(), cMarks::Align(), cFileName::Number(), cReplayControl::ShowProgress(), and cMark::ToText().
char* LimitNameLengths | ( | char * | s, |
int | PathMax, | ||
int | NameMax | ||
) |
Definition at line 653 of file recording.c.
References FOLDERDELIMCHAR, NeedsConversion(), and SI::Utf8CharLen().
Referenced by cRecording::FileName().
bool NeedsConversion | ( | const char * | p | ) |
Definition at line 575 of file recording.c.
References DirectoryEncoding, FOLDERDELIMCHAR, and InvalidChars.
Referenced by ExchangeChars(), and LimitNameLengths().
int ReadFrame | ( | cUnbufferedFile * | f, |
uchar * | b, | ||
int | Length, | ||
int | Max | ||
) |
Definition at line 3005 of file recording.c.
References esyslog, LOG_ERROR, and cUnbufferedFile::Read().
Referenced by cDvbPlayer::Goto(), cCuttingThread::LoadFrame(), and cFileName::Number().
void RemoveDeletedRecordings | ( | void | ) |
Definition at line 132 of file recording.c.
References cThread::Active(), DELETEDLIFETIME, DeletedRecordings(), cList< T >::First(), cList< T >::Next(), REMOVECHECKDELTA, and cThread::Start().
Referenced by main().
int SecondsToFrames | ( | int | Seconds, |
double | FramesPerSecond | ||
) |
Definition at line 2998 of file recording.c.
Referenced by cReplayControl::EditTest(), cReplayControl::MarkJump(), cFileName::Number(), cDvbPlayer::SkipSeconds(), and cReplayControl::TimeSearchProcess().
void SetRecordingsSortMode | ( | const char * | Directory, |
eRecordingsSortMode | SortMode | ||
) |
Definition at line 3039 of file recording.c.
References AddDirectory(), cIndexFile::f, SORTMODEFILE, and cString::sprintf().
Referenced by cRecordControl::cRecordControl(), and IncRecordingsSortMode().
tCharExchange CharExchange[] |
Definition at line 562 of file recording.c.
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().
int InstanceId = 0 |
Definition at line 77 of file recording.c.
Referenced by cRecording::cRecording(), and main().
const char* InvalidChars = "\"\\/:*?|<>#" |
Definition at line 573 of file recording.c.
Referenced by NeedsConversion().
double MarkFramesPerSecond = DEFAULTFRAMESPERSECOND |
Definition at line 2015 of file recording.c.
Referenced by cMark::Parse(), and cMarks::Update().
cMutex MutexMarkFramesPerSecond |
Definition at line 2016 of file recording.c.
cRecordings Recordings |
Any access to Recordings that loops through the list of recordings needs to hold a thread lock on this object!
Definition at line 1365 of file recording.c.
Referenced by cRecorder::Action(), cCuttingThread::Action(), cMenuRecordingEdit::Action(), AddRecordingFolders(), cMenuPathEdit::ApplyChanges(), AssertFreeDiskSpace(), cRecording::ChangeName(), cRecording::ChangePriorityLifetime(), cRecordings::ChangeState(), ClearVanishedRecordings(), cSVDRP::CmdCPYR(), cSVDRP::CmdDELR(), cSVDRP::CmdMOVR(), cSVDRP::CmdUPDR(), cMenuPathEdit::cMenuPathEdit(), cMenuRecording::cMenuRecording(), cMenuRecordingEdit::cMenuRecordingEdit(), cMenuRecordings::cMenuRecordings(), cMenuTimers::Commands(), cRecordControl::cRecordControl(), cResumeFile::Delete(), cMenuRecordings::Delete(), cReplayControl::GetInfo(), cReplayControl::GetRecording(), cVideoDiskUsage::HasChanged(), cReplayControl::LastReplayed(), main(), cMenuRecordings::ProcessKey(), cMenuSetupOSD::ProcessKey(), cMenuRecordingEdit::RefreshRecording(), cMenuRecording::RefreshRecording(), cResumeFile::Save(), cMenuFolder::Set(), cMenuRecordings::Set(), SetTrackDescriptions(), cReplayControl::ShowProgress(), cCutter::Start(), cCutter::Stop(), cReplayControl::Stop(), and cMenuSetupReplay::Store().
cRecordingsHandler RecordingsHandler |
Definition at line 1910 of file recording.c.
Referenced by cMenuRecordingEdit::Action(), cSVDRP::CmdCPYR(), cSVDRP::CmdEDIT(), cShutdownHandler::ConfirmRestart(), cShutdownHandler::ConfirmShutdown(), cMenuRecordings::Delete(), cReplayControl::EditCut(), cRecording::IsInUse(), main(), cVideoDirectory::Move(), cMenuMain::ProcessKey(), and cMenuMain::Update().
eRecordingsSortMode RecordingsSortMode = rsmName |
Definition at line 3021 of file recording.c.
Referenced by GetRecordingsSortMode(), IncRecordingsSortMode(), cMenuRecordings::Set(), and cRecording::SortName().
|
static |
Definition at line 128 of file recording.c.
|
static |
Definition at line 80 of file recording.c.