2 Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 /** @file src/config.h
21 * @brief Class holding configuration.
24 #ifndef DVDOMATIC_CONFIG_H
25 #define DVDOMATIC_CONFIG_H
28 #include <boost/shared_ptr.hpp>
29 #include <boost/signals2.hpp>
30 #include "dci_metadata.h"
32 class ServerDescription;
40 * @brief A singleton class holding configuration.
46 /** @return number of threads to use for J2K encoding on the local machine */
47 int num_local_encoding_threads () const {
48 return _num_local_encoding_threads;
51 std::string default_directory () const {
52 return _default_directory;
55 std::string default_directory_or (std::string a) const;
57 /** @return port to use for J2K encoding servers */
58 int server_port () const {
62 /** @return J2K encoding servers to use */
63 std::vector<ServerDescription*> servers () const {
67 Scaler const * reference_scaler () const {
68 return _reference_scaler;
71 std::vector<Filter const *> reference_filters () const {
72 return _reference_filters;
75 /** @return The IP address of a TMS that we can copy DCPs to */
76 std::string tms_ip () const {
80 /** @return The path on a TMS that we should write DCPs to */
81 std::string tms_path () const {
85 /** @return User name to log into the TMS with */
86 std::string tms_user () const {
90 /** @return Password to log into the TMS with */
91 std::string tms_password () const {
95 /** @return The sound processor that we are using */
96 SoundProcessor const * sound_processor () const {
97 return _sound_processor;
100 std::list<int> allowed_dcp_frame_rates () const {
101 return _allowed_dcp_frame_rates;
104 DCIMetadata default_dci_metadata () const {
105 return _default_dci_metadata;
108 boost::optional<std::string> language () const {
112 Format const * default_format () const {
113 return _default_format;
116 DCPContentType const * default_dcp_content_type () const {
117 return _default_dcp_content_type;
120 /** @param n New number of local encoding threads */
121 void set_num_local_encoding_threads (int n) {
122 _num_local_encoding_threads = n;
125 void set_default_directory (std::string d) {
126 _default_directory = d;
129 /** @param p New server port */
130 void set_server_port (int p) {
134 /** @param s New list of servers */
135 void set_servers (std::vector<ServerDescription*> s) {
139 void set_reference_scaler (Scaler const * s) {
140 _reference_scaler = s;
143 void set_reference_filters (std::vector<Filter const *> const & f) {
144 _reference_filters = f;
147 /** @param i IP address of a TMS that we can copy DCPs to */
148 void set_tms_ip (std::string i) {
152 /** @param p Path on a TMS that we should write DCPs to */
153 void set_tms_path (std::string p) {
157 /** @param u User name to log into the TMS with */
158 void set_tms_user (std::string u) {
162 /** @param p Password to log into the TMS with */
163 void set_tms_password (std::string p) {
167 void set_allowed_dcp_frame_rates (std::list<int> const & r) {
168 _allowed_dcp_frame_rates = r;
171 void set_default_dci_metadata (DCIMetadata d) {
172 _default_dci_metadata = d;
175 void set_language (std::string l) {
179 void unset_language () {
180 _language = boost::none;
183 void set_default_format (Format const * f) {
187 void set_default_dcp_content_type (DCPContentType const * t) {
188 _default_dcp_content_type = t;
193 static Config* instance ();
198 std::string file () const;
200 /** number of threads to use for J2K encoding on the local machine */
201 int _num_local_encoding_threads;
202 /** default directory to put new films in */
203 std::string _default_directory;
204 /** port to use for J2K encoding servers */
207 /** J2K encoding servers to use */
208 std::vector<ServerDescription *> _servers;
209 /** Scaler to use for the "A" part of A/B comparisons */
210 Scaler const * _reference_scaler;
211 /** Filters to use for the "A" part of A/B comparisons */
212 std::vector<Filter const *> _reference_filters;
213 /** The IP address of a TMS that we can copy DCPs to */
215 /** The path on a TMS that we should write DCPs to */
216 std::string _tms_path;
217 /** User name to log into the TMS with */
218 std::string _tms_user;
219 /** Password to log into the TMS with */
220 std::string _tms_password;
221 /** Our sound processor */
222 SoundProcessor const * _sound_processor;
223 std::list<int> _allowed_dcp_frame_rates;
224 /** Default DCI metadata for newly-created Films */
225 DCIMetadata _default_dci_metadata;
226 boost::optional<std::string> _language;
227 Format const * _default_format;
228 DCPContentType const * _default_dcp_content_type;
230 /** Singleton instance, or 0 */
231 static Config* _instance;