OpenShot Library | libopenshot  0.6.0
Settings.h
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 #ifndef OPENSHOT_SETTINGS_H
14 #define OPENSHOT_SETTINGS_H
15 
16 #include <string>
17 
18 namespace openshot {
19 
26  class Settings {
27  private:
28 
30  Settings(){}; // Don't allow user to create an instance of this singleton
31 
32 #if __GNUC__ >=7
33  Settings(Settings const&) = delete; // Don't allow the user to assign this instance
35 
37  Settings & operator=(Settings const&) = delete; // Don't allow the user to assign this instance
38 #else
39  Settings(Settings const&) {}; // Don't allow the user to assign this instance
41 
43  Settings & operator=(Settings const&); // Don't allow the user to assign this instance
44 #endif
45 
47  static Settings * m_pInstance;
48 
50  int applied_omp_threads = 0;
51 
53  int default_omp_threads = 2;
54 
56  int default_ff_threads = 2;
57 
58  public:
72 
74  bool HIGH_QUALITY_SCALING = false;
75 
77  int OMP_THREADS = 2;
78 
80  int FF_THREADS = 16;
81 
83  int CACHE_MIN_FRAMES = 24;
84 
86  int DE_LIMIT_HEIGHT_MAX = 1100;
87 
89  int DE_LIMIT_WIDTH_MAX = 1950;
90 
93 
96 
99 
102 
105 
107  int VIDEO_CACHE_MAX_FRAMES = 30 * 10;
108 
111 
113  std::string PLAYBACK_AUDIO_DEVICE_NAME = "";
114 
116  std::string PLAYBACK_AUDIO_DEVICE_TYPE = "";
117 
120 
123  std::string PATH_OPENSHOT_INSTALL = "";
124 
126  bool DEBUG_TO_STDERR = false;
127 
129  int EffectiveOMPThreads() const;
130 
132  int MaxAllowedThreads() const;
133 
135  int DefaultOMPThreads() const { return default_omp_threads; }
136 
138  int DefaultFFThreads() const { return default_ff_threads; }
139 
141  void ApplyOpenMPSettings();
142 
144  static Settings * Instance();
145  };
146 
147 }
148 
149 #endif
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:98
openshot::Settings::HARDWARE_DECODER
int HARDWARE_DECODER
Use video codec for faster video decoding (if supported)
Definition: Settings.h:71
openshot
This namespace is the default namespace for all code in the openshot library.
Definition: Compressor.h:28
openshot::Settings::MaxAllowedThreads
int MaxAllowedThreads() const
Return the maximum allowed thread override based on this machine.
Definition: Settings.cpp: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:110
openshot::Settings::PLAYBACK_AUDIO_BUFFER_SIZE
int PLAYBACK_AUDIO_BUFFER_SIZE
Size of playback buffer before audio playback starts.
Definition: Settings.h:119
openshot::Settings::ApplyOpenMPSettings
void ApplyOpenMPSettings()
Apply any explicit OpenMP thread override to the runtime.
Definition: Settings.cpp:33
openshot::Settings::VIDEO_CACHE_MAX_FRAMES
int VIDEO_CACHE_MAX_FRAMES
Max number of frames (when paused) to cache for playback.
Definition: Settings.h:107
openshot::Settings::HW_EN_DEVICE_SET
int HW_EN_DEVICE_SET
Which GPU to use to encode (0 is the first)
Definition: Settings.h:95
openshot::Settings::DefaultFFThreads
int DefaultFFThreads() const
Return the machine default FFmpeg thread count detected at startup.
Definition: Settings.h:138
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:104
openshot::Settings::DE_LIMIT_HEIGHT_MAX
int DE_LIMIT_HEIGHT_MAX
Maximum rows that hardware decode can handle.
Definition: Settings.h:86
openshot::Settings::PLAYBACK_AUDIO_DEVICE_NAME
std::string PLAYBACK_AUDIO_DEVICE_NAME
The audio device name to use during playback.
Definition: Settings.h:113
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:101
openshot::Settings::Instance
static Settings * Instance()
Create or get an instance of this logger singleton (invoke the class with this method)
Definition: Settings.cpp:43
openshot::Settings::PATH_OPENSHOT_INSTALL
std::string PATH_OPENSHOT_INSTALL
Definition: Settings.h:123
openshot::Settings::FF_THREADS
int FF_THREADS
Number of threads that ffmpeg uses.
Definition: Settings.h:80
openshot::Settings::PLAYBACK_AUDIO_DEVICE_TYPE
std::string PLAYBACK_AUDIO_DEVICE_TYPE
The device type for the playback audio devices.
Definition: Settings.h:116
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:74
openshot::Settings::DefaultOMPThreads
int DefaultOMPThreads() const
Return the machine default OpenMP thread count detected at startup.
Definition: Settings.h:135
openshot::Settings::CACHE_MIN_FRAMES
int CACHE_MIN_FRAMES
Minimum number of frames for frame-count-based caches.
Definition: Settings.h:83
openshot::Settings::DE_LIMIT_WIDTH_MAX
int DE_LIMIT_WIDTH_MAX
Maximum columns that hardware decode can handle.
Definition: Settings.h:89
openshot::Settings::OMP_THREADS
int OMP_THREADS
Number of OpenMP threads.
Definition: Settings.h:77
openshot::Settings::DEBUG_TO_STDERR
bool DEBUG_TO_STDERR
Whether to dump ZeroMQ debug messages to stderr.
Definition: Settings.h:126
openshot::Settings::EffectiveOMPThreads
int EffectiveOMPThreads() const
Return the effective OpenMP worker budget used by libopenshot heuristics.
Definition: Settings.cpp:23
openshot::Settings::HW_DE_DEVICE_SET
int HW_DE_DEVICE_SET
Which GPU to use to decode (0 is the first)
Definition: Settings.h:92