8 #include "audiodevice.inc"
11 #include "channel.inc"
12 #include "channeldb.inc"
13 #include "condition.inc"
15 #include "mwindow.inc"
16 #include "playbackengine.inc"
17 #include "pluginserver.inc"
18 #include "preferences.inc"
20 #include "transportque.inc"
21 #include "videodevice.inc"
22 #include "vrender.inc"
24 class RenderEngine
: public Thread
27 RenderEngine(PlaybackEngine
*playback_engine
,
28 Preferences
*preferences
,
29 TransportCommand
*command
,
31 ArrayList
<PluginServer
*> *plugindb
,
32 ChannelDB
*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
,
53 CICache
* get_acache();
54 CICache
* get_vcache();
55 void set_acache(CICache
*cache
);
56 void set_vcache(CICache
*cache
);
57 // Get levels for tracking
58 void get_output_levels(double *levels
, int64_t position
);
59 void get_module_levels(ArrayList
<double> *module_levels
, int64_t position
);
62 // Sends the command sequence, compensating for network latency
63 int arm_command(TransportCommand
*command
,
64 int ¤t_vchannel
,
65 int ¤t_achannel
);
71 // return position to synchronize video against
72 int64_t sync_position();
73 // Called by VRender to reset the timers once the first frame is done.
74 void reset_sync_position();
75 // return samples since start of playback
76 int64_t session_position();
78 // Update preferences window
79 void update_framerate(float framerate
);
82 TransportCommand
*command
;
83 // EDL to be used by renderengine since not all commands involve an EDL change
85 // Pointer to playback config for one head
86 PlaybackConfig
*config
;
87 // Defined only for the master render engine
88 PlaybackEngine
*playback_engine
;
89 // Copy of preferences
90 Preferences
*preferences
;
91 // Canvas if being used for CWindow
95 // Lock out new commands until completion
96 Condition
*input_lock
;
97 // Lock out interrupts until started
98 Condition
*start_lock
;
99 Condition
*output_lock
;
100 // Lock out audio and synchronization timers until first frame is done
101 Condition
*first_frame_lock
;
102 // Lock out interrupts before and after renderengine is active
103 Mutex
*interrupt_lock
;
105 // Show the timecode on the video
115 // Timer for synchronization without audio
117 float actual_frame_rate
;
118 // If the termination came from interrupt or end of selection
121 ArrayList
<PluginServer
*> *plugindb
;
122 // Channels for the BUZ output
123 ChannelDB
*channeldb
;
125 // Samples in audio buffer to process
126 int64_t fragment_len
;
127 // Samples to send to audio device after speed adjustment
128 int64_t adjusted_fragment_len
;
129 // CICaches for use if no playbackengine exists
130 CICache
*audio_cache
, *video_cache
;
147 // constructing with an audio device forces output buffer allocation
148 // constructing without an audio device puts in one buffer at a time mode
149 RenderEngine(MWindow
*mwindow
,
150 AudioDevice
*audio
= 0,
151 VideoDevice
*video
= 0,
152 PlaybackEngine
*playbackengine
= 0);
154 // buffersize is in samples
155 int reset_parameters();
157 int arm_playback_audio(int64_t input_length
,
158 int64_t amodule_render_fragment
,
159 int64_t playback_buffer
,
160 int64_t output_length
,
163 int arm_playback_video(int every_frame
,
165 int64_t output_length
,
171 int64_t get_correction_factor(int reset
); // calling it resets the correction factor
173 // start video since vrender is the master
177 // information for playback
178 int follow_loop
; // loop if mwindow is looped
179 int infinite
; // don't stop rendering at the end of the range or loops
181 int64_t start_position
; // lowest numbered sample in playback range
182 int64_t end_position
; // highest numbered sample in playback range
183 int64_t current_sample
;