2 #include "edlsession.h"
3 #include "pluginserver.h"
4 #include "pluginvclient.h"
9 PluginVClient::PluginVClient(PluginServer *server)
10 : PluginClient(server)
19 project_frame_rate = server->edl->session->frame_rate;
20 frame_rate = project_frame_rate;
24 project_frame_rate = 1.0;
25 frame_rate = project_frame_rate;
29 PluginVClient::~PluginVClient()
34 int PluginVClient::is_video()
39 VFrame* PluginVClient::new_temp(int w, int h, int color_model)
42 (temp->get_w() != w ||
44 temp->get_color_model() != color_model))
52 temp = new VFrame(0, w, h, color_model);
58 void PluginVClient::age_temp()
61 temp->get_w() > PLUGIN_MAX_W &&
62 temp->get_h() > PLUGIN_MAX_H)
69 VFrame* PluginVClient::get_temp()
74 // Run before every realtime buffer is to be rendered.
75 int PluginVClient::get_render_ptrs()
77 int i, j, double_buffer, fragment_position;
79 for(i = 0; i < total_in_buffers; i++)
81 double_buffer = double_buffer_in_render.values[i];
82 fragment_position = offset_in_render.values[i];
83 input_ptr_render[i] = &input_ptr_master.values[i][double_buffer][fragment_position];
86 for(i = 0; i < total_out_buffers; i++)
88 double_buffer = double_buffer_out_render.values[i];
89 fragment_position = offset_out_render.values[i];
90 output_ptr_render[i] = &output_ptr_master.values[i][double_buffer][fragment_position];
95 // Run after the non realtime plugin is run.
96 int PluginVClient::delete_nonrealtime_parameters()
100 for(i = 0; i < total_in_buffers; i++)
102 for(j = 0; j < in_buffer_size; j++)
104 delete video_in[i][j];
108 for(i = 0; i < total_out_buffers; i++)
110 for(j = 0; j < out_buffer_size; j++)
112 delete video_out[i][j];
121 int PluginVClient::init_realtime_parameters()
123 project_frame_rate = server->edl->session->frame_rate;
124 project_color_model = server->edl->session->color_model;
125 aspect_w = server->edl->session->aspect_w;
126 aspect_h = server->edl->session->aspect_h;
130 int PluginVClient::process_realtime(VFrame **input,
136 int PluginVClient::process_realtime(VFrame *input,
142 int PluginVClient::process_buffer(VFrame **frame,
143 int64_t start_position,
146 for(int i = 0; i < PluginClient::total_in_buffers; i++)
147 read_frame(frame[i], i, start_position, frame_rate);
148 if(is_multichannel())
149 process_realtime(frame, frame);
153 int PluginVClient::process_buffer(VFrame *frame,
154 int64_t start_position,
157 read_frame(frame, 0, start_position, frame_rate);
158 process_realtime(frame, frame);
163 // Replaced by pull method
164 // void PluginVClient::plugin_process_realtime(VFrame **input,
166 // int64_t current_position,
167 // int64_t total_len)
169 // this->source_position = current_position;
170 // this->total_len = total_len;
172 // if(is_multichannel())
173 // process_realtime(input, output);
175 // process_realtime(input[0], output[0]);
178 void PluginVClient::plugin_render_gui(void *data)
183 void PluginVClient::send_render_gui(void *data)
185 server->send_render_gui(data);
188 int PluginVClient::plugin_start_loop(int64_t start,
193 frame_rate = get_project_framerate();
194 return PluginClient::plugin_start_loop(start,
200 int PluginVClient::plugin_get_parameters()
202 frame_rate = get_project_framerate();
203 return PluginClient::plugin_get_parameters();
206 int64_t PluginVClient::local_to_edl(int64_t position)
208 if(position < 0) return position;
209 return (int64_t)Units::round(position *
210 get_project_framerate() /
215 int64_t PluginVClient::edl_to_local(int64_t position)
217 if(position < 0) return position;
218 return (int64_t)Units::round(position *
220 get_project_framerate());
223 int PluginVClient::plugin_process_loop(VFrame **buffers, int64_t &write_length)
227 if(is_multichannel())
228 result = process_loop(buffers);
230 result = process_loop(buffers[0]);
239 int PluginVClient::run_opengl()
241 server->run_opengl(this);
245 int PluginVClient::handle_opengl()
250 VFrame* PluginVClient::get_input(int channel)
252 return input[channel];
255 VFrame* PluginVClient::get_output(int channel)
257 return output[channel];
260 int PluginVClient::next_effect_is(char *title)
262 return !strcmp(title, output[0]->get_next_effect());
265 int PluginVClient::prev_effect_is(char *title)
267 return !strcmp(title, output[0]->get_prev_effect());
272 int PluginVClient::read_frame(VFrame *buffer,
274 int64_t start_position)
276 return server->read_frame(buffer,
281 int PluginVClient::read_frame(VFrame *buffer,
282 int64_t start_position)
284 return server->read_frame(buffer,
289 int PluginVClient::read_frame(VFrame *buffer,
291 int64_t start_position,
295 return server->read_frame(buffer,
303 double PluginVClient::get_project_framerate()
305 return project_frame_rate;
308 double PluginVClient::get_framerate()