Go to the documentation of this file.
23 #include <sys/select.h>
25 #include <sys/types.h>
43 #define TVREC_CARDNUM \
44 ((m_tvrec != nullptr) ? QString::number(m_tvrec->GetInputId()) : "NULL")
46 #define LOC QString("ImportRec[%1](%2): ") \
47 .arg(TVREC_CARDNUM, m_videodevice)
50 const QString &videodev,
51 [[maybe_unused]]
const QString &audiodev,
52 [[maybe_unused]]
const QString &vbidev)
54 QString testVideoDev = videodev;
56 if (videodev.startsWith(
"file:", Qt::CaseInsensitive))
57 testVideoDev = videodev.mid(5);
59 QFileInfo fi(testVideoDev);
60 if (fi.exists() && fi.isReadable() && fi.isFile() && fi.size() > 1560)
91 LOG(VB_RECORD, LOG_INFO,
LOC +
"run -- begin");
100 LOG(VB_RECORD, LOG_INFO,
LOC +
"run -- " +
101 QString(
"attempting to open '%1'")
125 ctx->SetRingBuffer(buffer);
130 cfp->RebuildSeekTable(
false,
UpdateFS,
this);
148 LOG(VB_RECORD, LOG_INFO,
LOC +
"run -- end");
158 LOG(VB_RECORD, LOG_ERR,
LOC +
"no current recording!");
171 if (preRecorded.exists() && (!
copy.exists() ||
copy.size() == 0))
176 targetDir.remove(fn);
179 LOG(VB_RECORD, LOG_INFO,
LOC + QString(
"Trying to link %1 to %2")
182 if (preRecorded.link(fn))
183 LOG(VB_RECORD, LOG_DEBUG,
LOC +
"success!");
185 LOG(VB_RECORD, LOG_ERR,
LOC + preRecorded.errorString());
188 if (fn.startsWith(
"myth://", Qt::CaseInsensitive))
190 LOG(VB_RECORD, LOG_ERR,
LOC +
"Malformed recording ProgramInfo.");
197 LOG(VB_RECORD, LOG_INFO,
LOC +
198 QString(
"'%1' does not exist yet").arg(fn));
203 std::this_thread::sleep_for(250ms);
209 LOG(VB_GENERAL, LOG_ERR,
LOC +
210 QString(
"'%1' is not readable").arg(fn));
215 LOG(VB_GENERAL, LOG_ERR,
LOC +
216 QString(
"'%1' is empty").arg(fn));
220 m_importFd = open(fn.toLocal8Bit().constData(), O_RDONLY);
223 LOG(VB_GENERAL, LOG_ERR,
LOC +
224 QString(
"Couldn't open '%1'").arg(fn) +
ENO);
MythCommFlagPlayer * m_cfp
#define ENO
This can be appended to the LOG args with "+".
void UnregisterFileForWrite(const QString &file)
void ResetForNewFile(void) override
void RegisterFileForWrite(const QString &file, uint64_t size=0LL)
static bool VERBOSE_LEVEL_CHECK(uint64_t mask, LogLevel_t level)
bool IsErrored(void) override
Tells us whether an unrecoverable error has been encountered.
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
void FinishRecording(void) override
Flushes the ringbuffer, and if this is not a live LiveTV recording saves the position map and filesiz...
void run(void) override
run() starts the recording process, and does not exit until the recording is complete.
QString GetPathname(void) const
QWaitCondition m_recordingWait
RecordingInfo * m_curRecording
long long GetFramesWritten(void) override
Returns number of frames written to disk.
MBASE_PUBLIC long long copy(QFile &dst, QFile &src, uint block_size=0)
Copies src file to dst file.
void SaveFilesize(uint64_t fsize) override
Sets recording file size in database, and sets "filesize" field.
void SetOptionsFromProfile(RecordingProfile *profile, const QString &videodev, const QString &audiodev, const QString &vbidev) override
Sets basic recorder options.
virtual bool IsRecordingRequested(void)
Tells us if StopRecording() has been called.
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.
DecoderBase * GetDecoder(void)
Returns the stream decoder currently in use.
MythMediaBuffer * m_ringBuffer
virtual void SetRecordingStatus(RecStatus::Type status, const QString &file, int line)
bool m_recording
True while recording is actually being performed.
ImportRecorder imports files, creating a seek map and other stuff that MythTV likes to have for recor...
void UpdateFS(int pc, void *ir)
QWaitCondition m_unpauseWait
long long GetFramesRead(void) const
const QString kImportRecorderInUseID
QString GetSetting(const QString &key, const QString &defaultval="")
bool m_requestRecording
True if API call has requested a recording be [re]started.