no longer need ffmpeg patch0 which was for Termux
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / bdcreate.h
1 /*
2  * CINELERRA
3  * Copyright (C) 2016-2020 William Morrow
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License as published
7  * by the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public
16  * License along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
18  * USA
19  */
20
21
22 #ifndef __BDCREATE_H__
23 #define __BDCREATE_H__
24
25 #include "arraylist.h"
26 #include "batchrender.h"
27 #include "bcwindowbase.h"
28 #include "bcbutton.h"
29 #include "bcdialog.h"
30 #include "bclistboxitem.inc"
31 #include "bcmenuitem.h"
32 #include "bctextbox.h"
33 #include "browsebutton.h"
34 #include "mwindow.h"
35 #include "rescale.h"
36
37 #include "bdcreate.inc"
38
39
40 class CreateBD_MenuItem : public BC_MenuItem
41 {
42 public:
43         CreateBD_MenuItem(MWindow *mwindow);
44         int handle_event();
45         MWindow *mwindow;
46 };
47
48 class BD_BatchRenderJob : public BatchRenderJob
49 {
50 public:
51         static int get_udfs_mount(char *udfs, char *mopts, char *mntpt);
52         BD_BatchRenderJob(Preferences *preferences, int labeled, int farmed);
53         char *create_script(EDL *edl, ArrayList<Indexable *> *idxbls);
54         int tsmuxered;
55 };
56
57
58 class CreateBD_Thread : public BC_DialogThread
59 {
60         static const int64_t BD_SIZE;
61         static const int BD_STREAMS, BD_WIDTH, BD_HEIGHT;
62         static const double BD_ASPECT_WIDTH, BD_ASPECT_HEIGHT;
63         static const double BD_WIDE_ASPECT_WIDTH, BD_WIDE_ASPECT_HEIGHT;
64         static const int BD_MAX_BITRATE, BD_CHANNELS, BD_WIDE_CHANNELS;
65         static const double BD_FRAMERATE, BD_SAMPLERATE, BD_KAUDIO_RATE;
66         static const int BD_INTERLACE_MODE;
67 public:
68         CreateBD_Thread(MWindow *mwindow);
69         ~CreateBD_Thread();
70         void handle_close_event(int result);
71         BC_Window* new_gui();
72         int option_presets();
73         int create_bd_script(const char *path, EDL *edl);
74         int create_bd_jobs(ArrayList<BatchRenderJob*> *jobs, const char *asset_dir);
75         int insert_video_plugin(const char *title, KeyFrame *default_keyframe);
76         int resize_tracks();
77
78         MWindow *mwindow;
79         CreateBD_GUI *gui;
80         char asset_title[BCTEXTLEN];
81         char tmp_path[BCTEXTLEN];
82         char use_profile[BCTEXTLEN];
83         int use_deinterlace, use_inverse_telecine;
84         int use_scale, use_resize_tracks;
85         int use_wide_audio, use_farmed;
86         int use_histogram, use_labeled;
87         int use_standard;
88         int use_tsmuxer;
89
90         int64_t bd_size;
91         int bd_width;
92         int bd_height;
93         double bd_aspect_width;
94         double bd_aspect_height;
95         double bd_framerate;
96         int bd_samplerate;
97         int bd_max_bitrate;
98         double bd_kaudio_rate;
99         int bd_interlace_mode;
100         int max_w, max_h;
101
102         BD_BatchRenderJob *batchrender;
103 };
104
105 class CreateBD_OK : public BC_OKButton
106 {
107 public:
108         CreateBD_OK(CreateBD_GUI *gui, int x, int y);
109         ~CreateBD_OK();
110         int button_press_event();
111         int keypress_event();
112
113         CreateBD_GUI *gui;
114 };
115
116 class CreateBD_Cancel : public BC_CancelButton
117 {
118 public:
119         CreateBD_Cancel(CreateBD_GUI *gui, int x, int y);
120         ~CreateBD_Cancel();
121         int button_press_event();
122
123         CreateBD_GUI *gui;
124 };
125
126
127 class CreateBD_DiskSpace : public BC_Title
128 {
129 public:
130         CreateBD_DiskSpace(CreateBD_GUI *gui, int x, int y);
131         ~CreateBD_DiskSpace();
132         int64_t tmp_path_space();
133         void update();
134
135         CreateBD_GUI *gui;
136 };
137
138 class CreateBD_TmpPath : public BC_TextBox
139 {
140 public:
141         CreateBD_TmpPath(CreateBD_GUI *gui, int x, int y, int w);
142         ~CreateBD_TmpPath();
143         int handle_event();
144
145         CreateBD_GUI *gui;
146 };
147
148
149 class CreateBD_AssetTitle : public BC_TextBox
150 {
151 public:
152         CreateBD_AssetTitle(CreateBD_GUI *gui, int x, int y, int w);
153         ~CreateBD_AssetTitle();
154         int handle_event();
155
156         CreateBD_GUI *gui;
157 };
158
159 class CreateBD_Deinterlace : public BC_CheckBox
160 {
161 public:
162         CreateBD_Deinterlace(CreateBD_GUI *gui, int x, int y);
163         ~CreateBD_Deinterlace();
164         int handle_event();
165
166         CreateBD_GUI *gui;
167 };
168
169 class CreateBD_InverseTelecine : public BC_CheckBox
170 {
171 public:
172         CreateBD_InverseTelecine(CreateBD_GUI *gui, int x, int y);
173         ~CreateBD_InverseTelecine();
174         int handle_event();
175
176         CreateBD_GUI *gui;
177 };
178
179 class CreateBD_ResizeTracks : public BC_CheckBox
180 {
181 public:
182         CreateBD_ResizeTracks(CreateBD_GUI *gui, int x, int y);
183         ~CreateBD_ResizeTracks();
184
185         CreateBD_GUI *gui;
186 };
187
188 class CreateBD_Histogram : public BC_CheckBox
189 {
190 public:
191         CreateBD_Histogram(CreateBD_GUI *gui, int x, int y);
192         ~CreateBD_Histogram();
193
194         CreateBD_GUI *gui;
195 };
196
197 class CreateBD_LabelChapters : public BC_CheckBox
198 {
199 public:
200         CreateBD_LabelChapters(CreateBD_GUI *gui, int x, int y);
201         ~CreateBD_LabelChapters();
202
203         CreateBD_GUI *gui;
204 };
205
206 class CreateBD_UseRenderFarm : public BC_CheckBox
207 {
208 public:
209         CreateBD_UseRenderFarm(CreateBD_GUI *gui, int x, int y);
210         ~CreateBD_UseRenderFarm();
211
212         CreateBD_GUI *gui;
213 };
214
215
216 class CreateBD_WideAudio : public BC_CheckBox
217 {
218 public:
219         CreateBD_WideAudio(CreateBD_GUI *gui, int x, int y);
220         ~CreateBD_WideAudio();
221
222         CreateBD_GUI *gui;
223 };
224
225
226 class CreateBD_UseTsmuxer : public BC_CheckBox
227 {
228 public:
229         CreateBD_UseTsmuxer(CreateBD_GUI *gui, int x, int y);
230         ~CreateBD_UseTsmuxer();
231
232         CreateBD_GUI *gui;
233 };
234
235
236 class CreateBD_GUI : public BC_Window
237 {
238 public:
239         CreateBD_GUI(CreateBD_Thread *thread,
240                 int x, int y, int w, int h);
241         ~CreateBD_GUI();
242
243         void create_objects();
244         int resize_event(int w, int h);
245         int translation_event();
246         int close_event();
247         void update();
248
249         CreateBD_Thread *thread;
250         int at_x, at_y;
251         CreateBD_AssetTitle *asset_title;
252         int tmp_x, tmp_y;
253         CreateBD_TmpPath *tmp_path;
254         BrowseButton *btmp_path;
255         CreateBD_DiskSpace *disk_space;
256         CreateBD_Format *standard;
257         CreateBD_Scale *scale;
258         ArrayList<BC_ListBoxItem *> media_sizes;
259         CreateBD_MediaSize *media_size;
260         CreateBD_Deinterlace *need_deinterlace;
261         CreateBD_InverseTelecine *need_inverse_telecine;
262         CreateBD_ResizeTracks *need_resize_tracks;
263         CreateBD_Histogram *need_histogram;
264         CreateBD_UseTsmuxer *need_tsmuxer;
265         BC_Title *non_standard;
266         CreateBD_WideAudio *need_wide_audio;
267         CreateBD_LabelChapters *need_labeled;
268         CreateBD_UseRenderFarm *need_farmed;
269         int ok_x, ok_y, ok_w, ok_h;
270         CreateBD_OK *ok;
271         int cancel_x, cancel_y, cancel_w, cancel_h;
272         CreateBD_Cancel *cancel;
273         ArrayList<BC_ListBoxItem *> profiles;
274         CreateBD_Profile *profile;
275 };
276
277 class CreateBD_FormatItem : public BC_MenuItem
278 {
279 public:
280         int handle_event();
281         CreateBD_FormatItem(CreateBD_Format *popup, int standard, const char *name);
282         ~CreateBD_FormatItem();
283
284         CreateBD_Format *popup;
285         int standard;
286 };
287
288 class CreateBD_Format : public BC_PopupMenu
289 {
290 public:
291         void create_objects();
292         int handle_event();
293         CreateBD_Format(CreateBD_GUI *gui, int x, int y);
294         ~CreateBD_Format();
295         void set_value(int v) { set_text(get_item(v)->get_text()); }
296
297         CreateBD_GUI *gui;
298 };
299
300 class CreateBD_ScaleItem : public BC_MenuItem
301 {
302 public:
303         int handle_event();
304         CreateBD_ScaleItem(CreateBD_Scale *popup, int scale, const char *text);
305         ~CreateBD_ScaleItem();
306
307         CreateBD_Scale *popup;
308         int scale;
309 };
310
311 class CreateBD_Scale : public BC_PopupMenu
312 {
313 public:
314         void create_objects();
315         int handle_event();
316         CreateBD_Scale(CreateBD_GUI *gui, int x, int y);
317         ~CreateBD_Scale();
318
319         CreateBD_GUI *gui;
320         void set_value(int v) { set_text(Rescale::scale_types[v]); }
321 };
322
323 class CreateBD_MediaSize : public BC_PopupTextBox
324 {
325 public:
326         CreateBD_MediaSize(CreateBD_GUI *gui, int x, int y);
327         ~CreateBD_MediaSize();
328         int handle_event();
329
330         CreateBD_GUI *gui;
331 };
332
333 class CreateBD_Profile : public BC_PopupTextBox
334 {
335 public:
336         CreateBD_Profile(CreateBD_GUI *gui, int x, int y);
337         ~CreateBD_Profile();
338         int handle_event();
339
340         CreateBD_GUI *gui;
341 };
342
343
344 #endif