rework batchrender, renderfarm improvements, ffmpeg audio quality, a few fixes
[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 "formattools.inc"
34 #include "mwindow.inc"
35
36 class FormatTools
37 {
38 public:
39         FormatTools(MWindow *mwindow,
40                                 BC_WindowBase *window,
41                                 Asset *asset);
42         virtual ~FormatTools();
43
44         void create_objects(int &init_x,
45                                                 int &init_y,
46                                                 int do_audio,    // Include tools for audio
47                                                 int do_video,   // Include tools for video
48                                                 int prompt_audio,  // Include checkbox for audio
49                                                 int prompt_video,  // Include checkbox for video
50                                                 int prompt_audio_channels,
51                                                 int prompt_video_compression,
52                                                 const char *locked_compressor,  // Select compressors to be offered
53                                                 int recording, // Change captions for recording
54                                                 int *file_per_label,  // prompt if nonzero
55                                                 int brender,   // Supply file formats for background rendering
56                                                 int horizontal_layout = 0);
57 // In recording preferences, aspects of the format are locked
58 // depending on the driver used.
59         void update_driver(int driver);
60         virtual void update_format();
61
62
63         void reposition_window(int &init_x, int &init_y);
64 // Put new asset's parameters in and change asset.
65         void update(Asset *asset, int *file_per_label);
66 // Update filename extension when format is changed.
67         void update_extension();
68         void close_format_windows();
69         Asset* get_asset();
70
71 // Handle change in path text.  Used in BatchRender.
72         virtual int handle_event();
73
74         int set_audio_options();
75         int set_video_options();
76         void set_w(int w);
77         int get_w();
78
79         BC_WindowBase *window;
80         Asset *asset;
81
82         FormatAParams *aparams_button;
83         FormatVParams *vparams_button;
84         FormatAThread *aparams_thread;
85         FormatVThread *vparams_thread;
86         BrowseButton *path_button;
87         FormatPathText *path_textbox;
88         BC_RecentList *path_recent;
89         BC_Title *format_title;
90         FormatFormat *format_button;
91         BC_TextBox *format_text;
92         FormatFFMPEG *format_ffmpeg;
93         FFMpegType *ffmpeg_type;
94
95         BC_Title *audio_title;
96         FormatAudio *audio_switch;
97
98         BC_Title *video_title;
99         FormatVideo *video_switch;
100
101         FormatFilePerLabel *labeled_files;
102
103         ArrayList<PluginServer*> *plugindb;
104         MWindow *mwindow;
105         const char *locked_compressor;
106         int recording;
107         int use_brender;
108         int do_audio;
109         int do_video;
110         int prompt_audio;
111         int prompt_audio_channels;
112         int prompt_video;
113         int prompt_video_compression;
114         int *file_per_label;
115         int w;
116 // Determines what the configuration buttons do.
117         int video_driver;
118 };
119
120
121
122 class FormatPathText : public BC_TextBox
123 {
124 public:
125         FormatPathText(int x, int y, FormatTools *format);
126         ~FormatPathText();
127         int handle_event();
128
129         FormatTools *format;
130 };
131
132
133
134 class FormatFormat : public FormatPopup
135 {
136 public:
137         FormatFormat(int x, int y, FormatTools *format);
138         ~FormatFormat();
139
140         int handle_event();
141         FormatTools *format;
142 };
143
144 class FormatFFMPEG : public FFMPEGPopup
145 {
146 public:
147         FormatFFMPEG(int x, int y, FormatTools *format);
148         ~FormatFFMPEG();
149
150         int handle_event();
151         FormatTools *format;
152
153 // squash show/hide window
154         int show_window(int flush=1) { return 0; }
155         int hide_window(int flush=1) { return 0; }
156         int show(int flush=1) { return BC_SubWindow::show_window(flush); }
157         int hide(int flush=1) { return BC_SubWindow::hide_window(flush); }
158 };
159
160 class FFMpegType : public BC_TextBox
161 {
162 public:
163         FFMpegType(int x, int y, int w, int h, const char *text)
164          : BC_TextBox(x, y, w, h, text) {}
165         ~FFMpegType() {}
166 // squash show/hide window
167         int show_window(int flush=1) { return 0; }
168         int hide_window(int flush=1) { return 0; }
169         int show(int flush=1) { return BC_SubWindow::show_window(flush); }
170         int hide(int flush=1) { return BC_SubWindow::hide_window(flush); }
171 };
172
173 class FormatAParams : public BC_Button
174 {
175 public:
176         FormatAParams(MWindow *mwindow, FormatTools *format, int x, int y);
177         ~FormatAParams();
178         int handle_event();
179         FormatTools *format;
180 };
181
182 class FormatVParams : public BC_Button
183 {
184 public:
185         FormatVParams(MWindow *mwindow, FormatTools *format, int x, int y);
186         ~FormatVParams();
187         int handle_event();
188         FormatTools *format;
189 };
190
191
192 class FormatAThread : public Thread
193 {
194 public:
195         FormatAThread(FormatTools *format);
196         ~FormatAThread();
197
198         void run();
199         void start();
200         void join() { if( !joined ) { joined = 1; Thread::join(); } }
201
202         FormatTools *format;
203         File *file;
204         int joined;
205 };
206
207 class FormatVThread : public Thread
208 {
209 public:
210         FormatVThread(FormatTools *format);
211         ~FormatVThread();
212
213         void run();
214         void start();
215         void join() { if( !joined ) { joined = 1; Thread::join(); } }
216
217         FormatTools *format;
218         File *file;
219         int joined;
220 };
221
222 class FormatAudio : public BC_CheckBox
223 {
224 public:
225         FormatAudio(int x, int y, FormatTools *format, int default_);
226         ~FormatAudio();
227         int handle_event();
228         FormatTools *format;
229 };
230
231 class FormatVideo : public BC_CheckBox
232 {
233 public:
234         FormatVideo(int x, int y, FormatTools *format, int default_);
235         ~FormatVideo();
236         int handle_event();
237         FormatTools *format;
238 };
239
240
241 class FormatFilePerLabel : public BC_CheckBox
242 {
243 public:
244         FormatFilePerLabel(FormatTools *format, int x, int y, int *output);
245         ~FormatFilePerLabel();
246         int handle_event();
247         void update(int *output);
248
249         FormatTools *format;
250         int *output;
251 };
252
253
254 #endif