13 #define RECORDERBUFSIZE (MEGABYTE(20) / TS_SIZE * TS_SIZE)
17 #define MAXBROKENTIMEOUT 30000
19 #define MINFREEDISKSPACE (512)
20 #define DISKCHECKINTERVAL 100
44 int Pid = Channel->
Vpid();
45 int Type = Channel->
Vtype();
46 if (!Pid && Channel->
Apid(0)) {
47 Pid = Channel->
Apid(0);
50 if (!Pid && Channel->
Dpid(0)) {
51 Pid = Channel->
Dpid(0);
60 int PatVersion, PmtVersion;
70 esyslog(
"ERROR: can't allocate index");
84 #define ERROR_LOG_DELTA 1
139 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
140 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
141 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
142 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
143 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
144 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
145 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
146 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
147 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
148 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
149 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
150 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
151 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
152 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
153 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
154 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
155 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
156 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
158 if ((Data[3] & 0b00110000) == 0b00100000 && !memcmp(Data + 4, aff,
sizeof(aff)))
169 bool InfoWritten =
false;
170 bool pendIndependentFrame =
false;
171 uint16_t pendNumber = 0;
172 off_t pendFileSize = 0;
173 bool pendErrors =
false;
174 bool pendMissing =
false;
206 int PreviousErrors = 0;
207 int MissingFrames = 0;
211 index->
Write(pendIndependentFrame, pendNumber, pendFileSize, pendErrors, pendMissing);
215 pendErrors = PreviousErrors;
216 pendMissing = MissingFrames;
246 index->
Write(pendIndependentFrame, pendNumber, pendFileSize, pendErrors, pendMissing);
250 esyslog(
"ERROR: video data stream broken");
256 index->
Write(pendIndependentFrame, pendNumber, pendFileSize, pendErrors, pendMissing);
cUnbufferedFile * NextFile(void)
cUnbufferedFile * Open(void)
bool GetLastPatPmtVersions(int &PatVersion, int &PmtVersion)
bool Synced(void)
Returns true if the frame detector has synced on the data stream.
bool IndependentFrame(void)
Returns true if a new frame was detected and this is an independent frame (i.e.
double FramesPerSecond(void)
Returns the number of frames per second, or 0 if this information is not available.
uint16_t FrameWidth(void)
Returns the frame width, or 0 if this information is not available.
eScanType ScanType(void)
Returns the scan type, or stUnknown if this information is not available.
bool NewFrame(int *PreviousErrors=NULL, int *MissingFrames=NULL)
Returns true if the data given to the last call to Analyze() started a new frame.
int Analyze(const uchar *Data, int Length, bool ErrorCheck=true)
Analyzes the TS packets pointed to by Data.
uint16_t FrameHeight(void)
Returns the frame height, or 0 if this information is not available.
void SetMissing(void)
Call if this is a resumed recording, which has missing frames.
eAspectRatio AspectRatio(void)
Returns the aspect ratio, or arUnknown if this information is not available.
bool Write(bool Independent, uint16_t FileNumber, off_t FileOffset, bool Errors=false, bool Missing=false)
uchar * GetPmt(int &Index)
Returns a pointer to the Index'th TS packet of the PMT section.
void SetChannel(const cChannel *Channel)
Sets the Channel for which the PAT/PMT shall be generated.
void SetVersions(int PatVersion, int PmtVersion)
Sets the version numbers for the generated PAT and PMT, in case this generator is used to,...
uchar * GetPat(void)
Returns a pointer to the PAT section, which consists of exactly one TS packet.
cRecorder(const char *FileName, const cChannel *Channel, int Priority)
Creates a new recorder for the given Channel and the given Priority that will record into the file Fi...
virtual void Receive(const uchar *Data, int Length) override
This function is called from the cDevice we are attached to, and delivers one TS packet from the set ...
virtual void Activate(bool On) override
If you override Activate() you need to call Detach() (which is a member of the cReceiver class) from ...
void HandleErrors(bool Force=false)
cRecordingInfo * recordingInfo
cFrameDetector * frameDetector
time_t lastDiskSpaceCheck
cUnbufferedFile * recordFile
virtual void Action(void) override
A derived cThread class must implement the code it wants to execute as a separate thread in this func...
cRingBufferLinear * ringBuffer
bool RunningLowOnDiskSpace(void)
virtual ~cRecorder() override
cPatPmtGenerator patPmtGenerator
void SetFramesPerSecond(double FramesPerSecond)
uint16_t FrameHeight(void) const
bool Write(FILE *f, const char *Prefix="") const
uint16_t FrameWidth(void) const
void SetFrameParams(uint16_t FrameWidth, uint16_t FrameHeight, eScanType ScanType, eAspectRatio AspectRatio)
void SetErrors(int Errors)
eAspectRatio AspectRatio(void) const
bool Read(FILE *f, bool Force=false)
double FramesPerSecond(void) const
static void InvokeCommand(const char *State, const char *RecordingFileName, const char *SourceFileName=NULL)
void Del(int Count)
Deletes at most Count bytes from the ring buffer.
int Put(const uchar *Data, int Count)
Puts at most Count bytes of Data into the ring buffer.
uchar * Get(int &Count)
Gets data from the ring buffer.
void SetTimeouts(int PutTimeout, int GetTimeout)
void ReportOverflow(int Bytes)
void RequestEmergencyExit(void)
Requests an emergency exit of the VDR main loop.
void bool Start(void)
Sets the description of this thread, which will be used when logging starting or stopping of the thre...
bool Running(void)
Returns false if a derived cThread object shall leave its Action() function.
void Cancel(int WaitSeconds=0)
Cancels the thread by first setting 'running' to false, so that the Action() loop can finish in an or...
void Set(int Ms=0)
Sets the timer.
bool TimedOut(void) const
ssize_t Write(const void *Data, size_t Size)
#define DISKCHECKINTERVAL
#define DEFAULTFRAMESPERSECOND
#define LOCK_RECORDINGS_WRITE
#define RUC_STARTRECORDING
#define MIN_TS_PACKETS_FOR_FRAME_DETECTOR
cShutdownHandler ShutdownHandler