make kfrm operator= illegal, use copy_from instead
[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.inc"
33 #include "maxchannels.h"
34 #include "mwindow.inc"
35 #include "playabletracks.inc"
36 #include "playbackconfig.inc"
37 #include "pluginserver.inc"
38 #include "preferences.inc"
39 #include "renderengine.inc"
40 #include "samples.inc"
41 #include "track.inc"
42 #include "transportque.inc"
43 #include "vframe.inc"
44 #include "videodevice.inc"
45
46
47 #include <stdint.h>
48
49 class RenderPackage
50 {
51 public:
52         RenderPackage();
53         ~RenderPackage();
54
55 // Path of output without remote prefix
56         char path[BCTEXTLEN];
57
58 // Range not including preroll
59         int64_t audio_start;
60         int64_t audio_end;
61         int64_t video_start;
62         int64_t video_end;
63         int done;
64         int use_brender;
65         int video_do;
66         int audio_do;
67 };
68
69
70
71
72 // Used by Render and BRender to do packages.
73 class PackageRenderer
74 {
75 public:
76         PackageRenderer();
77         ~PackageRenderer();
78
79 // Initialize stuff which is reused between packages
80         int initialize(MWindow *mwindow,
81                 EDL *edl,
82                 Preferences *preferences,
83                 Asset *default_asset);
84
85 // Aborts and returns 1 if an error is encountered.
86         int render_package(RenderPackage *package);
87
88         int direct_copy_possible(EDL *edl,
89                 int64_t current_position,
90                 Track* &playable_track,  // The one track which is playable
91                 Edit* &playable_edit, // The edit which is playing
92                 File *file);   // Output file
93         int direct_frame_copy(EDL *edl,
94                 int64_t &video_position,
95                 File *file,
96                 int &result);
97
98 // Invoke behavior for master node
99         virtual int get_master();
100 // Get result status from server
101         virtual int get_result();
102         virtual void set_result(int value);
103         virtual void set_progress(int64_t total_samples);
104 // Used by background rendering to mark a frame as finished.
105 // If the GUI is locked for a long time this may abort,
106 // assuming the server crashed.
107         virtual int set_video_map(int64_t position, int value);
108         virtual int progress_cancelled();
109
110         void create_output();
111         void create_engine();
112         void do_audio();
113         void do_video();
114         void stop_engine();
115         void stop_output();
116         void close_output();
117
118
119 // Passed in from outside
120         EDL *edl;
121         Preferences *preferences;
122         Asset *default_asset;
123
124 // Created locally
125         Timer *timer;
126 // Calculate frames per second for the renderfarm table.
127         float frames_per_second;
128         int64_t total_samples_rendered;
129         Asset *asset;
130         Samples **audio_output;
131         int64_t audio_position;
132         int64_t audio_preroll;
133         int64_t audio_read_length;
134         File *file;
135 // This is 1 if an error is encountered.
136         int result;
137         VFrame ***video_output;
138 // A nonzero mwindow signals master render engine to the engine.
139 // A zero mwindow signals client or non interactive.
140         MWindow *mwindow;
141         Samples *audio_output_ptr[MAX_CHANNELS];
142         CICache *audio_cache;
143         CICache *video_cache;
144         VFrame *compressed_output;
145         AudioOutConfig *aconfig;
146         VideoOutConfig *vconfig;
147 //      PlaybackConfig *playback_config;
148         PlayableTracks *playable_tracks;
149         RenderEngine *render_engine;
150         RenderPackage *package;
151         TransportCommand *command;
152         int direct_frame_copying;
153         VideoDevice *video_device;
154         VFrame *video_output_ptr;
155         int64_t video_preroll;
156         int64_t video_position;
157         int64_t video_read_length;
158         int64_t video_write_length;
159         int64_t video_write_position;
160 };
161
162
163
164
165 #endif