39#define LOC QString("V4L2Rec[%1](%2): ") \
40 .arg(m_tvrec ? m_tvrec->GetInputId() : -1) \
41 .arg(m_channel->GetDevice())
48 m_error =
"Failed to open device";
76 const QString &videodev,
77 [[maybe_unused]]
const QString &audiodev,
78 [[maybe_unused]]
const QString &vbidev)
80 LOG(VB_GENERAL, LOG_INFO,
LOC +
"SetOptionsFromProfile() -- begin");
119 LOG(VB_GENERAL, LOG_INFO,
LOC +
"SetOptionsFromProfile -- end");
124 LOG(VB_RECORD, LOG_INFO,
LOC +
"StartNewFile -- begin");
128 LOG(VB_RECORD, LOG_INFO,
LOC +
"StartNewFile -- end");
134 LOG(VB_RECORD, LOG_INFO,
LOC +
"run() -- begin");
140 m_error =
"MPEGStreamData pointer has not been set";
162 LOG(VB_GENERAL, LOG_INFO,
LOC +
"PMT set");
170 LOG(VB_RECORD, LOG_INFO,
LOC +
"mpeg2ts");
176 LOG(VB_RECORD, LOG_INFO,
LOC +
"program stream (non mpeg2ts)");
191 LOG(VB_GENERAL, LOG_WARNING,
LOC +
192 "Recording will not commence until a PMT is set.");
193 std::this_thread::sleep_for(5ms);
197 bool failing =
false;
203 m_error =
"Stream handler died unexpectedly.";
212 LOG(VB_RECORD, LOG_INFO,
LOC +
"Shutting down");
235 LOG(VB_RECORD, LOG_INFO,
LOC +
"run() -- end");
240 LOG(VB_RECORD, LOG_INFO,
LOC +
"Open() -- begin");
244 LOG(VB_RECORD, LOG_WARNING,
LOC +
"Open() -- Card already open");
255 LOG(VB_GENERAL, LOG_ERR,
LOC +
256 "Open() -- Failed to get a stream handler.");
262 LOG(VB_GENERAL, LOG_ERR,
LOC +
263 QString(
"Open() -- Failed to open recorder: %1")
272 LOG(VB_RECORD, LOG_INFO,
LOC +
"Open() -- Success.");
278 LOG(VB_RECORD, LOG_INFO,
LOC +
"Close() -- begin");
285 LOG(VB_RECORD, LOG_INFO,
LOC +
"Close() -- end");
295 LOG(VB_RECORD, LOG_INFO,
LOC +
"PauseAndWait() -- pause");
308 LOG(VB_RECORD, LOG_INFO,
LOC +
"PauseAndWait() -- unpause");
325 LOG(VB_RECORD, LOG_DEBUG,
LOC +
"V4L2encRecorder::StartEncoding() -- begin");
331 LOG(VB_RECORD, LOG_DEBUG,
LOC +
"V4L2encRecorder::StartEncoding() -- end");
337 LOG(VB_RECORD, LOG_DEBUG,
LOC +
"V4L2encRecorder::StopEncoding()");
bool HasGeneratedPAT(void) const
const ProgramMapTable * GetGeneratedPMT(void) const
const ProgramAssociationTable * GetGeneratedPAT(void) const
QString m_error
non-empty iff irrecoverable recording error detected
void FinishRecording(void) override
Flushes the ringbuffer, and if this is not a live LiveTV recording saves the position map and filesiz...
ProgramMapTable * m_inputPmt
PMT on input side.
bool IsErrored(void) override
Tells us whether an unrecoverable error has been encountered.
H2645Parser * m_h2645Parser
void HandleSingleProgramPAT(ProgramAssociationTable *pat, bool insert) override
bool m_waitForKeyframeOption
Wait for the a GOP/SEQ-start before sending data.
MPEGStreamData * m_streamData
void HandleSingleProgramPMT(ProgramMapTable *pmt, bool insert) override
void AddPSStreamListener(PSStreamListener *val)
const ProgramMapTable * PMTSingleProgram(void) const
void AddWritingListener(TSPacketListener *val)
int DesiredProgram(void) const
void RemoveWritingListener(TSPacketListener *val)
void RemovePSStreamListener(PSStreamListener *val)
const ProgramAssociationTable * PATSingleProgram(void) const
void RemoveAVListener(TSPacketListenerAV *val)
virtual bool HandleTables(uint pid, const PSIPTable &psip)
Process PSIP packets.
void AddAVListener(TSPacketListenerAV *val)
QString GetSetting(const QString &key, const QString &defaultval="")
The Program Association Table lists all the programs in a stream, and is always found on PID 0.
uint ProgramNumber(uint i) const
uint ProgramPID(uint i) const
A PMT table maps a program described in the ProgramAssociationTable to various PID's which describe t...
virtual bool IsRecordingRequested(void)
Tells us if StopRecording() has been called.
bool m_recording
True while recording is actually being performed.
virtual void SetRecordingStatus(RecStatus::Type status, const QString &file, int line)
QWaitCondition m_pauseWait
virtual bool IsPaused(bool holding_lock=false) const
Returns true iff recorder is paused.
bool m_requestRecording
True if API call has requested a recording be [re]started.
QWaitCondition m_unpauseWait
QWaitCondition m_recordingWait
virtual QString getValue(void) const
virtual void RemoveListener(MPEGStreamData *data)
virtual void AddListener(MPEGStreamData *data, bool allow_section_reader=false, bool needs_buffering=false, const QString &output_file=QString())
This is the coordinating class of the Recorder Subsystem.
void RecorderPaused(void)
This is a callback, called by the "recorder" instance when it has actually paused.
uint GetInputId(void) const
Returns the inputid.
void run(void) override
run() starts the recording process, and does not exit until the recording is complete.
V4L2encRecorder(TVRec *rec, V4LChannel *channel)
void SetStrOption(RecordingProfile *profile, const QString &name)
void SetIntOption(RecordingProfile *profile, const QString &name)
V4L2encStreamHandler * m_streamHandler
bool PauseAndWait(std::chrono::milliseconds timeout=500ms) override
If m_requestPause is true, sets pause and blocks up to timeout milliseconds or until unpaused,...
void SetOptionsFromProfile(RecordingProfile *profile, const QString &videodev, const QString &audiodev, const QString &vbidev) override
Sets basic recorder options.
void StartNewFile(void) override
bool SetOption(const QString &opt, int value)
bool Status(bool &failed, bool &failing)
static void Return(V4L2encStreamHandler *&ref, int inputid)
QString ErrorString(void) const
static V4L2encStreamHandler * Get(const QString &devname, int audioinput, int inputid)
Implements tuning for TV cards using the V4L driver API, both versions 1 and 2.
QString GetAudioDevice(void) const
QString GetDevice(void) const override
Returns String representing device, useful for debugging.
Abstract base class for Video4Linux based recorders.
void SetOption(const QString &name, const QString &value) override
Set an specific option.
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
#define LOG(_MASK_, _LEVEL_, _QSTRING_)