Go to the documentation of this file.
21 #define FOLDERDELIMCHAR '~'
56 cResumeFile(
const char *FileName,
bool IsPesRecording);
85 const char *
Title(
void)
const {
return event->Title(); }
86 const char *
ShortText(
void)
const {
return event->ShortText(); }
87 const char *
Description(
void)
const {
return event->Description(); }
89 const char *
Aux(
void)
const {
return aux; }
93 bool Write(FILE *f,
const char *Prefix =
"")
const;
95 bool Write(
void)
const;
130 int Id(
void)
const {
return id; }
137 bool IsInPath(
const char *Path)
const;
152 const char *
Title(
char Delimiter =
' ',
bool NewIndicator =
false,
int Level = -1)
const;
180 bool WriteInfo(
const char *OtherFileName = NULL);
249 static void Update(
bool Wait =
false);
260 void ResetResume(
const char *ResumeFileName = NULL);
267 void AddByName(
const char *FileName,
bool TriggerUpdate =
true);
306 #define LOCK_RECORDINGS_READ USE_LIST_LOCK_READ(Recordings)
307 #define LOCK_RECORDINGS_WRITE USE_LIST_LOCK_WRITE(Recordings)
308 #define LOCK_DELETEDRECORDINGS_READ USE_LIST_LOCK_READ2(Recordings, DeletedRecordings)
309 #define LOCK_DELETEDRECORDINGS_WRITE USE_LIST_LOCK_WRITE2(Recordings, DeletedRecordings)
321 virtual void Action(
void);
325 bool Add(
int Usage,
const char *FileNameSrc,
const char *FileNameDst = NULL);
333 void Del(
const char *FileName);
351 #define DEFAULTFRAMESPERSECOND 25.0
367 bool Parse(
const char *s);
391 void Add(
int Position);
397 const cMark *
Get(
int Position)
const;
420 #define RUC_BEFORERECORDING "before"
421 #define RUC_STARTRECORDING "started"
422 #define RUC_AFTERRECORDING "after"
423 #define RUC_EDITINGRECORDING "editing"
424 #define RUC_EDITEDRECORDING "edited"
425 #define RUC_DELETERECORDING "deleted"
432 static void InvokeCommand(
const char *State,
const char *RecordingFileName,
const char *SourceFileName = NULL);
436 #define MAXFRAMESIZE (KILOBYTE(1024) / TS_SIZE * TS_SIZE) // multiple of TS_SIZE to avoid breaking up TS packets
443 #define MAXVIDEOFILESIZETS 1048570 // MB
444 #define MAXVIDEOFILESIZEPES 2000 // MB
445 #define MINVIDEOFILESIZE 100 // MB
446 #define MAXVIDEOFILESIZEDEFAULT MAXVIDEOFILESIZEPES
465 cIndexFile(
const char *FileName,
bool Record,
bool IsPesRecording =
false,
bool PauseLive =
false,
bool Update =
false);
468 bool Write(
bool Independent, uint16_t FileNumber, off_t FileOffset);
469 bool Get(
int Index, uint16_t *FileNumber, off_t *FileOffset,
bool *Independent = NULL,
int *Length = NULL);
470 int GetNextIFrame(
int Index,
bool Forward, uint16_t *FileNumber = NULL, off_t *FileOffset = NULL,
int *Length = NULL);
476 int Get(uint16_t FileNumber, off_t FileOffset);
483 static int GetLength(
const char *FileName,
bool IsPesRecording =
false);
498 cFileName(
const char *FileName,
bool Record,
bool Blocking =
false,
bool IsPesRecording =
false);
524 bool GenerateIndex(
const char *FileName,
bool Update =
false);
541 #endif //__RECORDING_H
cString BaseName(void) const
Returns the base name of this recording (without the video directory and folder).
void IncRecordingsSortMode(const char *Directory)
int ReadFrame(cUnbufferedFile *f, uchar *b, int Length, int Max)
void ResetResume(void) const
void ResetResume(const char *ResumeFileName=NULL)
static cString MarksFileName(const cRecording *Recording)
Returns the marks file name for the given Recording (regardless whether such a file actually exists).
cResumeFile(const char *FileName, bool IsPesRecording)
cRecordingsHandler RecordingsHandler
void Add(cRecording *Recording)
void SetFramesPerSecond(double FramesPerSecond)
bool CatchUp(int Index=-1)
bool IsPesRecording(void) const
void DelAll(void)
Deletes/terminates all operations.
const cMark * GetNext(int Position) const
void ConvertToPes(tIndexTs *IndexTs, int Count)
bool GenerateIndex(const char *FileName, bool Update=false)
Generates the index of the existing recording with the given FileName.
static int GetLength(const char *FileName, bool IsPesRecording=false)
Calculates the recording length (number of frames) without actually reading the index file.
void AddByName(const char *FileName, bool TriggerUpdate=true)
void ConvertFromPes(tIndexTs *IndexTs, int Count)
eRecordingsSortMode RecordingsSortMode
const char * Title(void) const
void SetRecordingsSortMode(const char *Directory, eRecordingsSortMode SortMode)
cUnbufferedFile * SetOffset(int Number, off_t Offset=0)
const cRecordingInfo * Info(void) const
cRecording * GetById(int Id)
static const cRecordings * GetRecordingsRead(cStateKey &StateKey, int TimeoutMs=0)
Gets the list of recordings for read access.
const cRecording * GetByName(const char *FileName) const
void SetData(const char *Title, const char *ShortText, const char *Description)
int SecondsToFrames(int Seconds, double FramesPerSecond=DEFAULTFRAMESPERSECOND)
int PathIsInUse(const char *Path) const
Checks whether any recording in the given Path is currently in use and therefore the whole Path shall...
cUnbufferedFile * NextFile(void)
cUnbufferedFile * Open(void)
bool IsOnVideoDirectoryFileSystem(void) const
bool Finished(bool &Error)
Returns true if all operations in the list have been finished.
const char * Description(void) const
bool Add(int Usage, const char *FileNameSrc, const char *FileNameDst=NULL)
Adds the given FileNameSrc to the recordings handler for (later) processing.
static cString IndexFileName(const char *FileName, bool IsPesRecording)
double FramesPerSecond(void) const
const char * Title(char Delimiter=' ', bool NewIndicator=false, int Level=-1) const
const char * FileName(void) const
Returns the full path name to the recording directory, including the video directory and the actual '...
time_t Deleted(void) const
cMark * GetPrev(int Position)
static cRecordings recordings
bool GetLastPatPmtVersions(int &PatVersion, int &PmtVersion)
cString Folder(void) const
Returns the name of the folder this recording is stored in (without the video directory).
const char * ShortText(void) const
const cMark * GetPrev(int Position) const
void Add(int Position)
If this cMarks object is used by multiple threads, the caller must Lock() it before calling Add() and...
const cComponents * Components(void) const
static cRecordings deletedRecordings
bool Delete(void)
Changes the file name so that it will no longer be visible in the "Recordings" menu Returns false in ...
static cRecordings * GetRecordingsWrite(cStateKey &StateKey, int TimeoutMs=0)
Gets the list of recordings for write access.
const char * Aux(void) const
virtual int Compare(const cListObject &ListObject) const
Must return 0 if this object is equal to ListObject, a positive value if it is "greater",...
void SetPosition(int Position)
static char * StripEpisodeName(char *s, bool Strip)
const char * Name(void) const
Returns the full name of the recording (without the video directory).
void Del(const char *FileName)
Deletes the given FileName from the list of operations.
cUnbufferedFile is used for large files that are mainly written or read in a streaming manner,...
cRecordingsHandlerEntry * Get(const char *FileName)
const cMark * Get(int Position) const
void UpdateByName(const char *FileName)
tChannelID ChannelID(void) const
int isOnVideoDirectoryFileSystem
static void InvokeCommand(const char *State, const char *RecordingFileName, const char *SourceFileName=NULL)
void GetRecordingsSortMode(const char *Directory)
cString recordingFileName
cRecording * GetByName(const char *FileName)
int GetUsage(const char *FileName)
Returns the usage type for the given FileName.
static const cRecordings * GetDeletedRecordingsRead(cStateKey &StateKey, int TimeoutMs=0)
Gets the list of deleted recordings for read access.
const cRecording * GetById(int Id) const
double FramesPerSecond(void) const
const char * PrefixFileName(char Prefix)
void SetAux(const char *Aux)
bool Lock(cStateKey &StateKey, bool Write=false, int TimeoutMs=0) const
Tries to get a lock on this list and returns true if successful.
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 * GetNextBegin(const cMark *EndMark=NULL) const
Returns the next "begin" mark after EndMark, skipping any marks at the same position as EndMark.
int TotalFileSizeMB(void) const
int FileSizeMB(void) const
Returns the total file size of this recording (in MB), or -1 if the file size is unknown.
int GetClosestIFrame(int Index)
Returns the index of the I-frame that is closest to the given Index (or Index itself,...
bool StoreResume(int Index)
DEF_LIST_LOCK(Recordings)
DEF_LIST_LOCK2(Recordings, DeletedRecordings)
static int lastRecordingId
cMark(int Position=0, const char *Comment=NULL, double FramesPerSecond=DEFAULTFRAMESPERSECOND)
int LengthInSeconds(void) const
Returns the length (in seconds) of this recording, or -1 in case of error.
#define DEFAULTFRAMESPERSECOND
virtual void Action(void)
A derived cThread class must implement the code it wants to execute as a separate thread in this func...
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.
cIndexFile(const char *FileName, bool Record, bool IsPesRecording=false, bool PauseLive=false, bool Update=false)
const char * Comment(void) const
void SetRecordingTimerId(const char *Directory, const char *TimerId)
bool IsStillRecording(void)
cString IndexToHMSF(int Index, bool WithFrame=false, double FramesPerSecond=DEFAULTFRAMESPERSECOND)
static cVideoDirectoryScannerThread * videoDirectoryScannerThread
bool ChangeName(const char *NewName)
Changes the name of this recording to the given value.
cString GetRecordingTimerId(const char *Directory)
void SetFileName(const char *FileName)
void ClearSortNames(void)
cRecordingInfo(const cChannel *Channel=NULL, const cEvent *Event=NULL)
int HMSFToIndex(const char *HMSF, double FramesPerSecond=DEFAULTFRAMESPERSECOND)
bool HasMarks(void) const
Returns true if this recording has any editing marks.
bool Parse(const char *s)
static const char * UpdateFileName(void)
cIndexFileGenerator * indexFileGenerator
int HierarchyLevels(void) const
cMark * GetNextBegin(const cMark *EndMark=NULL)
int GetNumRecordingsInPath(const char *Path) const
Returns the total number of recordings in the given Path, including all sub-folders of Path.
static bool NeedsUpdate(void)
cRecordings(bool Deleted=false)
bool HasRecordingsSortMode(const char *Directory)
void SetComment(const char *Comment)
static bool DeleteMarksFile(const cRecording *Recording)
bool Load(const char *RecordingFileName, double FramesPerSecond=DEFAULTFRAMESPERSECOND, bool IsPesRecording=false)
int GetNumSequences(void) const
Returns the actual number of sequences to be cut from the recording.
bool Write(bool Independent, uint16_t FileNumber, off_t FileOffset)
static char * updateFileName
const char * ChannelName(void) const
int Last(void)
Returns the index of the last entry in this file, or -1 if the file is empty.
void DelByName(const char *FileName)
cList< cRecordingsHandlerEntry > operations
bool Undelete(void)
Changes the file name so that it will be visible in the "Recordings" menu again and not processed by ...
static void TouchUpdate(void)
Touches the '.update' file in the video directory, so that other instances of VDR that access the sam...
bool MoveRecordings(const char *OldPath, const char *NewPath)
Moves all recordings in OldPath to NewPath.
virtual ~cRecordingsHandler()
const cEvent * GetEvent(void) const
static cRecordings * GetDeletedRecordingsWrite(cStateKey &StateKey, int TimeoutMs=0)
Gets the list of deleted recordings for write access.
int IsInUse(void) const
Checks whether this recording is currently in use and therefore shall not be tampered with.
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...
static void SetCommand(const char *Command)
int GetNextIFrame(int Index, bool Forward, uint16_t *FileNumber=NULL, off_t *FileOffset=NULL, int *Length=NULL)
cRecording(const cRecording &)
cMark * Get(int Position)
cMark * GetNextEnd(const cMark *BeginMark)
cRecording & operator=(const cRecording &)
bool ChangePriorityLifetime(int NewPriority, int NewLifetime)
Changes the priority and lifetime of this recording to the given values.
bool IsInPath(const char *Path) const
Returns true if this recording is stored anywhere under the given Path.
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...
char * ExchangeChars(char *s, bool ToFileSystem)
bool Remove(void)
Actually removes the file from the disk Returns false in case of error.
bool Get(int Index, uint16_t *FileNumber, off_t *FileOffset, bool *Independent=NULL, int *Length=NULL)
char * SortName(void) const
static const char * command
cMark * GetNext(int Position)
cFileName(const char *FileName, bool Record, bool Blocking=false, bool IsPesRecording=false)
bool IsEdited(void) const
bool DeleteMarks(void)
Deletes the editing marks from this recording (if any).
int NumFrames(void) const
Returns the number of frames in this recording.
double MBperMinute(void) const
Returns the average data rate (in MB/min) of all recordings, or -1 if this value is unknown.
bool WriteInfo(const char *OtherFileName=NULL)
Writes in info file of this recording.
void SetStartTime(time_t Start)
Sets the start time of this recording to the given value.
void RemoveDeletedRecordings(void)