4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
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.
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.
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
25 #include "arraylist.h"
27 #include "batchrender.inc"
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 "timeentry.h"
38 #define BATCHRENDER_COLUMNS 4
43 class BatchRenderMenuItem : public BC_MenuItem
46 BatchRenderMenuItem(MWindow *mwindow);
56 BatchRenderJob(Preferences *preferences);
59 void copy_from(BatchRenderJob *src);
60 void load(FileXML *file);
61 void save(FileXML *file);
64 // Source EDL to render
65 char edl_path[BCTEXTLEN];
66 // Destination file for output
70 // Amount of time elapsed in last render operation
72 Preferences *preferences;
82 class BatchRenderThread : public BC_DialogThread
85 BatchRenderThread(MWindow *mwindow);
88 void handle_close_event(int result);
92 void calculate_dest_paths(ArrayList<char*> *paths,
93 Preferences *preferences);
95 // Load batch rendering jobs
96 void load_jobs(char *path, Preferences *preferences);
97 // Not applicable to western civilizations
98 void save_jobs(char *path);
99 void load_defaults(BC_Hash *defaults);
100 void save_defaults(BC_Hash *defaults);
101 // Create path for persistent storage functions
102 char* create_path(char *string);
105 void update_selected_edl();
106 void use_current_edl();
107 // Conditionally returns the job or the default job based on current_job
108 BatchRenderJob* get_current_job();
109 Asset* get_current_asset();
110 char* get_current_edl();
111 // For command line usage
112 void start_rendering(char *config_path, char *batch_path);
114 void start_rendering();
115 void stop_rendering();
116 // Highlight the currently rendering job.
117 void update_active(int number);
118 void update_done(int number, int create_list, double elapsed_time);
119 void move_batch(int src, int dst);
122 double current_start;
124 BatchRenderJob *default_job;
125 ArrayList<BatchRenderJob*> jobs;
127 int column_width[BATCHRENDER_COLUMNS];
130 // job being rendered
133 ArrayList<BC_ListBoxItem*> *file_entries;
145 class BatchRenderEDLPath : public BC_TextBox
148 BatchRenderEDLPath(BatchRenderThread *thread,
154 BatchRenderThread *thread;
158 class BatchRenderCurrentEDL : public BC_GenericButton
161 BatchRenderCurrentEDL(BatchRenderThread *thread,
165 BatchRenderThread *thread;
169 class BatchRenderUpdateEDL : public BC_GenericButton
172 BatchRenderUpdateEDL(BatchRenderThread *thread,
176 BatchRenderThread *thread;
180 class BatchRenderNew : public BC_GenericButton
183 BatchRenderNew(BatchRenderThread *thread,
187 BatchRenderThread *thread;
190 class BatchRenderDelete : public BC_GenericButton
193 BatchRenderDelete(BatchRenderThread *thread,
197 BatchRenderThread *thread;
200 class BatchRenderList : public BC_ListBox
203 BatchRenderList(BatchRenderThread *thread,
209 int selection_changed();
210 int column_resize_event();
211 int drag_start_event();
212 int drag_motion_event();
213 int drag_stop_event();
215 BatchRenderThread *thread;
217 class BatchRenderStart : public BC_GenericButton
220 BatchRenderStart(BatchRenderThread *thread,
224 BatchRenderThread *thread;
227 class BatchRenderStop : public BC_GenericButton
230 BatchRenderStop(BatchRenderThread *thread,
234 BatchRenderThread *thread;
237 class BatchRenderCancel : public BC_GenericButton
240 BatchRenderCancel(BatchRenderThread *thread,
244 int keypress_event();
245 BatchRenderThread *thread;
249 class BatchFormat : public FormatTools
252 BatchFormat(MWindow *mwindow,
264 class BatchRenderGUI : public BC_Window
267 BatchRenderGUI(MWindow *mwindow,
268 BatchRenderThread *thread,
275 void create_objects();
276 int resize_event(int w, int h);
277 int translation_event();
279 void create_list(int update_widget);
281 void button_enable();
282 void button_disable();
284 ArrayList<BC_ListBoxItem*> list_columns[BATCHRENDER_COLUMNS];
287 BatchRenderThread *thread;
288 BC_Title *output_path_title;
289 BatchFormat *format_tools;
290 BrowseButton *edl_path_browse;
291 BatchRenderEDLPath *edl_path_text;
292 BC_Title *edl_path_title;
293 // BC_Title *status_title;
294 // BC_Title *status_text;
295 // BC_ProgressBar *progress_bar;
296 BC_Title *list_title;
297 BatchRenderNew *new_batch;
298 BatchRenderDelete *delete_batch;
299 BatchRenderList *batch_list;
300 BatchRenderStart *start_button;
301 BatchRenderStop *stop_button;
302 BatchRenderCancel *cancel_button;
303 BatchRenderCurrentEDL *use_current_edl;
304 BatchRenderUpdateEDL *update_selected_edl;
310 class CreateDVD_MenuItem : public BC_MenuItem
313 CreateDVD_MenuItem(MWindow *mwindow);
319 class CreateDVD_Thread : public BC_DialogThread
321 static const int64_t DVD_SIZE;
322 static const int DVD_STREAMS, DVD_WIDTH, DVD_HEIGHT;
323 static const double DVD_ASPECT_WIDTH, DVD_ASPECT_HEIGHT;
324 static const double DVD_WIDE_ASPECT_WIDTH, DVD_WIDE_ASPECT_HEIGHT;
325 static const int DVD_MAX_BITRATE, DVD_CHANNELS, DVD_WIDE_CHANNELS;
326 static const double DVD_FRAMERATE, DVD_SAMPLERATE, DVD_KAUDIO_RATE;
328 CreateDVD_Thread(MWindow *mwindow);
330 void handle_close_event(int result);
331 BC_Window* new_gui();
332 int option_presets();
333 int create_dvd_jobs(ArrayList<BatchRenderJob*> *jobs,
334 const char *tmp_path, const char *asset_title);
335 int insert_video_plugin(const char *title, KeyFrame *default_keyframe);
340 char asset_title[BCTEXTLEN];
341 char tmp_path[BCTEXTLEN];
342 int use_deinterlace, use_inverse_telecine;
343 int use_scale, use_resize_tracks;
344 int use_wide_audio, use_wide_aspect;
345 int use_histogram, use_label_chapters;
348 class CreateDVD_OK : public BC_OKButton
351 CreateDVD_OK(CreateDVD_GUI *gui, int x, int y);
353 int button_press_event();
354 int keypress_event();
359 class CreateDVD_Cancel : public BC_CancelButton
362 CreateDVD_Cancel(CreateDVD_GUI *gui, int x, int y);
364 int button_press_event();
370 class CreateDVD_DiskSpace : public BC_Title
373 CreateDVD_DiskSpace(CreateDVD_GUI *gui, int x, int y);
374 ~CreateDVD_DiskSpace();
375 int64_t tmp_path_space();
381 class CreateDVD_TmpPath : public BC_TextBox
384 CreateDVD_TmpPath(CreateDVD_GUI *gui, int x, int y, int w);
385 ~CreateDVD_TmpPath();
392 class CreateDVD_AssetTitle : public BC_TextBox
395 CreateDVD_AssetTitle(CreateDVD_GUI *gui, int x, int y, int w);
396 ~CreateDVD_AssetTitle();
401 class CreateDVD_Deinterlace : public BC_CheckBox
404 CreateDVD_Deinterlace(CreateDVD_GUI *gui, int x, int y);
405 ~CreateDVD_Deinterlace();
411 class CreateDVD_InverseTelecine : public BC_CheckBox
414 CreateDVD_InverseTelecine(CreateDVD_GUI *gui, int x, int y);
415 ~CreateDVD_InverseTelecine();
421 class CreateDVD_Scale : public BC_CheckBox
424 CreateDVD_Scale(CreateDVD_GUI *gui, int x, int y);
430 class CreateDVD_ResizeTracks : public BC_CheckBox
433 CreateDVD_ResizeTracks(CreateDVD_GUI *gui, int x, int y);
434 ~CreateDVD_ResizeTracks();
439 class CreateDVD_Histogram : public BC_CheckBox
442 CreateDVD_Histogram(CreateDVD_GUI *gui, int x, int y);
443 ~CreateDVD_Histogram();
448 class CreateDVD_LabelChapters : public BC_CheckBox
451 CreateDVD_LabelChapters(CreateDVD_GUI *gui, int x, int y);
452 ~CreateDVD_LabelChapters();
457 class CreateDVD_WideAudio : public BC_CheckBox
460 CreateDVD_WideAudio(CreateDVD_GUI *gui, int x, int y);
461 ~CreateDVD_WideAudio();
466 class CreateDVD_WideAspect : public BC_CheckBox
469 CreateDVD_WideAspect(CreateDVD_GUI *gui, int x, int y);
470 ~CreateDVD_WideAspect();
475 class CreateDVD_GUI : public BC_Window
478 CreateDVD_GUI(CreateDVD_Thread *thread,
479 int x, int y, int w, int h);
482 void create_objects();
483 int resize_event(int w, int h);
484 int translation_event();
487 int64_t needed_disk_space;
488 CreateDVD_Thread *thread;
490 CreateDVD_AssetTitle *asset_title;
492 CreateDVD_TmpPath *tmp_path;
493 CreateDVD_DiskSpace *disk_space;
494 CreateDVD_Deinterlace *need_deinterlace;
495 CreateDVD_InverseTelecine *need_inverse_telecine;
496 CreateDVD_Scale *need_scale;
497 CreateDVD_ResizeTracks *need_resize_tracks;
498 CreateDVD_Histogram *need_histogram;
499 CreateDVD_WideAudio *need_wide_audio;
500 CreateDVD_WideAspect *need_wide_aspect;
501 CreateDVD_LabelChapters *need_label_chapters;
502 int ok_x, ok_y, ok_w, ok_h;
504 int cancel_x, cancel_y, cancel_w, cancel_h;
505 CreateDVD_Cancel *cancel;