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
);
36 void create_render_threads();
37 void arm_render_threads();
38 void start_render_threads();
39 void wait_render_threads();
40 void interrupt_playback();
43 int brender_available(int position
, int direction
);
44 // Get current channel for the BUZ output
45 Channel
* get_current_channel();
46 double get_tracking_position();
47 // Find the plugin whose title matches title and return it
48 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 // Called by VRender to reset the timers once the first frame is done.
71 void reset_sync_position();
72 // return samples since start of playback
73 int64_t session_position();
75 // Update preferences window
76 void update_framerate(float framerate
);
79 TransportCommand
*command
;
80 // EDL to be used by renderengine since not all commands involve an EDL change
82 // Pointer to playback config for one head
83 PlaybackConfig
*config
;
84 // Defined only for the master render engine
85 PlaybackEngine
*playback_engine
;
86 // Copy of preferences
87 Preferences
*preferences
;
88 // Canvas if being used for CWindow
92 // Lock out new commands until completion
93 Condition
*input_lock
;
94 // Lock out interrupts until started
95 Condition
*start_lock
;
96 Condition
*output_lock
;
97 // Lock out audio and synchronization timers until first frame is done
98 Condition
*first_frame_lock
;
99 // Lock out interrupts before and after renderengine is active
100 Mutex
*interrupt_lock
;
102 // Show the timecode on the video
112 // Timer for synchronization without audio
114 float actual_frame_rate
;
115 // If the termination came from interrupt or end of selection
118 ArrayList
<PluginServer
*> *plugindb
;
119 // Channels for the BUZ output
120 ChannelDB
*channeldb
;
122 // Samples in audio buffer to process
123 int64_t fragment_len
;
124 // Samples to send to audio device after speed adjustment
125 int64_t adjusted_fragment_len
;
126 // CICaches for use if no playbackengine exists
127 CICache
*audio_cache
, *video_cache
;
144 // constructing with an audio device forces output buffer allocation
145 // constructing without an audio device puts in one buffer at a time mode
146 RenderEngine(MWindow
*mwindow
,
147 AudioDevice
*audio
= 0,
148 VideoDevice
*video
= 0,
149 PlaybackEngine
*playbackengine
= 0);
151 // buffersize is in samples
152 int reset_parameters();
154 int arm_playback_audio(int64_t input_length
,
155 int64_t amodule_render_fragment
,
156 int64_t playback_buffer
,
157 int64_t output_length
);
159 int arm_playback_video(int every_frame
,
161 int64_t output_length
,
167 int64_t get_correction_factor(int reset
); // calling it resets the correction factor
169 // start video since vrender is the master
173 // information for playback
174 int follow_loop
; // loop if mwindow is looped
175 int infinite
; // don't stop rendering at the end of the range or loops
177 int64_t start_position
; // lowest numbered sample in playback range
178 int64_t end_position
; // highest numbered sample in playback range
179 int64_t current_sample
;
196 // c-file-style: "linux"