2019-01-09 16:50:40 -06:00
|
|
|
/**
|
|
|
|
|
* @file
|
|
|
|
|
* @brief Source file for global Settings class
|
|
|
|
|
* @author Jonathan Thomas <jonathan@openshot.org>
|
|
|
|
|
*
|
2019-06-09 08:31:04 -04:00
|
|
|
* @ref License
|
|
|
|
|
*/
|
|
|
|
|
|
2021-10-16 01:26:26 -04:00
|
|
|
// Copyright (c) 2008-2019 OpenShot Studios, LLC
|
|
|
|
|
//
|
|
|
|
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
2019-01-09 16:50:40 -06:00
|
|
|
|
2025-06-06 15:26:40 -05:00
|
|
|
#include <cstdlib>
|
|
|
|
|
#include <omp.h>
|
2020-10-18 07:43:37 -04:00
|
|
|
#include "Settings.h"
|
2019-01-09 16:50:40 -06:00
|
|
|
|
|
|
|
|
using namespace openshot;
|
|
|
|
|
|
2020-02-01 02:00:43 -05:00
|
|
|
// Global reference to Settings
|
2021-04-27 16:19:31 -04:00
|
|
|
Settings *Settings::m_pInstance = nullptr;
|
2019-01-09 16:50:40 -06:00
|
|
|
|
2020-02-01 02:00:43 -05:00
|
|
|
// Create or Get an instance of the settings singleton
|
2019-01-09 16:50:40 -06:00
|
|
|
Settings *Settings::Instance()
|
|
|
|
|
{
|
|
|
|
|
if (!m_pInstance) {
|
2020-02-01 02:00:43 -05:00
|
|
|
// Create the actual instance of Settings only once
|
2019-01-09 16:50:40 -06:00
|
|
|
m_pInstance = new Settings;
|
2025-06-06 15:26:40 -05:00
|
|
|
m_pInstance->OMP_THREADS = omp_get_num_procs();
|
|
|
|
|
m_pInstance->FF_THREADS = omp_get_num_procs();
|
2021-04-27 16:19:31 -04:00
|
|
|
auto env_debug = std::getenv("LIBOPENSHOT_DEBUG");
|
|
|
|
|
if (env_debug != nullptr)
|
|
|
|
|
m_pInstance->DEBUG_TO_STDERR = true;
|
2019-01-09 16:50:40 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return m_pInstance;
|
|
|
|
|
}
|