8 #include "audiodevice.inc"
11 #include "channel.inc"
12 #include "condition.inc"
14 #include "mwindow.inc"
15 #include "playbackengine.inc"
16 #include "pluginserver.inc"
17 #include "preferences.inc"
19 #include "transportque.inc"
20 #include "videodevice.inc"
21 #include "vrender.inc"
23 class RenderEngine
: public Thread
26 RenderEngine(PlaybackEngine
*playback_engine
,
27 Preferences
*preferences
,
28 TransportCommand
*command
,
30 ArrayList
<PluginServer
*> *plugindb
,
31 ArrayList
<Channel
*> *channeldb
,
35 int total_playable_channels();
36 // Translate sequential to subscript for EDL array
37 int playable_channel_number(int number
);
39 void create_render_threads();
40 void arm_render_threads();
41 void start_render_threads();
42 void wait_render_threads();
43 void interrupt_playback();
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
);
61 // Sends the command sequence, compensating for network latency
62 int arm_command(TransportCommand
*command
,
63 int ¤t_vchannel
,
64 int ¤t_achannel
);
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
);
80 TransportCommand
*command
;
81 // EDL to be used by renderengine since not all commands involve an EDL change
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
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
;
110 // Timer for synchronization without audio
112 float actual_frame_rate
;
113 // If the termination came from interrupt or end of selection
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
,
152 int64_t current_sample
,
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
,
164 int arm_playback_video(int every_frame
,
166 int64_t output_length
,
172 int64_t get_correction_factor(int reset
); // calling it resets the correction factor
174 // start video since vrender is the master
178 // information for playback
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
;