OpenShot Library | libopenshot 0.3.3
Loading...
Searching...
No Matches
Settings.cpp
Go to the documentation of this file.
1
9// Copyright (c) 2008-2019 OpenShot Studios, LLC
10//
11// SPDX-License-Identifier: LGPL-3.0-or-later
12
13#include <cstdlib> // For std::getenv
14
15#include "Settings.h"
16
17using namespace openshot;
18
19// Global reference to Settings
20Settings *Settings::m_pInstance = nullptr;
21
22// Create or Get an instance of the settings singleton
24{
25 if (!m_pInstance) {
26 // Create the actual instance of Settings only once
27 m_pInstance = new Settings;
28 m_pInstance->HARDWARE_DECODER = 0;
29 m_pInstance->HIGH_QUALITY_SCALING = false;
30 m_pInstance->OMP_THREADS = 12;
31 m_pInstance->FF_THREADS = 8;
32 m_pInstance->DE_LIMIT_HEIGHT_MAX = 1100;
33 m_pInstance->DE_LIMIT_WIDTH_MAX = 1950;
34 m_pInstance->HW_DE_DEVICE_SET = 0;
35 m_pInstance->HW_EN_DEVICE_SET = 0;
36 m_pInstance->VIDEO_CACHE_PERCENT_AHEAD = 0.7;
37 m_pInstance->VIDEO_CACHE_MIN_PREROLL_FRAMES = 24;
38 m_pInstance->VIDEO_CACHE_MAX_PREROLL_FRAMES = 48;
39 m_pInstance->VIDEO_CACHE_MAX_FRAMES = 30 * 10;
40 m_pInstance->ENABLE_PLAYBACK_CACHING = true;
41 m_pInstance->PLAYBACK_AUDIO_DEVICE_NAME = "";
42 m_pInstance->PLAYBACK_AUDIO_DEVICE_TYPE = "";
43 m_pInstance->DEBUG_TO_STDERR = false;
44 auto env_debug = std::getenv("LIBOPENSHOT_DEBUG");
45 if (env_debug != nullptr)
46 m_pInstance->DEBUG_TO_STDERR = true;
47 }
48
49 return m_pInstance;
50}
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:26
int DE_LIMIT_WIDTH_MAX
Maximum columns that hardware decode can handle.
Definition Settings.h:77
int OMP_THREADS
Number of threads of OpenMP.
Definition Settings.h:68
std::string PLAYBACK_AUDIO_DEVICE_NAME
The audio device name to use during playback.
Definition Settings.h:101
std::string PLAYBACK_AUDIO_DEVICE_TYPE
The device type for the playback audio devices.
Definition Settings.h:104
int HW_DE_DEVICE_SET
Which GPU to use to decode (0 is the first)
Definition Settings.h:80
int DE_LIMIT_HEIGHT_MAX
Maximum rows that hardware decode can handle.
Definition Settings.h:74
static Settings * Instance()
Create or get an instance of this logger singleton (invoke the class with this method)
Definition Settings.cpp:23
int VIDEO_CACHE_MIN_PREROLL_FRAMES
Minimum number of frames to cache before playback begins.
Definition Settings.h:89
int HARDWARE_DECODER
Use video codec for faster video decoding (if supported)
Definition Settings.h:62
bool HIGH_QUALITY_SCALING
Scale mode used in FFmpeg decoding and encoding (used as an optimization for faster previews)
Definition Settings.h:65
int VIDEO_CACHE_MAX_FRAMES
Max number of frames (when paused) to cache for playback.
Definition Settings.h:95
int FF_THREADS
Number of threads that ffmpeg uses.
Definition Settings.h:71
float VIDEO_CACHE_PERCENT_AHEAD
Percentage of cache in front of the playhead (0.0 to 1.0)
Definition Settings.h:86
bool ENABLE_PLAYBACK_CACHING
Enable/Disable the cache thread to pre-fetch and cache video frames before we need them.
Definition Settings.h:98
int HW_EN_DEVICE_SET
Which GPU to use to encode (0 is the first)
Definition Settings.h:83
int VIDEO_CACHE_MAX_PREROLL_FRAMES
Max number of frames (ahead of playhead) to cache during playback.
Definition Settings.h:92
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:29