OBS源码 run_program函数

#include <Shlwapi.h>

#pragma comment(lib, "shlwapi.lib")
static const char *run_program_init = "run_program_init";
static int run_program(fstream &logFile, int argc, char *argv[])

{

/*初始化和读取profile相关信息*/

int ret = -1;
auto profilerNameStore = CreateNameStore();
std::unique_ptr<void, decltype(ProfilerFree)>
prof_release(static_cast<void*>(&ProfilerFree),
ProfilerFree);
profiler_start();
profile_register_root(run_program_init, 0);
ScopeProfiler prof{run_program_init};
QCoreApplication::addLibraryPath(".");
//keys load 自己添加的通过web启动程序并保存参数
char filepath[MAX_PATH];
GetModuleFileNameA(NULL, filepath, MAX_PATH);
QTextCodec *xcodec = QTextCodec::codecForLocale();
QString exeDir = xcodec->toUnicode(QByteArray(filepath));
QString BKE_CURRENT_DIR = QFileInfo(exeDir).path();
QStringList  libpath;
libpath << BKE_CURRENT_DIR + QString::fromLocal8Bit("/platforms");
libpath << BKE_CURRENT_DIR;
QApplication::setLibraryPaths(libpath);
PathRemoveFileSpecA(filepath);
QDir::setCurrent(filepath);


/*生成OBSApp 对象*/
OBSApp program(argc, argv, profilerNameStore.get());

try {

/*初始化应用*/
program.AppInit();

OBSTranslator translator;

create_log_file(logFile);
delete_oldest_file("obs-studio/profiler_data");

program.installTranslator(&translator);

/*初始化obs模块*/

if (!program.OBSInit())
return 0;

prof.Stop();

return program.exec();

} catch (const char *error) {
blog(LOG_ERROR, "%s", error);
OBSErrorBox(nullptr, "%s", error);
}

return ret;
}

猜你喜欢

转载自blog.csdn.net/qq_35970739/article/details/80631234
obs