OpenShot Library | libopenshot  0.2.5
Settings.h
Go to the documentation of this file.
1 /**
2  * @file
3  * @brief Header 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 #ifndef OPENSHOT_SETTINGS_H
32 #define OPENSHOT_SETTINGS_H
33 
34 
35 #include <iostream>
36 #include <iomanip>
37 #include <fstream>
38 #include <stdlib.h>
39 #include <string>
40 #include <sstream>
41 #include <stdio.h>
42 #include <time.h>
43 #include <zmq.hpp>
44 #include <unistd.h>
45 #include "JuceHeader.h"
46 
47 
48 namespace openshot {
49 
50  /**
51  * @brief This class is contains settings used by libopenshot (and can be safely toggled at any point)
52  *
53  * Settings class is used primarily to toggle scale settings between preview and rendering, and adjust
54  * other runtime related settings.
55  */
56  class Settings {
57  private:
58 
59  /// Default constructor
60  Settings(){}; // Don't allow user to create an instance of this singleton
61 
62 #if __GNUC__ >=7
63  /// Default copy method
64  Settings(Settings const&) = delete; // Don't allow the user to assign this instance
65 
66  /// Default assignment operator
67  Settings & operator=(Settings const&) = delete; // Don't allow the user to assign this instance
68 #else
69  /// Default copy method
70  Settings(Settings const&) {}; // Don't allow the user to assign this instance
71 
72  /// Default assignment operator
73  Settings & operator=(Settings const&); // Don't allow the user to assign this instance
74 #endif
75 
76  /// Private variable to keep track of singleton instance
77  static Settings * m_pInstance;
78 
79  public:
80  /**
81  * @brief Use video codec for faster video decoding (if supported)
82  *
83  * 0 - No acceleration,
84  * 1 - Linux VA-API,
85  * 2 - nVidia NVDEC,
86  * 3 - Windows D3D9,
87  * 4 - Windows D3D11,
88  * 5 - MacOS / VideoToolBox,
89  * 6 - Linux VDPAU,
90  * 7 - Intel QSV
91  */
93 
94  /// Scale mode used in FFmpeg decoding and encoding (used as an optimization for faster previews)
95  bool HIGH_QUALITY_SCALING = false;
96 
97  /// Maximum width for image data (useful for optimzing for a smaller preview or render)
98  int MAX_WIDTH = 0;
99 
100  /// Maximum height for image data (useful for optimzing for a smaller preview or render)
101  int MAX_HEIGHT = 0;
102 
103  /// Wait for OpenMP task to finish before continuing (used to limit threads on slower systems)
105 
106  /// Number of threads of OpenMP
107  int OMP_THREADS = 12;
108 
109  /// Number of threads that ffmpeg uses
110  int FF_THREADS = 8;
111 
112  /// Maximum rows that hardware decode can handle
114 
115  /// Maximum columns that hardware decode can handle
116  int DE_LIMIT_WIDTH_MAX = 1950;
117 
118  /// Which GPU to use to decode (0 is the first)
120 
121  /// Which GPU to use to encode (0 is the first)
123 
124  /// The audio device name to use during playback
125  std::string PLAYBACK_AUDIO_DEVICE_NAME = "";
126 
127  /// Create or get an instance of this logger singleton (invoke the class with this method)
128  static Settings * Instance();
129  };
130 
131 }
132 
133 #endif
openshot::Settings::HARDWARE_DECODER
int HARDWARE_DECODER
Use video codec for faster video decoding (if supported)
Definition: Settings.h:92
openshot
This namespace is the default namespace for all code in the openshot library.
Definition: AudioBufferSource.h:38
openshot::Settings
This class is contains settings used by libopenshot (and can be safely toggled at any point)
Definition: Settings.h:56
openshot::Settings::HW_EN_DEVICE_SET
int HW_EN_DEVICE_SET
Which GPU to use to encode (0 is the first)
Definition: Settings.h:122
openshot::Settings::MAX_HEIGHT
int MAX_HEIGHT
Maximum height for image data (useful for optimzing for a smaller preview or render)
Definition: Settings.h:101
openshot::Settings::DE_LIMIT_HEIGHT_MAX
int DE_LIMIT_HEIGHT_MAX
Maximum rows that hardware decode can handle.
Definition: Settings.h:113
openshot::Settings::PLAYBACK_AUDIO_DEVICE_NAME
std::string PLAYBACK_AUDIO_DEVICE_NAME
The audio device name to use during playback.
Definition: Settings.h:125
openshot::Settings::WAIT_FOR_VIDEO_PROCESSING_TASK
bool WAIT_FOR_VIDEO_PROCESSING_TASK
Wait for OpenMP task to finish before continuing (used to limit threads on slower systems)
Definition: Settings.h:104
openshot::Settings::Instance
static Settings * Instance()
Create or get an instance of this logger singleton (invoke the class with this method)
Definition: Settings.cpp:41
openshot::Settings::FF_THREADS
int FF_THREADS
Number of threads that ffmpeg uses.
Definition: Settings.h:110
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:95
openshot::Settings::DE_LIMIT_WIDTH_MAX
int DE_LIMIT_WIDTH_MAX
Maximum columns that hardware decode can handle.
Definition: Settings.h:116
openshot::Settings::MAX_WIDTH
int MAX_WIDTH
Maximum width for image data (useful for optimzing for a smaller preview or render)
Definition: Settings.h:98
openshot::Settings::OMP_THREADS
int OMP_THREADS
Number of threads of OpenMP.
Definition: Settings.h:107
openshot::Settings::HW_DE_DEVICE_SET
int HW_DE_DEVICE_SET
Which GPU to use to decode (0 is the first)
Definition: Settings.h:119