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