window-basic-main-profiles.cpp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694
  1. /******************************************************************************
  2. Copyright (C) 2015 by Hugh Bailey <[email protected]>
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation, either version 2 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. ******************************************************************************/
  14. #include <obs.hpp>
  15. #include <util/platform.h>
  16. #include <util/util.hpp>
  17. #include <QMessageBox>
  18. #include <QVariant>
  19. #include <QFileDialog>
  20. #include "window-basic-main.hpp"
  21. #include "window-namedialog.hpp"
  22. #include "qt-wrappers.hpp"
  23. extern void DestroyPanelCookieManager();
  24. extern void DuplicateCurrentCookieProfile(ConfigFile &config);
  25. extern void CheckExistingCookieId();
  26. void EnumProfiles(std::function<bool (const char *, const char *)> &&cb)
  27. {
  28. char path[512];
  29. os_glob_t *glob;
  30. int ret = GetConfigPath(path, sizeof(path),
  31. "obs-studio/basic/profiles/*");
  32. if (ret <= 0) {
  33. blog(LOG_WARNING, "Failed to get profiles config path");
  34. return;
  35. }
  36. if (os_glob(path, 0, &glob) != 0) {
  37. blog(LOG_WARNING, "Failed to glob profiles");
  38. return;
  39. }
  40. for (size_t i = 0; i < glob->gl_pathc; i++) {
  41. const char *filePath = glob->gl_pathv[i].path;
  42. const char *dirName = strrchr(filePath, '/') + 1;
  43. if (!glob->gl_pathv[i].directory)
  44. continue;
  45. if (strcmp(dirName, ".") == 0 ||
  46. strcmp(dirName, "..") == 0)
  47. continue;
  48. std::string file = filePath;
  49. file += "/basic.ini";
  50. ConfigFile config;
  51. int ret = config.Open(file.c_str(), CONFIG_OPEN_EXISTING);
  52. if (ret != CONFIG_SUCCESS)
  53. continue;
  54. const char *name = config_get_string(config, "General", "Name");
  55. if (!name)
  56. name = strrchr(filePath, '/') + 1;
  57. if (!cb(name, filePath))
  58. break;
  59. }
  60. os_globfree(glob);
  61. }
  62. static bool ProfileExists(const char *findName)
  63. {
  64. bool found = false;
  65. auto func = [&](const char *name, const char*)
  66. {
  67. if (strcmp(name, findName) == 0) {
  68. found = true;
  69. return false;
  70. }
  71. return true;
  72. };
  73. EnumProfiles(func);
  74. return found;
  75. }
  76. static bool GetProfileName(QWidget *parent, std::string &name,
  77. std::string &file, const char *title, const char *text,
  78. const char *oldName = nullptr)
  79. {
  80. char path[512];
  81. int ret;
  82. for (;;) {
  83. bool success = NameDialog::AskForName(parent, title, text,
  84. name, QT_UTF8(oldName));
  85. if (!success) {
  86. return false;
  87. }
  88. if (name.empty()) {
  89. OBSMessageBox::information(parent,
  90. QTStr("NoNameEntered.Title"),
  91. QTStr("NoNameEntered.Text"));
  92. continue;
  93. }
  94. if (ProfileExists(name.c_str())) {
  95. OBSMessageBox::information(parent,
  96. QTStr("NameExists.Title"),
  97. QTStr("NameExists.Text"));
  98. continue;
  99. }
  100. break;
  101. }
  102. if (!GetFileSafeName(name.c_str(), file)) {
  103. blog(LOG_WARNING, "Failed to create safe file name for '%s'",
  104. name.c_str());
  105. return false;
  106. }
  107. ret = GetConfigPath(path, sizeof(path), "obs-studio/basic/profiles/");
  108. if (ret <= 0) {
  109. blog(LOG_WARNING, "Failed to get profiles config path");
  110. return false;
  111. }
  112. file.insert(0, path);
  113. if (!GetClosestUnusedFileName(file, nullptr)) {
  114. blog(LOG_WARNING, "Failed to get closest file name for %s",
  115. file.c_str());
  116. return false;
  117. }
  118. file.erase(0, ret);
  119. return true;
  120. }
  121. static bool CopyProfile(const char *fromPartial, const char *to)
  122. {
  123. os_glob_t *glob;
  124. char path[514];
  125. char dir[512];
  126. int ret;
  127. ret = GetConfigPath(dir, sizeof(dir), "obs-studio/basic/profiles/");
  128. if (ret <= 0) {
  129. blog(LOG_WARNING, "Failed to get profiles config path");
  130. return false;
  131. }
  132. snprintf(path, sizeof(path), "%s%s/*", dir, fromPartial);
  133. if (os_glob(path, 0, &glob) != 0) {
  134. blog(LOG_WARNING, "Failed to glob profile '%s'", fromPartial);
  135. return false;
  136. }
  137. for (size_t i = 0; i < glob->gl_pathc; i++) {
  138. const char *filePath = glob->gl_pathv[i].path;
  139. if (glob->gl_pathv[i].directory)
  140. continue;
  141. ret = snprintf(path, sizeof(path), "%s/%s",
  142. to, strrchr(filePath, '/') + 1);
  143. if (ret > 0) {
  144. if (os_copyfile(filePath, path) != 0) {
  145. blog(LOG_WARNING, "CopyProfile: Failed to "
  146. "copy file %s to %s",
  147. filePath, path);
  148. }
  149. }
  150. }
  151. os_globfree(glob);
  152. return true;
  153. }
  154. bool OBSBasic::AddProfile(bool create_new, const char *title, const char *text,
  155. const char *init_text, bool rename)
  156. {
  157. std::string newName;
  158. std::string newDir;
  159. std::string newPath;
  160. ConfigFile config;
  161. if (!GetProfileName(this, newName, newDir, title, text, init_text))
  162. return false;
  163. std::string curDir = config_get_string(App()->GlobalConfig(),
  164. "Basic", "ProfileDir");
  165. char baseDir[512];
  166. int ret = GetConfigPath(baseDir, sizeof(baseDir),
  167. "obs-studio/basic/profiles/");
  168. if (ret <= 0) {
  169. blog(LOG_WARNING, "Failed to get profiles config path");
  170. return false;
  171. }
  172. newPath = baseDir;
  173. newPath += newDir;
  174. if (os_mkdir(newPath.c_str()) < 0) {
  175. blog(LOG_WARNING, "Failed to create profile directory '%s'",
  176. newDir.c_str());
  177. return false;
  178. }
  179. if (!create_new)
  180. CopyProfile(curDir.c_str(), newPath.c_str());
  181. newPath += "/basic.ini";
  182. if (config.Open(newPath.c_str(), CONFIG_OPEN_ALWAYS) != 0) {
  183. blog(LOG_ERROR, "Failed to open new config file '%s'",
  184. newDir.c_str());
  185. return false;
  186. }
  187. config_set_string(App()->GlobalConfig(), "Basic", "Profile",
  188. newName.c_str());
  189. config_set_string(App()->GlobalConfig(), "Basic", "ProfileDir",
  190. newDir.c_str());
  191. if (create_new) {
  192. DestroyPanelCookieManager();
  193. } else if (!rename) {
  194. DuplicateCurrentCookieProfile(config);
  195. }
  196. config_set_string(config, "General", "Name", newName.c_str());
  197. config.SaveSafe("tmp");
  198. config.Swap(basicConfig);
  199. InitBasicConfigDefaults();
  200. RefreshProfiles();
  201. if (create_new)
  202. ResetProfileData();
  203. blog(LOG_INFO, "Created profile '%s' (%s, %s)", newName.c_str(),
  204. create_new ? "clean" : "duplicate", newDir.c_str());
  205. blog(LOG_INFO, "------------------------------------------------");
  206. config_save_safe(App()->GlobalConfig(), "tmp", nullptr);
  207. UpdateTitleBar();
  208. if (api) {
  209. api->on_event(OBS_FRONTEND_EVENT_PROFILE_LIST_CHANGED);
  210. api->on_event(OBS_FRONTEND_EVENT_PROFILE_CHANGED);
  211. }
  212. return true;
  213. }
  214. void OBSBasic::DeleteProfile(const char *profileName, const char *profileDir)
  215. {
  216. char profilePath[512];
  217. char basePath[512];
  218. int ret = GetConfigPath(basePath, 512, "obs-studio/basic/profiles");
  219. if (ret <= 0) {
  220. blog(LOG_WARNING, "Failed to get profiles config path");
  221. return;
  222. }
  223. ret = snprintf(profilePath, 512, "%s/%s/*", basePath, profileDir);
  224. if (ret <= 0) {
  225. blog(LOG_WARNING, "Failed to get path for profile dir '%s'",
  226. profileDir);
  227. return;
  228. }
  229. os_glob_t *glob;
  230. if (os_glob(profilePath, 0, &glob) != 0) {
  231. blog(LOG_WARNING, "Failed to glob profile dir '%s'",
  232. profileDir);
  233. return;
  234. }
  235. for (size_t i = 0; i < glob->gl_pathc; i++) {
  236. const char *filePath = glob->gl_pathv[i].path;
  237. if (glob->gl_pathv[i].directory)
  238. continue;
  239. os_unlink(filePath);
  240. }
  241. os_globfree(glob);
  242. ret = snprintf(profilePath, 512, "%s/%s", basePath, profileDir);
  243. if (ret <= 0) {
  244. blog(LOG_WARNING, "Failed to get path for profile dir '%s'",
  245. profileDir);
  246. return;
  247. }
  248. os_rmdir(profilePath);
  249. blog(LOG_INFO, "------------------------------------------------");
  250. blog(LOG_INFO, "Removed profile '%s' (%s)",
  251. profileName, profileDir);
  252. blog(LOG_INFO, "------------------------------------------------");
  253. }
  254. void OBSBasic::RefreshProfiles()
  255. {
  256. QList<QAction*> menuActions = ui->profileMenu->actions();
  257. int count = 0;
  258. for (int i = 0; i < menuActions.count(); i++) {
  259. QVariant v = menuActions[i]->property("file_name");
  260. if (v.typeName() != nullptr)
  261. delete menuActions[i];
  262. }
  263. const char *curName = config_get_string(App()->GlobalConfig(),
  264. "Basic", "Profile");
  265. auto addProfile = [&](const char *name, const char *path)
  266. {
  267. std::string file = strrchr(path, '/') + 1;
  268. QAction *action = new QAction(QT_UTF8(name), this);
  269. action->setProperty("file_name", QT_UTF8(path));
  270. connect(action, &QAction::triggered,
  271. this, &OBSBasic::ChangeProfile);
  272. action->setCheckable(true);
  273. action->setChecked(strcmp(name, curName) == 0);
  274. ui->profileMenu->addAction(action);
  275. count++;
  276. return true;
  277. };
  278. EnumProfiles(addProfile);
  279. ui->actionRemoveProfile->setEnabled(count > 1);
  280. }
  281. void OBSBasic::ResetProfileData()
  282. {
  283. ResetVideo();
  284. service = nullptr;
  285. InitService();
  286. ResetOutputs();
  287. ClearHotkeys();
  288. CreateHotkeys();
  289. /* load audio monitoring */
  290. #if defined(_WIN32) || defined(__APPLE__) || HAVE_PULSEAUDIO
  291. const char *device_name = config_get_string(basicConfig, "Audio",
  292. "MonitoringDeviceName");
  293. const char *device_id = config_get_string(basicConfig, "Audio",
  294. "MonitoringDeviceId");
  295. obs_set_audio_monitoring_device(device_name, device_id);
  296. blog(LOG_INFO, "Audio monitoring device:\n\tname: %s\n\tid: %s",
  297. device_name, device_id);
  298. #endif
  299. }
  300. void OBSBasic::on_actionNewProfile_triggered()
  301. {
  302. AddProfile(true, Str("AddProfile.Title"), Str("AddProfile.Text"));
  303. }
  304. void OBSBasic::on_actionDupProfile_triggered()
  305. {
  306. AddProfile(false, Str("AddProfile.Title"), Str("AddProfile.Text"));
  307. }
  308. void OBSBasic::on_actionRenameProfile_triggered()
  309. {
  310. std::string curDir = config_get_string(App()->GlobalConfig(),
  311. "Basic", "ProfileDir");
  312. std::string curName = config_get_string(App()->GlobalConfig(),
  313. "Basic", "Profile");
  314. /* Duplicate and delete in case there are any issues in the process */
  315. bool success = AddProfile(false, Str("RenameProfile.Title"),
  316. Str("AddProfile.Text"), curName.c_str(), true);
  317. if (success) {
  318. DeleteProfile(curName.c_str(), curDir.c_str());
  319. RefreshProfiles();
  320. }
  321. if (api) {
  322. api->on_event(OBS_FRONTEND_EVENT_PROFILE_LIST_CHANGED);
  323. api->on_event(OBS_FRONTEND_EVENT_PROFILE_CHANGED);
  324. }
  325. }
  326. void OBSBasic::on_actionRemoveProfile_triggered()
  327. {
  328. std::string newName;
  329. std::string newPath;
  330. ConfigFile config;
  331. std::string oldDir = config_get_string(App()->GlobalConfig(),
  332. "Basic", "ProfileDir");
  333. std::string oldName = config_get_string(App()->GlobalConfig(),
  334. "Basic", "Profile");
  335. auto cb = [&](const char *name, const char *filePath)
  336. {
  337. if (strcmp(oldName.c_str(), name) != 0) {
  338. newName = name;
  339. newPath = filePath;
  340. return false;
  341. }
  342. return true;
  343. };
  344. EnumProfiles(cb);
  345. /* this should never be true due to menu item being grayed out */
  346. if (newPath.empty())
  347. return;
  348. QString text = QTStr("ConfirmRemove.Text");
  349. text.replace("$1", QT_UTF8(oldName.c_str()));
  350. QMessageBox::StandardButton button = OBSMessageBox::question(this,
  351. QTStr("ConfirmRemove.Title"), text);
  352. if (button == QMessageBox::No)
  353. return;
  354. size_t newPath_len = newPath.size();
  355. newPath += "/basic.ini";
  356. if (config.Open(newPath.c_str(), CONFIG_OPEN_ALWAYS) != 0) {
  357. blog(LOG_ERROR, "ChangeProfile: Failed to load file '%s'",
  358. newPath.c_str());
  359. return;
  360. }
  361. newPath.resize(newPath_len);
  362. const char *newDir = strrchr(newPath.c_str(), '/') + 1;
  363. config_set_string(App()->GlobalConfig(), "Basic", "Profile",
  364. newName.c_str());
  365. config_set_string(App()->GlobalConfig(), "Basic", "ProfileDir",
  366. newDir);
  367. DestroyPanelCookieManager();
  368. config.Swap(basicConfig);
  369. InitBasicConfigDefaults();
  370. ResetProfileData();
  371. DeleteProfile(oldName.c_str(), oldDir.c_str());
  372. RefreshProfiles();
  373. config_save_safe(App()->GlobalConfig(), "tmp", nullptr);
  374. blog(LOG_INFO, "Switched to profile '%s' (%s)",
  375. newName.c_str(), newDir);
  376. blog(LOG_INFO, "------------------------------------------------");
  377. UpdateTitleBar();
  378. if (api) {
  379. api->on_event(OBS_FRONTEND_EVENT_PROFILE_LIST_CHANGED);
  380. api->on_event(OBS_FRONTEND_EVENT_PROFILE_CHANGED);
  381. }
  382. }
  383. void OBSBasic::on_actionImportProfile_triggered()
  384. {
  385. char path[512];
  386. QString home = QDir::homePath();
  387. int ret = GetConfigPath(path, 512, "obs-studio/basic/profiles/");
  388. if (ret <= 0) {
  389. blog(LOG_WARNING, "Failed to get profile config path");
  390. return;
  391. }
  392. QString dir = QFileDialog::getExistingDirectory(
  393. this,
  394. QTStr("Basic.MainMenu.Profile.Import"),
  395. home,
  396. QFileDialog::ShowDirsOnly |
  397. QFileDialog::DontResolveSymlinks);
  398. if (!dir.isEmpty() && !dir.isNull()) {
  399. QString inputPath = QString::fromUtf8(path);
  400. QFileInfo finfo(dir);
  401. QString directory = finfo.fileName();
  402. QString profileDir = inputPath + directory;
  403. QDir folder(profileDir);
  404. if (!folder.exists()) {
  405. folder.mkpath(profileDir);
  406. QFile::copy(dir + "/basic.ini",
  407. profileDir + "/basic.ini");
  408. QFile::copy(dir + "/service.json",
  409. profileDir + "/service.json");
  410. QFile::copy(dir + "/streamEncoder.json",
  411. profileDir + "/streamEncoder.json");
  412. QFile::copy(dir + "/recordEncoder.json",
  413. profileDir + "/recordEncoder.json");
  414. RefreshProfiles();
  415. } else {
  416. OBSMessageBox::information(this,
  417. QTStr("Basic.MainMenu.Profile.Import"),
  418. QTStr("Basic.MainMenu.Profile.Exists"));
  419. }
  420. }
  421. }
  422. void OBSBasic::on_actionExportProfile_triggered()
  423. {
  424. char path[512];
  425. QString home = QDir::homePath();
  426. QString currentProfile =
  427. QString::fromUtf8(config_get_string(App()->GlobalConfig(),
  428. "Basic", "ProfileDir"));
  429. int ret = GetConfigPath(path, 512, "obs-studio/basic/profiles/");
  430. if (ret <= 0) {
  431. blog(LOG_WARNING, "Failed to get profile config path");
  432. return;
  433. }
  434. QString dir = QFileDialog::getExistingDirectory(
  435. this,
  436. QTStr("Basic.MainMenu.Profile.Export"),
  437. home,
  438. QFileDialog::ShowDirsOnly |
  439. QFileDialog::DontResolveSymlinks);
  440. if (!dir.isEmpty() && !dir.isNull()) {
  441. QString outputDir = dir + "/" + currentProfile;
  442. QString inputPath = QString::fromUtf8(path);
  443. QDir folder(outputDir);
  444. if (!folder.exists()) {
  445. folder.mkpath(outputDir);
  446. } else {
  447. if (QFile::exists(outputDir + "/basic.ini"))
  448. QFile::remove(outputDir + "/basic.ini");
  449. if (QFile::exists(outputDir + "/service.json"))
  450. QFile::remove(outputDir + "/service.json");
  451. if (QFile::exists(outputDir + "/streamEncoder.json"))
  452. QFile::remove(outputDir + "/streamEncoder.json");
  453. if (QFile::exists(outputDir + "/recordEncoder.json"))
  454. QFile::remove(outputDir + "/recordEncoder.json");
  455. }
  456. QFile::copy(inputPath + currentProfile + "/basic.ini",
  457. outputDir + "/basic.ini");
  458. QFile::copy(inputPath + currentProfile + "/service.json",
  459. outputDir + "/service.json");
  460. QFile::copy(inputPath + currentProfile + "/streamEncoder.json",
  461. outputDir + "/streamEncoder.json");
  462. QFile::copy(inputPath + currentProfile + "/recordEncoder.json",
  463. outputDir + "/recordEncoder.json");
  464. }
  465. }
  466. void OBSBasic::ChangeProfile()
  467. {
  468. QAction *action = reinterpret_cast<QAction*>(sender());
  469. ConfigFile config;
  470. std::string path;
  471. if (!action)
  472. return;
  473. path = QT_TO_UTF8(action->property("file_name").value<QString>());
  474. if (path.empty())
  475. return;
  476. const char *oldName = config_get_string(App()->GlobalConfig(),
  477. "Basic", "Profile");
  478. if (action->text().compare(QT_UTF8(oldName)) == 0) {
  479. action->setChecked(true);
  480. return;
  481. }
  482. size_t path_len = path.size();
  483. path += "/basic.ini";
  484. if (config.Open(path.c_str(), CONFIG_OPEN_ALWAYS) != 0) {
  485. blog(LOG_ERROR, "ChangeProfile: Failed to load file '%s'",
  486. path.c_str());
  487. return;
  488. }
  489. path.resize(path_len);
  490. const char *newName = config_get_string(config, "General", "Name");
  491. const char *newDir = strrchr(path.c_str(), '/') + 1;
  492. config_set_string(App()->GlobalConfig(), "Basic", "Profile", newName);
  493. config_set_string(App()->GlobalConfig(), "Basic", "ProfileDir",
  494. newDir);
  495. DestroyPanelCookieManager();
  496. config.Swap(basicConfig);
  497. InitBasicConfigDefaults();
  498. ResetProfileData();
  499. RefreshProfiles();
  500. config_save_safe(App()->GlobalConfig(), "tmp", nullptr);
  501. UpdateTitleBar();
  502. CheckForSimpleModeX264Fallback();
  503. blog(LOG_INFO, "Switched to profile '%s' (%s)",
  504. newName, newDir);
  505. blog(LOG_INFO, "------------------------------------------------");
  506. if (api)
  507. api->on_event(OBS_FRONTEND_EVENT_PROFILE_CHANGED);
  508. }
  509. void OBSBasic::CheckForSimpleModeX264Fallback()
  510. {
  511. const char *curStreamEncoder = config_get_string(basicConfig,
  512. "SimpleOutput", "StreamEncoder");
  513. const char *curRecEncoder = config_get_string(basicConfig,
  514. "SimpleOutput", "RecEncoder");
  515. bool qsv_supported = false;
  516. bool amd_supported = false;
  517. bool nve_supported = false;
  518. bool changed = false;
  519. size_t idx = 0;
  520. const char *id;
  521. while (obs_enum_encoder_types(idx++, &id)) {
  522. if (strcmp(id, "amd_amf_h264") == 0)
  523. amd_supported = true;
  524. else if (strcmp(id, "obs_qsv11") == 0)
  525. qsv_supported = true;
  526. else if (strcmp(id, "ffmpeg_nvenc") == 0)
  527. nve_supported = true;
  528. }
  529. auto CheckEncoder = [&] (const char *&name)
  530. {
  531. if (strcmp(name, SIMPLE_ENCODER_QSV) == 0) {
  532. if (!qsv_supported) {
  533. changed = true;
  534. name = SIMPLE_ENCODER_X264;
  535. return false;
  536. }
  537. } else if (strcmp(name, SIMPLE_ENCODER_NVENC) == 0) {
  538. if (!nve_supported) {
  539. changed = true;
  540. name = SIMPLE_ENCODER_X264;
  541. return false;
  542. }
  543. } else if (strcmp(name, SIMPLE_ENCODER_AMD) == 0) {
  544. if (!amd_supported) {
  545. changed = true;
  546. name = SIMPLE_ENCODER_X264;
  547. return false;
  548. }
  549. }
  550. return true;
  551. };
  552. if (!CheckEncoder(curStreamEncoder))
  553. config_set_string(basicConfig,
  554. "SimpleOutput", "StreamEncoder",
  555. curStreamEncoder);
  556. if (!CheckEncoder(curRecEncoder))
  557. config_set_string(basicConfig,
  558. "SimpleOutput", "RecEncoder",
  559. curRecEncoder);
  560. if (changed)
  561. config_save_safe(basicConfig, "tmp", nullptr);
  562. }