4 * Copyright (C) 2009 Adam Williams <broadcast at earthling dot net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #include "attachmentpoint.h"
26 #include "bcsignals.h"
27 #include "cplayback.h"
31 #include "edlsession.h"
32 #include "floatautos.h"
33 #include "keyframes.h"
34 #include "localsession.h"
35 #include "mainerror.h"
36 #include "mainprogress.h"
37 #include "menueffects.h"
39 #include "mwindowgui.h"
40 #include "playbackengine.h"
42 #include "pluginaclient.h"
43 #include "pluginaclientlad.h"
44 #include "pluginfclient.h"
45 #include "pluginclient.h"
46 #include "plugincommands.h"
47 #include "pluginserver.h"
48 #include "pluginvclient.h"
49 #include "preferences.h"
52 #include "mainsession.h"
53 #include "trackcanvas.h"
54 #include "transportque.h"
55 #include "vdevicex11.h"
57 #include "videodevice.h"
58 #include "virtualanode.h"
59 #include "virtualvnode.h"
67 #include <sys/types.h>
73 void PluginServer::init()
76 this->plugin_type = PLUGIN_TYPE_UNKNOWN;
77 modules = new ArrayList<Module*>;
78 nodes = new ArrayList<VirtualNode*>;
81 PluginServer::PluginServer()
86 PluginServer::PluginServer(MWindow *mwindow, char *path, int type)
88 char fpath[BCTEXTLEN];
90 this->plugin_type = type;
91 this->mwindow = mwindow;
92 if( type == PLUGIN_TYPE_FFMPEG ) {
93 ff_name = cstrdup(path);
94 sprintf(fpath, "ff_%s", path);
100 PluginServer::PluginServer(PluginServer &that)
103 plugin_type = that.plugin_type;
104 title = !that.title ? 0 : cstrdup(that.title);
105 path = !that.path ? 0 : cstrdup(that.path);
106 ff_name = !that.ff_name ? 0 : cstrdup(that.ff_name);
107 modules = new ArrayList<Module*>;
108 nodes = new ArrayList<VirtualNode*>;
110 attachment = that.attachment;
111 realtime = that.realtime;
112 multichannel = that.multichannel;
113 preferences = that.preferences;
114 synthesis = that.synthesis;
118 fileio = that.fileio;
119 uses_gui = that.uses_gui;
120 mwindow = that.mwindow;
121 keyframe = that.keyframe;
122 new_plugin = that.new_plugin;
124 lad_descriptor = that.lad_descriptor;
125 lad_descriptor_function = that.lad_descriptor_function;
126 lad_index = that.lad_index;
129 PluginServer::~PluginServer()
140 // Done only once at creation
141 int PluginServer::reset_parameters()
154 audio = video = theme = 0;
157 realtime = multichannel = fileio = 0;
159 start_auto = end_auto = 0;
170 lad_descriptor_function = 0;
175 // Done every time the plugin is opened or closed
176 int PluginServer::cleanup_plugin()
178 in_buffer_size = out_buffer_size = 0;
179 total_in_buffers = total_out_buffers = 0;
184 written_samples = written_frames = 0;
191 void PluginServer::set_mwindow(MWindow *mwindow)
193 this->mwindow = mwindow;
196 void PluginServer::set_attachmentpoint(AttachmentPoint *attachmentpoint)
198 this->attachmentpoint = attachmentpoint;
201 void PluginServer::set_keyframe(KeyFrame *keyframe)
203 this->keyframe = keyframe;
206 void PluginServer::set_prompt(MenuEffectPrompt *prompt)
208 this->prompt = prompt;
211 void PluginServer::set_lad_index(int i)
216 int PluginServer::get_lad_index()
218 return this->lad_index;
221 int PluginServer::is_ladspa()
223 return plugin_type == PLUGIN_TYPE_LADSPA ? 1 : 0;
226 int PluginServer::is_ffmpeg()
228 return plugin_type == PLUGIN_TYPE_FFMPEG ? 1 : 0;
231 void PluginServer::set_path(const char *path)
233 delete [] this->path;
234 this->path = cstrdup(path);
237 char* PluginServer::get_path()
242 int PluginServer::get_synthesis()
248 void PluginServer::set_title(const char *string)
250 if(title) delete [] title;
251 title = cstrdup(string);
254 void PluginServer::generate_display_title(char *string)
256 char ltitle[BCTEXTLEN];
257 if(BC_Resources::locale_utf8)
258 strcpy(ltitle, _(title));
260 BC_Resources::encode(BC_Resources::encoding, 0,
261 _(title),strlen(title)+1, ltitle,BCTEXTLEN);
262 if(plugin && plugin->track)
263 sprintf(string, "%s: %s", plugin->track->title, ltitle);
265 strcpy(string, ltitle);
268 void *PluginServer::load_obj()
271 char dlpath[BCTEXTLEN], *dp = dlpath;
274 char *bp = preferences->plugin_dir;
275 while( *bp ) *dp++ = *bp++;
278 while( *cp ) *dp++ = *cp++;
280 dlobj = load(dlpath);
285 void PluginServer::unload_obj()
288 unload(dlobj); dlobj = 0;
291 void PluginServer::delete_this()
295 if( obj ) unload(obj);
298 // Open plugin for signal processing
299 int PluginServer::open_plugin(int master,
300 Preferences *preferences,
304 if(plugin_open) return 0;
306 this->preferences = preferences;
307 this->plugin = plugin;
309 if( plugin_type != PLUGIN_TYPE_FFMPEG && plugin_type != PLUGIN_TYPE_EXECUTABLE && !load_obj() ) {
310 // If the load failed it may still be an executable tool for a specific
311 // file format, in which case we just store the path.
313 char string[BCTEXTLEN];
314 strcpy(string, load_error());
315 if( !strstr(string, "executable") ) {
316 eprintf("PluginServer::open_plugin: load_obj failure = %s\n", string);
317 return PLUGINSERVER_NOT_RECOGNIZED;
319 plugin_type = PLUGIN_TYPE_EXECUTABLE;
321 if( plugin_type == PLUGIN_TYPE_UNKNOWN || plugin_type == PLUGIN_TYPE_BUILTIN ) {
323 (PluginClient* (*)(PluginServer*)) load_sym("new_plugin");
325 plugin_type = PLUGIN_TYPE_BUILTIN;
327 if( plugin_type == PLUGIN_TYPE_UNKNOWN || plugin_type == PLUGIN_TYPE_LADSPA ) {
328 lad_descriptor_function =
329 (LADSPA_Descriptor_Function) load_sym("ladspa_descriptor");
330 if( lad_descriptor_function ) {
331 if( lad_index < 0 ) {
333 return PLUGINSERVER_IS_LAD;
335 lad_descriptor = lad_descriptor_function(lad_index);
336 if( !lad_descriptor )
337 return PLUGINSERVER_NOT_RECOGNIZED;
338 plugin_type = PLUGIN_TYPE_LADSPA;
341 if( plugin_type == PLUGIN_TYPE_UNKNOWN ) {
342 fprintf(stderr, "PluginServer::open_plugin "
343 " %d: plugin undefined in %s\n", __LINE__, path);
345 return PLUGINSERVER_NOT_RECOGNIZED;
347 switch( plugin_type ) {
348 case PLUGIN_TYPE_BUILTIN:
349 client = new_plugin(this);
351 case PLUGIN_TYPE_LADSPA:
352 client = new PluginAClientLAD(this);
354 case PLUGIN_TYPE_FFMPEG:
355 client = new_ffmpeg_plugin();
362 return PLUGINSERVER_NOT_RECOGNIZED;
364 // Run initialization functions
365 realtime = client->is_realtime();
366 // Don't load defaults when probing the directory.
369 client->load_defaults_xml();
371 client->load_defaults();
373 audio = client->is_audio();
374 video = client->is_video();
375 theme = client->is_theme();
376 fileio = client->is_fileio();
377 uses_gui = client->uses_gui();
378 multichannel = client->is_multichannel();
379 synthesis = client->is_synthesis();
380 transition = client->is_transition();
381 set_title(client->plugin_title());
383 //printf("PluginServer::open_plugin 2\n");
385 return PLUGINSERVER_OK;
388 int PluginServer::close_plugin()
390 if(!plugin_open) return 0;
394 // Defaults are saved in the thread.
395 // if(client->defaults) client->save_defaults();
399 // shared object is persistent since plugin deletion would unlink its own object
405 void PluginServer::client_side_close()
407 // Last command executed in client thread
409 mwindow->hide_plugin(plugin, 1);
413 prompt->lock_window();
415 prompt->unlock_window();
419 void PluginServer::render_stop()
422 client->render_stop();
425 void PluginServer::write_table(FILE *fp, int idx)
428 fprintf(fp, "%d \"%s\" \"%s\" %d %d %d %d %d %d %d %d %d %d %d\n",
429 plugin_type, path, title, idx, audio, video, theme, realtime,
430 fileio, uses_gui, multichannel, synthesis, transition, lad_index);
433 int PluginServer::scan_table(char *text, int &type, char *path, char *title)
435 int n = sscanf(text, "%d \"%[^\"]\" \"%[^\"]\"", &type, path, title);
436 return n < 3 ? 1 : 0;
439 int PluginServer::read_table(char *text)
441 char path[BCTEXTLEN], title[BCTEXTLEN];
442 int n = sscanf(text, "%d \"%[^\"]\" \"%[^\"]\" %d %d %d %d %d %d %d %d %d %d %d",
443 &plugin_type, path, title, &dir_idx, &audio, &video, &theme, &realtime,
444 &fileio, &uses_gui, &multichannel, &synthesis, &transition, &lad_index);
445 if( n != 14 ) return 1;
446 this->path = cstrdup(path);
447 this->title = cstrdup(title);
451 int PluginServer::init_realtime(int realtime_sched,
452 int total_in_buffers,
456 if(!plugin_open) return 0;
458 // set for realtime priority
460 // Call start_realtime
461 this->total_in_buffers = this->total_out_buffers = total_in_buffers;
462 client->plugin_init_realtime(realtime_sched,
470 // Replaced by pull method but still needed for transitions
471 void PluginServer::process_transition(VFrame *input,
473 int64_t current_position,
476 if(!plugin_open) return;
477 PluginVClient *vclient = (PluginVClient*)client;
479 vclient->source_position = current_position;
480 vclient->source_start = 0;
481 vclient->total_len = total_len;
483 vclient->input = new VFrame*[1];
484 vclient->output = new VFrame*[1];
486 vclient->input[0] = input;
487 vclient->output[0] = output;
489 vclient->process_realtime(input, output);
491 delete [] vclient->input;
492 delete [] vclient->output;
496 void PluginServer::process_transition(Samples *input,
498 int64_t current_position,
499 int64_t fragment_size,
502 if(!plugin_open) return;
503 PluginAClient *aclient = (PluginAClient*)client;
505 aclient->source_position = current_position;
506 aclient->total_len = total_len;
507 aclient->source_start = 0;
508 aclient->process_realtime(fragment_size,
514 void PluginServer::process_buffer(VFrame **frame,
515 int64_t current_position,
520 if(!plugin_open) return;
521 PluginVClient *vclient = (PluginVClient*)client;
523 vclient->source_position = current_position;
524 vclient->total_len = total_len;
525 vclient->frame_rate = frame_rate;
526 vclient->input = new VFrame*[total_in_buffers];
527 vclient->output = new VFrame*[total_in_buffers];
528 for(int i = 0; i < total_in_buffers; i++)
530 vclient->input[i] = frame[i];
531 vclient->output[i] = frame[i];
533 vclient->source_start = (int64_t)(plugin ?
534 plugin->startproject *
536 vclient->project_frame_rate :
538 vclient->direction = direction;
541 vclient->begin_process_buffer();
544 vclient->process_buffer(frame, current_position, frame_rate);
548 vclient->process_buffer(frame[0], current_position, frame_rate);
550 vclient->end_process_buffer();
552 for(int i = 0; i < total_in_buffers; i++)
553 frame[i]->push_prev_effect(title);
555 delete [] vclient->input;
556 delete [] vclient->output;
562 void PluginServer::process_buffer(Samples **buffer,
563 int64_t current_position,
564 int64_t fragment_size,
569 if(!plugin_open) return;
570 PluginAClient *aclient = (PluginAClient*)client;
572 aclient->source_position = current_position;
573 aclient->total_len = total_len;
574 aclient->sample_rate = sample_rate;
577 aclient->source_start = plugin->startproject *
579 aclient->project_sample_rate;
581 aclient->direction = direction;
582 aclient->begin_process_buffer();
585 aclient->process_buffer(fragment_size,
592 aclient->process_buffer(fragment_size,
597 aclient->end_process_buffer();
601 void PluginServer::send_render_gui(void *data)
603 //printf("PluginServer::send_render_gui 1 %p\n", attachmentpoint);
604 if(attachmentpoint) attachmentpoint->render_gui(data, this);
607 void PluginServer::send_render_gui(void *data, int size)
609 //printf("PluginServer::send_render_gui 1 %p\n", attachmentpoint);
610 if(attachmentpoint) attachmentpoint->render_gui(data, size, this);
613 void PluginServer::render_gui(void *data)
615 if(client) client->plugin_render_gui(data);
618 void PluginServer::render_gui(void *data, int size)
620 if(client) client->plugin_render_gui(data, size);
623 MainProgressBar* PluginServer::start_progress(char *string, int64_t length)
625 mwindow->gui->lock_window();
626 MainProgressBar *result = mwindow->mainprogress->start_progress(string, length);
627 mwindow->gui->unlock_window();
631 int64_t PluginServer::get_written_samples()
633 if(!plugin_open) return 0;
634 return written_samples;
637 int64_t PluginServer::get_written_frames()
639 if(!plugin_open) return 0;
640 return written_frames;
652 // ======================= Non-realtime plugin
654 int PluginServer::get_parameters(int64_t start, int64_t end, int channels)
656 if(!plugin_open) return 0;
658 client->start = start;
660 client->source_start = start;
661 client->total_len = end - start;
662 client->total_in_buffers = channels;
663 return client->plugin_get_parameters();
666 int PluginServer::set_interactive()
668 if(!plugin_open) return 0;
669 client->set_interactive();
673 void PluginServer::append_module(Module *module)
675 modules->append(module);
678 void PluginServer::append_node(VirtualNode *node)
683 void PluginServer::reset_nodes()
688 int PluginServer::set_error()
694 int PluginServer::set_realtime_sched()
696 //struct sched_param params;
697 //params.sched_priority = 1;
698 //sched_setscheduler(0, SCHED_RR, ¶m);
703 int PluginServer::process_loop(VFrame **buffers, int64_t &write_length)
705 if(!plugin_open) return 1;
706 return client->plugin_process_loop(buffers, write_length);
709 int PluginServer::process_loop(Samples **buffers, int64_t &write_length)
711 if(!plugin_open) return 1;
712 return client->plugin_process_loop(buffers, write_length);
716 int PluginServer::start_loop(int64_t start,
721 if(!plugin_open) return 0;
722 client->plugin_start_loop(start, end, buffer_size, total_buffers);
726 int PluginServer::stop_loop()
728 if(!plugin_open) return 0;
729 return client->plugin_stop_loop();
732 int PluginServer::read_frame(VFrame *buffer,
734 int64_t start_position)
736 ((VModule*)modules->values[channel])->render(buffer,
739 mwindow->edl->session->frame_rate,
745 int PluginServer::read_samples(Samples *buffer,
748 int64_t start_position,
751 // len is now in buffer
752 if(!multichannel) channel = 0;
754 if(nodes->total > channel)
755 return ((VirtualANode*)nodes->values[channel])->read_data(buffer,
760 if(modules->total > channel)
761 return ((AModule*)modules->values[channel])->render(buffer,
769 printf("PluginServer::read_samples no object available for channel=%d\n",
777 int PluginServer::read_samples(Samples *buffer,
779 int64_t start_position,
782 // total_samples is now set in buffer
783 ((AModule*)modules->values[channel])->render(buffer,
787 mwindow->edl->session->sample_rate,
792 int PluginServer::read_frame(VFrame *buffer,
794 int64_t start_position,
798 // Data source depends on whether we're part of a virtual console or a
802 // If we're a VirtualNode, read_data in the virtual plugin node handles
803 // backward propogation and produces the data.
804 // If we're a Module, render in the module produces the data.
807 if(!multichannel) channel = 0;
809 // Push our name on the next effect stack
810 buffer->push_next_effect(title);
811 //printf("PluginServer::read_frame %p\n", buffer);
812 //buffer->dump_stacks();
814 if(nodes->total > channel)
816 //printf("PluginServer::read_frame %d\n", __LINE__);
817 result = ((VirtualVNode*)nodes->values[channel])->read_data(buffer,
823 if(modules->total > channel)
825 //printf("PluginServer::read_frame %d\n", __LINE__);
826 result = ((VModule*)modules->values[channel])->render(buffer,
837 printf("PluginServer::read_frame no object available for channel=%d\n",
841 // Pop our name from the next effect stack
842 buffer->pop_next_effect();
867 int PluginServer::get_gui_status()
870 return plugin->show ? GUI_ON : GUI_OFF;
875 void PluginServer::raise_window()
877 if(!plugin_open) return;
878 client->raise_window();
881 void PluginServer::show_gui()
883 if(!plugin_open) return;
884 if(plugin) client->total_len = plugin->length;
885 if(plugin) client->source_start = plugin->startproject;
888 client->source_position = Units::to_int64(
889 mwindow->edl->local_session->get_selectionstart(1) *
890 mwindow->edl->session->frame_rate);
895 client->source_position = Units::to_int64(
896 mwindow->edl->local_session->get_selectionstart(1) *
897 mwindow->edl->session->sample_rate);
900 client->update_display_title();
904 void PluginServer::hide_gui()
906 if(!plugin_open) return;
907 if(client->defaults) client->save_defaults();
911 void PluginServer::update_gui()
913 if(!plugin_open || !plugin) return;
915 client->total_len = plugin->length;
916 client->source_start = plugin->startproject;
920 client->source_position = Units::to_int64(
921 mwindow->edl->local_session->get_selectionstart(1) *
922 mwindow->edl->session->frame_rate);
927 client->source_position = Units::to_int64(
928 mwindow->edl->local_session->get_selectionstart(1) *
929 mwindow->edl->session->sample_rate);
932 client->plugin_update_gui();
935 void PluginServer::update_title()
937 if(!plugin_open) return;
939 client->update_display_title();
943 int PluginServer::set_string(char *string)
945 if(!plugin_open) return 0;
947 client->set_string_client(string);
951 int PluginServer::gui_open()
953 if(attachmentpoint) return attachmentpoint->gui_open();
957 void PluginServer::set_use_opengl(int value, VideoDevice *vdevice)
959 this->use_opengl = value;
960 this->vdevice = vdevice;
963 int PluginServer::get_use_opengl()
969 void PluginServer::run_opengl(PluginClient *plugin_client)
972 ((VDeviceX11*)vdevice->get_output_base())->run_plugin(plugin_client);
975 // ============================= queries
977 void PluginServer::get_defaults_path(char *path)
979 // Get plugin name from path
980 char *ptr1 = strrchr(get_path(), '/');
981 char *ptr2 = strrchr(get_path(), '.');
982 if(!ptr1) ptr1 = get_path();
983 if(!ptr2) ptr2 = get_path() + strlen(get_path());
984 char string2[BCTEXTLEN];
985 char *ptr3 = string2;
991 sprintf(path, "%s%s.xml", BCASTDIR, string2);
994 void PluginServer::save_defaults()
996 if(client) client->save_defaults();
999 int PluginServer::get_samplerate()
1001 if(!plugin_open) return 0;
1004 return client->get_samplerate();
1008 return mwindow->edl->session->sample_rate;
1011 printf("PluginServer::get_samplerate audio and mwindow == NULL\n");
1017 double PluginServer::get_framerate()
1019 if(!plugin_open) return 0;
1022 return client->get_framerate();
1026 return mwindow->edl->session->frame_rate;
1029 printf("PluginServer::get_framerate video and mwindow == NULL\n");
1034 int PluginServer::get_project_samplerate()
1037 return mwindow->edl->session->sample_rate;
1040 return edl->session->sample_rate;
1043 printf("PluginServer::get_project_samplerate mwindow and edl are NULL.\n");
1048 double PluginServer::get_project_framerate()
1051 return mwindow->edl->session->frame_rate;
1054 return edl->session->frame_rate;
1057 printf("PluginServer::get_project_framerate mwindow and edl are NULL.\n");
1064 int PluginServer::detach_buffers()
1066 ring_buffers_out.remove_all();
1067 offset_out_render.remove_all();
1068 double_buffer_out_render.remove_all();
1069 realtime_out_size.remove_all();
1071 ring_buffers_in.remove_all();
1072 offset_in_render.remove_all();
1073 double_buffer_in_render.remove_all();
1074 realtime_in_size.remove_all();
1076 out_buffer_size = 0;
1078 total_out_buffers = 0;
1080 total_in_buffers = 0;
1084 int PluginServer::arm_buffer(int buffer_number,
1087 int double_buffer_in,
1088 int double_buffer_out)
1090 offset_in_render.values[buffer_number] = offset_in;
1091 offset_out_render.values[buffer_number] = offset_out;
1092 double_buffer_in_render.values[buffer_number] = double_buffer_in;
1093 double_buffer_out_render.values[buffer_number] = double_buffer_out;
1098 int PluginServer::set_automation(FloatAutos *autos, FloatAuto **start_auto, FloatAuto **end_auto, int reverse)
1100 this->autos = autos;
1101 this->start_auto = start_auto;
1102 this->end_auto = end_auto;
1103 this->reverse = reverse;
1109 void PluginServer::save_data(KeyFrame *keyframe)
1111 if(!plugin_open) return;
1112 client->save_data(keyframe);
1115 KeyFrame* PluginServer::get_prev_keyframe(int64_t position)
1117 KeyFrame *result = 0;
1119 result = plugin->get_prev_keyframe(position, client->direction);
1125 KeyFrame* PluginServer::get_next_keyframe(int64_t position)
1127 KeyFrame *result = 0;
1129 result = plugin->get_next_keyframe(position, client->direction);
1136 KeyFrame* PluginServer::get_keyframe()
1139 // Realtime plugin case
1140 return plugin->get_keyframe();
1142 // Rendered plugin case
1147 void PluginServer::apply_keyframe(KeyFrame *src)
1151 keyframe->copy_data(src);
1156 plugin->keyframes->update_parameter(src);
1164 void PluginServer::get_camera(float *x, float *y, float *z,
1165 int64_t position, int direction)
1167 plugin->track->automation->get_camera(x, y, z, position, direction);
1170 void PluginServer::get_projector(float *x, float *y, float *z,
1171 int64_t position, int direction)
1173 plugin->track->automation->get_projector(x, y, z, position, direction);
1177 int PluginServer::get_interpolation_type()
1179 return plugin->edl->session->interpolation_type;
1182 Theme* PluginServer::new_theme()
1186 return client->new_theme();
1192 Theme* PluginServer::get_theme()
1194 if(mwindow) return mwindow->theme;
1195 printf("PluginServer::get_theme mwindow not set\n");
1200 char *PluginServer::get_plugin_png_path(char *png_path)
1202 char *bp = strrchr(path, '/'), *cp = png_path;
1203 if( !bp ) bp = path; else ++bp;
1204 char *sp = strrchr(bp,'.');
1205 if( !sp || ( strcmp(sp, ".plugin") && strcmp(sp,".so") ) ) return 0;
1206 cp += sprintf(cp,"%s/picons/", mwindow->preferences->plugin_dir);
1207 while( bp < sp ) *cp++ = *bp++;
1212 VFrame *PluginServer::get_plugin_images()
1214 char png_path[BCTEXTLEN];
1215 if( !get_plugin_png_path(png_path) ) return 0;
1217 if( stat(png_path, &st) ) return 0;
1218 if( !S_ISREG(st.st_mode) ) return 0;
1219 if( st.st_size == 0 ) return 0;
1220 unsigned len = st.st_size;
1221 int ret = 0, w = 0, h = 0;
1223 int fd = ::open(png_path, O_RDONLY);
1224 if( fd < 0 ) ret = 1;
1226 bfr = (uint8_t*) ::mmap (NULL, len, PROT_READ, MAP_SHARED, fd, 0);
1227 if( bfr == MAP_FAILED ) ret = 1;
1231 vframe = new VFrame(bfr, st.st_size);
1232 if( (w=vframe->get_w()) <= 0 || (h=vframe->get_h()) <= 0 ||
1233 vframe->get_data() == 0 ) ret = 1;
1235 if( bfr && bfr != MAP_FAILED ) ::munmap(bfr, len);
1236 if( fd >= 0 ) ::close(fd);
1237 if( ret ) { delete vframe; vframe = 0; }
1241 VFrame *PluginServer::get_picon()
1244 picon = get_plugin_images();
1248 // Called when plugin interface is tweeked
1249 void PluginServer::sync_parameters()
1251 if(video) mwindow->restart_brender();
1252 mwindow->sync_parameters();
1253 mwindow->update_keyframe_guis();
1254 if(mwindow->edl->session->auto_conf->plugins)
1256 mwindow->gui->lock_window("PluginServer::sync_parameters");
1257 mwindow->gui->draw_overlays(1);
1258 mwindow->gui->unlock_window();
1264 void PluginServer::dump(FILE *fp)
1266 fprintf(fp," PluginServer %d %p %s %s %d\n",
1267 __LINE__, this, path, title, realtime);