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
|
|
|
|
2021-04-27 16:19:31 -04:00
|
|
|
#include <cstdlib> // For std::getenv
|
|
|
|
|
|
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;
|
2019-01-30 09:58:54 -08:00
|
|
|
m_pInstance->HARDWARE_DECODER = 0;
|
2019-01-09 16:50:40 -06:00
|
|
|
m_pInstance->HIGH_QUALITY_SCALING = false;
|
2019-01-31 09:42:26 -08:00
|
|
|
m_pInstance->OMP_THREADS = 12;
|
|
|
|
|
m_pInstance->FF_THREADS = 8;
|
2019-01-30 09:58:54 -08:00
|
|
|
m_pInstance->DE_LIMIT_HEIGHT_MAX = 1100;
|
|
|
|
|
m_pInstance->DE_LIMIT_WIDTH_MAX = 1950;
|
|
|
|
|
m_pInstance->HW_DE_DEVICE_SET = 0;
|
|
|
|
|
m_pInstance->HW_EN_DEVICE_SET = 0;
|
2019-04-23 16:45:02 -05:00
|
|
|
m_pInstance->PLAYBACK_AUDIO_DEVICE_NAME = "";
|
Audio: New device name lookup
- A new AudioDevices class replaces the AudioDeviceInfo struct.
It has a single method, getNames(), which:
* creates an AudioDeviceManager (NOT using the singleton)
* scans for available devices
* returns the results as a std::vector containing
std::pair<std::string, std::string> objects
(The AudioDevices device manager is never initialize()d, so
no devices are opened; it should be safe to use even DURING
playback, without disruption.)
By using STL containers (rather than a custom struct) to return
the results, Python is able to consume the output as a native
list of tuples.
AudioDeviceInfo is still present for compatibility, but deprecated.
- Eliminated some unnecessary conversions (like):
* calls to std::string::c_str, when passing to juce::String.
juce::String accepts std::string directly.
* calls to juce::String::toRawUTF8, when creating std::string.
There's a juce::String::ToStdString, which is better.
2021-08-24 13:03:46 -04:00
|
|
|
m_pInstance->PLAYBACK_AUDIO_DEVICE_TYPE = "";
|
2020-02-01 02:00:43 -05:00
|
|
|
m_pInstance->DEBUG_TO_STDERR = false;
|
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;
|
|
|
|
|
}
|