Go to the documentation of this file.
23 #include <sys/select.h>
25 #include <sys/types.h>
42 #define TVREC_CARDNUM \
43 ((m_tvrec != nullptr) ? QString::number(m_tvrec->GetInputId()) : "NULL")
45 #define LOC QString("ImportRec[%1](%2): ") \
46 .arg(TVREC_CARDNUM).arg(m_videodevice)
49 const QString &videodev,
50 const QString &audiodev,
51 const QString &vbidev)
57 QString testVideoDev = videodev;
59 if (videodev.startsWith(
"file:", Qt::CaseInsensitive))
60 testVideoDev = videodev.mid(5);
62 QFileInfo fi(testVideoDev);
63 if (fi.exists() && fi.isReadable() && fi.isFile() && fi.size() > 1560)
94 LOG(VB_RECORD, LOG_INFO,
LOC +
"run -- begin");
103 LOG(VB_RECORD, LOG_INFO,
LOC +
"run -- " +
104 QString(
"attempting to open '%1'")
128 ctx->SetRingBuffer(buffer);
133 cfp->RebuildSeekTable(
false,
UpdateFS,
this);
151 LOG(VB_RECORD, LOG_INFO,
LOC +
"run -- end");
161 LOG(VB_RECORD, LOG_ERR,
LOC +
"no current recording!");
174 if (preRecorded.exists() && (!
copy.exists() ||
copy.size() == 0))
179 targetDir.remove(fn);
182 LOG(VB_RECORD, LOG_INFO,
LOC + QString(
"Trying to link %1 to %2")
185 if (preRecorded.link(fn))
186 LOG(VB_RECORD, LOG_DEBUG,
LOC +
"success!");
188 LOG(VB_RECORD, LOG_ERR,
LOC + preRecorded.errorString());
191 if (fn.startsWith(
"myth://", Qt::CaseInsensitive))
193 LOG(VB_RECORD, LOG_ERR,
LOC +
"Malformed recording ProgramInfo.");
200 LOG(VB_RECORD, LOG_INFO,
LOC +
201 QString(
"'%1' does not exist yet").
arg(fn));
206 std::this_thread::sleep_for(std::chrono::milliseconds(250));
212 LOG(VB_GENERAL, LOG_ERR,
LOC +
213 QString(
"'%1' is not readable").
arg(fn));
218 LOG(VB_GENERAL, LOG_ERR,
LOC +
219 QString(
"'%1' is empty").
arg(fn));
223 m_importFd = open(fn.toLocal8Bit().constData(), O_RDONLY);
226 LOG(VB_GENERAL, LOG_ERR,
LOC +
227 QString(
"Couldn't open '%1'").
arg(fn) +
ENO);
MythCommFlagPlayer * m_cfp
#define ENO
This can be appended to the LOG args with "+".
long long copy(QFile &dst, QFile &src, uint block_size)
Copies src file to dst file.
void UnregisterFileForWrite(const QString &file)
void ResetForNewFile(void) override
void RegisterFileForWrite(const QString &file, uint64_t size=0LL)
arg(title).arg(filename).arg(doDelete))
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.
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
#define VERBOSE_LEVEL_CHECK(_MASK_, _LEVEL_)
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.