no longer need ffmpeg patch0 which was for Termux
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / dvdcreate.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 #ifndef __DVDCREATE_H__
22 #define __DVDCREATE_H__
23
24 #include "arraylist.h"
25 #include "batchrender.h"
26 #include "bcwindowbase.h"
27 #include "bcbutton.h"
28 #include "bcdialog.h"
29 #include "bclistboxitem.inc"
30 #include "bcmenuitem.h"
31 #include "bctextbox.h"
32 #include "browsebutton.h"
33 #include "mwindow.h"
34 #include "rescale.h"
35
36 #include "dvdcreate.inc"
37
38 class CreateDVD_MenuItem : public BC_MenuItem
39 {
40 public:
41         CreateDVD_MenuItem(MWindow *mwindow);
42         int handle_event();
43         MWindow *mwindow;
44 };
45
46 class DVD_BatchRenderJob : public BatchRenderJob
47 {
48         int chapter;
49         FILE *fp;
50         EDL *edl;
51 public:
52         DVD_BatchRenderJob(Preferences *preferences,
53                 int labeled, int farmed, int standard, int muxed);
54         void copy_from(DVD_BatchRenderJob *src);
55         DVD_BatchRenderJob *copy();
56         void load(FileXML *file);
57         void save(FileXML *file);
58         char *create_script(EDL *edl, ArrayList<Indexable *> *idxbls);
59         void create_chapter(double pos);
60
61         int standard;
62         int muxed;
63 };
64
65 class CreateDVD_Thread : public BC_DialogThread
66 {
67         static const int64_t DVD_SIZE;
68         static const int DVD_STREAMS, DVD_WIDTH, DVD_HEIGHT;
69         static const double DVD_ASPECT_WIDTH, DVD_ASPECT_HEIGHT;
70         static const double DVD_WIDE_ASPECT_WIDTH, DVD_WIDE_ASPECT_HEIGHT;
71         static const int DVD_MAX_BITRATE, DVD_CHANNELS, DVD_WIDE_CHANNELS;
72         static const double DVD_FRAMERATE, DVD_SAMPLERATE, DVD_KAUDIO_RATE;
73 public:
74         CreateDVD_Thread(MWindow *mwindow);
75         ~CreateDVD_Thread();
76         void handle_close_event(int result);
77         BC_Window* new_gui();
78         int option_presets();
79         void create_chapter(FILE *fp, double pos);
80         static int create_dvd_script(BatchRenderJob *job);
81         int create_dvd_jobs(ArrayList<BatchRenderJob*> *jobs, const char *asset_path);
82         int insert_video_plugin(const char *title, KeyFrame *default_keyframe);
83         int resize_tracks();
84
85         MWindow *mwindow;
86         CreateDVD_GUI *gui;
87         char asset_title[BCTEXTLEN];
88         char tmp_path[BCTEXTLEN];
89         int use_deinterlace, use_inverse_telecine;
90         int use_scale, use_resize_tracks;
91         int use_wide_audio, use_farmed;
92         int use_histogram, use_labeled;
93         int use_ffmpeg, use_standard;
94
95         int64_t dvd_size;
96         int dvd_width;
97         int dvd_height;
98         double dvd_aspect_width;
99         double dvd_aspect_height;
100         double dvd_framerate;
101         int dvd_samplerate;
102         int dvd_max_bitrate;
103         double dvd_kaudio_rate;
104         int max_w, max_h;
105 };
106
107 class CreateDVD_OK : public BC_OKButton
108 {
109 public:
110         CreateDVD_OK(CreateDVD_GUI *gui, int x, int y);
111         ~CreateDVD_OK();
112         int button_press_event();
113         int keypress_event();
114
115         CreateDVD_GUI *gui;
116 };
117
118 class CreateDVD_Cancel : public BC_CancelButton
119 {
120 public:
121         CreateDVD_Cancel(CreateDVD_GUI *gui, int x, int y);
122         ~CreateDVD_Cancel();
123         int button_press_event();
124
125         CreateDVD_GUI *gui;
126 };
127
128
129 class CreateDVD_DiskSpace : public BC_Title
130 {
131 public:
132         CreateDVD_DiskSpace(CreateDVD_GUI *gui, int x, int y);
133         ~CreateDVD_DiskSpace();
134         int64_t tmp_path_space();
135         void update();
136
137         CreateDVD_GUI *gui;
138 };
139
140 class CreateDVD_TmpPath : public BC_TextBox
141 {
142 public:
143         CreateDVD_TmpPath(CreateDVD_GUI *gui, int x, int y, int w);
144         ~CreateDVD_TmpPath();
145         int handle_event();
146
147         CreateDVD_GUI *gui;
148 };
149
150
151 class CreateDVD_AssetTitle : public BC_TextBox
152 {
153 public:
154         CreateDVD_AssetTitle(CreateDVD_GUI *gui, int x, int y, int w);
155         ~CreateDVD_AssetTitle();
156         int handle_event();
157
158         CreateDVD_GUI *gui;
159 };
160
161 class CreateDVD_Deinterlace : public BC_CheckBox
162 {
163 public:
164         CreateDVD_Deinterlace(CreateDVD_GUI *gui, int x, int y);
165         ~CreateDVD_Deinterlace();
166         int handle_event();
167
168         CreateDVD_GUI *gui;
169 };
170
171 class CreateDVD_InverseTelecine : public BC_CheckBox
172 {
173 public:
174         CreateDVD_InverseTelecine(CreateDVD_GUI *gui, int x, int y);
175         ~CreateDVD_InverseTelecine();
176         int handle_event();
177
178         CreateDVD_GUI *gui;
179 };
180
181 class CreateDVD_ResizeTracks : public BC_CheckBox
182 {
183 public:
184         CreateDVD_ResizeTracks(CreateDVD_GUI *gui, int x, int y);
185         ~CreateDVD_ResizeTracks();
186
187         CreateDVD_GUI *gui;
188 };
189
190 class CreateDVD_Histogram : public BC_CheckBox
191 {
192 public:
193         CreateDVD_Histogram(CreateDVD_GUI *gui, int x, int y);
194         ~CreateDVD_Histogram();
195
196         CreateDVD_GUI *gui;
197 };
198
199 class CreateDVD_LabelChapters : public BC_CheckBox
200 {
201 public:
202         CreateDVD_LabelChapters(CreateDVD_GUI *gui, int x, int y);
203         ~CreateDVD_LabelChapters();
204
205         CreateDVD_GUI *gui;
206 };
207
208 class CreateDVD_UseRenderFarm : public BC_CheckBox
209 {
210 public:
211         CreateDVD_UseRenderFarm(CreateDVD_GUI *gui, int x, int y);
212         ~CreateDVD_UseRenderFarm();
213
214         CreateDVD_GUI *gui;
215 };
216
217 class CreateDVD_WideAudio : public BC_CheckBox
218 {
219 public:
220         CreateDVD_WideAudio(CreateDVD_GUI *gui, int x, int y);
221         ~CreateDVD_WideAudio();
222
223         CreateDVD_GUI *gui;
224 };
225
226 class CreateDVD_UseFFMpeg : public BC_CheckBox
227 {
228 public:
229         CreateDVD_UseFFMpeg(CreateDVD_GUI *gui, int x, int y);
230         ~CreateDVD_UseFFMpeg();
231
232         CreateDVD_GUI *gui;
233 };
234
235 class CreateDVD_GUI : public BC_Window
236 {
237 public:
238         CreateDVD_GUI(CreateDVD_Thread *thread,
239                 int x, int y, int w, int h);
240         ~CreateDVD_GUI();
241
242         void create_objects();
243         int resize_event(int w, int h);
244         int translation_event();
245         int close_event();
246         void update();
247
248         CreateDVD_Thread *thread;
249         int at_x, at_y;
250         CreateDVD_AssetTitle *asset_title;
251         int tmp_x, tmp_y;
252         CreateDVD_TmpPath *tmp_path;
253         BrowseButton *btmp_path;
254         CreateDVD_DiskSpace *disk_space;
255         CreateDVD_Format *standard;
256         CreateDVD_Scale *scale;
257         ArrayList<BC_ListBoxItem *> media_sizes;
258         CreateDVD_MediaSize *media_size;
259         CreateDVD_Deinterlace *need_deinterlace;
260         CreateDVD_InverseTelecine *need_inverse_telecine;
261         CreateDVD_UseFFMpeg *need_use_ffmpeg;
262         CreateDVD_ResizeTracks *need_resize_tracks;
263         CreateDVD_Histogram *need_histogram;
264         CreateDVD_WideAudio *need_wide_audio;
265         CreateDVD_LabelChapters *need_labeled;
266         CreateDVD_UseRenderFarm *need_farmed;
267         int ok_x, ok_y, ok_w, ok_h;
268         CreateDVD_OK *ok;
269         int cancel_x, cancel_y, cancel_w, cancel_h;
270         CreateDVD_Cancel *cancel;
271 };
272
273 class CreateDVD_FormatItem : public BC_MenuItem
274 {
275 public:
276         int handle_event();
277         CreateDVD_FormatItem(CreateDVD_Format *popup, int standard, const char *text);
278         ~CreateDVD_FormatItem();
279
280         CreateDVD_Format *popup;
281         int standard;
282 };
283
284 class CreateDVD_Format : public BC_PopupMenu
285 {
286 public:
287         void create_objects();
288         int handle_event();
289         CreateDVD_Format(CreateDVD_GUI *gui, int x, int y);
290         ~CreateDVD_Format();
291         void set_value(int v) { set_text(get_item(v)->get_text()); }
292
293         CreateDVD_GUI *gui;
294 };
295
296 class CreateDVD_ScaleItem : public BC_MenuItem
297 {
298 public:
299         int handle_event();
300         CreateDVD_ScaleItem(CreateDVD_Scale *popup, int scale, const char *text);
301         ~CreateDVD_ScaleItem();
302
303         CreateDVD_Scale *popup;
304         int scale;
305 };
306
307 class CreateDVD_Scale : public BC_PopupMenu
308 {
309 public:
310         void create_objects();
311         int handle_event();
312         CreateDVD_Scale(CreateDVD_GUI *gui, int x, int y);
313         ~CreateDVD_Scale();
314
315         CreateDVD_GUI *gui;
316         void set_value(int v) { set_text(Rescale::scale_types[v]); }
317 };
318
319 class CreateDVD_MediaSize : public BC_PopupTextBox
320 {
321 public:
322         CreateDVD_MediaSize(CreateDVD_GUI *gui, int x, int y);
323         ~CreateDVD_MediaSize();
324         int handle_event();
325
326         CreateDVD_GUI *gui;
327 };
328
329 #endif