13 #define RECORDERBUFSIZE (MEGABYTE(20) / TS_SIZE * TS_SIZE) // multiple of TS_SIZE 17 #define MAXBROKENTIMEOUT 30000 // milliseconds 19 #define MINFREEDISKSPACE (512) // MB 20 #define DISKCHECKINTERVAL 100 // seconds 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);
135 bool InfoWritten =
false;
136 bool FirstIframeSeen =
false;
148 if (RecordingInfo.
Read()) {
151 RecordingInfo.
Write();
159 FirstIframeSeen =
true;
180 if (!OutData || OutLength <= 0)
206 esyslog(
"ERROR: video data stream broken");
void SetFramesPerSecond(double FramesPerSecond)
ssize_t Write(const void *Data, size_t Size)
void SetVersions(int PatVersion, int PmtVersion)
Sets the version numbers for the generated PAT and PMT, in case this generator is used to...
#define DEFAULTFRAMESPERSECOND
cFrameDetector * frameDetector
static void InvokeCommand(const char *State, const char *RecordingFileName, const char *SourceFileName=NULL)
bool RunningLowOnDiskSpace(void)
int Analyze(const uchar *Data, int Length)
Analyzes the TS packets pointed to by Data.
long long int GetDroppedPackets()
cUnbufferedFile * NextFile(void)
time_t lastDiskSpaceCheck
void SetChannel(const cChannel *Channel)
Sets the Channel for which the PAT/PMT shall be generated.
double FramesPerSecond(void) const
int Put(const uchar *Data, int Count)
Puts at most Count bytes of Data into the ring buffer.
bool GetLastPatPmtVersions(int &PatVersion, int &PmtVersion)
bool Synced(void)
Returns true if the frame detector has synced on the data stream.
long long int GetTotalPackets()
bool Write(FILE *f, const char *Prefix="") const
bool TimedOut(void) const
virtual void Action(void)
A derived cThread class must implement the code it wants to execute as a separate thread in this func...
void UpdateByName(const char *FileName)
void bool Start(void)
Sets the description of this thread, which will be used when logging starting or stopping of the thre...
uchar * GetPmt(int &Index)
Returns a pointer to the Index'th TS packet of the PMT section.
cUnbufferedFile * Open(void)
cPatPmtGenerator patPmtGenerator
cShutdownHandler ShutdownHandler
bool Running(void)
Returns false if a derived cThread object shall leave its Action() function.
virtual void Receive(uchar *Data, int Length)
This function is called from the cDevice we are attached to, and delivers one TS packet from the set ...
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...
void Del(int Count)
Deletes at most Count bytes from the ring buffer.
#define DISKCHECKINTERVAL
int Priority(void) const
Returns the priority of the current receiving session (-MAXPRIORITY..MAXPRIORITY), or IDLEPRIORITY if no receiver is currently active.
#define MIN_TS_PACKETS_FOR_FRAME_DETECTOR
bool NewFrame(void)
Returns true if the data given to the last call to Analyze() started a new frame. ...
bool IndependentFrame(void)
Returns true if a new frame was detected and this is an independent frame (i.e.
cRecordings Recordings
Any access to Recordings that loops through the list of recordings needs to hold a thread lock on thi...
uchar * Get(int &Count)
Gets data from the ring buffer.
double FramesPerSecond(void)
Returns the number of frames per second, or 0 if this information is not available.
cRingBufferLinear * ringBuffer
cNaluStreamProcessor * naluStreamProcessor
void Cancel(int WaitSeconds=0)
Cancels the thread by first setting 'running' to false, so that the Action() loop can finish in an or...
virtual void Activate(bool On)
If you override Activate() you need to call Detach() (which is a member of the cReceiver class) from ...
void PutBuffer(uchar *Data, int Length)
#define RUC_STARTRECORDING
void SetTimeouts(int PutTimeout, int GetTimeout)
void RequestEmergencyExit(void)
Requests an emergency exit of the VDR main loop.
bool Write(bool Independent, uint16_t FileNumber, off_t FileOffset)
uchar * GetPat(void)
Returns a pointer to the PAT section, which consists of exactly one TS packet.
cUnbufferedFile * recordFile
uchar * GetBuffer(int &OutLength)
void ReportOverflow(int Bytes)