22#if QT_VERSION >= QT_VERSION_CHECK(6,5,0)
23#include <QtSystemDetection>
28#include <sys/select.h>
50#define TVREC_CARDNUM \
51 ((m_tvrec != nullptr) ? QString::number(m_tvrec->GetInputId()) : "NULL")
53#define LOC QString("ImportRec[%1](%2): ") \
54 .arg(TVREC_CARDNUM, m_videodevice)
57 const QString &videodev,
58 [[maybe_unused]]
const QString &audiodev,
59 [[maybe_unused]]
const QString &vbidev)
61 QString testVideoDev = videodev;
63 if (videodev.startsWith(
"file:", Qt::CaseInsensitive))
64 testVideoDev = videodev.mid(5);
66 QFileInfo fi(testVideoDev);
67 if (fi.exists() && fi.isReadable() && fi.isFile() && fi.size() > 1560)
98 LOG(VB_RECORD, LOG_INFO,
LOC +
"run -- begin");
107 LOG(VB_RECORD, LOG_INFO,
LOC +
"run -- " +
108 QString(
"attempting to open '%1'")
132 ctx->SetRingBuffer(buffer);
137 cfp->RebuildSeekTable(
false,
UpdateFS,
this);
155 LOG(VB_RECORD, LOG_INFO,
LOC +
"run -- end");
165 LOG(VB_RECORD, LOG_ERR,
LOC +
"no current recording!");
178 if (preRecorded.exists() && (!
copy.exists() ||
copy.size() == 0))
183 targetDir.remove(fn);
186 LOG(VB_RECORD, LOG_INFO,
LOC + QString(
"Trying to link %1 to %2")
189 if (preRecorded.link(fn))
190 LOG(VB_RECORD, LOG_DEBUG,
LOC +
"success!");
192 LOG(VB_RECORD, LOG_ERR,
LOC + preRecorded.errorString());
195 if (fn.startsWith(
"myth://", Qt::CaseInsensitive))
197 LOG(VB_RECORD, LOG_ERR,
LOC +
"Malformed recording ProgramInfo.");
204 LOG(VB_RECORD, LOG_INFO,
LOC +
205 QString(
"'%1' does not exist yet").arg(fn));
210 std::this_thread::sleep_for(250ms);
216 LOG(VB_GENERAL, LOG_ERR,
LOC +
217 QString(
"'%1' is not readable").arg(fn));
222 LOG(VB_GENERAL, LOG_ERR,
LOC +
223 QString(
"'%1' is empty").arg(fn));
227 m_importFd = open(fn.toLocal8Bit().constData(), O_RDONLY);
230 LOG(VB_GENERAL, LOG_ERR,
LOC +
231 QString(
"Couldn't open '%1'").arg(fn) +
ENO);
void FinishRecording(void) override
Flushes the ringbuffer, and if this is not a live LiveTV recording saves the position map and filesiz...
bool IsErrored(void) override
Tells us whether an unrecoverable error has been encountered.
void ResetForNewFile(void) override
void SetOption(const QString &name, const QString &value) override
Set an specific option.
long long GetFramesRead(void) const
ImportRecorder imports files, creating a seek map and other stuff that MythTV likes to have for recor...
void run(void) override
run() starts the recording process, and does not exit until the recording is complete.
void SetOptionsFromProfile(RecordingProfile *profile, const QString &videodev, const QString &audiodev, const QString &vbidev) override
Sets basic recorder options.
long long GetFramesWritten(void) override
Returns number of frames written to disk.
MythCommFlagPlayer * m_cfp
QString GetSetting(const QString &key, const QString &defaultval="")
void RegisterFileForWrite(const QString &file, uint64_t size=0LL)
void UnregisterFileForWrite(const QString &file)
DecoderBase * GetDecoder(void)
Returns the stream decoder currently in use.
QString GetPathname(void) const
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)
MythMediaBuffer * m_ringBuffer
bool m_requestRecording
True if API call has requested a recording be [re]started.
RecordingInfo * m_curRecording
QWaitCondition m_unpauseWait
QWaitCondition m_recordingWait
void SaveFilesize(uint64_t fsize) override
Sets recording file size in database, and sets "filesize" field.
void UpdateFS(int pc, void *ir)
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
static bool VERBOSE_LEVEL_CHECK(uint64_t mask, LogLevel_t level)
#define ENO
This can be appended to the LOG args with "+".
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
MBASE_PUBLIC long long copy(QFile &dst, QFile &src, uint block_size=0)
Copies src file to dst file.
const QString kImportRecorderInUseID