-fixed some more issues with the increment naming.
This commit is contained in:
zii 2024-10-09 13:44:25 -04:00
parent d9cdd30877
commit 7ba06ab92b
4 changed files with 29 additions and 14 deletions

View File

@ -32,7 +32,7 @@
using namespace std;
#define APP_VERSION "3.6.t2"
#define APP_VERSION "3.6.t3"
#define APP_NAME "JustMotion"
#define APP_TARGET "jmotion"
#define DATETIME_FMT "yyyyMMddhhmmss"

View File

@ -51,13 +51,15 @@ void DetectLoop::reset()
void DetectLoop::preExec()
{
vidAPath = shared->buffPath + "/live/" + QString::number(shared->seed - 2).leftJustified(21, '0') + shared->streamExt;
vidBPath = shared->buffPath + "/live/" + QString::number(shared->seed - 1).leftJustified(21, '0') + shared->streamExt;
vidAPath = shared->buffPath + "/live/" + QString::number(shared->seed - 1).rightJustified(20, '0') + shared->streamExt;
vidBPath = shared->buffPath + "/live/" + QString::number(shared->seed - 2).rightJustified(20, '0') + shared->streamExt;
eTimer.start();
if (QFileInfo::exists(vidAPath) && QFileInfo::exists(vidBPath))
{
shared->seed += 1;
exec();
}
}

View File

@ -15,9 +15,10 @@
RecordLoop::RecordLoop(shared_t *sharedRes, QThread *thr, QObject *parent) : QProcess(parent)
{
checkTimer = 0;
seedtimer = 0;
shared = sharedRes;
sharedRes->seed = 0;
sharedRes->seed = 3;
connect(thr, &QThread::started, this, &RecordLoop::init);
connect(thr, &QThread::finished, this, &RecordLoop::deleteLater);
@ -38,11 +39,14 @@ RecordLoop::~RecordLoop()
void RecordLoop::init()
{
checkTimer = new QTimer(this);
seedtimer = new QTimer(this);
connect(checkTimer, &QTimer::timeout, this, &RecordLoop::restart);
connect(seedtimer, &QTimer::timeout, this, &RecordLoop::checkSeed);
checkTimer->setSingleShot(true);
checkTimer->setInterval(3000);
seedtimer->setInterval(1000);
setupBuffDir(shared->buffPath);
restart();
@ -57,28 +61,34 @@ QString RecordLoop::camCmdFromConf()
ret += "-rtsp_transport udp ";
}
if (shared->seed == 18446744073709551615ULL)
{
setupBuffDir(shared->buffPath, true);
shared->seed = 0;
}
if (shared->vidCodec != "copy")
{
ret += "-vf fps=" + QString::number(shared->recFps) + ",scale=" + shared->recScale + " ";
}
shared->seed += 1;
ret += "-vcodec " + shared->vidCodec + " ";
ret += "-acodec " + shared->audCodec + " ";
ret += "-reset_timestamps 1 -sc_threshold 0 -g 2 -force_key_frames 'expr:gte(t, n_forced * 2)' -segment_time 2 -f segment ";
ret += shared->buffPath + "/live/" + QString::number(shared->seed).leftJustified(21, '0') + shared->streamExt;
ret += shared->buffPath + "/live/%020d" + shared->streamExt;
return ret;
}
void RecordLoop::checkSeed()
{
if (shared->seed >= 10000000000000000000ULL)
{
terminate();
waitForFinished();
setupBuffDir(shared->buffPath, true);
shared->seed = 3;
restart();
}
}
QString RecordLoop::statusLine()
{
if (state() == QProcess::Running)

View File

@ -22,13 +22,16 @@ class RecordLoop : public QProcess
private slots:
void init();
void checkSeed();
void resetTime();
private:
shared_t *shared;
QTimer *seedtimer;
QTimer *checkTimer;
quint64 getLatestSeed();
QString camCmdFromConf();
public slots: