4 * Copyright (C) 1997-2011 Adam Williams <broadcast at earthling dot net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #ifndef PACKAGERENDERER_H
23 #define PACKAGERENDERER_H
27 #include "bctimer.inc"
28 #include "bcwindowbase.inc"
33 #include "maxchannels.h"
34 #include "mwindow.inc"
35 #include "packagerenderer.inc"
36 #include "playabletracks.inc"
37 #include "playbackconfig.inc"
38 #include "pluginserver.inc"
39 #include "preferences.inc"
40 #include "renderengine.inc"
41 #include "samples.inc"
43 #include "transportque.inc"
45 #include "videodevice.inc"
56 // Path of output without remote prefix
59 // Range not including preroll
70 class PackageFile : public File
73 PackageFile(PackageRenderer *package_renderer);
75 int write_frame_done(int64_t position);
77 PackageRenderer *package_renderer;
82 // Used by Render and BRender to do packages.
89 // Initialize stuff which is reused between packages
90 int initialize(MWindow *mwindow,
92 Preferences *preferences,
93 Asset *default_asset);
95 // Aborts and returns 1 if an error is encountered.
96 int render_package(RenderPackage *package);
98 int direct_copy_possible(EDL *edl,
99 int64_t current_position,
100 Track* &playable_track, // The one track which is playable
101 Edit* &playable_edit, // The edit which is playing
102 File *file); // Output file
103 int direct_frame_copy(EDL *edl,
104 int64_t &video_position,
108 // Invoke behavior for master node
109 virtual int get_master();
110 // Get result status from server
111 virtual int get_result();
112 virtual void set_result(int value);
113 virtual void set_progress(int64_t total_samples);
114 // Used by background rendering to mark a frame as finished.
115 // If the GUI is locked for a long time this may abort,
116 // assuming the server crashed.
117 virtual int set_video_map(int64_t position, int value);
118 virtual int progress_cancelled();
120 void create_output();
121 void create_engine();
129 // Passed in from outside
131 Preferences *preferences;
132 Asset *default_asset;
136 // Calculate frames per second for the renderfarm table.
137 float frames_per_second;
138 int64_t total_samples_rendered;
140 Samples **audio_output;
141 int64_t audio_position;
142 int64_t audio_preroll;
143 int64_t audio_read_length;
145 // This is 1 if an error is encountered.
147 VFrame ***video_output;
148 // A nonzero mwindow signals master render engine to the engine.
149 // A zero mwindow signals client or non interactive.
151 Samples *audio_output_ptr[MAX_CHANNELS];
152 CICache *audio_cache;
153 CICache *video_cache;
154 VFrame *compressed_output;
155 AudioOutConfig *aconfig;
156 VideoOutConfig *vconfig;
157 // PlaybackConfig *playback_config;
158 PlayableTracks *playable_tracks;
159 RenderEngine *render_engine;
160 RenderPackage *package;
161 TransportCommand *command;
162 int direct_frame_copying;
163 VideoDevice *video_device;
164 VFrame *video_output_ptr;
165 int64_t video_preroll;
166 int64_t video_position;
167 int64_t video_read_length;
168 int64_t video_write_length;
169 int64_t video_write_position;