vdr 2.8.4
recorder.h
Go to the documentation of this file.
1/*
2 * recorder.h: The actual DVB recorder
3 *
4 * See the main source file 'vdr.c' for copyright information and
5 * how to reach the author.
6 *
7 * $Id: recorder.h 5.6 2025/12/26 16:04:59 kls Exp $
8 */
9
10#ifndef __RECORDER_H
11#define __RECORDER_H
12
13#include <atomic>
14#include "receiver.h"
15#include "recording.h"
16#include "remux.h"
17#include "ringbuffer.h"
18#include "thread.h"
19
20class cRecorder : public cReceiver, cThread {
21private:
30 std::atomic<bool> working; // set by the recorder thread, read by the receiver thread in Receive()
32 off_t fileSize;
37 int errors;
39 void GetLastPts(const char *RecordingName);
40 bool RunningLowOnDiskSpace(void);
41 bool NextFile(void);
42 void HandleErrors(bool Force = false);
43protected:
44 virtual void Activate(bool On) override;
49 virtual void Receive(const uchar *Data, int Length) override;
50 virtual void Action(void) override;
51public:
52 cRecorder(const char *FileName, const cChannel *Channel, int Priority);
55 virtual ~cRecorder() override;
56 void Stop(void);
59 int Errors(void) { return oldErrors + errors + tmpErrors; };
64 };
65
66#endif //__RECORDER_H
int Priority(void)
Definition receiver.h:58
cReceiver(const cChannel *Channel=NULL, int Priority=MINPRIORITY)
Creates a new receiver for the given Channel with the given Priority.
Definition receiver.c:14
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...
Definition recorder.c:24
bool NextFile(void)
Definition recorder.c:127
cFileName * fileName
Definition recorder.h:25
cIndexFile * index
Definition recorder.h:27
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 ...
Definition recorder.c:146
int Errors(void)
Definition recorder.h:59
time_t lastErrorLog
Definition recorder.h:34
virtual void Activate(bool On) override
If you override Activate() you need to call Detach() (which is a member of the cReceiver class) from ...
Definition recorder.c:138
std::atomic< bool > working
Definition recorder.h:30
void HandleErrors(bool Force=false)
Definition recorder.c:96
void GetLastPts(const char *RecordingName)
Definition recorder.c:179
void Stop(void)
Stops the recorder.
Definition recorder.c:89
off_t fileSize
Definition recorder.h:32
cRecordingInfo * recordingInfo
Definition recorder.h:26
cFrameDetector * frameDetector
Definition recorder.h:23
time_t lastDiskSpaceCheck
Definition recorder.h:33
cUnbufferedFile * recordFile
Definition recorder.h:28
virtual void Action(void) override
A derived cThread class must implement the code it wants to execute as a separate thread in this func...
Definition recorder.c:231
bool firstIframeSeen
Definition recorder.h:31
cRingBufferLinear * ringBuffer
Definition recorder.h:22
int tmpErrors
Definition recorder.h:36
char * recordingName
Definition recorder.h:29
int oldErrors
Definition recorder.h:35
bool RunningLowOnDiskSpace(void)
Definition recorder.c:114
int errors
Definition recorder.h:37
cPatPmtGenerator patPmtGenerator
Definition recorder.h:24
int lastErrors
Definition recorder.h:38
cThread(const char *Description=NULL, bool LowPriority=false)
Creates a new thread.
Definition thread.c:264
cUnbufferedFile is used for large files that are mainly written or read in a streaming manner,...
Definition tools.h:513
unsigned char uchar
Definition tools.h:31