vdr  2.2.0
recording.h
Go to the documentation of this file.
1 /*
2  * recording.h: Recording file handling
3  *
4  * See the main source file 'vdr.c' for copyright information and
5  * how to reach the author.
6  *
7  * $Id: recording.h 3.8 2015/02/07 14:29:14 kls Exp $
8  */
9 
10 #ifndef __RECORDING_H
11 #define __RECORDING_H
12 
13 #include <time.h>
14 #include "channels.h"
15 #include "config.h"
16 #include "epg.h"
17 #include "thread.h"
18 #include "timers.h"
19 #include "tools.h"
20 
21 #define FOLDERDELIMCHAR '~'
22 
23 extern int DirectoryPathMax;
24 extern int DirectoryNameMax;
25 extern bool DirectoryEncoding;
26 extern int InstanceId;
27 
29  ruNone = 0x0000, // the recording is currently unused
30  ruTimer = 0x0001, // the recording is currently written to by a timer
31  ruReplay = 0x0002, // the recording is being replayed
32  // mutually exclusive:
33  ruCut = 0x0004, // the recording is being cut
34  ruMove = 0x0008, // the recording is being moved
35  ruCopy = 0x0010, // the recording is being copied
36  // mutually exclusive:
37  ruSrc = 0x0020, // the recording is the source of a cut, move or copy process
38  ruDst = 0x0040, // the recording is the destination of a cut, move or copy process
39  //
40  ruPending = 0x0080, // the recording is pending a cut, move or copy process
41  };
42 
43 void RemoveDeletedRecordings(void);
44 void ClearVanishedRecordings(void);
45 void AssertFreeDiskSpace(int Priority = 0, bool Force = false);
50 
51 class cResumeFile {
52 private:
53  char *fileName;
55 public:
56  cResumeFile(const char *FileName, bool IsPesRecording);
57  ~cResumeFile();
58  int Read(void);
59  bool Save(int Index);
60  void Delete(void);
61  };
62 
64  friend class cRecording;
65 private:
67  char *channelName;
68  const cEvent *event;
70  char *aux;
72  int priority;
73  int lifetime;
74  char *fileName;
75  cRecordingInfo(const cChannel *Channel = NULL, const cEvent *Event = NULL);
76  bool Read(FILE *f);
77  void SetData(const char *Title, const char *ShortText, const char *Description);
78  void SetAux(const char *Aux);
79 public:
80  cRecordingInfo(const char *FileName);
82  tChannelID ChannelID(void) const { return channelID; }
83  const char *ChannelName(void) const { return channelName; }
84  const cEvent *GetEvent(void) const { return event; }
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(); }
88  const cComponents *Components(void) const { return event->Components(); }
89  const char *Aux(void) const { return aux; }
90  double FramesPerSecond(void) const { return framesPerSecond; }
92  void SetFileName(const char *FileName);
93  bool Write(FILE *f, const char *Prefix = "") const;
94  bool Read(void);
95  bool Write(void) const;
96  };
97 
98 class cRecording : public cListObject {
99  friend class cRecordings;
100 private:
101  mutable int resume;
102  mutable char *titleBuffer;
103  mutable char *sortBufferName;
104  mutable char *sortBufferTime;
105  mutable char *fileName;
106  mutable char *name;
107  mutable int fileSizeMB;
108  mutable int numFrames;
109  int channel;
112  mutable int isOnVideoDirectoryFileSystem; // -1 = unknown, 0 = no, 1 = yes
115  cRecording(const cRecording&); // can't copy cRecording
116  cRecording &operator=(const cRecording &); // can't assign cRecording
117  static char *StripEpisodeName(char *s, bool Strip);
118  char *SortName(void) const;
119  void ClearSortName(void);
120  time_t start;
121  int priority;
122  int lifetime;
123  time_t deleted;
124 public:
125  cRecording(cTimer *Timer, const cEvent *Event);
126  cRecording(const char *FileName);
127  virtual ~cRecording();
128  time_t Start(void) const { return start; }
129  int Priority(void) const { return priority; }
130  int Lifetime(void) const { return lifetime; }
131  time_t Deleted(void) const { return deleted; }
132  virtual int Compare(const cListObject &ListObject) const;
133  bool IsInPath(const char *Path);
136  cString Folder(void) const;
139  cString BaseName(void) const;
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;
149  const cRecordingInfo *Info(void) const { return info; }
150  const char *PrefixFileName(char Prefix);
151  int HierarchyLevels(void) const;
152  void ResetResume(void) const;
153  double FramesPerSecond(void) const { return framesPerSecond; }
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;
167  bool IsPesRecording(void) const { return isPesRecording; }
168  bool IsOnVideoDirectoryFileSystem(void) const;
169  bool HasMarks(void);
171  bool DeleteMarks(void);
175  void ReadInfo(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);
199  bool Delete(void);
202  bool Remove(void);
205  bool Undelete(void);
209  int IsInUse(void) const;
217  };
218 
219 class cRecordings : public cList<cRecording>, public cThread {
220 private:
221  static char *updateFileName;
222  bool deleted;
223  bool initial;
224  time_t lastUpdate;
225  int state;
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);
229 protected:
230  void Action(void);
231 public:
232  cRecordings(bool Deleted = false);
233  virtual ~cRecordings();
234  bool Load(void) { return Update(true); }
238  bool Update(bool Wait = false);
244  void TouchUpdate(void);
248  bool NeedsUpdate(void);
249  void ChangeState(void) { state++; }
250  bool StateChanged(int &State);
251  void ResetResume(const char *ResumeFileName = NULL);
252  void ClearSortNames(void);
253  cRecording *GetByName(const char *FileName);
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);
282  };
283 
286 extern cRecordings Recordings;
288 
290 
292 private:
295  bool finished;
296  bool error;
297  cRecordingsHandlerEntry *Get(const char *FileName);
298 public:
299  cRecordingsHandler(void);
301  bool Add(int Usage, const char *FileNameSrc, const char *FileNameDst = NULL);
309  void Del(const char *FileName);
314  void DelAll(void);
316  int GetUsage(const char *FileName);
318  bool Active(void);
324  bool Finished(bool &Error);
329  };
330 
332 
333 #define DEFAULTFRAMESPERSECOND 25.0
334 
335 class cMark : public cListObject {
336  friend class cMarks; // for sorting
337 private:
339  int position;
341 public:
342  cMark(int Position = 0, const char *Comment = NULL, double FramesPerSecond = DEFAULTFRAMESPERSECOND);
343  virtual ~cMark();
344  int Position(void) const { return position; }
345  const char *Comment(void) const { return comment; }
347  void SetComment(const char *Comment) { comment = Comment; }
348  cString ToText(void);
349  bool Parse(const char *s);
350  bool Save(FILE *f);
351  };
352 
353 class cMarks : public cConfig<cMark>, public cMutex {
354 private:
359  time_t nextUpdate;
360  time_t lastFileTime;
361  time_t lastChange;
362 public:
363  static cString MarksFileName(const cRecording *Recording);
366  bool Load(const char *RecordingFileName, double FramesPerSecond = DEFAULTFRAMESPERSECOND, bool IsPesRecording = false);
367  bool Update(void);
368  bool Save(void);
369  void Align(void);
370  void Sort(void);
371  void Add(int Position);
377  cMark *Get(int Position);
378  cMark *GetPrev(int Position);
379  cMark *GetNext(int Position);
380  cMark *GetNextBegin(cMark *EndMark = NULL);
384  cMark *GetNextEnd(cMark *BeginMark);
387  int GetNumSequences(void);
393  };
394 
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"
400 
402 private:
403  static const char *command;
404 public:
405  static void SetCommand(const char *Command) { command = Command; }
406  static void InvokeCommand(const char *State, const char *RecordingFileName, const char *SourceFileName = NULL);
407  };
408 
409 // The maximum size of a single frame (up to HDTV 1920x1080):
410 #define MAXFRAMESIZE (KILOBYTE(1024) / TS_SIZE * TS_SIZE) // multiple of TS_SIZE to avoid breaking up TS packets
411 
412 // The maximum file size is limited by the range that can be covered
413 // with a 40 bit 'unsigned int', which is 1TB. The actual maximum value
414 // used is 6MB below the theoretical maximum, to have some safety (the
415 // actual file size may be slightly higher because we stop recording only
416 // before the next independent frame, to have a complete Group Of Pictures):
417 #define MAXVIDEOFILESIZETS 1048570 // MB
418 #define MAXVIDEOFILESIZEPES 2000 // MB
419 #define MINVIDEOFILESIZE 100 // MB
420 #define MAXVIDEOFILESIZEDEFAULT MAXVIDEOFILESIZEPES
421 
422 struct tIndexTs;
423 class cIndexFileGenerator;
424 
425 class cIndexFile {
426 private:
427  int f;
429  int size, last;
435  void ConvertFromPes(tIndexTs *IndexTs, int Count);
436  void ConvertToPes(tIndexTs *IndexTs, int Count);
437  bool CatchUp(int Index = -1);
438 public:
439  cIndexFile(const char *FileName, bool Record, bool IsPesRecording = false, bool PauseLive = false, bool Update = false);
440  ~cIndexFile();
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; }
453  int GetResume(void) { return resumeFile.Read(); }
454  bool StoreResume(int Index) { return resumeFile.Save(Index); }
455  bool IsStillRecording(void);
456  void Delete(void);
457  static int GetLength(const char *FileName, bool IsPesRecording = false);
460  static cString IndexFileName(const char *FileName, bool IsPesRecording);
461  };
462 
463 class cFileName {
464 private:
466  uint16_t fileNumber;
468  bool record;
469  bool blocking;
471 public:
472  cFileName(const char *FileName, bool Record, bool Blocking = false, bool IsPesRecording = false);
473  ~cFileName();
474  const char *Name(void) { return fileName; }
475  uint16_t Number(void) { return fileNumber; }
476  bool GetLastPatPmtVersions(int &PatVersion, int &PmtVersion);
477  cUnbufferedFile *Open(void);
478  void Close(void);
479  cUnbufferedFile *SetOffset(int Number, off_t Offset = 0); // yes, Number is int for easier internal calculating
480  cUnbufferedFile *NextFile(void);
481  };
482 
483 cString IndexToHMSF(int Index, bool WithFrame = false, double FramesPerSecond = DEFAULTFRAMESPERSECOND);
484  // Converts the given index to a string, optionally containing the frame number.
485 int HMSFToIndex(const char *HMSF, double FramesPerSecond = DEFAULTFRAMESPERSECOND);
486  // Converts the given string (format: "hh:mm:ss.ff") to an index.
487 int SecondsToFrames(int Seconds, double FramesPerSecond = DEFAULTFRAMESPERSECOND);
488  // Returns the number of frames corresponding to the given number of seconds.
489 
490 int ReadFrame(cUnbufferedFile *f, uchar *b, int Length, int Max);
491 
492 char *ExchangeChars(char *s, bool ToFileSystem);
493  // Exchanges the characters in the given string to or from a file system
494  // specific representation (depending on ToFileSystem). The given string will
495  // be modified and may be reallocated if more space is needed. The return
496  // value points to the resulting string, which may be different from s.
497 
498 bool GenerateIndex(const char *FileName, bool Update = false);
503 
506 bool HasRecordingsSortMode(const char *Directory);
507 void GetRecordingsSortMode(const char *Directory);
508 void SetRecordingsSortMode(const char *Directory, eRecordingsSortMode SortMode);
509 void IncRecordingsSortMode(const char *Directory);
510 
511 #endif //__RECORDING_H
bool initial
Definition: recording.h:223
void ClearVanishedRecordings(void)
Definition: recording.c:233
unsigned char uchar
Definition: tools.h:30
Definition: epg.h:71
void SetFramesPerSecond(double FramesPerSecond)
Definition: recording.c:440
int Priority(void) const
Definition: recording.h:129
bool DirectoryEncoding
Definition: recording.c:77
int Position(void) const
Definition: recording.h:344
bool Update(bool Wait=false)
Triggers an update of the list of recordings, which will run as a separate thread if Wait is false...
Definition: recording.c:1499
static cString MarksFileName(const cRecording *Recording)
Returns the marks file name for the given Recording (regardless whether such a file actually exists)...
Definition: recording.c:2056
int TotalFileSizeMB(void)
Definition: recording.c:1567
tIndexTs * index
Definition: recording.h:430
int NumFrames(void) const
Returns the number of frames in this recording.
Definition: recording.c:1334
void Refresh(bool Foreground=false)
Definition: recording.c:1396
cRecordingsHandler(void)
Definition: recording.c:1913
static char * StripEpisodeName(char *s, bool Strip)
Definition: recording.c:946
#define DEFAULTFRAMESPERSECOND
Definition: recording.h:333
time_t Start(void) const
Definition: recording.h:128
cRecordingInfo * info
Definition: recording.h:114
cEvent * ownEvent
Definition: recording.h:69
char * fileName
Definition: recording.h:74
char * sortBufferName
Definition: recording.h:103
bool Load(void)
Loads the current list of recordings and returns true if there is anything in it (for compatibility w...
Definition: recording.h:234
cMark * GetPrev(int Position)
Definition: recording.c:2158
void SetRecordingsSortMode(const char *Directory, eRecordingsSortMode SortMode)
Definition: recording.c:3040
const cRecordingInfo * Info(void) const
Definition: recording.h:149
void ResetResume(const char *ResumeFileName=NULL)
Definition: recording.c:1641
const cEvent * event
Definition: recording.h:68
bool CatchUp(int Index=-1)
Definition: recording.c:2573
cResumeFile(const char *FileName, bool IsPesRecording)
Definition: recording.c:241
bool Save(FILE *f)
Definition: recording.c:2049
void ChangeState(void)
Definition: recording.h:249
bool isPesRecording
Definition: recording.h:431
const char * ShortText(void) const
Definition: recording.h:86
bool IsEdited(void) const
Definition: recording.c:1144
char * name
Definition: recording.h:106
void Sort(void)
Definition: recording.c:2129
bool IsInPath(const char *Path)
Returns true if this recording is stored anywhere under the given Path.
Definition: recording.c:1021
static void InvokeCommand(const char *State, const char *RecordingFileName, const char *SourceFileName=NULL)
Definition: recording.c:2232
double FramesPerSecond(void) const
Definition: recording.h:153
eRecordingsSortMode RecordingsSortMode
Definition: recording.c:3022
cMark * GetNextBegin(cMark *EndMark=NULL)
Returns the next &quot;begin&quot; mark after EndMark, skipping any marks at the same position as EndMark...
Definition: recording.c:2176
cUnbufferedFile * SetOffset(int Number, off_t Offset=0)
Definition: recording.c:2923
const char * Title(char Delimiter= ' ', bool NewIndicator=false, int Level=-1) const
Definition: recording.c:1061
int DirectoryNameMax
Definition: recording.c:76
time_t deleted
Definition: recording.h:123
int GetNextIFrame(int Index, bool Forward, uint16_t *FileNumber=NULL, off_t *FileOffset=NULL, int *Length=NULL)
Definition: recording.c:2672
void Align(void)
Definition: recording.c:2116
bool IsOnVideoDirectoryFileSystem(void) const
Definition: recording.c:1151
bool ChangePriorityLifetime(int NewPriority, int NewLifetime)
Changes the priority and lifetime of this recording to the given values.
Definition: recording.c:1202
cMutex mutex
Definition: recording.h:434
int fileSizeMB
Definition: recording.h:107
cUnbufferedFile * NextFile(void)
Definition: recording.c:2965
Definition: tools.h:489
bool Ok(void)
Definition: recording.h:441
tChannelID channelID
Definition: recording.h:66
const cComponents * Components(void) const
Definition: recording.h:88
virtual ~cMark()
Definition: recording.c:2026
int ReadFrame(cUnbufferedFile *f, uchar *b, int Length, int Max)
Definition: recording.c:3006
double FramesPerSecond(void) const
Definition: recording.h:90
void ResetResume(void) const
Definition: recording.c:1329
cRecording(const cRecording &)
bool IsNew(void) const
Definition: recording.h:165
int Last(void)
Returns the index of the last entry in this file, or -1 if the file is empty.
Definition: recording.h:451
time_t start
Definition: recording.h:120
void SetPosition(int Position)
Definition: recording.h:346
void SetAux(const char *Aux)
Definition: recording.c:434
eRecordingsSortMode
Definition: recording.h:504
cUnbufferedFile is used for large files that are mainly written or read in a streaming manner...
Definition: tools.h:418
static cString IndexFileName(const char *FileName, bool IsPesRecording)
Definition: recording.c:2543
bool GetLastPatPmtVersions(int &PatVersion, int &PmtVersion)
Definition: recording.c:2838
static void SetCommand(const char *Command)
Definition: recording.h:405
uint16_t Number(void)
Definition: recording.h:475
static const char * command
Definition: recording.h:403
cString IndexToHMSF(int Index, bool WithFrame, double FramesPerSecond)
Definition: recording.c:2972
eRecordingUsage
Definition: recording.h:28
Definition: timers.h:27
bool ChangeName(const char *NewName)
Changes the name of this recording to the given value.
Definition: recording.c:1229
bool Save(int Index)
Definition: recording.c:304
bool isPesRecording
Definition: recording.h:54
char * SortName(void) const
Definition: recording.c:975
cMark * GetNextEnd(cMark *BeginMark)
Returns the next &quot;end&quot; mark after BeginMark, skipping any marks at the same position as BeginMark...
Definition: recording.c:2192
int priority
Definition: recording.h:121
double framesPerSecond
Definition: recording.h:113
cMark(int Position=0, const char *Comment=NULL, double FramesPerSecond=DEFAULTFRAMESPERSECOND)
Definition: recording.c:2019
int PathIsInUse(const char *Path)
Checks whether any recording in the given Path is currently in use and therefore the whole Path shall...
Definition: recording.c:1601
double framesPerSecond
Definition: recording.h:71
cRecording & operator=(const cRecording &)
cRecording * GetByName(const char *FileName)
Definition: recording.c:1510
cMark * GetNext(int Position)
Definition: recording.c:2167
void ReadInfo(void)
Definition: recording.c:1174
const char * Comment(void) const
Definition: recording.h:345
void GetRecordingsSortMode(const char *Directory)
Definition: recording.c:3029
void SetFileName(const char *FileName)
Definition: recording.c:445
bool isPesRecording
Definition: recording.h:358
char * aux
Definition: recording.h:70
time_t lastChange
Definition: recording.h:361
bool deleted
Definition: recording.h:222
virtual ~cRecording()
Definition: recording.c:936
char * sortBufferTime
Definition: recording.h:104
bool record
Definition: recording.h:468
bool isPesRecording
Definition: recording.h:111
time_t Deleted(void) const
Definition: recording.h:131
void SetData(const char *Title, const char *ShortText, const char *Description)
Definition: recording.c:424
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...
Definition: recording.c:1006
int LengthInSeconds(void) const
Returns the length (in seconds) of this recording, or -1 in case of error.
Definition: recording.c:1345
bool blocking
Definition: recording.h:469
void RemoveDeletedRecordings(void)
Definition: recording.c:133
int instanceId
Definition: recording.h:110
void UpdateByName(const char *FileName)
Definition: recording.c:1559
int GetNumRecordingsInPath(const char *Path)
Returns the total number of recordings in the given Path, including all sub-folders of Path...
Definition: recording.c:1612
int HMSFToIndex(const char *HMSF, double FramesPerSecond)
Definition: recording.c:2988
char * channelName
Definition: recording.h:67
int position
Definition: recording.h:339
int lifetime
Definition: recording.h:122
void SetStartTime(time_t Start)
Sets the start time of this recording to the given value.
Definition: recording.c:1195
bool Finished(bool &Error)
Returns true if all operations in the list have been finished.
Definition: recording.c:2002
bool GenerateIndex(const char *FileName, bool Update)
Generates the index of the existing recording with the given FileName.
Definition: recording.c:2778
int FileSizeMB(void) const
Returns the total file size of this recording (in MB), or -1 if the file size is unknown.
Definition: recording.c:1353
bool Delete(void)
Changes the file name so that it will no longer be visible in the &quot;Recordings&quot; menu Returns false in ...
Definition: recording.c:1255
tChannelID ChannelID(void) const
Definition: recording.h:82
void ConvertToPes(tIndexTs *IndexTs, int Count)
Definition: recording.c:2560
cUnbufferedFile * Open(void)
Definition: recording.c:2889
static int GetLength(const char *FileName, bool IsPesRecording=false)
Calculates the recording length (number of frames) without actually reading the index file...
Definition: recording.c:2769
int Lifetime(void) const
Definition: recording.h:130
int isOnVideoDirectoryFileSystem
Definition: recording.h:112
void ConvertFromPes(tIndexTs *IndexTs, int Count)
Definition: recording.c:2548
char * pFileNumber
Definition: recording.h:467
int GetClosestIFrame(int Index)
Returns the index of the I-frame that is closest to the given Index (or Index itself, if it already points to an I-frame).
Definition: recording.c:2710
bool Write(void) const
Definition: recording.c:542
char * fileName
Definition: recording.h:467
static char * updateFileName
Definition: recording.h:221
bool HasRecordingsSortMode(const char *Directory)
Definition: recording.c:3024
Definition: thread.h:63
int InstanceId
Definition: recording.c:78
bool Read(void)
Definition: recording.c:524
cRecordingsHandler RecordingsHandler
Definition: recording.c:1911
int HierarchyLevels(void) const
Definition: recording.c:1133
void Action(void)
A derived cThread class must implement the code it wants to execute as a separate thread in this func...
Definition: recording.c:1384
void TouchUpdate(void)
Touches the &#39;.update&#39; file in the video directory, so that other instances of VDR that access the sam...
Definition: recording.c:1483
bool MoveRecordings(const char *OldPath, const char *NewPath)
Moves all recordings in OldPath to NewPath.
Definition: recording.c:1623
bool Parse(const char *s)
Definition: recording.c:2035
const char * UpdateFileName(void)
Definition: recording.c:1389
cIndexFile(const char *FileName, bool Record, bool IsPesRecording=false, bool PauseLive=false, bool Update=false)
Definition: recording.c:2451
bool Remove(void)
Actually removes the file from the disk Returns false in case of error.
Definition: recording.c:1281
const char * Name(void)
Definition: recording.h:474
cString BaseName(void) const
Returns the base name of this recording (without the video directory and folder). ...
Definition: recording.c:1036
int GetUsage(const char *FileName)
Returns the usage type for the given FileName.
Definition: recording.c:1982
cString fileName
Definition: recording.h:356
cRecordings DeletedRecordings
bool StoreResume(int Index)
Definition: recording.h:454
cIndexFileGenerator * indexFileGenerator
Definition: recording.h:433
cString comment
Definition: recording.h:340
cRecordings(bool Deleted=false)
Definition: recording.c:1370
int DirectoryPathMax
Definition: recording.c:75
char * titleBuffer
Definition: recording.h:102
int GetNumSequences(void)
Returns the actual number of sequences to be cut from the recording.
Definition: recording.c:2210
int channel
Definition: recording.h:109
void DelAll(void)
Deletes/terminates all operations.
Definition: recording.c:1975
cMark * Get(int Position)
Definition: recording.c:2149
cFileName(const char *FileName, bool Record, bool Blocking=false, bool IsPesRecording=false)
Definition: recording.c:2814
int GetResume(void)
Definition: recording.h:453
cString fileName
Definition: recording.h:428
void Delete(void)
Definition: recording.c:2757
time_t lastFileTime
Definition: recording.h:360
bool NeedsUpdate(void)
Definition: recording.c:1491
void Close(void)
Definition: recording.c:2913
void Delete(void)
Definition: recording.c:332
void ClearSortName(void)
Definition: recording.c:999
cRecordings Recordings
Any access to Recordings that loops through the list of recordings needs to hold a thread lock on thi...
Definition: recording.c:1366
double MBperMinute(void)
Returns the average data rate (in MB/min) of all recordings, or -1 if this value is unknown...
Definition: recording.c:1579
void Add(int Position)
If this cMarks object is used by multiple threads, the caller must Lock() it before calling Add() and...
Definition: recording.c:2142
cRecordingsHandlerEntry * Get(const char *FileName)
Definition: recording.c:1923
void IncRecordingsSortMode(const char *Directory)
Definition: recording.c:3048
const cEvent * GetEvent(void) const
Definition: recording.h:84
const char * Description(void) const
Definition: recording.h:87
const char * Name(void) const
Returns the full name of the recording (without the video directory.
Definition: recording.h:142
void AssertFreeDiskSpace(int Priority, bool Force)
The special Priority value -1 means that we shall get rid of any deleted recordings faster than norma...
Definition: recording.c:150
double framesPerSecond
Definition: recording.h:357
cResumeFile resumeFile
Definition: recording.h:432
Definition: thread.h:77
void DelByName(const char *FileName)
Definition: recording.c:1535
char * fileName
Definition: recording.h:53
const char * Title(void) const
Definition: recording.h:85
cList< cRecordingsHandlerEntry > operations
Definition: recording.h:294
bool Update(void)
Definition: recording.c:2074
void ClearSortNames(void)
Definition: recording.c:1651
int SecondsToFrames(int Seconds, double FramesPerSecond)
Definition: recording.c:2999
bool StateChanged(int &State)
Definition: recording.c:1475
cString Folder(void) const
Returns the name of the folder this recording is stored in (without the video directory).
Definition: recording.c:1029
int Read(void)
Definition: recording.c:259
int resume
Definition: recording.h:101
bool Load(const char *RecordingFileName, double FramesPerSecond=DEFAULTFRAMESPERSECOND, bool IsPesRecording=false)
Definition: recording.c:2061
cRecordingInfo(const cChannel *Channel=NULL, const cEvent *Event=NULL)
Definition: recording.c:344
bool DeleteMarks(void)
Deletes the editing marks from this recording (if any).
Definition: recording.c:1163
time_t nextUpdate
Definition: recording.h:359
bool Get(int Index, uint16_t *FileNumber, off_t *FileOffset, bool *Independent=NULL, int *Length=NULL)
Definition: recording.c:2646
bool Active(void)
Checks whether there is currently any operation running and starts the next one form the list if the ...
Definition: recording.c:1990
const char * ChannelName(void) const
Definition: recording.h:83
bool IsStillRecording(void)
Definition: recording.c:2752
void SetComment(const char *Comment)
Definition: recording.h:347
const char * Aux(void) const
Definition: recording.h:89
char * ExchangeChars(char *s, bool ToFileSystem)
Definition: recording.c:583
bool isPesRecording
Definition: recording.h:470
uint16_t fileNumber
Definition: recording.h:466
cString recordingFileName
Definition: recording.h:355
char * fileName
Definition: recording.h:105
const char * FileName(void) const
Returns the full path name to the recording directory, including the video directory and the actual &#39;...
Definition: recording.c:1043
time_t lastUpdate
Definition: recording.h:224
virtual int Compare(const cListObject &ListObject) const
Must return 0 if this object is equal to ListObject, a positive value if it is &quot;greater&quot;, and a negative value if it is &quot;smaller&quot;.
Definition: recording.c:1015
const char * PrefixFileName(char Prefix)
Definition: recording.c:1122
bool WriteInfo(const char *OtherFileName=NULL)
Writes in info file of this recording.
Definition: recording.c:1182
bool Save(void)
Definition: recording.c:2106
cUnbufferedFile * file
Definition: recording.h:465
int numFrames
Definition: recording.h:108
void Del(const char *FileName)
Deletes the given FileName from the list of operations.
Definition: recording.c:1966
void AddByName(const char *FileName, bool TriggerUpdate=true)
Definition: recording.c:1522
bool IsPesRecording(void) const
Definition: recording.h:167
int IsInUse(void) const
Checks whether this recording is currently in use and therefore shall not be tampered with...
Definition: recording.c:1318
virtual ~cRecordings()
Definition: recording.c:1379
bool Write(bool Independent, uint16_t FileNumber, off_t FileOffset)
Definition: recording.c:2629
double framesPerSecond
Definition: recording.h:338
bool Add(int Usage, const char *FileNameSrc, const char *FileNameDst=NULL)
Adds the given FileNameSrc to the recordings handler for (later) processing.
Definition: recording.c:1934
bool Undelete(void)
Changes the file name so that it will be visible in the &quot;Recordings&quot; menu again and not processed by ...
Definition: recording.c:1292
Definition: tools.h:168
cString ToText(void)
Definition: recording.c:2030
bool HasMarks(void)
Returns true if this recording has any editing marks.
Definition: recording.c:1158
bool ScanVideoDir(const char *DirName, bool Foreground=false, int LinkLevel=0, int DirLevel=0)
Definition: recording.c:1409