Loading...
Searching...
No Matches
Settings.cpp
Go to the documentation of this file.
// Copyright (c) 2008-2019 OpenShot Studios, LLC
//
// SPDX-License-Identifier: LGPL-3.0-or-later
#include <cstdlib> // For std::getenv
#include "Settings.h"
using namespace openshot;
// Global reference to Settings
Settings *Settings::m_pInstance = nullptr;
// Create or Get an instance of the settings singleton
Settings *Settings::Instance()
{
if (!m_pInstance) {
// Create the actual instance of Settings only once
m_pInstance = new Settings;
m_pInstance->HARDWARE_DECODER = 0;
m_pInstance->HIGH_QUALITY_SCALING = false;
m_pInstance->OMP_THREADS = 12;
m_pInstance->FF_THREADS = 8;
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;
m_pInstance->VIDEO_CACHE_PERCENT_AHEAD = 0.7;
m_pInstance->VIDEO_CACHE_MIN_PREROLL_FRAMES = 24;
m_pInstance->VIDEO_CACHE_MAX_PREROLL_FRAMES = 48;
m_pInstance->VIDEO_CACHE_MAX_FRAMES = 30 * 10;
m_pInstance->ENABLE_PLAYBACK_CACHING = true;
m_pInstance->PLAYBACK_AUDIO_DEVICE_NAME = "";
m_pInstance->PLAYBACK_AUDIO_DEVICE_TYPE = "";
m_pInstance->DEBUG_TO_STDERR = false;
auto env_debug = std::getenv("LIBOPENSHOT_DEBUG");
if (env_debug != nullptr)
m_pInstance->DEBUG_TO_STDERR = true;
}
return m_pInstance;
}
Settings.h
Header file for global Settings class.
openshot::Settings
This class is contains settings used by libopenshot (and can be safely toggled at any point)
Definition Settings.h:26
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::PLAYBACK_AUDIO_DEVICE_NAME
std::string PLAYBACK_AUDIO_DEVICE_NAME
The audio device name to use during playback.
Definition Settings.h:101
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::HW_DE_DEVICE_SET
int HW_DE_DEVICE_SET
Which GPU to use to decode (0 is the first)
Definition Settings.h:80
openshot::Settings::DE_LIMIT_HEIGHT_MAX
int DE_LIMIT_HEIGHT_MAX
Maximum rows that hardware decode can handle.
Definition Settings.h:74
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::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::HARDWARE_DECODER
int HARDWARE_DECODER
Use video codec for faster video decoding (if supported)
Definition Settings.h:62
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::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::FF_THREADS
int FF_THREADS
Number of threads that ffmpeg uses.
Definition Settings.h:71
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::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::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::DEBUG_TO_STDERR
bool DEBUG_TO_STDERR
Whether to dump ZeroMQ debug messages to stderr.
Definition Settings.h:111
openshot
This namespace is the default namespace for all code in the openshot library.
Definition Compressor.h:29