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

pluginserver.C

Go to the documentation of this file.
00001 #include "amodule.h"
00002 #include "atrack.h"
00003 #include "attachmentpoint.h"
00004 #include "autoconf.h"
00005 #include "bcsignals.h"
00006 #include "cplayback.h"
00007 #include "cwindow.h"
00008 #include "edl.h"
00009 #include "edlsession.h"
00010 #include "floatautos.h"
00011 #include "localsession.h"
00012 #include "mainprogress.h"
00013 #include "mainundo.h"
00014 #include "menueffects.h"
00015 #include "mwindow.h"
00016 #include "mwindowgui.h"
00017 #include "playbackengine.h"
00018 #include "plugin.h"
00019 #include "pluginaclient.h"
00020 #include "pluginaclientlad.h"
00021 #include "pluginclient.h"
00022 #include "plugincommands.h"
00023 #include "pluginserver.h"
00024 #include "pluginvclient.h"
00025 #include "preferences.h"
00026 #include "sema.h"
00027 #include "mainsession.h"
00028 #include "trackcanvas.h"
00029 #include "transportque.h"
00030 #include "vframe.h"
00031 #include "virtualanode.h"
00032 #include "virtualvnode.h"
00033 #include "vmodule.h"
00034 #include "vtrack.h"
00035 
00036 
00037 #include <sys/types.h>
00038 #include <sys/wait.h>
00039 #include <dlfcn.h>
00040 
00041 
00042 PluginServer::PluginServer()
00043 {
00044         reset_parameters();
00045         modules = new ArrayList<Module*>;
00046         nodes = new ArrayList<VirtualNode*>;
00047 }
00048 
00049 PluginServer::PluginServer(char *path)
00050 {
00051         reset_parameters();
00052         set_path(path);
00053         modules = new ArrayList<Module*>;
00054         nodes = new ArrayList<VirtualNode*>;
00055 }
00056 
00057 PluginServer::PluginServer(PluginServer &that)
00058 {
00059         reset_parameters();
00060 
00061         if(that.title)
00062         {
00063                 title = new char[strlen(that.title) + 1];
00064                 strcpy(title, that.title);
00065         }
00066 
00067         if(that.path)
00068         {
00069                 path = new char[strlen(that.path) + 1];
00070                 strcpy(path, that.path);
00071         }
00072 
00073         modules = new ArrayList<Module*>;
00074         nodes = new ArrayList<VirtualNode*>;
00075 
00076         attachment = that.attachment;   
00077         realtime = that.realtime;
00078         multichannel = that.multichannel;
00079         preferences = that.preferences;
00080         synthesis = that.synthesis;
00081         audio = that.audio;
00082         video = that.video;
00083         theme = that.theme;
00084         fileio = that.fileio;
00085         uses_gui = that.uses_gui;
00086         mwindow = that.mwindow;
00087         keyframe = that.keyframe;
00088         plugin_fd = that.plugin_fd;
00089         new_plugin = that.new_plugin;
00090 
00091         is_lad = that.is_lad;
00092         lad_descriptor = that.lad_descriptor;
00093         lad_descriptor_function = that.lad_descriptor_function;
00094 }
00095 
00096 PluginServer::~PluginServer()
00097 {
00098         close_plugin();
00099         if(path) delete [] path;
00100         if(title) delete [] title;
00101         if(modules) delete modules;
00102         if(nodes) delete nodes;
00103         if(picon) delete picon;
00104 }
00105 
00106 // Done only once at creation
00107 int PluginServer::reset_parameters()
00108 {
00109         mwindow = 0;
00110         keyframe = 0;
00111         prompt = 0;
00112         cleanup_plugin();
00113         plugin_fd = 0;
00114         autos = 0;
00115         plugin = 0;
00116         edl = 0;
00117         preferences = 0;
00118         title = 0;
00119         path = 0;
00120         audio = video = theme = 0;
00121         uses_gui = 0;
00122         realtime = multichannel = fileio = 0;
00123         synthesis = 0;
00124         start_auto = end_auto = 0;
00125         picon = 0;
00126         transition = 0;
00127         new_plugin = 0;
00128         client = 0;
00129 
00130         is_lad = 0;
00131         lad_descriptor_function = 0;
00132         lad_descriptor = 0;
00133 }
00134 
00135 
00136 // Done every time the plugin is opened or closed
00137 int PluginServer::cleanup_plugin()
00138 {
00139         in_buffer_size = out_buffer_size = 0;
00140         total_in_buffers = total_out_buffers = 0;
00141         error_flag = 0;
00142         written_samples = 0;
00143         shared_buffers = 0;
00144         new_buffers = 0;
00145         written_samples = written_frames = 0;
00146         gui_on = 0;
00147         plugin = 0;
00148         plugin_open = 0;
00149 }
00150 
00151 void PluginServer::set_mwindow(MWindow *mwindow)
00152 {
00153         this->mwindow = mwindow;
00154 }
00155 
00156 void PluginServer::set_attachmentpoint(AttachmentPoint *attachmentpoint)
00157 {
00158         this->attachmentpoint = attachmentpoint;
00159 }
00160 
00161 void PluginServer::set_keyframe(KeyFrame *keyframe)
00162 {
00163         this->keyframe = keyframe;
00164 }
00165 
00166 void PluginServer::set_prompt(MenuEffectPrompt *prompt)
00167 {
00168         this->prompt = prompt;
00169 }
00170 
00171 
00172 int PluginServer::set_path(char *path)
00173 {
00174         if(this->path) delete [] this->path;
00175         this->path = new char[strlen(path) + 1];
00176         strcpy(this->path, path);
00177 }
00178 
00179 void PluginServer::set_title(char *string)
00180 {
00181         if(title) delete [] title;
00182         title = new char[strlen(string) + 1];
00183         strcpy(title, string);
00184 }
00185 
00186 void PluginServer::generate_display_title(char *string)
00187 {
00188         if(plugin && plugin->track) 
00189                 sprintf(string, "%s: %s", plugin->track->title, title);
00190         else
00191                 strcpy(string, title);
00192 }
00193 
00194 // Open plugin for signal processing
00195 int PluginServer::open_plugin(int master, 
00196         Preferences *preferences,
00197         EDL *edl, 
00198         Plugin *plugin,
00199         int lad_index)
00200 {
00201         if(plugin_open) return 0;
00202 
00203         this->preferences = preferences;
00204         this->plugin = plugin;
00205         this->edl = edl;
00206 
00207 
00208 
00209         if(!new_plugin && !plugin_fd) plugin_fd = dlopen(path, RTLD_NOW);
00210 
00211         if(!new_plugin && !plugin_fd)
00212         {
00213 // If the dlopen failed it may still be an executable tool for a specific
00214 // file format, in which case we just store the path.
00215                 set_title(path);
00216                 char string[BCTEXTLEN];
00217                 strcpy(string, dlerror());
00218 
00219                 if(!strstr(string, "executable"))
00220                         printf("PluginServer::open_plugin: %s\n", string);
00221                 
00222                 return 0;
00223         }
00224 
00225 
00226         if(!new_plugin && !lad_descriptor)
00227         {
00228                 new_plugin = (PluginClient* (*)(PluginServer*))dlsym(plugin_fd, "new_plugin");
00229 
00230 // Probably a LAD plugin but we're not going to instantiate it here anyway.
00231                 if(!new_plugin)
00232                 {
00233                         lad_descriptor_function = (LADSPA_Descriptor_Function)dlsym(
00234                                 plugin_fd,
00235                                 "ladspa_descriptor");
00236 
00237                         if(!lad_descriptor_function)
00238                         {
00239 // Not a recognized plugin
00240                                 fprintf(stderr, "PluginServer::open_plugin: new_plugin undefined in %s\n", path);
00241                                 dlclose(plugin_fd);
00242                                 plugin_fd = 0;
00243                                 return PLUGINSERVER_NOT_RECOGNIZED;
00244                         }
00245                         else
00246                         {
00247 // LAD plugin,  Load the descriptor and get parameters.
00248                                 is_lad = 1;
00249                                 if(lad_index >= 0)
00250                                 {
00251                                         lad_descriptor = lad_descriptor_function(lad_index);
00252                                 }
00253 
00254 // make plugin initializer handle the subplugins in the LAD plugin or stop
00255 // trying subplugins.
00256                                 if(!lad_descriptor)
00257                                 {
00258                                         dlclose(plugin_fd);
00259                                         plugin_fd = 0;
00260                                         return PLUGINSERVER_IS_LAD;
00261                                 }
00262                         }
00263                 }
00264         }
00265 
00266 
00267         if(is_lad)
00268         {
00269                 client = new PluginAClientLAD(this);
00270         }
00271         else
00272         {
00273                 client = new_plugin(this);
00274         }
00275 
00276         realtime = client->is_realtime();
00277         audio = client->is_audio();
00278         video = client->is_video();
00279         theme = client->is_theme();
00280         fileio = client->is_fileio();
00281         uses_gui = client->uses_gui();
00282         multichannel = client->is_multichannel();
00283         synthesis = client->is_synthesis();
00284         transition = client->is_transition();
00285         set_title(client->plugin_title());
00286 
00287         if(master)
00288         {
00289                 picon = client->new_picon();
00290         }
00291 
00292 //printf("PluginServer::open_plugin 2\n");
00293         plugin_open = 1;
00294         return PLUGINSERVER_OK;
00295 }
00296 
00297 int PluginServer::close_plugin()
00298 {
00299         if(!plugin_open) return 0;
00300 
00301         int plugin_status, result;
00302         if(client) delete client;
00303 
00304 // shared object is persistent since plugin deletion would unlink its own object
00305 //      dlclose(plugin_fd);
00306         plugin_open = 0;
00307 
00308         cleanup_plugin();
00309 
00310         return 0;
00311 }
00312 
00313 void PluginServer::client_side_close()
00314 {
00315 // Last command executed in client thread
00316         if(plugin)
00317                 mwindow->hide_plugin(plugin, 1);
00318         else
00319         if(prompt)
00320         {
00321                 prompt->lock_window();
00322                 prompt->set_done(1);
00323                 prompt->unlock_window();
00324         }
00325 }
00326 
00327 int PluginServer::init_realtime(int realtime_sched,
00328                 int total_in_buffers, 
00329                 int buffer_size)
00330 {
00331 SET_TRACE
00332         if(!plugin_open) return 0;
00333 SET_TRACE
00334 // set for realtime priority
00335 // initialize plugin
00336 // Call start_realtime
00337         client->plugin_init_realtime(realtime_sched, 
00338                 total_in_buffers, 
00339                 buffer_size);
00340 SET_TRACE
00341 }
00342 
00343 
00344 // Replaced by pull method but still needed for transitions
00345 void PluginServer::process_transition(VFrame *input, 
00346                 VFrame *output, 
00347                 int64_t current_position,
00348                 int64_t total_len)
00349 {
00350         if(!plugin_open) return;
00351         PluginVClient *vclient = (PluginVClient*)client;
00352 
00353         vclient->source_position = current_position;
00354         vclient->source_start = 0;
00355         vclient->total_len = total_len;
00356         vclient->process_realtime(input, output);
00357         vclient->age_temp();
00358 }
00359 
00360 void PluginServer::process_transition(double *input, 
00361                 double *output,
00362                 int64_t current_position, 
00363                 int64_t fragment_size,
00364                 int64_t total_len)
00365 {
00366         if(!plugin_open) return;
00367         PluginAClient *aclient = (PluginAClient*)client;
00368 
00369         aclient->source_position = current_position;
00370         aclient->total_len = total_len;
00371         aclient->source_start = 0;
00372         aclient->process_realtime(fragment_size,
00373                 input, 
00374                 output);
00375 }
00376 
00377 
00378 void PluginServer::process_buffer(VFrame **frame, 
00379         int64_t current_position,
00380         double frame_rate,
00381         int64_t total_len,
00382         int direction)
00383 {
00384         if(!plugin_open) return;
00385         PluginVClient *vclient = (PluginVClient*)client;
00386 
00387         vclient->source_position = current_position;
00388         vclient->total_len = total_len;
00389         vclient->frame_rate = frame_rate;
00390         vclient->source_start = (int64_t)(plugin ? 
00391                 plugin->startproject * 
00392                 frame_rate /
00393                 vclient->project_frame_rate :
00394                 0);
00395         vclient->direction = direction;
00396 
00397         if(multichannel)
00398         {
00399                 vclient->process_buffer(frame, current_position, frame_rate);
00400         }
00401         else
00402         {
00403                 vclient->process_buffer(frame[0], current_position, frame_rate);
00404         }
00405 
00406 
00407     vclient->age_temp();
00408 }
00409 
00410 void PluginServer::process_buffer(double **buffer,
00411         int64_t current_position,
00412         int64_t fragment_size,
00413         int64_t sample_rate,
00414         int64_t total_len,
00415         int direction)
00416 {
00417         if(!plugin_open) return;
00418         PluginAClient *aclient = (PluginAClient*)client;
00419         aclient->source_position = current_position;
00420         aclient->total_len = total_len;
00421         aclient->sample_rate = sample_rate;
00422         if(plugin)
00423                 aclient->source_start = plugin->startproject * 
00424                         sample_rate /
00425                         aclient->project_sample_rate;
00426         aclient->direction = direction;
00427         if(multichannel)
00428                 aclient->process_buffer(fragment_size, 
00429                         buffer, 
00430                         current_position, 
00431                         sample_rate);
00432         else
00433         {
00434                 aclient->process_buffer(fragment_size, 
00435                         buffer[0], 
00436                         current_position, 
00437                         sample_rate);
00438         }
00439 }
00440 
00441 
00442 void PluginServer::send_render_gui(void *data)
00443 {
00444 //printf("PluginServer::send_render_gui 1 %p\n", attachmentpoint);
00445         if(attachmentpoint) attachmentpoint->render_gui(data);
00446 }
00447 
00448 void PluginServer::send_render_gui(void *data, int size)
00449 {
00450 //printf("PluginServer::send_render_gui 1 %p\n", attachmentpoint);
00451         if(attachmentpoint) attachmentpoint->render_gui(data, size);
00452 }
00453 
00454 void PluginServer::render_gui(void *data)
00455 {
00456         if(client) client->plugin_render_gui(data);
00457 }
00458 
00459 void PluginServer::render_gui(void *data, int size)
00460 {
00461         if(client) client->plugin_render_gui(data, size);
00462 }
00463 
00464 MainProgressBar* PluginServer::start_progress(char *string, int64_t length)
00465 {
00466         mwindow->gui->lock_window();
00467         MainProgressBar *result = mwindow->mainprogress->start_progress(string, length);
00468         mwindow->gui->unlock_window();
00469         return result;
00470 }
00471 
00472 int64_t PluginServer::get_written_samples()
00473 {
00474         if(!plugin_open) return 0;
00475         return written_samples;
00476 }
00477 
00478 int64_t PluginServer::get_written_frames()
00479 {
00480         if(!plugin_open) return 0;
00481         return written_frames;
00482 }
00483 
00484 
00485 
00486 
00487 
00488 
00489 
00490 
00491 
00492 
00493 // ======================= Non-realtime plugin
00494 
00495 int PluginServer::get_parameters(int64_t start, int64_t end, int channels)      
00496 {
00497         if(!plugin_open) return 0;
00498 
00499         client->start = start;
00500         client->end = end;
00501         client->source_start = start;
00502         client->total_len = end - start;
00503         client->total_in_buffers = channels;
00504         return client->plugin_get_parameters();
00505 }
00506 
00507 int PluginServer::set_interactive()
00508 {
00509         if(!plugin_open) return 0;
00510         client->set_interactive();
00511         return 0;
00512 }
00513 
00514 void PluginServer::append_module(Module *module)
00515 {
00516         modules->append(module);
00517 }
00518 
00519 void PluginServer::append_node(VirtualNode *node)
00520 {
00521         nodes->append(node);
00522 }
00523 
00524 void PluginServer::reset_nodes()
00525 {
00526         nodes->remove_all();
00527 }
00528 
00529 int PluginServer::set_error()
00530 {
00531         error_flag = 1;
00532         return 0;
00533 }
00534 
00535 int PluginServer::set_realtime_sched()
00536 {
00537         struct sched_param params;
00538         params.sched_priority = 1;
00539         return 0;
00540 }
00541 
00542 
00543 int PluginServer::process_loop(VFrame **buffers, int64_t &write_length)
00544 {
00545         if(!plugin_open) return 1;
00546         return client->plugin_process_loop(buffers, write_length);
00547 }
00548 
00549 int PluginServer::process_loop(double **buffers, int64_t &write_length)
00550 {
00551         if(!plugin_open) return 1;
00552         return client->plugin_process_loop(buffers, write_length);
00553 }
00554 
00555 
00556 int PluginServer::start_loop(int64_t start, 
00557         int64_t end, 
00558         int64_t buffer_size, 
00559         int total_buffers)
00560 {
00561         if(!plugin_open) return 0;
00562         client->plugin_start_loop(start, end, buffer_size, total_buffers);
00563         return 0;
00564 }
00565 
00566 int PluginServer::stop_loop()
00567 {
00568         if(!plugin_open) return 0;
00569         return client->plugin_stop_loop();
00570 }
00571 
00572 int PluginServer::read_frame(VFrame *buffer, 
00573         int channel, 
00574         int64_t start_position)
00575 {
00576         ((VModule*)modules->values[channel])->render(buffer,
00577                 start_position,
00578                 PLAY_FORWARD,
00579                 mwindow->edl->session->frame_rate,
00580                 0,
00581                 0);
00582         return 0;
00583 }
00584 
00585 int PluginServer::read_samples(double *buffer, 
00586         int channel, 
00587         int64_t start_position, 
00588         int64_t total_samples)
00589 {
00590         ((AModule*)modules->values[channel])->render(buffer, 
00591                 start_position,
00592                 total_samples, 
00593                 PLAY_FORWARD,
00594                 mwindow->edl->session->sample_rate,
00595                 0);
00596         return 0;
00597 }
00598 
00599 int PluginServer::read_frame(VFrame *buffer, 
00600         int channel, 
00601         int64_t start_position, 
00602         double frame_rate)
00603 {
00604 // Data source depends on whether we're part of a virtual console or a
00605 // plugin array.
00606 //     VirtualNode
00607 //     Module
00608 // If we're a VirtualNode, read_data in the virtual plugin node handles
00609 //     backward propogation and produces the data.
00610 // If we're a Module, render in the module produces the data.
00611 
00612         if(!multichannel) channel = 0;
00613 
00614 
00615         if(nodes->total > channel)
00616         {
00617                 return ((VirtualVNode*)nodes->values[channel])->read_data(buffer,
00618                         start_position,
00619                         frame_rate);
00620         }
00621         else
00622         if(modules->total > channel)
00623         {
00624                 return ((VModule*)modules->values[channel])->render(buffer,
00625                         start_position,
00626                         PLAY_FORWARD,
00627                         frame_rate,
00628                         0,
00629                         0);
00630         }
00631         else
00632         {
00633                 printf("PluginServer::read_frame no object available for channel=%d\n",
00634                         channel);
00635         }
00636 //printf("PluginServer::read_frame 10\n");
00637 
00638         return -1;
00639 }
00640 
00641 int PluginServer::read_samples(double *buffer,
00642         int channel,
00643         int64_t sample_rate,
00644         int64_t start_position, 
00645         int64_t len)
00646 {
00647         if(!multichannel) channel = 0;
00648 
00649         if(nodes->total > channel)
00650                 return ((VirtualANode*)nodes->values[channel])->read_data(buffer,
00651                         start_position,
00652                         len,
00653                         sample_rate);
00654         else
00655         if(modules->total > channel)
00656                 return ((AModule*)modules->values[channel])->render(buffer,
00657                         start_position,
00658                         len,
00659                         PLAY_FORWARD,
00660                         sample_rate,
00661                         0);
00662         else
00663         {
00664                 printf("PluginServer::read_samples no object available for channel=%d\n",
00665                         channel);
00666         }
00667 
00668         return -1;
00669 }
00670 
00671 
00672 
00673 
00674 
00675 
00676 
00677 
00678 
00679 
00680 
00681 
00682 
00683 
00684 
00685 
00686 
00687 
00688 
00689 
00690 // Called by client
00691 int PluginServer::get_gui_status()
00692 {
00693         if(plugin)
00694                 return plugin->show ? GUI_ON : GUI_OFF;
00695         else
00696                 return GUI_OFF;
00697 }
00698 
00699 void PluginServer::raise_window()
00700 {
00701         if(!plugin_open) return;
00702         client->raise_window();
00703 }
00704 
00705 void PluginServer::show_gui()
00706 {
00707         if(!plugin_open) return;
00708         client->smp = preferences->processors - 1;
00709         if(plugin) client->total_len = plugin->length;
00710         if(plugin) client->source_start = plugin->startproject;
00711         if(video)
00712         {
00713                 client->source_position = Units::to_int64(
00714                         mwindow->edl->local_session->get_selectionstart(1) * 
00715                                 mwindow->edl->session->frame_rate);
00716         }
00717         else
00718         if(audio)
00719         {
00720                 client->source_position = Units::to_int64(
00721                         mwindow->edl->local_session->get_selectionstart(1) * 
00722                                 mwindow->edl->session->sample_rate);
00723         }
00724         client->update_display_title();
00725         client->show_gui();
00726 }
00727 
00728 void PluginServer::update_gui()
00729 {
00730         if(!plugin_open || !plugin) return;
00731 
00732         client->total_len = plugin->length;
00733         client->source_start = plugin->startproject;
00734         if(video)
00735         {
00736                 client->source_position = Units::to_int64(
00737                         mwindow->edl->local_session->get_selectionstart(1) * 
00738                                 mwindow->edl->session->frame_rate);
00739         }
00740         else
00741         if(audio)
00742         {
00743                 client->source_position = Units::to_int64(
00744                         mwindow->edl->local_session->get_selectionstart(1) * 
00745                                 mwindow->edl->session->sample_rate);
00746         }
00747         client->update_gui();
00748 }
00749 
00750 void PluginServer::update_title()
00751 {
00752         if(!plugin_open) return;
00753         
00754         client->update_display_title();
00755 }
00756 
00757 
00758 int PluginServer::set_string(char *string)
00759 {
00760         if(!plugin_open) return 0;
00761 
00762         client->set_string_client(string);
00763         return 0;
00764 }
00765 
00766 
00767 // ============================= queries
00768 
00769 int PluginServer::get_samplerate()
00770 {
00771         if(!plugin_open) return 0;
00772         if(audio)
00773         {
00774                 return client->get_samplerate();
00775         }
00776         else
00777         if(mwindow)
00778                 return mwindow->edl->session->sample_rate;
00779         else
00780         {
00781                 printf("PluginServer::get_samplerate audio and mwindow == NULL\n");
00782                 return 1;
00783         }
00784 }
00785 
00786 
00787 double PluginServer::get_framerate()
00788 {
00789         if(!plugin_open) return 0;
00790         if(video)
00791         {
00792                 return client->get_framerate();
00793         }
00794         else
00795         if(mwindow)
00796                 return mwindow->edl->session->frame_rate;
00797         else 
00798         {
00799                 printf("PluginServer::get_framerate video and mwindow == NULL\n");
00800                 return 1;
00801         }
00802 }
00803 
00804 int PluginServer::get_project_samplerate()
00805 {
00806         if(mwindow)
00807                 return mwindow->edl->session->sample_rate;
00808         else
00809         if(edl)
00810                 return edl->session->sample_rate;
00811         else
00812         {
00813                 printf("PluginServer::get_project_samplerate mwindow and edl are NULL.\n");
00814                 return 1;
00815         }
00816 }
00817 
00818 double PluginServer::get_project_framerate()
00819 {
00820         if(mwindow)
00821                 return mwindow->edl->session->frame_rate;
00822         else
00823         if(edl)
00824                 return edl->session->frame_rate;
00825         else
00826         {
00827                 printf("PluginServer::get_project_framerate mwindow and edl are NULL.\n");
00828                 return 1;
00829         }
00830 }
00831 
00832 
00833 
00834 int PluginServer::detach_buffers()
00835 {
00836         ring_buffers_out.remove_all();
00837         offset_out_render.remove_all();
00838         double_buffer_out_render.remove_all();
00839         realtime_out_size.remove_all();
00840 
00841         ring_buffers_in.remove_all();
00842         offset_in_render.remove_all();
00843         double_buffer_in_render.remove_all();
00844         realtime_in_size.remove_all();
00845         
00846         out_buffer_size = 0;
00847         shared_buffers = 0;
00848         total_out_buffers = 0;
00849         in_buffer_size = 0;
00850         total_in_buffers = 0;
00851         return 0;
00852 }
00853 
00854 int PluginServer::arm_buffer(int buffer_number, 
00855                 int64_t offset_in, 
00856                 int64_t offset_out,
00857                 int double_buffer_in,
00858                 int double_buffer_out)
00859 {
00860         offset_in_render.values[buffer_number] = offset_in;
00861         offset_out_render.values[buffer_number] = offset_out;
00862         double_buffer_in_render.values[buffer_number] = double_buffer_in;
00863         double_buffer_out_render.values[buffer_number] = double_buffer_out;
00864 }
00865 
00866 
00867 int PluginServer::set_automation(FloatAutos *autos, FloatAuto **start_auto, FloatAuto **end_auto, int reverse)
00868 {
00869         this->autos = autos;
00870         this->start_auto = start_auto;
00871         this->end_auto = end_auto;
00872         this->reverse = reverse;
00873 }
00874 
00875 
00876 
00877 void PluginServer::save_data(KeyFrame *keyframe)
00878 {
00879         if(!plugin_open) return;
00880         client->save_data(keyframe);
00881 }
00882 
00883 KeyFrame* PluginServer::get_prev_keyframe(int64_t position)
00884 {
00885         KeyFrame *result = 0;
00886         if(plugin)
00887                 result = plugin->get_prev_keyframe(position, client->direction);
00888         else
00889                 result = keyframe;
00890         return result;
00891 }
00892 
00893 KeyFrame* PluginServer::get_next_keyframe(int64_t position)
00894 {
00895         KeyFrame *result = 0;
00896         if(plugin)
00897                 result = plugin->get_next_keyframe(position, client->direction);
00898         else
00899                 result = keyframe;
00900         return result;
00901 }
00902 
00903 KeyFrame* PluginServer::get_keyframe()
00904 {
00905         if(plugin)
00906                 return plugin->get_keyframe();
00907         else
00908                 return keyframe;
00909 }
00910 
00911 
00912 int PluginServer::get_interpolation_type()
00913 {
00914         return plugin->edl->session->interpolation_type;
00915 }
00916 
00917 Theme* PluginServer::new_theme()
00918 {
00919         if(theme)
00920         {
00921                 return client->new_theme();
00922         }
00923         else
00924                 return 0;
00925 }
00926 
00927 Theme* PluginServer::get_theme()
00928 {
00929         if(mwindow) return mwindow->theme;
00930         printf("PluginServer::get_theme mwindow not set\n");
00931         return 0;
00932 }
00933 
00934 
00935 // Called when plugin interface is tweeked
00936 void PluginServer::sync_parameters()
00937 {
00938         if(video) mwindow->restart_brender();
00939         mwindow->sync_parameters();
00940         if(mwindow->edl->session->auto_conf->plugins)
00941         {
00942                 mwindow->gui->lock_window("PluginServer::sync_parameters");
00943                 mwindow->gui->canvas->draw_overlays();
00944                 mwindow->gui->canvas->flash();
00945                 mwindow->gui->unlock_window();
00946         }
00947 }
00948 
00949 
00950 
00951 void PluginServer::dump()
00952 {
00953         printf("    PluginServer %s %s\n", path, title);
00954 }

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