Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

pluginclient.C

Go to the documentation of this file.
00001 #include "bcsignals.h"
00002 #include "edl.h"
00003 #include "edlsession.h"
00004 #include "language.h"
00005 #include "localsession.h"
00006 #include "mainundo.h"
00007 #include "mwindow.h"
00008 #include "pluginclient.h"
00009 #include "pluginserver.h"
00010 #include "preferences.h"
00011 #include "transportque.inc"
00012 
00013 #include <string.h>
00014 
00015 PluginClient::PluginClient(PluginServer *server)
00016 {
00017         reset();
00018         this->server = server;
00019 }
00020 
00021 PluginClient::~PluginClient()
00022 {
00023 }
00024 
00025 int PluginClient::reset()
00026 {
00027         interactive = 0;
00028         show_initially = 0;
00029         wr = rd = 0;
00030         master_gui_on = 0;
00031         client_gui_on = 0;
00032         realtime_priority = 0;
00033         gui_string[0] = 0;
00034         total_in_buffers = 0;
00035         total_out_buffers = 0;
00036         source_position = 0;
00037         source_start = 0;
00038         total_len = 0;
00039         direction = PLAY_FORWARD;
00040 }
00041 
00042 
00043 
00044 // For realtime plugins initialize buffers
00045 int PluginClient::plugin_init_realtime(int realtime_priority, 
00046         int total_in_buffers,
00047         int buffer_size)
00048 {
00049 SET_TRACE
00050 // Get parameters for all
00051         master_gui_on = get_gui_status();
00052 
00053 SET_TRACE
00054 
00055 // get parameters depending on video or audio
00056         init_realtime_parameters();
00057 SET_TRACE
00058         smp = server->preferences->processors - 1;
00059 SET_TRACE
00060         this->realtime_priority = realtime_priority;
00061 SET_TRACE
00062         this->total_in_buffers = this->total_out_buffers = total_in_buffers;
00063 SET_TRACE
00064         this->out_buffer_size = this->in_buffer_size = buffer_size;
00065 SET_TRACE
00066         return 0;
00067 }
00068 
00069 int PluginClient::plugin_start_loop(int64_t start, 
00070         int64_t end, 
00071         int64_t buffer_size, 
00072         int total_buffers)
00073 {
00074         this->source_start = start;
00075         this->total_len = end - start;
00076         this->start = start;
00077         this->end = end;
00078         this->in_buffer_size = this->out_buffer_size = buffer_size;
00079         this->total_in_buffers = this->total_out_buffers = total_buffers;
00080         start_loop();
00081         return 0;
00082 }
00083 
00084 int PluginClient::plugin_process_loop()
00085 {
00086         return process_loop();
00087 }
00088 
00089 int PluginClient::plugin_stop_loop()
00090 {
00091         return stop_loop();
00092 }
00093 
00094 MainProgressBar* PluginClient::start_progress(char *string, int64_t length)
00095 {
00096         return server->start_progress(string, length);
00097 }
00098 
00099 
00100 
00101 int PluginClient::plugin_get_parameters()
00102 {
00103         int result = get_parameters();
00104         return result;
00105 }
00106 
00107 // ========================= main loop
00108 
00109 int PluginClient::is_multichannel() { return 0; }
00110 int PluginClient::is_synthesis() { return 0; }
00111 int PluginClient::is_realtime() { return 0; }
00112 int PluginClient::is_fileio() { return 0; }
00113 int PluginClient::delete_buffer_ptrs() { return 0; }
00114 char* PluginClient::plugin_title() { return _("Untitled"); }
00115 VFrame* PluginClient::new_picon() { return 0; }
00116 Theme* PluginClient::new_theme() { return 0; }
00117 
00118 
00119 
00120 
00121 Theme* PluginClient::get_theme()
00122 {
00123         return server->get_theme();
00124 }
00125 
00126 
00127 
00128 int PluginClient::is_audio() { return 0; }
00129 int PluginClient::is_video() { return 0; }
00130 int PluginClient::is_theme() { return 0; }
00131 int PluginClient::uses_gui() { return 1; }
00132 int PluginClient::is_transition() { return 0; }
00133 int PluginClient::load_defaults() { return 0; }
00134 int PluginClient::save_defaults() { return 0; }
00135 int PluginClient::show_gui() { return 0; }
00136 int PluginClient::set_string() { return 0; }
00137 int PluginClient::get_parameters() { return 0; }
00138 int PluginClient::get_samplerate() { return get_project_samplerate(); }
00139 double PluginClient::get_framerate() { return get_project_framerate(); }
00140 int PluginClient::init_realtime_parameters() { return 0; }
00141 int PluginClient::delete_nonrealtime_parameters() { return 0; }
00142 int PluginClient::start_loop() { return 0; };
00143 int PluginClient::process_loop() { return 0; };
00144 int PluginClient::stop_loop() { return 0; };
00145 
00146 void PluginClient::set_interactive()
00147 {
00148         interactive = 1;
00149 }
00150 
00151 int64_t PluginClient::get_in_buffers(int64_t recommended_size)
00152 {
00153         return recommended_size;
00154 }
00155 
00156 int64_t PluginClient::get_out_buffers(int64_t recommended_size)
00157 {
00158         return recommended_size;
00159 }
00160 
00161 int PluginClient::get_gui_status()
00162 {
00163         return server->get_gui_status();
00164 }
00165 
00166 int PluginClient::start_plugin()
00167 {
00168         printf(_("No processing defined for this plugin.\n"));
00169         return 0;
00170 }
00171 
00172 // close event from client side
00173 void PluginClient::client_side_close()
00174 {
00175 // Last command executed
00176         server->client_side_close();
00177 }
00178 
00179 int PluginClient::stop_gui_client()
00180 {
00181         if(!client_gui_on) return 0;
00182         client_gui_on = 0;
00183         return 0;
00184 }
00185 
00186 int PluginClient::get_project_samplerate()
00187 {
00188         return server->get_project_samplerate();
00189 }
00190 
00191 double PluginClient::get_project_framerate()
00192 {
00193         return server->get_project_framerate();
00194 }
00195 
00196 
00197 void PluginClient::update_display_title()
00198 {
00199         server->generate_display_title(gui_string);
00200         set_string();
00201 }
00202 
00203 char* PluginClient::get_gui_string()
00204 {
00205         return gui_string;
00206 }
00207 
00208 
00209 char* PluginClient::get_path()
00210 {
00211         return server->path;
00212 }
00213 
00214 int PluginClient::set_string_client(char *string)
00215 {
00216         strcpy(gui_string, string);
00217         set_string();
00218         return 0;
00219 }
00220 
00221 
00222 int PluginClient::get_interpolation_type()
00223 {
00224         return server->get_interpolation_type();
00225 }
00226 
00227 
00228 float PluginClient::get_red()
00229 {
00230         if(server->mwindow)
00231                 return server->mwindow->edl->local_session->red;
00232         else
00233         if(server->edl)
00234                 return server->edl->local_session->red;
00235         else
00236                 return 0;
00237 }
00238 
00239 float PluginClient::get_green()
00240 {
00241         if(server->mwindow)
00242                 return server->mwindow->edl->local_session->green;
00243         else
00244         if(server->edl)
00245                 return server->edl->local_session->green;
00246         else
00247                 return 0;
00248 }
00249 
00250 float PluginClient::get_blue()
00251 {
00252         if(server->mwindow)
00253                 return server->mwindow->edl->local_session->blue;
00254         else
00255         if(server->edl)
00256                 return server->edl->local_session->blue;
00257         else
00258                 return 0;
00259 }
00260 
00261 
00262 
00263 int64_t PluginClient::get_source_position()
00264 {
00265         return source_position;
00266 }
00267 
00268 int64_t PluginClient::get_source_start()
00269 {
00270         return source_start;
00271 }
00272 
00273 int64_t PluginClient::get_total_len()
00274 {
00275         return total_len;
00276 }
00277 
00278 int PluginClient::get_direction()
00279 {
00280         return direction;
00281 }
00282 
00283 
00284 int64_t PluginClient::local_to_edl(int64_t position)
00285 {
00286         return position;
00287 }
00288 
00289 int64_t PluginClient::edl_to_local(int64_t position)
00290 {
00291         return position;
00292 }
00293 
00294 int PluginClient::get_total_buffers()
00295 {
00296         return total_in_buffers;
00297 }
00298 
00299 int PluginClient::get_buffer_size()
00300 {
00301         return in_buffer_size;
00302 }
00303 
00304 int PluginClient::get_project_smp()
00305 {
00306         return smp;
00307 }
00308 
00309 char* PluginClient::get_defaultdir()
00310 {
00311         return BCASTDIR;
00312 }
00313 
00314 
00315 int PluginClient::send_hide_gui()
00316 {
00317 // Stop the GUI server and delete GUI messages
00318         client_gui_on = 0;
00319         return 0;
00320 }
00321 
00322 int PluginClient::send_configure_change()
00323 {
00324         KeyFrame* keyframe = server->get_keyframe();
00325         save_data(keyframe);
00326         if(server->mwindow)
00327                 server->mwindow->undo->update_undo("tweek", LOAD_AUTOMATION, this);
00328         server->sync_parameters();
00329         return 0;
00330 }
00331 
00332 
00333 KeyFrame* PluginClient::get_prev_keyframe(int64_t position, int is_local)
00334 {
00335         if(is_local) position = local_to_edl(position);
00336         return server->get_prev_keyframe(position);
00337 }
00338 
00339 KeyFrame* PluginClient::get_next_keyframe(int64_t position, int is_local)
00340 {
00341         if(is_local) position = local_to_edl(position);
00342         return server->get_next_keyframe(position);
00343 }
00344 

Generated on Sun Jan 8 13:38:58 2006 for Cinelerra-svn by  doxygen 1.4.4