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;
77 ConvertPackageRenderer *renderer;
80 int total_rendered, remove_originals;
81 int failed, canceled, result;
86 class ConvertMenuItem : public BC_MenuItem
89 ConvertMenuItem(MWindow *mwindow);
93 void create_objects();
96 ConvertDialog *dialog;
99 class ConvertFormatTools : public FormatTools
102 ConvertFormatTools(MWindow *mwindow, ConvertWindow *gui, Asset *asset);
104 void update_format();
108 class ConvertSuffixText : public BC_TextBox
111 ConvertSuffixText(ConvertWindow *gui, ConvertDialog *dialog, int x, int y);
112 ~ConvertSuffixText();
116 ConvertDialog *dialog;
119 class ConvertRemoveOriginals : public BC_CheckBox
122 ConvertRemoveOriginals(ConvertWindow *gui, int x, int y);
123 ~ConvertRemoveOriginals();
130 class ConvertToProxyPath : public BC_CheckBox
133 ConvertToProxyPath(ConvertWindow *gui, int x, int y);
134 ~ConvertToProxyPath();
141 class ConvertBeepOnDone : public BC_FPot
144 ConvertBeepOnDone(ConvertWindow *gui, int x, int y);
151 class ConvertPackageRenderer : public PackageRenderer
154 ConvertPackageRenderer(ConvertRender *render);
155 virtual ~ConvertPackageRenderer();
159 void set_result(int value);
160 void set_progress(int64_t value);
161 int progress_cancelled();
163 ConvertRender *render;
166 class ConvertProgress : public Thread
169 ConvertProgress(MWindow *mwindow, ConvertRender *render);
175 ConvertRender *render;
179 class ConvertWindow : public BC_Window
182 ConvertWindow(MWindow *mwindow, ConvertDialog *dialog,
186 void create_objects();
189 ConvertDialog *dialog;
191 ConvertSuffixText *suffix_text;
192 ConvertFormatTools *format_tools;
193 ConvertRemoveOriginals *remove_originals;
194 ConvertToProxyPath *to_proxy_path;
195 ConvertBeepOnDone *beep_on_done;
198 class ConvertDialog : public BC_DialogThread
201 ConvertDialog(MWindow *mwindow);
203 BC_Window* new_gui();
205 void handle_close_event(int result);
211 char suffix[BCTEXTLEN];
212 ConvertRender *convert_render;
214 int orig_scale, new_scale;
215 int use_scaler, auto_scale;
217 int remove_originals;