r1014: Enable horizontal scrolling with the mouse wheel by pressing Ctrl.
[cinelerra_cv/ct.git] / cinelerra / render.h
blob4d0e4f5a33b39b0273d201209d062a8c179cfe50
1 #ifndef RENDER_H
2 #define RENDER_H
5 #include "asset.inc"
6 #include "batchrender.inc"
7 #include "bitspopup.h"
8 #include "browsebutton.h"
9 #include "cache.inc"
10 #include "compresspopup.h"
11 #include "condition.inc"
12 #include "bchash.inc"
13 #include "edit.inc"
14 #include "errorbox.inc"
15 #include "file.inc"
16 #include "formatpopup.inc"
17 #include "formattools.inc"
18 #include "guicast.h"
19 #include "loadmode.inc"
20 #include "mainprogress.inc"
21 #include "maxchannels.h"
22 #include "mutex.inc"
23 #include "mwindow.inc"
24 #include "packagedispatcher.inc"
25 #include "packagerenderer.h"
26 #include "playabletracks.inc"
27 #include "preferences.inc"
28 #include "bcprogressbox.inc"
29 #include "render.inc"
30 #include "track.inc"
31 #include "transportque.inc"
32 #include "vframe.inc"
33 #include "renderprofiles.inc"
36 class RenderItem : public BC_MenuItem
38 public:
39 RenderItem(MWindow *mwindow);
40 int handle_event();
41 MWindow *mwindow;
44 class RenderProgress : public Thread
46 public:
47 RenderProgress(MWindow *mwindow, Render *render);
48 ~RenderProgress();
50 void run();
53 MWindow *mwindow;
54 Render *render;
56 int64_t last_value;
61 class MainPackageRenderer : public PackageRenderer
63 public:
64 MainPackageRenderer(Render *render);
65 ~MainPackageRenderer();
68 int get_master();
69 int get_result();
70 void set_result(int value);
71 void set_progress(int64_t value);
72 int progress_cancelled();
74 Render *render;
77 class RenderWindow;
80 class Render : public Thread
82 public:
83 Render(MWindow *mwindow);
84 ~Render();
86 // Start dialogue box and render interactively.
87 void start_interactive();
88 // Start batch rendering jobs.
89 // A new thread is created and the rendering is interactive.
90 void start_batches(ArrayList<BatchRenderJob*> *jobs);
91 // The batches are processed in the foreground in non interactive mode.
92 void start_batches(ArrayList<BatchRenderJob*> *jobs,
93 BC_Hash *boot_defaults,
94 Preferences *preferences,
95 ArrayList<PluginServer*> *plugindb);
96 // Called by BatchRender to stop the operation.
97 void stop_operation();
98 void run();
101 // Render single job. Used by run.
102 int render(int test_overwrite,
103 Asset *asset,
104 EDL *edl,
105 int strategy,
106 int range_type);
108 int load_defaults(Asset *asset);
109 int save_defaults(Asset *asset);
110 int load_profile(int profile_slot, Asset *asset);
111 // force asset parameters regardless of window
112 // This should be integrated into the Asset Class.
113 static int check_asset(EDL *edl, Asset &asset);
114 // Fix strategy to conform with using renderfarm.
115 static int fix_strategy(int strategy, int use_renderfarm);
116 // Force filename to have a 0 padded number if rendering to a list.
117 int check_numbering(Asset &asset);
118 static void create_filename(char *path,
119 char *default_path,
120 int current_number,
121 int total_digits,
122 int number_start);
123 static void get_starting_number(char *path,
124 int &current_number,
125 int &number_start,
126 int &total_digits,
127 int min_digits = 3);
128 int direct_frame_copy(EDL *edl, int64_t &render_video_position, File *file);
129 int direct_copy_possible(EDL *edl,
130 int64_t current_position,
131 Track* playable_track, // The one track which is playable
132 Edit* &playable_edit, // The edit which is playing
133 File *file); // Output file
135 void start_progress();
136 void stop_progress();
138 // Procedure the run function should use.
139 int mode;
140 enum
142 INTERACTIVE,
143 BATCH
145 // When batch rendering is cancelled from the batch dialog
146 int batch_cancelled;
149 int load_mode;
150 int in_progress;
151 // Background compression must be disabled when direct frame copying and reenabled afterwards
152 int direct_frame_copying;
154 CICache *audio_cache, *video_cache;
155 VFrame *compressed_output;
156 MainProgressBar *progress;
157 RenderProgress *render_progress;
158 MWindow *mwindow;
159 PlayableTracks *playable_tracks;
160 PackageDispatcher *packages;
161 Mutex *package_lock, *counter_lock;
162 // Copy of mwindow preferences
163 Preferences *preferences;
164 // For use in non interactive mode
165 ArrayList<PluginServer*> *plugindb;
166 int strategy;
167 int range_type;
168 // Total selection to render in seconds
169 double total_start, total_end;
170 // External Render farm checks this every frame.
171 int result;
172 Asset *default_asset;
173 TransportCommand *command;
174 // Jobs pointer passed to start_batches
175 ArrayList<BatchRenderJob*> *jobs;
176 // Used by batch rendering to wait until rendering is finished
177 Condition *completion;
180 // Total samples updated by the render farm and the local renderer.
181 // This avoids rounding errors and complies with the use of samples for
182 // timing.
183 int64_t total_rendered;
184 // Speed for the master node
185 double frames_per_second;
186 // Time used in last render
187 double elapsed_time;
189 // Current open RenderWindow
190 RenderWindow *render_window;
192 // For non interactive mode, maintain progress here.
193 int64_t progress_max;
194 Timer *progress_timer;
195 int64_t last_eta;
198 class RenderToTracks;
201 class RenderRangeProject : public BC_Radial
203 public:
204 RenderRangeProject(RenderWindow *rwindow, int value, int x, int y);
205 int handle_event();
206 RenderWindow *rwindow;
209 class RenderRangeSelection : public BC_Radial
211 public:
212 RenderRangeSelection(RenderWindow *rwindow, int value, int x, int y);
213 int handle_event();
214 RenderWindow *rwindow;
218 class RenderRangeInOut : public BC_Radial
220 public:
221 RenderRangeInOut(RenderWindow *rwindow, int value, int x, int y);
222 int handle_event();
223 RenderWindow *rwindow;
228 class RenderWindow : public BC_Window
230 public:
231 RenderWindow(MWindow *mwindow, Render *render, Asset *asset);
232 ~RenderWindow();
234 int create_objects();
235 void update_range_type(int range_type);
236 int load_profile(int profile_slot);
238 RenderRangeProject *rangeproject;
239 RenderRangeSelection *rangeselection;
240 RenderRangeInOut *rangeinout;
242 RenderProfile *renderprofile;
244 LoadMode *loadmode;
245 FormatTools *format_tools;
247 MWindow *mwindow;
248 Render *render;
249 Asset *asset;
264 #endif