13 #define RECORDERBUFSIZE (MEGABYTE(20) / TS_SIZE * TS_SIZE)
17 #define MAXBROKENTIMEOUT 30000
19 #define MINFREEDISKSPACE (512)
20 #define DISKCHECKINTERVAL 100
38 int Pid = Channel->
Vpid();
39 int Type = Channel->
Vtype();
40 if (!Pid && Channel->
Apid(0)) {
41 Pid = Channel->
Apid(0);
44 if (!Pid && Channel->
Dpid(0)) {
45 Pid = Channel->
Dpid(0);
50 && (
Setup.
DumpNaluFill ? (strstr(FileName,
"NALUKEEP") == NULL) : (strstr(FileName,
"NALUDUMP") != NULL))) {
51 isyslog(
"Starting NALU fill dumper");
61 int PatVersion, PmtVersion;
71 esyslog(
"ERROR: can't allocate index");
81 isyslog(
"NALU fill dumper: %lld of %lld packets dropped, %lli%%", DroppedPackets, TotalPackets, TotalPackets ? DroppedPackets*100/TotalPackets : 0);
127 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
128 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
129 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
130 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
131 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
132 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
133 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
134 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
135 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
136 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
137 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
138 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
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,
146 if ((Data[3] & 0b00110000) == 0b00100000 && !memcmp(Data + 4, aff,
sizeof(aff)))
157 bool InfoWritten =
false;
158 bool FirstIframeSeen =
false;
170 if (RecordingInfo.
Read()) {
173 RecordingInfo.
Write();
182 FirstIframeSeen =
true;
203 if (!OutData || OutLength <= 0)
229 esyslog(
"ERROR: video data stream broken");
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.
int Analyze(const uchar *Data, int Length)
Analyzes the TS packets pointed to by Data.
bool NewFrame(void)
Returns true if the data given to the last call to Analyze() started a new frame.
bool Write(bool Independent, uint16_t FileNumber, off_t FileOffset)
long long int GetTotalPackets()
void PutBuffer(uchar *Data, int Length)
uchar * GetBuffer(int &OutLength)
long long int GetDroppedPackets()
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)
This function is called from the cDevice we are attached to, and delivers one TS packet from the set ...
virtual void Action(void)
A derived cThread class must implement the code it wants to execute as a separate thread in this func...
cFrameDetector * frameDetector
time_t lastDiskSpaceCheck
cUnbufferedFile * recordFile
cRingBufferLinear * ringBuffer
bool RunningLowOnDiskSpace(void)
virtual void Activate(bool On)
If you override Activate() you need to call Detach() (which is a member of the cReceiver class) from ...
cNaluStreamProcessor * naluStreamProcessor
cPatPmtGenerator patPmtGenerator
void SetFramesPerSecond(double FramesPerSecond)
bool Write(FILE *f, const char *Prefix="") const
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