bd/dvd create reworks, Makefile updates
[goodguy/history.git] / cinelerra-5.1 / cinelerra / batchrender.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 BATCHRENDER_H
23 #define BATCHRENDER_H
24
25 #include "arraylist.h"
26 #include "asset.inc"
27 #include "batchrender.inc"
28 #include "bcbutton.h"
29 #include "bcdialog.h"
30 #include "browsebutton.inc"
31 #include "filexml.inc"
32 #include "formattools.h"
33 #include "keyframe.inc"
34 #include "mwindow.inc"
35 #include "preferences.inc"
36 #include "render.inc"
37 #include "timeentry.h"
38
39 #define BATCHRENDER_COLUMNS 4
40
41
42
43
44 class BatchRenderMenuItem : public BC_MenuItem
45 {
46 public:
47         BatchRenderMenuItem(MWindow *mwindow);
48         int handle_event();
49         MWindow *mwindow;
50 };
51
52
53
54 class BatchRenderJob
55 {
56 public:
57         BatchRenderJob(Preferences *preferences);
58         ~BatchRenderJob();
59
60         void copy_from(BatchRenderJob *src);
61         void load(FileXML *file);
62         void save(FileXML *file);
63         void fix_strategy();
64
65 // Source EDL to render
66         char edl_path[BCTEXTLEN];
67 // Destination file for output
68         Asset *asset;
69         int strategy;
70         int enabled;
71 // Amount of time elapsed in last render operation
72         double elapsed;
73         Preferences *preferences;
74 };
75
76
77
78
79
80
81
82
83 class BatchRenderThread : public BC_DialogThread
84 {
85 public:
86         BatchRenderThread(MWindow *mwindow);
87         BatchRenderThread();
88         ~BatchRenderThread();
89         void handle_close_event(int result);
90         BC_Window* new_gui();
91
92         int test_edl_files();
93         void calculate_dest_paths(ArrayList<char*> *paths,
94                 Preferences *preferences);
95         void reset(int warn=0);
96 // Load batch rendering jobs
97         void load_jobs(char *path, Preferences *preferences);
98 // Not applicable to western civilizations
99         void save_jobs(char *path);
100         void load_defaults(BC_Hash *defaults);
101         void save_defaults(BC_Hash *defaults);
102 // Create path for persistent storage functions
103         char* create_path(char *string);
104         void new_job();
105         void delete_job();
106         void update_selected_edl();
107         void use_current_edl();
108 // Conditionally returns the job or the default job based on current_job
109         BatchRenderJob* get_current_job();
110         Asset* get_current_asset();
111         char* get_current_edl();
112 // For command line usage
113         void start_rendering(char *config_path, char *batch_path);
114 // For GUI usage
115         void start_rendering();
116         void stop_rendering();
117 // Highlight the currently rendering job.
118         void update_active(int number);
119         void update_done(int number, int create_list, double elapsed_time);
120         void move_batch(int src, int dst);
121
122         MWindow *mwindow;
123         double current_start;
124         double current_end;
125         BatchRenderJob *default_job;
126         ArrayList<BatchRenderJob*> jobs;
127         BC_Hash *boot_defaults;
128         Preferences *preferences;
129         Render *render;
130         BatchRenderGUI *gui;
131         int column_width[BATCHRENDER_COLUMNS];
132 // job being edited
133         int current_job;
134 // job being rendered
135         int rendering_job;
136         int is_rendering;
137         int warn;
138         ArrayList<BC_ListBoxItem*> *file_entries;
139 };
140
141
142
143 class BatchRenderEDLPath : public BC_TextBox
144 {
145 public:
146         BatchRenderEDLPath(BatchRenderThread *thread, int x, int y, int w,
147                 char *text);
148         int handle_event();
149         BatchRenderThread *thread;
150 };
151
152
153 class BatchRenderCurrentEDL : public BC_GenericButton
154 {
155 public:
156         BatchRenderCurrentEDL(BatchRenderThread *thread, int x, int y);
157         int handle_event();
158         BatchRenderThread *thread;
159 };
160
161
162 class BatchRenderUpdateEDL : public BC_GenericButton
163 {
164 public:
165         BatchRenderUpdateEDL(BatchRenderThread *thread, int x, int y);
166         int handle_event();
167         BatchRenderThread *thread;
168 };
169
170
171 class BatchRenderNew : public BC_GenericButton
172 {
173 public:
174         BatchRenderNew(BatchRenderThread *thread, int x, int y);
175         int handle_event();
176         BatchRenderThread *thread;
177 };
178
179 class BatchRenderDelete : public BC_GenericButton
180 {
181 public:
182         BatchRenderDelete(BatchRenderThread *thread, int x, int y);
183         int handle_event();
184         BatchRenderThread *thread;
185 };
186
187
188
189 class BatchRenderSaveList : public BC_GenericButton, public Thread
190 {
191 public:
192         BatchRenderSaveList(BatchRenderThread *thread, int x, int y);
193         ~BatchRenderSaveList();
194         int handle_event();
195         BatchRenderThread *thread;
196         BC_FileBox *gui;
197         void run();
198         virtual int keypress_event();
199         Mutex *startup_lock;
200 };
201
202 class BatchRenderLoadList : public BC_GenericButton, public Thread
203 {
204 public:
205         BatchRenderLoadList(BatchRenderThread *thread, int x, int y);
206         ~BatchRenderLoadList();
207         int handle_event();
208         BatchRenderThread *thread;
209         BC_FileBox *gui;
210         void run();
211         virtual int keypress_event();
212         Mutex *startup_lock;
213 };
214
215
216
217 class BatchRenderList : public BC_ListBox
218 {
219 public:
220         BatchRenderList(BatchRenderThread *thread, int x, int y, int w, int h);
221         int handle_event();
222         int selection_changed();
223         int column_resize_event();
224         int drag_start_event();
225         int drag_motion_event();
226         int drag_stop_event();
227         int dragging_item;
228         BatchRenderThread *thread;
229 };
230 class BatchRenderStart : public BC_GenericButton
231 {
232 public:
233         BatchRenderStart(BatchRenderThread *thread, int x, int y);
234         int handle_event();
235         BatchRenderThread *thread;
236 };
237
238 class BatchRenderStop : public BC_GenericButton
239 {
240 public:
241         BatchRenderStop(BatchRenderThread *thread, int x, int y);
242         int handle_event();
243         BatchRenderThread *thread;
244 };
245
246 class BatchRenderWarning : public BC_CheckBox
247 {
248 public:
249         BatchRenderWarning(BatchRenderThread *thread, int x, int y);
250         int handle_event();
251         BatchRenderThread *thread;
252 };
253
254 class BatchRenderCancel : public BC_GenericButton
255 {
256 public:
257         BatchRenderCancel(BatchRenderThread *thread, int x, int y);
258         int handle_event();
259         int keypress_event();
260         BatchRenderThread *thread;
261 };
262
263
264 class BatchFormat : public FormatTools
265 {
266 public:
267         BatchFormat(MWindow *mwindow, BatchRenderGUI *gui, Asset *asset);
268         ~BatchFormat();
269
270         int handle_event();
271
272         BatchRenderGUI *gui;
273         MWindow *mwindow;
274 };
275
276
277 class BatchRenderGUI : public BC_Window
278 {
279 public:
280         BatchRenderGUI(MWindow *mwindow,
281                 BatchRenderThread *thread,
282                 int x,
283                 int y,
284                 int w,
285                 int h);
286         ~BatchRenderGUI();
287
288         void create_objects();
289         int resize_event(int w, int h);
290         int translation_event();
291         int close_event();
292         void create_list(int update_widget);
293         void change_job();
294         void button_enable();
295         void button_disable();
296
297         ArrayList<BC_ListBoxItem*> list_columns[BATCHRENDER_COLUMNS];
298
299         MWindow *mwindow;
300         BatchRenderThread *thread;
301         BC_Title *output_path_title;
302         BatchFormat *format_tools;
303         BrowseButton *edl_path_browse;
304         BatchRenderEDLPath *edl_path_text;
305         BC_Title *edl_path_title;
306 //      BC_Title *status_title;
307 //      BC_Title *status_text;
308 //      BC_ProgressBar *progress_bar;
309         BC_Title *list_title;
310         BatchRenderNew *new_batch;
311         BatchRenderDelete *delete_batch;
312         BatchRenderSaveList *savelist_batch;
313         BatchRenderLoadList *loadlist_batch;
314         BatchRenderWarning *warning;
315         BatchRenderList *batch_list;
316         BatchRenderStart *start_button;
317         BatchRenderStop *stop_button;
318         BatchRenderCancel *cancel_button;
319         BatchRenderCurrentEDL *use_current_edl;
320         BatchRenderUpdateEDL *update_selected_edl;
321 };
322
323
324 #endif