RecordControlApplication/main.cpp
2024-01-17 23:41:43 -08:00

80 lines
1.9 KiB
C++

#include "BoxController.h"
#include "Config.h"
#include "Link.h"
#include "TcpServer.h"
#include "Widget.h"
#include <QApplication>
#include <QDebug>
#include <QTimer>
#include <unistd.h>
TcpServer* server;
LinkObject* vo;
LinkObject* vo1;
const char* ConfigurationPath = "/opt/RecordControlApplication/bin/config.json";
int main(int argc, char* argv[])
{
// init Link
if (!Link::init()) {
qDebug() << "Link init failed!";
return 0;
}
// init videooOutput and linuxfb before init QApplication,
// otherwise dump because cant init screen and we have ui components
// video output in channel HDMI-OUT0
vo = Link::create("OutputVo");
QVariantMap dataVo;
dataVo["vid"] = 0;
dataVo["type"] = "hdmi";
vo->start(dataVo);
// video output in channel HDMI-OUT1
vo1 = Link::create("OutputVo");
QVariantMap dataVo1;
dataVo1["vid"] = 1;
dataVo1["ui"] = false;
dataVo1["type"] = "vga|bt1120";
vo1->start(dataVo1);
// special settings used channel HDMI-OUT1
static int lastNorm = 0;
int norm = 0;
QString str = "1080P60";
if (str == "1080P60")
norm = 9;
else if (str == "1080P50")
norm = 10;
else if (str == "1080P30")
norm = 12;
else if (str == "720P60")
norm = 5;
else if (str == "720P50")
norm = 6;
else if (str == "3840x2160_30")
norm = 14;
if (norm != lastNorm) {
lastNorm = norm;
QString cmd = "rmmod hi_lt8618sx_lp.ko";
system(cmd.toLatin1().data());
cmd = "insmod /ko/extdrv/hi_lt8618sx_lp.ko norm=" + QString::number(norm);
system(cmd.toLatin1().data());
}
QApplication a(argc, argv);
// initialize configuration
Config::loadConfig(ConfigurationPath);
// create server and listen port 8080
// server = new TcpServer();
// server->listen(QHostAddress::Any, 8080);
Widget w;
w.show();
return a.exec();
}