Skip to content
Snippets Groups Projects
Commit 838c3535 authored by am0ebe's avatar am0ebe
Browse files

calc ncam from config and derive threads per cam

parent 7b52a9bc
No related branches found
No related tags found
No related merge requests found
......@@ -15,14 +15,11 @@
#include <QTimer>
#include <QDebug>
using State = Cam::State;
using namespace VmbCPP;
using namespace std::chrono;
using utils::DELIM;
Cam::Cam(QString name, QString ip) : IPrinter(),
_cam(nullptr),
_name(name),
......@@ -39,7 +36,6 @@ _outDir(utils::outDir() + QDir::separator() + _name + QDir::separator()) //speci
connect(_timer, SIGNAL(timeout()), this, SLOT(stopRecording()));
}
// Copy constructor
Cam::Cam(const Cam& other) : IPrinter(),
_cam(other._cam),
_name(other._name),
......
......@@ -50,7 +50,7 @@ void Core::init()
return;
}
//add to cam list
//create cams and add 'em to list
for ( auto cam : parsedCameras )
{
auto pcam = std::make_shared<Cam>(cam.first,cam.second);
......
......@@ -28,13 +28,13 @@ const int APP_VERSION_PATCH = 0;
std::atomic<bool> running(true);
int ncam()
int ncam(const int& n)
{
static const int _ncam = n;
#ifdef DEBUG
return 1; //XXX read in from config file
#else
return 1;
#endif
return _ncam;
}
int threadsPerCam()
......@@ -139,7 +139,6 @@ bool parseConfig(QList<QPair<QString,QString>>& parsedCameras, seconds& recDurat
}
recDuration = jsonObject["recordDurationInSeconds"].toInt() * 1s; //convert to s
qDebug() << "parsed recDuration:" << recDuration.count();
// Parse outDir
if (!jsonObject.contains("outDir") || !jsonObject["outDir"].isString())
......@@ -148,7 +147,7 @@ bool parseConfig(QList<QPair<QString,QString>>& parsedCameras, seconds& recDurat
return false;
}
outDir(jsonObject["outDir"].toString()); //set global
qDebug() << "parsed outDir:" << outDir();
// Parse cameras
if (!jsonObject.contains("cameras") || !jsonObject["cameras"].isArray())
......@@ -173,6 +172,11 @@ bool parseConfig(QList<QPair<QString,QString>>& parsedCameras, seconds& recDurat
parsedCameras.append(qMakePair(name, ip));
}
ncam(parsedCameras.size()); //set global
qDebug() << "parsed recDuration:" << recDuration.count();
qDebug() << "parsed outDir:" << outDir();
qDebug() << "threads per cam:" << threadsPerCam();
return true;
}
......@@ -189,7 +193,6 @@ QString outDir(QString dirname)
_outDir = dirname;
}
qDebug() << "outDir:" << _outDir;
return _outDir;
}
......
......@@ -30,7 +30,7 @@ const QString errorCodeToMessage( VmbError_t );
extern std::atomic<bool> running; //global flag to ensure proper exit of threads
int threadsPerCam();
int ncam();
int ncam(const int& n=0);
const QChar DELIM='|';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment