22#define FOLDERDELIMCHAR '~'
57 cResumeFile(
const char *FileName,
bool IsPesRecording);
83 bool Read(FILE *f,
bool Force =
false);
90 const char *
Title(
void)
const {
return event->Title(); }
91 const char *
ShortText(
void)
const {
return event->ShortText(); }
92 const char *
Description(
void)
const {
return event->Description(); }
94 const char *
Aux(
void)
const {
return aux; }
112 bool Write(FILE *f,
const char *Prefix =
"")
const;
113 bool Read(
bool Force =
false);
114 bool Write(
void)
const;
148 int Id(
void)
const {
return id; }
155 bool IsInPath(
const char *Path)
const;
170 const char *
Title(
char Delimiter =
' ',
bool NewIndicator =
false,
int Level = -1)
const;
205 bool WriteInfo(
const char *OtherFileName = NULL);
274 static void Update(
bool Wait =
false);
283 void ResetResume(
const char *ResumeFileName = NULL);
290 void AddByName(
const char *FileName,
bool TriggerUpdate =
true);
329#define LOCK_RECORDINGS_READ USE_LIST_LOCK_READ(Recordings)
330#define LOCK_RECORDINGS_WRITE USE_LIST_LOCK_WRITE(Recordings)
331#define LOCK_DELETEDRECORDINGS_READ USE_LIST_LOCK_READ2(Recordings, DeletedRecordings)
332#define LOCK_DELETEDRECORDINGS_WRITE USE_LIST_LOCK_WRITE2(Recordings, DeletedRecordings)
344 virtual void Action(
void)
override;
348 bool Add(
int Usage,
const char *FileNameSrc,
const char *FileNameDst = NULL);
356 void Del(
const char *FileName);
378#define DEFAULTFRAMESPERSECOND 25.0
388 virtual ~cMark()
override;
394 bool Parse(
const char *s);
418 void Add(
int Position);
424 const cMark *
Get(
int Position)
const;
444 cMark *
Get(
int Position) {
return const_cast<cMark *
>(
static_cast<const cMarks *
>(
this)->Get(Position)); }
454#define RUC_BEFORERECORDING "before"
455#define RUC_STARTRECORDING "started"
456#define RUC_AFTERRECORDING "after"
457#define RUC_EDITINGRECORDING "editing"
458#define RUC_EDITEDRECORDING "edited"
459#define RUC_DELETERECORDING "deleted"
460#define RUC_RENAMEDRECORDING "renamed"
461#define RUC_MOVEDRECORDING "moved"
462#define RUC_COPYINGRECORDING "copying"
463#define RUC_COPIEDRECORDING "copied"
470 static void InvokeCommand(
const char *State,
const char *RecordingFileName,
const char *SourceFileName = NULL);
474#define MAXFRAMESIZE (KILOBYTE(1024) / TS_SIZE * TS_SIZE)
481#define MAXVIDEOFILESIZETS 1048570
482#define MAXVIDEOFILESIZEPES 2000
483#define MINVIDEOFILESIZE 100
484#define MAXVIDEOFILESIZEDEFAULT MAXVIDEOFILESIZEPES
505 cIndexFile(
const char *FileName,
bool Record,
bool IsPesRecording =
false,
bool PauseLive =
false,
bool Update =
false);
508 bool Write(
bool Independent, uint16_t FileNumber, off_t FileOffset,
bool Errors =
false,
bool Missing =
false);
509 bool Get(
int Index, uint16_t *FileNumber, off_t *FileOffset,
bool *Independent = NULL,
int *Length = NULL,
bool *Errors = NULL,
bool *Missing = NULL);
512 int GetNextIFrame(
int Index,
bool Forward, uint16_t *FileNumber = NULL, off_t *FileOffset = NULL,
int *Length = NULL);
518 int Get(uint16_t FileNumber, off_t FileOffset);
525 static int GetLength(
const char *FileName,
bool IsPesRecording =
false);
540 cFileName(
const char *FileName,
bool Record,
bool Blocking =
false,
bool IsPesRecording =
false);
555 void Add(
const char *Title);
557 bool Load(
const char *FileName);
558 bool Save(
void)
const;
559 void Append(
const char *Title);
560 bool Contains(
const char *Title)
const;
580bool GenerateIndex(
const char *FileName,
bool Update =
false);
cConfig(const char *NeedsLocking=NULL)
cStringList doneRecordings
void Add(const char *Title)
void Append(const char *Title)
bool Load(const char *FileName)
bool Contains(const char *Title) const
cUnbufferedFile * NextFile(void)
cUnbufferedFile * Open(void)
cFileName(const char *FileName, bool Record, bool Blocking=false, bool IsPesRecording=false)
bool GetLastPatPmtVersions(int &PatVersion, int &PmtVersion)
cUnbufferedFile * SetOffset(int Number, off_t Offset=0)
int GetNextIFrame(int Index, bool Forward, uint16_t *FileNumber=NULL, off_t *FileOffset=NULL, int *Length=NULL)
bool Write(bool Independent, uint16_t FileNumber, off_t FileOffset, bool Errors=false, bool Missing=false)
bool IsStillRecording(void)
void ConvertFromPes(tIndexTs *IndexTs, int Count)
static int GetLength(const char *FileName, bool IsPesRecording=false)
Calculates the recording length (number of frames) without actually reading the index file.
bool CatchUp(int Index=-1)
const cErrors * GetErrors(void)
Returns the frame indexes of errors in the recording (if any).
void ConvertToPes(tIndexTs *IndexTs, int Count)
bool StoreResume(int Index)
cIndexFile(const char *FileName, bool Record, bool IsPesRecording=false, bool PauseLive=false, bool Update=false)
cIndexFileGenerator * indexFileGenerator
static cString IndexFileName(const char *FileName, bool IsPesRecording)
int GetClosestIFrame(int Index)
Returns the index of the I-frame that is closest to the given Index (or Index itself,...
bool Get(int Index, uint16_t *FileNumber, off_t *FileOffset, bool *Independent=NULL, int *Length=NULL, bool *Errors=NULL, bool *Missing=NULL)
int Last(void)
Returns the index of the last entry in this file, or -1 if the file is empty.
cListObject(const cListObject &ListObject)
cList(const char *NeedsLocking=NULL)
cMark(int Position=0, const char *Comment=NULL, double FramesPerSecond=DEFAULTFRAMESPERSECOND)
bool Parse(const char *s)
const char * Comment(void) const
void SetPosition(int Position)
virtual ~cMark() override
void SetComment(const char *Comment)
int GetNumSequences(void) const
Returns the actual number of sequences to be cut from the recording.
void Add(int Position)
If this cMarks object is used by multiple threads, the caller must Lock() it before calling Add() and...
const cMark * GetNextBegin(const cMark *EndMark=NULL) const
Returns the next "begin" mark after EndMark, skipping any marks at the same position as EndMark.
const cMark * GetNext(int Position) const
bool Load(const char *RecordingFileName, double FramesPerSecond=DEFAULTFRAMESPERSECOND, bool IsPesRecording=false)
const cMark * GetNextEnd(const cMark *BeginMark) const
Returns the next "end" mark after BeginMark, skipping any marks at the same position as BeginMark.
const cMark * Get(int Position) const
cString recordingFileName
static bool DeleteMarksFile(const cRecording *Recording)
int GetFrameAfterEdit(int Frame, int LastFrame) const
Returns the number of the given Frame within the region covered by begin/end sequences.
cMark * Get(int Position)
cMark * GetNextEnd(const cMark *BeginMark)
cMark * GetNextBegin(const cMark *EndMark=NULL)
cMark * GetPrev(int Position)
static cString MarksFileName(const cRecording *Recording)
Returns the marks file name for the given Recording (regardless whether such a file actually exists).
cMark * GetNext(int Position)
const cMark * GetPrev(int Position) const
char ScanTypeChar(void) const
const char * ChannelName(void) const
void SetFramesPerSecond(double FramesPerSecond)
const cEvent * GetEvent(void) const
uint16_t FrameHeight(void) const
const char * AspectRatioText(void) const
const char * ShortText(void) const
eScanType ScanType(void) const
cRecordingInfo(const cChannel *Channel=NULL, const cEvent *Event=NULL)
void SetLifetime(int Lifetime)
const char * Title(void) const
cString FrameParams(void) const
const char * Aux(void) const
tChannelID ChannelID(void) const
void SetFileName(const char *FileName)
void SetPriority(int Priority)
uint16_t FrameWidth(void) const
void SetFrameParams(uint16_t FrameWidth, uint16_t FrameHeight, eScanType ScanType, eAspectRatio AspectRatio)
void SetErrors(int Errors)
void SetAux(const char *Aux)
void SetData(const char *Title, const char *ShortText, const char *Description)
const char * Description(void) const
eAspectRatio AspectRatio(void) const
bool Read(FILE *f, bool Force=false)
double FramesPerSecond(void) const
const cComponents * Components(void) const
static const char * command
static void InvokeCommand(const char *State, const char *RecordingFileName, const char *SourceFileName=NULL)
static void SetCommand(const char *Command)
virtual int Compare(const cListObject &ListObject) const override
Must return 0 if this object is equal to ListObject, a positive value if it is "greater",...
int isOnVideoDirectoryFileSystem
virtual ~cRecording() override
bool ChangePriorityLifetime(int NewPriority, int NewLifetime)
Changes the priority and lifetime of this recording to the given values.
bool HasMarks(void) const
Returns true if this recording has any editing marks.
cRecording & operator=(const cRecording &)
bool WriteInfo(const char *OtherFileName=NULL)
Writes in info file of this recording.
int IsInUse(void) const
Checks whether this recording is currently in use and therefore shall not be tampered with.
bool ChangeName(const char *NewName)
Changes the name of this recording to the given value.
bool Undelete(void)
Changes the file name so that it will be visible in the "Recordings" menu again and not processed by ...
void ResetResume(void) const
void ReadInfo(bool Force=false)
bool Delete(void)
Changes the file name so that it will no longer be visible in the "Recordings" menu Returns false in ...
cString Folder(void) const
Returns the name of the folder this recording is stored in (without the video directory).
int NumFrames(void) const
Returns the number of frames in this recording.
bool IsEdited(void) const
int GetResume(void) const
Returns the index of the frame where replay of this recording shall be resumed, or -1 in case of an e...
bool IsInPath(const char *Path) const
Returns true if this recording is stored anywhere under the given Path.
void SetStartTime(time_t Start)
Sets the start time of this recording to the given value.
char * SortName(void) const
const char * Name(void) const
Returns the full name of the recording (without the video directory).
int NumFramesAfterEdit(void) const
Returns the number of frames in the edited version of this recording.
const char * FileName(void) const
Returns the full path name to the recording directory, including the video directory and the actual '...
cRecordingInfo * Info(void) const
const char * PrefixFileName(char Prefix)
bool DeleteMarks(void)
Deletes the editing marks from this recording (if any).
bool IsOnVideoDirectoryFileSystem(void) const
int HierarchyLevels(void) const
int FileSizeMB(void) const
Returns the total file size of this recording (in MB), or -1 if the file size is unknown.
cString BaseName(void) const
Returns the base name of this recording (without the video directory and folder).
const char * Title(char Delimiter=' ', bool NewIndicator=false, int Level=-1) const
bool Remove(void)
Actually removes the file from the disk Returns false in case of error.
cRecording(const cRecording &)
int LengthInSecondsAfterEdit(void) const
Returns the length (in seconds) of the edited version of this recording, or -1 in case of error.
double FramesPerSecond(void) const
bool IsPesRecording(void) const
time_t Deleted(void) const
static char * StripEpisodeName(char *s, bool Strip)
int LengthInSeconds(void) const
Returns the length (in seconds) of this recording, or -1 in case of error.
void DelAll(void)
Deletes/terminates all operations.
virtual ~cRecordingsHandler() override
cRecordingsHandlerEntry * Get(const char *FileName)
bool Add(int Usage, const char *FileNameSrc, const char *FileNameDst=NULL)
Adds the given FileNameSrc to the recordings handler for (later) processing.
bool Finished(bool &Error)
Returns true if all operations in the list have been finished.
int GetUsage(const char *FileName)
Returns the usage type for the given FileName.
cList< cRecordingsHandlerEntry > operations
void Del(const char *FileName)
Deletes the given FileName from the list of operations.
virtual void Action(void) override
A derived cThread class must implement the code it wants to execute as a separate thread in this func...
int GetRequiredDiskSpaceMB(const char *FileName=NULL)
Returns the total disk space required to process all actions.
void ResetResume(const char *ResumeFileName=NULL)
void UpdateByName(const char *FileName)
static const char * UpdateFileName(void)
double MBperMinute(void) const
Returns the average data rate (in MB/min) of all recordings, or -1 if this value is unknown.
cRecording * GetByName(const char *FileName)
virtual ~cRecordings() override
cRecordings(bool Deleted=false)
int GetNumRecordingsInPath(const char *Path) const
Returns the total number of recordings in the given Path, including all sub-folders of Path.
static const cRecordings * GetRecordingsRead(cStateKey &StateKey, int TimeoutMs=0)
Gets the list of recordings for read access.
const cRecording * GetById(int Id) const
static const cRecordings * GetDeletedRecordingsRead(cStateKey &StateKey, int TimeoutMs=0)
Gets the list of deleted recordings for read access.
static cRecordings * GetDeletedRecordingsWrite(cStateKey &StateKey, int TimeoutMs=0)
Gets the list of deleted recordings for write access.
static cRecordings deletedRecordings
void AddByName(const char *FileName, bool TriggerUpdate=true)
static cRecordings recordings
int TotalFileSizeMB(void) const
static void Update(bool Wait=false)
Triggers an update of the list of recordings, which will run as a separate thread if Wait is false.
static cRecordings * GetRecordingsWrite(cStateKey &StateKey, int TimeoutMs=0)
Gets the list of recordings for write access.
static void TouchUpdate(void)
Touches the '.update' file in the video directory, so that other instances of VDR that access the sam...
void Add(cRecording *Recording)
static cVideoDirectoryScannerThread * videoDirectoryScannerThread
void DelByName(const char *FileName)
bool MoveRecordings(const char *OldPath, const char *NewPath)
Moves all recordings in OldPath to NewPath.
static bool NeedsUpdate(void)
cRecording * GetById(int Id)
void ClearSortNames(void)
static int lastRecordingId
const cRecording * GetByName(const char *FileName) const
static char * updateFileName
int PathIsInUse(const char *Path) const
Checks whether any recording in the given Path is currently in use and therefore the whole Path shall...
cResumeFile(const char *FileName, bool IsPesRecording)
cThread(const char *Description=NULL, bool LowPriority=false)
Creates a new thread.
cUnbufferedFile is used for large files that are mainly written or read in a streaming manner,...
cVector(const cVector &Vector)
eRecordingsSortMode RecordingsSortMode
cDoneRecordings DoneRecordingsPattern
cRecordingsHandler RecordingsHandler
cString GetRecordingTimerId(const char *Directory)
#define DEFAULTFRAMESPERSECOND
int HMSFToIndex(const char *HMSF, double FramesPerSecond=DEFAULTFRAMESPERSECOND)
void GetRecordingsSortMode(const char *Directory)
bool HasRecordingsSortMode(const char *Directory)
bool EnoughFreeDiskSpaceForEdit(const char *FileName)
char * ExchangeChars(char *s, bool ToFileSystem)
void IncRecordingsSortMode(const char *Directory)
void SetRecordingsSortMode(const char *Directory, eRecordingsSortMode SortMode)
int FileSizeMBafterEdit(const char *FileName)
int ReadFrame(cUnbufferedFile *f, uchar *b, int Length, int Max)
void SetRecordingTimerId(const char *Directory, const char *TimerId)
void RemoveDeletedRecordings(void)
int SecondsToFrames(int Seconds, double FramesPerSecond=DEFAULTFRAMESPERSECOND)
cString IndexToHMSF(int Index, bool WithFrame=false, double FramesPerSecond=DEFAULTFRAMESPERSECOND)
bool GenerateIndex(const char *FileName, bool Update=false)
Generates the index of the existing recording with the given FileName.
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 norma...
const char * AspectRatioTexts[]
const char * ScanTypeChars