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
27 #include "bitspopup.h"
28 #include "browsebutton.h"
29 #include "compresspopup.h"
32 #include "formatpopup.h"
33 #include "formattools.inc"
34 #include "mwindow.inc"
39 FormatTools(MWindow *mwindow, BC_WindowBase *window, Asset *asset);
40 virtual ~FormatTools();
42 void create_objects(int &init_x, int &init_y,
43 int do_audio, int do_video, // Include tools for audio, video
44 int prompt_audio, int prompt_video, // Include checkbox for audio, video
45 int prompt_audio_channels, int prompt_video_compression,
46 const char *locked_compressor, // Select compressors to be offered
47 int recording, // Change captions for recording
48 int *file_per_label, // prompt if nonzero
49 int brender, // Supply file formats for background rendering
50 int horizontal_layout = 0);
51 // In recording preferences, aspects of the format are locked
52 // depending on the driver used.
53 void update_driver(int driver);
54 virtual void update_format();
57 void reposition_window(int &init_x, int &init_y);
58 // Put new asset's parameters in and change asset.
59 void update(Asset *asset, int *file_per_label);
60 // Update filename extension when format is changed.
61 void update_extension();
62 void close_format_windows();
65 // Handle change in path text. Used in BatchRender.
66 virtual int handle_event();
68 int set_audio_options();
69 int set_video_options();
73 BC_WindowBase *window;
76 FormatAParams *aparams_button;
77 FormatVParams *vparams_button;
78 FormatAThread *aparams_thread;
79 FormatVThread *vparams_thread;
80 BrowseButton *path_button;
81 FormatPathText *path_textbox;
82 BC_RecentList *path_recent;
83 BC_Title *format_title;
84 FormatFormat *format_button;
85 BC_TextBox *format_text;
86 FormatFFMPEG *format_ffmpeg;
87 FFMpegType *ffmpeg_type;
89 BC_Title *audio_title;
90 FormatAudio *audio_switch;
92 BC_Title *video_title;
93 FormatVideo *video_switch;
95 FormatFilePerLabel *labeled_files;
98 const char *locked_compressor;
104 int prompt_audio_channels;
106 int prompt_video_compression;
109 // Determines what the configuration buttons do.
115 class FormatPathText : public BC_TextBox
118 FormatPathText(int x, int y, FormatTools *format);
127 class FormatFormat : public FormatPopup
130 FormatFormat(int x, int y, FormatTools *format);
137 class FormatFFMPEG : public FFMPEGPopup
140 FormatFFMPEG(int x, int y, FormatTools *format);
146 // squash show/hide window
147 int show_window(int flush=1) { return 0; }
148 int hide_window(int flush=1) { return 0; }
149 int show(int flush=1) { return BC_SubWindow::show_window(flush); }
150 int hide(int flush=1) { return BC_SubWindow::hide_window(flush); }
153 class FFMpegType : public BC_TextBox
156 FFMpegType(int x, int y, int w, int h, const char *text)
157 : BC_TextBox(x, y, w, h, text) {}
159 // squash show/hide window
160 int show_window(int flush=1) { return 0; }
161 int hide_window(int flush=1) { return 0; }
162 int show(int flush=1) { return BC_SubWindow::show_window(flush); }
163 int hide(int flush=1) { return BC_SubWindow::hide_window(flush); }
166 class FormatAParams : public BC_Button
169 FormatAParams(MWindow *mwindow, FormatTools *format, int x, int y);
175 class FormatVParams : public BC_Button
178 FormatVParams(MWindow *mwindow, FormatTools *format, int x, int y);
185 class FormatAThread : public Thread
188 FormatAThread(FormatTools *format);
193 void join() { if( !joined ) { joined = 1; Thread::join(); } }
200 class FormatVThread : public Thread
203 FormatVThread(FormatTools *format);
208 void join() { if( !joined ) { joined = 1; Thread::join(); } }
215 class FormatAudio : public BC_CheckBox
218 FormatAudio(int x, int y, FormatTools *format, int default_);
224 class FormatVideo : public BC_CheckBox
227 FormatVideo(int x, int y, FormatTools *format, int default_);
234 class FormatFilePerLabel : public BC_CheckBox
237 FormatFilePerLabel(FormatTools *format, int x, int y, int *output);
238 ~FormatFilePerLabel();
240 void update(int *output);