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