RafaMar + programmer friend Help button in Batch Render addition
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / packagerenderer.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 1997-2011 Adam Williams <broadcast at earthling dot net>
5  *
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.
10  *
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.
15  *
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
19  *
20  */
21
22 #ifndef PACKAGERENDERER_H
23 #define PACKAGERENDERER_H
24
25
26 #include "assets.inc"
27 #include "bctimer.inc"
28 #include "bcwindowbase.inc"
29 #include "cache.inc"
30 #include "edit.inc"
31 #include "edl.inc"
32 #include "file.h"
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"
42 #include "track.inc"
43 #include "transportque.inc"
44 #include "vframe.inc"
45 #include "videodevice.inc"
46
47
48 #include <stdint.h>
49
50 class RenderPackage
51 {
52 public:
53         RenderPackage();
54         ~RenderPackage();
55
56 // Path of output without remote prefix
57         char path[BCTEXTLEN];
58
59 // Range not including preroll
60         int64_t audio_start;
61         int64_t audio_end;
62         int64_t video_start;
63         int64_t video_end;
64         int done;
65         int use_brender;
66         int video_do;
67         int audio_do;
68 };
69
70 class PackageFile : public File
71 {
72 public:
73         PackageFile(PackageRenderer *package_renderer);
74         ~PackageFile();
75         int write_frame_done(int64_t position);
76
77         PackageRenderer *package_renderer;
78 };
79
80
81
82 // Used by Render and BRender to do packages.
83 class PackageRenderer
84 {
85 public:
86         PackageRenderer();
87         ~PackageRenderer();
88
89 // Initialize stuff which is reused between packages
90         int initialize(MWindow *mwindow,
91                 EDL *edl,
92                 Preferences *preferences,
93                 Asset *default_asset);
94
95 // Aborts and returns 1 if an error is encountered.
96         int render_package(RenderPackage *package);
97
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,
105                 File *file,
106                 int &result);
107
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();
119
120         void create_output();
121         void create_engine();
122         void do_audio();
123         void do_video();
124         void stop_engine();
125         void stop_output();
126         void close_output();
127
128
129 // Passed in from outside
130         EDL *edl;
131         Preferences *preferences;
132         Asset *default_asset;
133
134 // Created locally
135         Timer *timer;
136 // Calculate frames per second for the renderfarm table.
137         float frames_per_second;
138         int64_t total_samples_rendered;
139         Asset *asset;
140         Samples **audio_output;
141         int64_t audio_position;
142         int64_t audio_preroll;
143         int64_t audio_read_length;
144         PackageFile *file;
145 // This is 1 if an error is encountered.
146         int result;
147         VFrame ***video_output;
148 // A nonzero mwindow signals master render engine to the engine.
149 // A zero mwindow signals client or non interactive.
150         MWindow *mwindow;
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;
170 };
171
172
173
174
175 #endif