3 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 * Copyright (C) 2015 Adam Williams <broadcast at earthling dot net>
28 * This program is free software; you can redistribute it and/or modify
29 * it under the terms of the GNU General Public License as published by
30 * the Free Software Foundation; either version 2 of the License, or
31 * (at your option) any later version.
33 * This program is distributed in the hope that it will be useful,
34 * but WITHOUT ANY WARRANTY; without even the implied warranty of
35 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
36 * GNU General Public License for more details.
38 * You should have received a copy of the GNU General Public License
39 * along with this program; if not, write to the Free Software
40 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
44 #include "arraylist.h"
45 #include "audiodevice.inc"
48 #include "bctimer.inc"
49 #include "convert.inc"
51 #include "formattools.h"
53 #include "mainprogress.inc"
55 #include "mwindow.inc"
56 #include "packagerenderer.h"
59 class ConvertRender : public Thread
62 ConvertRender(MWindow *mwindow);
65 void to_convert_path(char *new_path, Indexable *idxbl);
66 int from_convert_path(char *new_path, Indexable *idxbl);
68 ArrayList<Indexable *> orig_idxbls; // originals which match the convert assets
69 ArrayList<Asset *> orig_copies; // convert assets
70 ArrayList<Indexable *> needed_idxbls; // originals which match the needed_assets
71 ArrayList<Asset *> needed_copies; // assets which must be created
73 double get_video_length(Indexable *idxbl);
74 double get_audio_length(Indexable *idxbl);
75 double get_length(Indexable *idxbl);
76 int match_format(Asset *asset);
77 EDL *convert_edl(EDL *edl, Indexable *idxbl); // create render edl for this indexable
78 int add_original(EDL *edl, Indexable *idxbl);
79 void add_needed(Indexable *idxbl, Asset *convert);
80 int find_convertable_assets(EDL *edl);
82 // if user canceled progress bar
84 void set_format(Asset *asset, const char *suffix, int to_proxy);
85 void start_convert(float beep, int remove_originals);
87 void create_copy(int i);
88 void start_progress();
89 void stop_progress(const char *msg);
94 MainProgressBar *progress;
95 ConvertProgress *convert_progress;
96 Timer *progress_timer;
97 ConvertPackageRenderer *renderer;
100 int total_rendered, remove_originals;
101 int failed, canceled, result;
106 class ConvertMenuItem : public BC_MenuItem
109 ConvertMenuItem(MWindow *mwindow);
113 void create_objects();
116 ConvertDialog *dialog;
119 class ConvertFormatTools : public FormatTools
122 ConvertFormatTools(MWindow *mwindow, ConvertWindow *gui, Asset *asset);
124 void update_format();
128 class ConvertSuffixText : public BC_TextBox
131 ConvertSuffixText(ConvertWindow *gui, ConvertDialog *dialog, int x, int y);
132 ~ConvertSuffixText();
136 ConvertDialog *dialog;
139 class ConvertRemoveOriginals : public BC_CheckBox
142 ConvertRemoveOriginals(ConvertWindow *gui, int x, int y);
143 ~ConvertRemoveOriginals();
150 class ConvertToProxyPath : public BC_CheckBox
153 ConvertToProxyPath(ConvertWindow *gui, int x, int y);
154 ~ConvertToProxyPath();
161 class ConvertBeepOnDone : public BC_FPot
164 ConvertBeepOnDone(ConvertWindow *gui, int x, int y);
171 class ConvertPackageRenderer : public PackageRenderer
174 ConvertPackageRenderer(ConvertRender *render);
175 virtual ~ConvertPackageRenderer();
179 void set_result(int value);
180 void set_progress(int64_t value);
181 int progress_cancelled();
183 ConvertRender *render;
186 class ConvertProgress : public Thread
189 ConvertProgress(MWindow *mwindow, ConvertRender *render);
195 ConvertRender *render;
199 class ConvertWindow : public BC_Window
202 ConvertWindow(MWindow *mwindow, ConvertDialog *dialog,
206 void create_objects();
209 ConvertDialog *dialog;
211 ConvertSuffixText *suffix_text;
212 ConvertFormatTools *format_tools;
213 ConvertRemoveOriginals *remove_originals;
214 ConvertToProxyPath *to_proxy_path;
215 ConvertBeepOnDone *beep_on_done;
218 class ConvertDialog : public BC_DialogThread
221 ConvertDialog(MWindow *mwindow);
223 BC_Window* new_gui();
225 void handle_close_event(int result);
231 char suffix[BCTEXTLEN];
232 ConvertRender *convert_render;
234 int orig_scale, new_scale;
235 int use_scaler, auto_scale;
237 int remove_originals;