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 const QString &audiodev,
52 const QString &vbidev)
58 QString testVideoDev = videodev;
60 if (videodev.startsWith(
"file:", Qt::CaseInsensitive))
61 testVideoDev = videodev.mid(5);
63 QFileInfo fi(testVideoDev);
64 if (fi.exists() && fi.isReadable() && fi.isFile() && fi.size() > 1560)
95 LOG(VB_RECORD, LOG_INFO,
LOC +
"run -- begin");
104 LOG(VB_RECORD, LOG_INFO,
LOC +
"run -- " +
105 QString(
"attempting to open '%1'")
129 ctx->SetRingBuffer(buffer);
134 cfp->RebuildSeekTable(
false,
UpdateFS,
this);
152 LOG(VB_RECORD, LOG_INFO,
LOC +
"run -- end");
162 LOG(VB_RECORD, LOG_ERR,
LOC +
"no current recording!");
175 if (preRecorded.exists() && (!
copy.exists() ||
copy.size() == 0))
180 targetDir.remove(fn);
183 LOG(VB_RECORD, LOG_INFO,
LOC + QString(
"Trying to link %1 to %2")
186 if (preRecorded.link(fn))
187 LOG(VB_RECORD, LOG_DEBUG,
LOC +
"success!");
189 LOG(VB_RECORD, LOG_ERR,
LOC + preRecorded.errorString());
192 if (fn.startsWith(
"myth://", Qt::CaseInsensitive))
194 LOG(VB_RECORD, LOG_ERR,
LOC +
"Malformed recording ProgramInfo.");
201 LOG(VB_RECORD, LOG_INFO,
LOC +
202 QString(
"'%1' does not exist yet").arg(fn));
207 std::this_thread::sleep_for(250ms);
213 LOG(VB_GENERAL, LOG_ERR,
LOC +
214 QString(
"'%1' is not readable").arg(fn));
219 LOG(VB_GENERAL, LOG_ERR,
LOC +
220 QString(
"'%1' is empty").arg(fn));
224 m_importFd = open(fn.toLocal8Bit().constData(), O_RDONLY);
227 LOG(VB_GENERAL, LOG_ERR,
LOC +
228 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.