initial commit
[goodguy/history.git] / cinelerra-5.0 / cinelerra / preferences.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5  * 
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  * 
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  * 
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  * 
20  */
21
22 #ifndef PREFERENCES_H
23 #define PREFERENCES_H
24
25 #include "asset.inc"
26 #include "audioconfig.inc"
27 #include "bchash.inc"
28 #include "guicast.h"
29 #include "maxchannels.h"
30 #include "mutex.inc"
31 #include "preferences.inc"
32 #include "videoconfig.inc"
33
34
35 class Preferences
36 {
37 public:
38         Preferences();
39         ~Preferences();
40
41         Preferences& operator=(Preferences &that);
42         void copy_from(Preferences *that);
43         int load_defaults(BC_Hash *defaults);
44         int save_defaults(BC_Hash *defaults);
45         void boundaries();
46
47         static void print_channels(char *string, 
48                 int *channel_positions, 
49                 int channels);
50         static void scan_channels(char *string, 
51                 int *channel_positions, 
52                 int channels);
53
54         void add_node(const char *text, int port, int enabled, float rate);
55         void delete_node(int number);
56         void delete_nodes();
57         void reset_rates();
58 // Get average frame rate or 1.0
59         float get_avg_rate(int use_master_node);
60         void sort_nodes();
61         void edit_node(int number, const char *new_text, int port, int enabled);
62         int get_enabled_nodes();
63         const char* get_node_hostname(int number);
64         int get_node_port(int number);
65         int get_asset_file_path(Asset *asset, char *path);
66 // Copy frame rates.  Always used where the argument is the renderfarm and this is
67 // the master preferences.  This way, the value for master node is properly 
68 // translated from a unix socket to the local_rate.
69         void copy_rates_from(Preferences *preferences);
70 // Set frame rate for a node.  Node -1 is the master node.
71 // The node number is relative to the enabled nodes.
72         void set_rate(float rate, int node);
73         float get_rate(int node);
74 // Calculate the number of cpus to use.  
75 // Determined by /proc/cpuinfo and force_uniprocessor.
76 // interactive forces it to ignore force_uniprocessor
77         int calculate_processors(int interactive = 0);
78
79 // ================================= Performance ================================
80 // directory to look in for indexes
81         char index_directory[BCTEXTLEN];   
82 // size of index file in bytes
83         int64_t index_size;                  
84         int index_count;
85 // Use thumbnails in AWindow assets.
86         int use_thumbnails;
87         int trap_sigsegv;
88         int trap_sigintr;
89 // Title of theme
90         char theme[BCTEXTLEN];
91         double render_preroll;
92         int brender_preroll;
93         int force_uniprocessor;
94 // The number of cpus to use when rendering.
95 // Determined by /proc/cpuinfo and force_uniprocessor
96         int processors;
97 // Number of processors for interactive operations.
98         int real_processors;
99 // enable/disable filefork
100         int file_forking;
101 // ffmpeg probes early/late during File::open_file read
102         int ffmpeg_early_probe;
103
104 // Default positions for channels
105         int channel_positions[MAXCHANNELS * MAXCHANNELS];
106
107         Asset *brender_asset;
108         int use_brender;
109 // Number of frames in a brender job.
110         int brender_fragment;
111 // Size of cache in bytes.
112 // Several caches of cache_size exist so multiply by 4.
113 // rendering, playback, timeline, preview
114         int64_t cache_size;
115
116         int use_renderfarm;
117         int renderfarm_port;
118 // If the node starts with a / it's on the localhost using a path as the socket.
119         ArrayList<char*> renderfarm_nodes;
120         ArrayList<int>   renderfarm_ports;
121         ArrayList<int>   renderfarm_enabled;
122         ArrayList<float> renderfarm_rate;
123 // Rate of master node
124         float local_rate;
125         char renderfarm_mountpoint[BCTEXTLEN];
126 // Use virtual filesystem
127         int renderfarm_vfs;
128 // Jobs per node
129         int renderfarm_job_count;
130 // Consolidate output files
131         int renderfarm_consolidate;
132
133 // Tip of the day
134         int use_tipwindow;
135 // Scan for commercials
136         int scan_commercials;
137 // Android remote control
138         int android_remote;
139         int android_port;
140         char android_pin[BCSTRLEN];
141
142 // ====================================== Plugin Set ==============================
143         char plugin_dir[BCTEXTLEN];
144
145 // Required when updating renderfarm rates
146         Mutex *preferences_lock;
147 };
148
149 #endif