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);
53 int PatVersion, PmtVersion;
63 esyslog(
"ERROR: can't allocate index");
113 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
114 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
115 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
116 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
117 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
118 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
119 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
120 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
121 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
122 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
123 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
124 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
125 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
126 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
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,
132 if ((Data[3] & 0b00110000) == 0b00100000 && !memcmp(Data + 4, aff,
sizeof(aff)))
143 bool InfoWritten =
false;
144 bool FirstIframeSeen =
false;
156 if (RecordingInfo.
Read()) {
159 RecordingInfo.
Write();
168 FirstIframeSeen =
true;
194 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.
cUnbufferedFile * NextFile(void)
time_t lastDiskSpaceCheck
void SetChannel(const cChannel *Channel)
Sets the Channel for which the PAT/PMT shall be generated.
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.
#define LOCK_RECORDINGS_WRITE
virtual void Action(void)
A derived cThread class must implement the code it wants to execute as a separate thread in this func...
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.
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.
double FramesPerSecond(void) const
#define DISKCHECKINTERVAL
#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.
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
bool Write(FILE *f, const char *Prefix="") const
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 ...
#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)
int Priority(void) const
Returns the priority of the current receiving session (-MAXPRIORITY..MAXPRIORITY),...
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 ...
uchar * GetPat(void)
Returns a pointer to the PAT section, which consists of exactly one TS packet.
cUnbufferedFile * recordFile
void ReportOverflow(int Bytes)
bool TimedOut(void) const