r136: This commit was manufactured by cvs2svn to create tag 'hv_1_1_8'.
[cinelerra_cv/mob.git] / hvirtual / cinelerra / renderengine.h
blob2c2e599671e9fb613dfc807ad46b42e3731c0af2
1 #ifndef RENDERENGINE_H
2 #define RENDERENGINE_H
5 class RenderEngine;
7 #include "arender.inc"
8 #include "audiodevice.inc"
9 #include "cache.inc"
10 #include "canvas.inc"
11 #include "channel.inc"
12 #include "condition.inc"
13 #include "mutex.inc"
14 #include "mwindow.inc"
15 #include "playbackengine.inc"
16 #include "pluginserver.inc"
17 #include "preferences.inc"
18 #include "thread.h"
19 #include "transportque.inc"
20 #include "videodevice.inc"
21 #include "vrender.inc"
23 class RenderEngine : public Thread
25 public:
26 RenderEngine(PlaybackEngine *playback_engine,
27 Preferences *preferences,
28 TransportCommand *command,
29 Canvas *output,
30 ArrayList<PluginServer*> *plugindb,
31 ArrayList<Channel*> *channeldb,
32 int head_number);
33 ~RenderEngine();
35 int total_playable_channels();
36 // Translate sequential to subscript for EDL array
37 int playable_channel_number(int number);
38 void get_duty();
39 void create_render_threads();
40 void arm_render_threads();
41 void start_render_threads();
42 void wait_render_threads();
43 void interrupt_playback();
44 int get_output_w();
45 int get_output_h();
46 int brender_available(int position, int direction);
47 // Get current channel for the BUZ output
48 Channel* get_current_channel();
49 double get_tracking_position();
50 // Find the plugin whose title matches title and return it
51 PluginServer* scan_plugindb(char *title);
52 CICache* get_acache();
53 CICache* get_vcache();
54 void set_acache(CICache *cache);
55 void set_vcache(CICache *cache);
56 // Get levels for tracking
57 void get_output_levels(double *levels, int64_t position);
58 void get_module_levels(ArrayList<double> *module_levels, int64_t position);
60 void run();
61 // Sends the command sequence, compensating for network latency
62 int arm_command(TransportCommand *command,
63 int &current_vchannel,
64 int &current_achannel);
65 // Start the command
66 int start_command();
68 int open_output();
69 int close_output();
70 // return position to synchronize video against
71 int64_t sync_position();
72 // return samples since start of playback
73 int64_t session_position();
75 // Update preferences window
76 void update_framerate(float framerate);
78 int head_number;
79 // Copy of command
80 TransportCommand *command;
81 // EDL to be used by renderengine since not all commands involve an EDL change
82 EDL *edl;
83 // Pointer to playback config for one head
84 PlaybackConfig *config;
85 // Defined only for the master render engine
86 PlaybackEngine *playback_engine;
87 // Copy of preferences
88 Preferences *preferences;
89 // Canvas if being used for CWindow
90 Canvas *output;
93 // Lock out new commands until completion
94 Condition *input_lock;
95 // Lock out interrupts until started
96 Condition *start_lock;
97 Condition *output_lock;
98 // Lock out interrupts before and after renderengine is active
99 Mutex *interrupt_lock;
103 int done;
104 AudioDevice *audio;
105 VideoDevice *video;
106 ARender *arender;
107 VRender *vrender;
108 int do_audio;
109 int do_video;
110 // Timer for synchronization without audio
111 Timer timer;
112 float actual_frame_rate;
113 // If the termination came from interrupt or end of selection
114 int interrupted;
116 ArrayList<PluginServer*> *plugindb;
117 // Channels for the BUZ output
118 ArrayList<Channel*> *channeldb;
120 // length to send to audio device after speed adjustment
121 int64_t adjusted_fragment_len;
122 // CICaches for use if no playbackengine exists
123 CICache *audio_cache, *video_cache;
140 // constructing with an audio device forces output buffer allocation
141 // constructing without an audio device puts in one buffer at a time mode
142 RenderEngine(MWindow *mwindow,
143 AudioDevice *audio = 0,
144 VideoDevice *video = 0,
145 PlaybackEngine *playbackengine = 0);
147 // buffersize is in samples
148 int reset_parameters();
150 int arm_playback_common(int64_t start_sample,
151 int64_t end_sample,
152 int64_t current_sample,
153 int reverse,
154 float speed,
155 int follow_loop,
156 int infinite);
158 int arm_playback_audio(int64_t input_length,
159 int64_t amodule_render_fragment,
160 int64_t playback_buffer,
161 int64_t output_length,
162 int audio_channels);
164 int arm_playback_video(int every_frame,
165 int64_t read_length,
166 int64_t output_length,
167 int track_w,
168 int track_h,
169 int output_w,
170 int output_h);
172 int64_t get_correction_factor(int reset); // calling it resets the correction factor
174 // start video since vrender is the master
175 int start_video();
178 // information for playback
179 int reverse;
180 int follow_loop; // loop if mwindow is looped
181 int infinite; // don't stop rendering at the end of the range or loops
183 int64_t start_position; // lowest numbered sample in playback range
184 int64_t end_position; // highest numbered sample in playback range
185 int64_t current_sample;
186 int audio_channels;
187 int every_frame;
189 MWindow *mwindow;
199 #endif