OpenShot Library | libopenshot 0.2.7
Settings.cpp
Go to the documentation of this file.
1/**
2 * @file
3 * @brief Source file for global Settings class
4 * @author Jonathan Thomas <jonathan@openshot.org>
5 *
6 * @ref License
7 */
8
9/* LICENSE
10 *
11 * Copyright (c) 2008-2019 OpenShot Studios, LLC
12 * <http://www.openshotstudios.com/>. This file is part of
13 * OpenShot Library (libopenshot), an open-source project dedicated to
14 * delivering high quality video editing and animation solutions to the
15 * world. For more information visit <http://www.openshot.org/>.
16 *
17 * OpenShot Library (libopenshot) is free software: you can redistribute it
18 * and/or modify it under the terms of the GNU Lesser General Public License
19 * as published by the Free Software Foundation, either version 3 of the
20 * License, or (at your option) any later version.
21 *
22 * OpenShot Library (libopenshot) is distributed in the hope that it will be
23 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU Lesser General Public License for more details.
26 *
27 * You should have received a copy of the GNU Lesser General Public License
28 * along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
29 */
30
31#include <cstdlib> // For std::getenv
32
33#include "Settings.h"
34
35using namespace openshot;
36
37// Global reference to Settings
38Settings *Settings::m_pInstance = nullptr;
39
40// Create or Get an instance of the settings singleton
41Settings *Settings::Instance()
42{
43 if (!m_pInstance) {
44 // Create the actual instance of Settings only once
45 m_pInstance = new Settings;
46 m_pInstance->HARDWARE_DECODER = 0;
47 m_pInstance->HIGH_QUALITY_SCALING = false;
48 m_pInstance->OMP_THREADS = 12;
49 m_pInstance->FF_THREADS = 8;
50 m_pInstance->DE_LIMIT_HEIGHT_MAX = 1100;
51 m_pInstance->DE_LIMIT_WIDTH_MAX = 1950;
52 m_pInstance->HW_DE_DEVICE_SET = 0;
53 m_pInstance->HW_EN_DEVICE_SET = 0;
54 m_pInstance->PLAYBACK_AUDIO_DEVICE_NAME = "";
55 m_pInstance->DEBUG_TO_STDERR = false;
56 auto env_debug = std::getenv("LIBOPENSHOT_DEBUG");
57 if (env_debug != nullptr)
58 m_pInstance->DEBUG_TO_STDERR = true;
59 }
60
61 return m_pInstance;
62}
Header file for global Settings class.
This class is contains settings used by libopenshot (and can be safely toggled at any point)
Definition: Settings.h:44
int DE_LIMIT_WIDTH_MAX
Maximum columns that hardware decode can handle.
Definition: Settings.h:95
int OMP_THREADS
Number of threads of OpenMP.
Definition: Settings.h:86
std::string PLAYBACK_AUDIO_DEVICE_NAME
The audio device name to use during playback.
Definition: Settings.h:104
int HW_DE_DEVICE_SET
Which GPU to use to decode (0 is the first)
Definition: Settings.h:98
int DE_LIMIT_HEIGHT_MAX
Maximum rows that hardware decode can handle.
Definition: Settings.h:92
int HARDWARE_DECODER
Use video codec for faster video decoding (if supported)
Definition: Settings.h:80
bool HIGH_QUALITY_SCALING
Scale mode used in FFmpeg decoding and encoding (used as an optimization for faster previews)
Definition: Settings.h:83
int FF_THREADS
Number of threads that ffmpeg uses.
Definition: Settings.h:89
int HW_EN_DEVICE_SET
Which GPU to use to encode (0 is the first)
Definition: Settings.h:101
bool DEBUG_TO_STDERR
Whether to dump ZeroMQ debug messages to stderr.
Definition: Settings.h:111
This namespace is the default namespace for all code in the openshot library.
Definition: Compressor.h:47