OpenShot Library | libopenshot  0.3.3
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 
17 using namespace openshot;
18 
19 // Global reference to Settings
20 Settings *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 }
Settings.h
Header file for global Settings class.
openshot::Settings::VIDEO_CACHE_PERCENT_AHEAD
float VIDEO_CACHE_PERCENT_AHEAD
Percentage of cache in front of the playhead (0.0 to 1.0)
Definition: Settings.h:86
openshot::Settings::HARDWARE_DECODER
int HARDWARE_DECODER
Use video codec for faster video decoding (if supported)
Definition: Settings.h:62
openshot
This namespace is the default namespace for all code in the openshot library.
Definition: Compressor.h:28
openshot::Settings
This class is contains settings used by libopenshot (and can be safely toggled at any point)
Definition: Settings.h:26
openshot::Settings::ENABLE_PLAYBACK_CACHING
bool ENABLE_PLAYBACK_CACHING
Enable/Disable the cache thread to pre-fetch and cache video frames before we need them.
Definition: Settings.h:98
openshot::Settings::VIDEO_CACHE_MAX_FRAMES
int VIDEO_CACHE_MAX_FRAMES
Max number of frames (when paused) to cache for playback.
Definition: Settings.h:95
openshot::Settings::HW_EN_DEVICE_SET
int HW_EN_DEVICE_SET
Which GPU to use to encode (0 is the first)
Definition: Settings.h:83
openshot::Settings::VIDEO_CACHE_MAX_PREROLL_FRAMES
int VIDEO_CACHE_MAX_PREROLL_FRAMES
Max number of frames (ahead of playhead) to cache during playback.
Definition: Settings.h:92
openshot::Settings::DE_LIMIT_HEIGHT_MAX
int DE_LIMIT_HEIGHT_MAX
Maximum rows that hardware decode can handle.
Definition: Settings.h:74
openshot::Settings::PLAYBACK_AUDIO_DEVICE_NAME
std::string PLAYBACK_AUDIO_DEVICE_NAME
The audio device name to use during playback.
Definition: Settings.h:101
openshot::Settings::VIDEO_CACHE_MIN_PREROLL_FRAMES
int VIDEO_CACHE_MIN_PREROLL_FRAMES
Minimum number of frames to cache before playback begins.
Definition: Settings.h:89
openshot::Settings::Instance
static Settings * Instance()
Create or get an instance of this logger singleton (invoke the class with this method)
Definition: Settings.cpp:23
openshot::Settings::FF_THREADS
int FF_THREADS
Number of threads that ffmpeg uses.
Definition: Settings.h:71
openshot::Settings::PLAYBACK_AUDIO_DEVICE_TYPE
std::string PLAYBACK_AUDIO_DEVICE_TYPE
The device type for the playback audio devices.
Definition: Settings.h:104
openshot::Settings::HIGH_QUALITY_SCALING
bool HIGH_QUALITY_SCALING
Scale mode used in FFmpeg decoding and encoding (used as an optimization for faster previews)
Definition: Settings.h:65
openshot::Settings::DE_LIMIT_WIDTH_MAX
int DE_LIMIT_WIDTH_MAX
Maximum columns that hardware decode can handle.
Definition: Settings.h:77
openshot::Settings::OMP_THREADS
int OMP_THREADS
Number of threads of OpenMP.
Definition: Settings.h:68
openshot::Settings::DEBUG_TO_STDERR
bool DEBUG_TO_STDERR
Whether to dump ZeroMQ debug messages to stderr.
Definition: Settings.h:111
openshot::Settings::HW_DE_DEVICE_SET
int HW_DE_DEVICE_SET
Which GPU to use to decode (0 is the first)
Definition: Settings.h:80