21 #define FOLDERDELIMCHAR '~' 56 cResumeFile(
const char *FileName,
bool IsPesRecording);
77 void SetData(
const char *
Title,
const char *ShortText,
const char *Description);
78 void SetAux(
const char *Aux);
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; }
92 void SetFileName(
const char *
FileName);
93 bool Write(FILE *f,
const char *Prefix =
"")
const;
95 bool Write(
void)
const;
117 static char *StripEpisodeName(
char *s,
bool Strip);
118 char *SortName(
void)
const;
119 void ClearSortName(
void);
128 time_t
Start(
void)
const {
return start; }
132 virtual int Compare(
const cListObject &ListObject)
const;
133 bool IsInPath(
const char *Path);
142 const char *
Name(
void)
const {
return name; }
145 const char *FileName(
void)
const;
148 const char *Title(
char Delimiter =
' ',
bool NewIndicator =
false,
int Level = -1)
const;
150 const char *PrefixFileName(
char Prefix);
151 int HierarchyLevels(
void)
const;
154 int NumFrames(
void)
const;
157 int LengthInSeconds(
void)
const;
159 int FileSizeMB(
void)
const;
162 int GetResume(
void)
const;
165 bool IsNew(
void)
const {
return GetResume() <= 0; }
166 bool IsEdited(
void)
const;
168 bool IsOnVideoDirectoryFileSystem(
void)
const;
171 bool DeleteMarks(
void);
176 bool WriteInfo(
const char *OtherFileName = NULL);
180 void SetStartTime(time_t
Start);
188 bool ChangePriorityLifetime(
int NewPriority,
int NewLifetime);
192 bool ChangeName(
const char *NewName);
209 int IsInUse(
void)
const;
226 const char *UpdateFileName(
void);
227 void Refresh(
bool Foreground =
false);
228 bool ScanVideoDir(
const char *DirName,
bool Foreground =
false,
int LinkLevel = 0,
int DirLevel = 0);
234 bool Load(
void) {
return Update(
true); }
238 bool Update(
bool Wait =
false);
244 void TouchUpdate(
void);
248 bool NeedsUpdate(
void);
250 bool StateChanged(
int &State);
251 void ResetResume(
const char *ResumeFileName = NULL);
252 void ClearSortNames(
void);
254 void AddByName(
const char *FileName,
bool TriggerUpdate =
true);
255 void DelByName(
const char *FileName);
256 void UpdateByName(
const char *FileName);
257 int TotalFileSizeMB(
void);
258 double MBperMinute(
void);
261 int PathIsInUse(
const char *Path);
269 int GetNumRecordingsInPath(
const char *Path);
273 bool MoveRecordings(
const char *OldPath,
const char *NewPath);
301 bool Add(
int Usage,
const char *FileNameSrc,
const char *FileNameDst = NULL);
309 void Del(
const char *FileName);
316 int GetUsage(
const char *FileName);
324 bool Finished(
bool &Error);
333 #define DEFAULTFRAMESPERSECOND 25.0 345 const char *
Comment(
void)
const {
return comment; }
349 bool Parse(
const char *s);
366 bool Load(
const char *RecordingFileName,
double FramesPerSecond =
DEFAULTFRAMESPERSECOND,
bool IsPesRecording =
false);
371 void Add(
int Position);
377 cMark *Get(
int Position);
378 cMark *GetPrev(
int Position);
379 cMark *GetNext(
int Position);
387 int GetNumSequences(
void);
395 #define RUC_BEFORERECORDING "before" 396 #define RUC_STARTRECORDING "started" 397 #define RUC_AFTERRECORDING "after" 398 #define RUC_EDITEDRECORDING "edited" 399 #define RUC_DELETERECORDING "deleted" 405 static void SetCommand(
const char *Command) { command = Command; }
406 static void InvokeCommand(
const char *State,
const char *RecordingFileName,
const char *SourceFileName = NULL);
410 #define MAXFRAMESIZE (KILOBYTE(1024) / TS_SIZE * TS_SIZE) // multiple of TS_SIZE to avoid breaking up TS packets 417 #define MAXVIDEOFILESIZETS 1048570 // MB 418 #define MAXVIDEOFILESIZEPES 2000 // MB 419 #define MINVIDEOFILESIZE 100 // MB 420 #define MAXVIDEOFILESIZEDEFAULT MAXVIDEOFILESIZEPES 435 void ConvertFromPes(
tIndexTs *IndexTs,
int Count);
436 void ConvertToPes(
tIndexTs *IndexTs,
int Count);
437 bool CatchUp(
int Index = -1);
439 cIndexFile(
const char *FileName,
bool Record,
bool IsPesRecording =
false,
bool PauseLive =
false,
bool Update =
false);
441 bool Ok(
void) {
return index != NULL; }
442 bool Write(
bool Independent, uint16_t FileNumber, off_t FileOffset);
443 bool Get(
int Index, uint16_t *FileNumber, off_t *FileOffset,
bool *Independent = NULL,
int *Length = NULL);
444 int GetNextIFrame(
int Index,
bool Forward, uint16_t *FileNumber = NULL, off_t *FileOffset = NULL,
int *Length = NULL);
445 int GetClosestIFrame(
int Index);
450 int Get(uint16_t FileNumber, off_t FileOffset);
451 int Last(
void) { CatchUp();
return last; }
455 bool IsStillRecording(
void);
457 static int GetLength(
const char *FileName,
bool IsPesRecording =
false);
460 static cString IndexFileName(
const char *FileName,
bool IsPesRecording);
472 cFileName(
const char *FileName,
bool Record,
bool Blocking =
false,
bool IsPesRecording =
false);
475 uint16_t
Number(
void) {
return fileNumber; }
476 bool GetLastPatPmtVersions(
int &PatVersion,
int &PmtVersion);
498 bool GenerateIndex(
const char *FileName,
bool Update =
false);
511 #endif //__RECORDING_H
#define DEFAULTFRAMESPERSECOND
bool Load(void)
Loads the current list of recordings and returns true if there is anything in it (for compatibility w...
const cRecordingInfo * Info(void) const
void ResetResume(const char *ResumeFileName=NULL)
cResumeFile(const char *FileName, bool IsPesRecording)
const char * ShortText(void) const
int HMSFToIndex(const char *HMSF, double FramesPerSecond=DEFAULTFRAMESPERSECOND)
double FramesPerSecond(void) const
const char * Title(char Delimiter= ' ', bool NewIndicator=false, int Level=-1) const
const cComponents * Components(void) const
cString IndexToHMSF(int Index, bool WithFrame=false, double FramesPerSecond=DEFAULTFRAMESPERSECOND)
double FramesPerSecond(void) const
int Last(void)
Returns the index of the last entry in this file, or -1 if the file is empty.
void SetPosition(int Position)
cUnbufferedFile is used for large files that are mainly written or read in a streaming manner...
static void SetCommand(const char *Command)
static const char * command
bool GenerateIndex(const char *FileName, bool Update=false)
Generates the index of the existing recording with the given FileName.
bool HasRecordingsSortMode(const char *Directory)
void IncRecordingsSortMode(const char *Directory)
eRecordingsSortMode RecordingsSortMode
const char * Comment(void) const
void RemoveDeletedRecordings(void)
char * ExchangeChars(char *s, bool ToFileSystem)
time_t Deleted(void) const
void bool Start(void)
Sets the description of this thread, which will be used when logging starting or stopping of the thre...
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...
tChannelID ChannelID(void) const
int isOnVideoDirectoryFileSystem
static char * updateFileName
int SecondsToFrames(int Seconds, double FramesPerSecond=DEFAULTFRAMESPERSECOND)
cRecordings DeletedRecordings
bool StoreResume(int Index)
cIndexFileGenerator * indexFileGenerator
void GetRecordingsSortMode(const char *Directory)
int ReadFrame(cUnbufferedFile *f, uchar *b, int Length, int Max)
void SetRecordingsSortMode(const char *Directory, eRecordingsSortMode SortMode)
cRecordingsHandler RecordingsHandler
const cEvent * GetEvent(void) const
const char * Description(void) const
const char * Name(void) const
Returns the full name of the recording (without the video directory.
void ClearVanishedRecordings(void)
const char * Title(void) const
cList< cRecordingsHandlerEntry > operations
const char * ChannelName(void) const
void SetComment(const char *Comment)
const char * Aux(void) const
static const uint8_t * GetLength(const uint8_t *Data, int &Length)
cString recordingFileName
cRecordings Recordings
Any access to Recordings that loops through the list of recordings needs to hold a thread lock on thi...
const char * FileName(void) const
Returns the full path name to the recording directory, including the video directory and the actual '...
bool IsPesRecording(void) const