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 "mwindow.inc"
40 class FormatPathButton;
52 FormatTools(MWindow *mwindow,
53 BC_WindowBase *window,
55 virtual ~FormatTools();
57 void create_objects(int &init_x,
59 int do_audio, // Include tools for audio
60 int do_video, // Include tools for video
61 int prompt_audio, // Include checkbox for audio
62 int prompt_video, // Include checkbox for video
63 int prompt_audio_channels,
64 int prompt_video_compression,
65 const char *locked_compressor, // Select compressors to be offered
66 int recording, // Change captions for recording
67 int *strategy, // If nonzero, prompt for insertion strategy
68 int brender, // Supply file formats for background rendering
69 int horizontal_layout = 0);
70 // In recording preferences, aspects of the format are locked
71 // depending on the driver used.
72 void update_driver(int driver);
76 void reposition_window(int &init_x, int &init_y);
77 // Put new asset's parameters in and change asset.
78 void update(Asset *asset, int *strategy);
79 // Update filename extension when format is changed.
80 void update_extension();
81 void close_format_windows();
84 // Handle change in path text. Used in BatchRender.
85 virtual int handle_event();
87 int set_audio_options();
88 int set_video_options();
92 BC_WindowBase *window;
95 FormatAParams *aparams_button;
96 FormatVParams *vparams_button;
97 FormatAThread *aparams_thread;
98 FormatVThread *vparams_thread;
99 BrowseButton *path_button;
100 FormatPathText *path_textbox;
101 BC_RecentList *path_recent;
102 BC_Title *format_title;
103 FormatFormat *format_button;
104 BC_TextBox *format_text;
105 FormatFFMPEG *format_ffmpeg;
106 FFMpegType *ffmpeg_type;
107 BC_ITumbler *channels_tumbler;
109 BC_Title *audio_title;
110 BC_Title *channels_title;
111 FormatChannels *channels_button;
112 FormatAudio *audio_switch;
114 BC_Title *video_title;
115 FormatVideo *video_switch;
117 FormatMultiple *multiple_files;
119 // Suggestions for the textbox
120 ArrayList<BC_ListBoxItem*> *file_entries;
121 ArrayList<PluginServer*> *plugindb;
123 const char *locked_compressor;
129 int prompt_audio_channels;
131 int prompt_video_compression;
134 // Determines what the configuration buttons do.
140 class FormatPathText : public BC_TextBox
143 FormatPathText(int x, int y, FormatTools *format);
152 class FormatFormat : public FormatPopup
155 FormatFormat(int x, int y, FormatTools *format);
162 class FormatFFMPEG : public FFMPEGPopup
165 FormatFFMPEG(int x, int y, FormatTools *format);
170 static int load_defaults(const char *path, const char *type,
171 char *codec, char *codec_options, int len);
173 // squash show/hide window
174 int show_window(int flush=1) { return 0; }
175 int hide_window(int flush=1) { return 0; }
176 int show(int flush=1) { return BC_SubWindow::show_window(flush); }
177 int hide(int flush=1) { return BC_SubWindow::hide_window(flush); }
180 class FFMpegType : public BC_TextBox
183 FFMpegType(int x, int y, int w, int h, const char *text)
184 : BC_TextBox(x, y, w, h, text) {}
186 // squash show/hide window
187 int show_window(int flush=1) { return 0; }
188 int hide_window(int flush=1) { return 0; }
189 int show(int flush=1) { return BC_SubWindow::show_window(flush); }
190 int hide(int flush=1) { return BC_SubWindow::hide_window(flush); }
193 class FormatAParams : public BC_Button
196 FormatAParams(MWindow *mwindow, FormatTools *format, int x, int y);
202 class FormatVParams : public BC_Button
205 FormatVParams(MWindow *mwindow, FormatTools *format, int x, int y);
212 class FormatAThread : public Thread
215 FormatAThread(FormatTools *format);
220 void join() { if( !joined ) { joined = 1; Thread::join(); } }
227 class FormatVThread : public Thread
230 FormatVThread(FormatTools *format);
235 void join() { if( !joined ) { joined = 1; Thread::join(); } }
242 class FormatAudio : public BC_CheckBox
245 FormatAudio(int x, int y, FormatTools *format, int default_);
251 class FormatVideo : public BC_CheckBox
254 FormatVideo(int x, int y, FormatTools *format, int default_);
261 class FormatChannels : public BC_TextBox
264 FormatChannels(int x, int y, FormatTools *format);
270 class FormatToTracks : public BC_CheckBox
273 FormatToTracks(int x, int y, int *output);
279 class FormatMultiple : public BC_CheckBox
282 FormatMultiple(MWindow *mwindow, int x, int y, int *output);
285 void update(int *output);