1、添加配置文件控制推流参数;

2、解决遥控器解码时帧序混乱的问题(gop_size = 1);
3、完善代码;
This commit is contained in:
tangchao0503
2024-01-29 17:21:07 +08:00
parent 2e4679aaef
commit a91f5f5b04
6 changed files with 445 additions and 385 deletions

View File

@ -166,6 +166,64 @@ bool Configfile::getEffectiveWindowRoi(int &width, int &offsetx)
return true;
}
bool Configfile::getPushFlowParam(int &flowSwitch, int &rgbHeight, int &framerateVideo)
{
Setting& root = cfg.getRoot();
if (!root.exists("push_flow_param"))
{
// 配置项不存在,添加配置项
Setting & push_flow_param = root.add("push_flow_param", Setting::TypeGroup);
push_flow_param.add("flow_switch", Setting::TypeInt) = 0;
push_flow_param.add("rgb_height", Setting::TypeInt) = 720;
push_flow_param.add("framerate_video", Setting::TypeInt) = 5;
// 保存修改后的配置到文件
try
{
QList<QString> fileInfo = getFileInfo(QString::fromStdString(m_configfilePath));
bool ret = createDir(fileInfo[0]);
cfg.writeFile(m_configfilePath.c_str());
std::cout << "Config item 'push_flow_param' added." << std::endl;
flowSwitch = 0;
rgbHeight = 720;
framerateVideo = 5;
return true;
}
catch (const libconfig::FileIOException &fioex)
{
std::cerr << "I/O error while writing file." << std::endl;
return false;
}
}
else
{
try
{
const Setting &push_flow_param = root["push_flow_param"];
if(!(push_flow_param.lookupValue("rgb_height", rgbHeight)
&& push_flow_param.lookupValue("framerate_video", framerateVideo)
&& push_flow_param.lookupValue("flow_switch", flowSwitch)
))
{
return false;
}
}
catch(const SettingNotFoundException &nfex)
{
// Ignore.
return false;
}
return true;
}
}
bool Configfile::getWindowOffsety_HeightOfSpectral(int &offsety, int &height, string spectralBinString)
{
const Setting& root = cfg.getRoot();