r125: This commit was manufactured by cvs2svn to create tag 'r1_1_7-last'.
[cinelerra_cv/mob.git] / hvirtual / cinelerra / pluginvclient.C
blob63f2e38fb7fefd46a95697ca0c42f589a4d68458
1 #include "edl.h"
2 #include "edlsession.h"
3 #include "pluginserver.h"
4 #include "pluginvclient.h"
5 #include "vframe.h"
7 #include <string.h>
9 PluginVClient::PluginVClient(PluginServer *server)
10  : PluginClient(server)
12         video_in = 0;
13         video_out = 0;
14         if(server &&
15                 server->edl &&
16                 server->edl->session) 
17                 project_frame_rate = server->edl->session->frame_rate;
20 PluginVClient::~PluginVClient()
24 int PluginVClient::is_video()
26         return 1;
30 // Run before every realtime buffer is to be rendered.
31 int PluginVClient::get_render_ptrs()
33         int i, j, double_buffer, fragment_position;
35         for(i = 0; i < total_in_buffers; i++)
36         {
37                 double_buffer = double_buffer_in_render.values[i];
38                 fragment_position = offset_in_render.values[i];
39                 input_ptr_render[i] = &input_ptr_master.values[i][double_buffer][fragment_position];
40         }
42         for(i = 0; i < total_out_buffers; i++)
43         {
44                 double_buffer = double_buffer_out_render.values[i];
45                 fragment_position = offset_out_render.values[i];
46                 output_ptr_render[i] = &output_ptr_master.values[i][double_buffer][fragment_position];
47         }
48         return 0;
51 // Run after the non realtime plugin is run.
52 int PluginVClient::delete_nonrealtime_parameters()
54         int i, j;
56         for(i = 0; i < total_in_buffers; i++)
57         {
58                 for(j = 0; j < in_buffer_size; j++)
59                 {
60                         delete video_in[i][j];
61                 }
62         }
64         for(i = 0; i < total_out_buffers; i++)
65         {
66                 for(j = 0; j < out_buffer_size; j++)
67                 {
68                         delete video_out[i][j];
69                 }
70         }
71         video_in = 0;
72         video_out = 0;
74         return 0;
77 int PluginVClient::init_realtime_parameters()
79         project_frame_rate = server->edl->session->frame_rate;
80         project_color_model = server->edl->session->color_model;
81         aspect_w = server->edl->session->aspect_w;
82         aspect_h = server->edl->session->aspect_h;
83         return 0;
87 void PluginVClient::plugin_process_realtime(VFrame **input, 
88                 VFrame **output, 
89                 int64_t current_position,
90                 int64_t total_len)
92         this->source_position = current_position;
93         this->total_len = total_len;
95 //printf("PluginVClient::plugin_process_realtime 1\n");
96         if(is_multichannel())
97                 process_realtime(input, output);
98         else
99                 process_realtime(input[0], output[0]);
100 //printf("PluginVClient::plugin_process_realtime 2\n");
103 void PluginVClient::plugin_render_gui(void *data)
105         render_gui(data);
108 void PluginVClient::send_render_gui(void *data)
110 //printf("PluginVClient::send_render_gui 1\n");
111         server->send_render_gui(data);
114 int PluginVClient::plugin_process_loop(VFrame **buffers, int64_t &write_length)
116         int result = 0;
118         if(is_multichannel())
119                 result = process_loop(buffers);
120         else
121                 result = process_loop(buffers[0]);
122         
123         
124         write_length = 1;
125         
126         return result;
130 int PluginVClient::read_frame(VFrame *buffer, int channel, int64_t start_position)
132         return server->read_frame(buffer, channel, start_position);
135 int PluginVClient::read_frame(VFrame *buffer, int64_t start_position)
137         return server->read_frame(buffer, 0, start_position);