8 #include "audiodevice.inc"
11 #include "channel.inc"
12 #include "mwindow.inc"
13 #include "playbackengine.inc"
14 #include "pluginserver.inc"
15 #include "preferences.inc"
17 #include "transportque.inc"
18 #include "videodevice.inc"
19 #include "vrender.inc"
21 class RenderEngine
: public Thread
24 RenderEngine(PlaybackEngine
*playback_engine
,
25 Preferences
*preferences
,
26 TransportCommand
*command
,
28 ArrayList
<PluginServer
*> *plugindb
,
29 ArrayList
<Channel
*> *channeldb
,
33 int total_playable_channels();
34 // Translate sequential to subscript for EDL array
35 int playable_channel_number(int number
);
37 void create_render_threads();
38 void arm_render_threads();
39 void start_render_threads();
40 void wait_render_threads();
41 void interrupt_playback();
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
);
59 // Sends the command sequence, compensating for network latency
60 int arm_command(TransportCommand
*command
,
61 int ¤t_vchannel
,
62 int ¤t_achannel
);
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
);
78 TransportCommand
*command
;
79 // EDL to be used by renderengine since not all commands involve an EDL change
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
89 // Lock out new commands until completion
91 // Lock out interrupts until started
101 // Timer for synchronization without audio
103 float actual_frame_rate
;
104 // If the termination came from interrupt or end of selection
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
,
145 int64_t current_sample
,
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
,
157 int arm_playback_video(int every_frame
,
159 int64_t output_length
,
165 int64_t get_correction_factor(int reset
); // calling it resets the correction factor
167 // start video since vrender is the master
170 int wait_for_startup();
171 int wait_for_completion();
173 // information for playback
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
;