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 // functions for handling proxies
26 #include "arraylist.h"
31 #include "formattools.inc"
32 #include "loadbalance.h"
34 #include "mwindow.inc"
35 #include "renderengine.inc"
42 class ProxyMenuItem : public BC_MenuItem
45 ProxyMenuItem(MWindow *mwindow);
49 void create_objects();
55 class FromProxyMenuItem : public BC_MenuItem
58 FromProxyMenuItem(MWindow *mwindow);
68 ProxyRender(MWindow *mwindow, Asset *format_asset);
70 void to_proxy_path(char *new_path, Indexable *indexable, int scale);
71 static int from_proxy_path(char *new_path, Indexable *indexable, int scale);
73 ArrayList<Indexable *> orig_idxbls; // originals which match the proxy assets
74 ArrayList<Indexable *> orig_proxies; // proxy assets
75 Asset *add_original(Indexable *idxbl, int new_scale);
76 ArrayList<Indexable *> needed_idxbls; // originals which match the needed_assets
77 ArrayList<Asset *> needed_proxies; // assets which must be created
78 void add_needed(Indexable *idxbl, Asset *proxy);
80 int create_needed_proxies(int new_scale);
81 // increment the frame count by 1
82 void update_progress();
83 // if user canceled progress bar
88 MainProgressBar *progress;
94 class ProxyDialog : public BC_DialogThread
97 ProxyDialog(MWindow *mwindow);
100 void handle_close_event(int result);
104 // calculate possible sizes based on the original size
105 void calculate_sizes();
106 void scale_to_text(char *string, int scale);
111 ProxyRender *proxy_render;
117 char *size_text[MAX_SIZES];
118 int size_factors[MAX_SIZES];
122 class ProxyUseScaler : public BC_CheckBox
125 ProxyUseScaler(ProxyWindow *pwindow, int x, int y);
129 ProxyWindow *pwindow;
132 class ProxyAutoScale : public BC_CheckBox
135 ProxyAutoScale(ProxyWindow *pwindow, int x, int y);
139 ProxyWindow *pwindow;
142 class ProxyFormatTools : public FormatTools
145 ProxyFormatTools(MWindow *mwindow, ProxyWindow *window, Asset *asset);
147 void update_format();
148 ProxyWindow *pwindow;
151 class ProxyMenu : public BC_PopupMenu
154 ProxyMenu(MWindow *mwindow, ProxyWindow *pwindow,
155 int x, int y, int w, const char *text);
159 ProxyWindow *pwindow;
163 class ProxyTumbler : public BC_Tumbler
166 ProxyTumbler(MWindow *mwindow, ProxyWindow *pwindow, int x, int y);
168 int handle_up_event();
169 int handle_down_event();
171 ProxyWindow *pwindow;
176 class ProxyWindow : public BC_Window
179 ProxyWindow(MWindow *mwindow, ProxyDialog *dialog,
183 void create_objects();
188 FormatTools *format_tools;
189 BC_Title *new_dimensions;
190 ProxyMenu *scale_factor;
191 ProxyUseScaler *use_scaler;
192 ProxyAutoScale *auto_scale;
197 class ProxyPackage : public LoadPackage
201 Indexable *orig_idxbl;
205 class ProxyClient : public LoadClient
208 ProxyClient(MWindow *mwindow, ProxyRender *proxy_render, ProxyFarm *server);
210 void process_package(LoadPackage *package);
213 ProxyRender *proxy_render;
214 RenderEngine *render_engine;
215 CICache *video_cache;
220 class ProxyFarm : public LoadServer
223 ProxyFarm(MWindow *mwindow, ProxyRender *proxy_render,
224 ArrayList<Indexable*> *orig_idxbls, ArrayList<Asset*> *proxy_assets);
226 void init_packages();
227 LoadClient* new_client();
228 LoadPackage* new_package();
231 ProxyRender *proxy_render;
232 ArrayList<Indexable*> *orig_idxbls;
233 ArrayList<Asset*> *proxy_assets;