6 * Copyright (C) 2015 Adam Williams <broadcast at earthling dot net>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #include "arraylist.h"
25 #include "audiodevice.inc"
28 #include "bctimer.inc"
29 #include "convert.inc"
31 #include "formattools.h"
33 #include "mainprogress.inc"
35 #include "mwindow.inc"
36 #include "packagerenderer.h"
39 class ConvertRender : public Thread
42 ConvertRender(MWindow *mwindow);
45 void to_convert_path(char *new_path, Indexable *idxbl);
46 int from_convert_path(char *new_path, Indexable *idxbl);
48 ArrayList<Indexable *> orig_idxbls; // originals which match the convert assets
49 ArrayList<Asset *> orig_copies; // convert assets
50 ArrayList<Indexable *> needed_idxbls; // originals which match the needed_assets
51 ArrayList<Asset *> needed_copies; // assets which must be created
53 double get_video_length(Indexable *idxbl);
54 double get_audio_length(Indexable *idxbl);
55 double get_length(Indexable *idxbl);
56 int match_format(Asset *asset);
57 EDL *convert_edl(EDL *edl, Indexable *idxbl); // create render edl for this indexable
58 int add_original(EDL *edl, Indexable *idxbl);
59 void add_needed(Indexable *idxbl, Asset *convert);
60 int find_convertable_assets(EDL *edl);
62 // if user canceled progress bar
64 void set_format(Asset *asset, const char *suffix, int to_proxy);
65 void start_convert(float beep, int remove_originals);
67 void create_copy(int i);
68 void start_progress();
69 void stop_progress(const char *msg);
74 MainProgressBar *progress;
75 ConvertProgress *convert_progress;
76 Timer *progress_timer;
79 int total_rendered, remove_originals;
80 int failed, canceled, result;
85 class ConvertMenuItem : public BC_MenuItem
88 ConvertMenuItem(MWindow *mwindow);
92 void create_objects();
95 ConvertDialog *dialog;
98 class ConvertFormatTools : public FormatTools
101 ConvertFormatTools(MWindow *mwindow, ConvertWindow *gui, Asset *asset);
103 void update_format();
107 class ConvertSuffixText : public BC_TextBox
110 ConvertSuffixText(ConvertWindow *gui, ConvertDialog *dialog, int x, int y);
111 ~ConvertSuffixText();
115 ConvertDialog *dialog;
118 class ConvertRemoveOriginals : public BC_CheckBox
121 ConvertRemoveOriginals(ConvertWindow *gui, int x, int y);
122 ~ConvertRemoveOriginals();
129 class ConvertToProxyPath : public BC_CheckBox
132 ConvertToProxyPath(ConvertWindow *gui, int x, int y);
133 ~ConvertToProxyPath();
140 class ConvertBeepOnDone : public BC_FPot
143 ConvertBeepOnDone(ConvertWindow *gui, int x, int y);
150 class ConvertPackageRenderer : public PackageRenderer
153 ConvertPackageRenderer(ConvertRender *render);
154 ~ConvertPackageRenderer();
158 void set_result(int value);
159 void set_progress(int64_t value);
160 int progress_cancelled();
162 ConvertRender *render;
165 class ConvertProgress : public Thread
168 ConvertProgress(MWindow *mwindow, ConvertRender *render);
174 ConvertRender *render;
178 class ConvertWindow : public BC_Window
181 ConvertWindow(MWindow *mwindow, ConvertDialog *dialog,
185 void create_objects();
188 ConvertDialog *dialog;
190 ConvertSuffixText *suffix_text;
191 ConvertFormatTools *format_tools;
192 ConvertRemoveOriginals *remove_originals;
193 ConvertToProxyPath *to_proxy_path;
194 ConvertBeepOnDone *beep_on_done;
197 class ConvertDialog : public BC_DialogThread
200 ConvertDialog(MWindow *mwindow);
202 BC_Window* new_gui();
204 void handle_close_event(int result);
210 char suffix[BCTEXTLEN];
211 ConvertRender *convert_render;
213 int orig_scale, new_scale;
214 int use_scaler, auto_scale;
216 int remove_originals;