edl plugin names eng, fix segv for opengl brender, renderfarm rework strategy, perf...
[goodguy/history.git] / cinelerra-5.1 / cinelerra / formattools.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 FORMATTOOLS_H
23 #define FORMATTOOLS_H
24
25 #include "asset.inc"
26 #include "guicast.h"
27 #include "bitspopup.h"
28 #include "browsebutton.h"
29 #include "compresspopup.h"
30 #include "file.inc"
31 #include "ffmpeg.h"
32 #include "formatpopup.h"
33 #include "mwindow.inc"
34
35 class FormatAParams;
36 class FormatVParams;
37 class FormatAThread;
38 class FormatVThread;
39 class FormatChannels;
40 class FormatPathButton;
41 class FormatPathText;
42 class FormatFormat;
43 class FormatFFMPEG;
44 class FFMpegType;
45 class FormatAudio;
46 class FormatVideo;
47 class FormatMultiple;
48
49 class FormatTools
50 {
51 public:
52         FormatTools(MWindow *mwindow,
53                                 BC_WindowBase *window,
54                                 Asset *asset);
55         virtual ~FormatTools();
56
57         void create_objects(int &init_x,
58                                                 int &init_y,
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 *file_per_label,  // prompt if nonzero
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);
73         virtual void update_format();
74
75
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 *file_per_label);
79 // Update filename extension when format is changed.
80         void update_extension();
81         void close_format_windows();
82         Asset* get_asset();
83
84 // Handle change in path text.  Used in BatchRender.
85         virtual int handle_event();
86
87         int set_audio_options();
88         int set_video_options();
89         void set_w(int w);
90         int get_w();
91
92         BC_WindowBase *window;
93         Asset *asset;
94
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;
108
109         BC_Title *audio_title;
110         BC_Title *channels_title;
111         FormatChannels *channels_button;
112         FormatAudio *audio_switch;
113
114         BC_Title *video_title;
115         FormatVideo *video_switch;
116
117         FormatMultiple *multiple_files;
118
119         ArrayList<PluginServer*> *plugindb;
120         MWindow *mwindow;
121         const char *locked_compressor;
122         int recording;
123         int use_brender;
124         int do_audio;
125         int do_video;
126         int prompt_audio;
127         int prompt_audio_channels;
128         int prompt_video;
129         int prompt_video_compression;
130         int *file_per_label;
131         int w;
132 // Determines what the configuration buttons do.
133         int video_driver;
134 };
135
136
137
138 class FormatPathText : public BC_TextBox
139 {
140 public:
141         FormatPathText(int x, int y, FormatTools *format);
142         ~FormatPathText();
143         int handle_event();
144
145         FormatTools *format;
146 };
147
148
149
150 class FormatFormat : public FormatPopup
151 {
152 public:
153         FormatFormat(int x, int y, FormatTools *format);
154         ~FormatFormat();
155
156         int handle_event();
157         FormatTools *format;
158 };
159
160 class FormatFFMPEG : public FFMPEGPopup
161 {
162 public:
163         FormatFFMPEG(int x, int y, FormatTools *format);
164         ~FormatFFMPEG();
165
166         int handle_event();
167         FormatTools *format;
168
169 // squash show/hide window
170         int show_window(int flush=1) { return 0; }
171         int hide_window(int flush=1) { return 0; }
172         int show(int flush=1) { return BC_SubWindow::show_window(flush); }
173         int hide(int flush=1) { return BC_SubWindow::hide_window(flush); }
174 };
175
176 class FFMpegType : public BC_TextBox
177 {
178 public:
179         FFMpegType(int x, int y, int w, int h, const char *text)
180          : BC_TextBox(x, y, w, h, text) {}
181         ~FFMpegType() {}
182 // squash show/hide window
183         int show_window(int flush=1) { return 0; }
184         int hide_window(int flush=1) { return 0; }
185         int show(int flush=1) { return BC_SubWindow::show_window(flush); }
186         int hide(int flush=1) { return BC_SubWindow::hide_window(flush); }
187 };
188
189 class FormatAParams : public BC_Button
190 {
191 public:
192         FormatAParams(MWindow *mwindow, FormatTools *format, int x, int y);
193         ~FormatAParams();
194         int handle_event();
195         FormatTools *format;
196 };
197
198 class FormatVParams : public BC_Button
199 {
200 public:
201         FormatVParams(MWindow *mwindow, FormatTools *format, int x, int y);
202         ~FormatVParams();
203         int handle_event();
204         FormatTools *format;
205 };
206
207
208 class FormatAThread : public Thread
209 {
210 public:
211         FormatAThread(FormatTools *format);
212         ~FormatAThread();
213
214         void run();
215         void start();
216         void join() { if( !joined ) { joined = 1; Thread::join(); } }
217
218         FormatTools *format;
219         File *file;
220         int joined;
221 };
222
223 class FormatVThread : public Thread
224 {
225 public:
226         FormatVThread(FormatTools *format);
227         ~FormatVThread();
228
229         void run();
230         void start();
231         void join() { if( !joined ) { joined = 1; Thread::join(); } }
232
233         FormatTools *format;
234         File *file;
235         int joined;
236 };
237
238 class FormatAudio : public BC_CheckBox
239 {
240 public:
241         FormatAudio(int x, int y, FormatTools *format, int default_);
242         ~FormatAudio();
243         int handle_event();
244         FormatTools *format;
245 };
246
247 class FormatVideo : public BC_CheckBox
248 {
249 public:
250         FormatVideo(int x, int y, FormatTools *format, int default_);
251         ~FormatVideo();
252         int handle_event();
253         FormatTools *format;
254 };
255
256
257 class FormatChannels : public BC_TextBox
258 {
259 public:
260         FormatChannels(int x, int y, FormatTools *format);
261         ~FormatChannels();
262         int handle_event();
263         FormatTools *format;
264 };
265
266 class FormatToTracks : public BC_CheckBox
267 {
268 public:
269         FormatToTracks(int x, int y, int *output);
270         ~FormatToTracks();
271         int handle_event();
272         int *output;
273 };
274
275 class FormatMultiple : public BC_CheckBox
276 {
277 public:
278         FormatMultiple(MWindow *mwindow, int x, int y, int *output);
279         ~FormatMultiple();
280         int handle_event();
281         void update(int *output);
282         int *output;
283         MWindow *mwindow;
284 };
285
286
287 #endif