From: Good Guy Date: Sun, 8 Mar 2020 18:14:36 +0000 (-0600) Subject: change to id based refs for plugins, save plugin on/off in edit drag/drop, fix transi... X-Git-Tag: 2020-03~17 X-Git-Url: https://git.cinelerra-gg.org/git/?a=commitdiff_plain;h=12d4e343f31707c899e6e4daa10c68b172433cff;p=goodguy%2Fcinelerra.git change to id based refs for plugins, save plugin on/off in edit drag/drop, fix transition length popup close hang, add image2 ffmpeg leader file, add libtool build deps --- diff --git a/cinelerra-5.1/blds/bld_prepare.sh b/cinelerra-5.1/blds/bld_prepare.sh index 3c34ff6a..f5201e64 100755 --- a/cinelerra-5.1/blds/bld_prepare.sh +++ b/cinelerra-5.1/blds/bld_prepare.sh @@ -27,7 +27,7 @@ case "$dir" in libsndfile-devel libtheora-devel linux-firmware ivtv-firmware \ libvorbis-devel texinfo xz-devel lzma-devel cmake udftools git \ autoconf automake rpm-build jbigkit-devel libvdpau-devel libva-devel \ - alsa-lib-devel gtk2-devel pulseaudio-libs-devel + alsa-lib-devel gtk2-devel pulseaudio-libs-devel libtool yasm=yasm-1.3.0-3.fc24.x86_64.rpm release=http://archives.fedoraproject.org/pub/fedora/linux/releases/24 url=$release/Everything/x86_64/os/Packages/y/$yasm @@ -55,7 +55,7 @@ case "$dir" in ctags patch gcc-c++ perl-XML-XPath libtiff-devel python dvdauthor \ gettext-devel inkscape udftools autoconf automake numactl-devel \ jbigkit-devel libvdpau-devel libva-devel gtk2-devel mesa-vdpau-drivers \ - pulseaudio-libs-devel + pulseaudio-libs-devel libtool ;; "suse" | "leap" | "tumbleweed") zypper -n install nasm gcc gcc-c++ zlib-devel texinfo libpng16-devel \ @@ -67,7 +67,7 @@ case "$dir" in ilmbase-devel fftw3-devel libsndfile-devel libtheora-devel flac-devel \ libtiff-devel inkscape cmake patch libnuma-devel lzma-devel udftools git \ yasm autoconf automake rpm-build libjbig-devel libvdpau-devel libva-devel \ - gtk2-devel libusb-1_0-devel libpulse-devel + gtk2-devel libusb-1_0-devel libpulse-devel libtool if [ ! -f /usr/lib64/libtermcap.so ]; then ln -s libtermcap.so.2 /usr/lib64/libtermcap.so fi @@ -94,7 +94,7 @@ case "$dir" in libdc1394-22-dev libiec61883-dev libflac-dev libjbig-dev libusb-1.0-0-dev \ libvdpau-dev libva-dev libsndfile1-dev libtheora-dev cmake udftools \ libxml2-utils git inkscape autoconf automake debhelper libgtk2.0-dev \ - libpulse-dev + libpulse-dev libtool ;; *) echo "unknown os: $dir" diff --git a/cinelerra-5.1/cinelerra/amodule.C b/cinelerra-5.1/cinelerra/amodule.C index fb102c5c..c45935e5 100644 --- a/cinelerra-5.1/cinelerra/amodule.C +++ b/cinelerra-5.1/cinelerra/amodule.C @@ -49,6 +49,7 @@ #include "theme.h" #include "transition.h" #include "transportque.h" +#include "tracks.h" #include @@ -501,13 +502,9 @@ if(debug) printf("AModule::render %d %jd\n", __LINE__, fragment_len); // Clamp to end of transition int64_t transition_len = 0; - - if(transition && - previous_edit) - { - transition_len = transition->length * - sample_rate / - edl_rate; + Plugin *transition = get_edl()->tracks->plugin_exists(transition_id); + if( transition && previous_edit ) { + transition_len = transition->length * sample_rate / edl_rate; if(direction == PLAY_FORWARD && start_position < edit_startproject + transition_len && start_position + fragment_len > edit_startproject + transition_len) diff --git a/cinelerra-5.1/cinelerra/attachmentpoint.C b/cinelerra-5.1/cinelerra/attachmentpoint.C index adc1c4ac..0d80cb37 100644 --- a/cinelerra-5.1/cinelerra/attachmentpoint.C +++ b/cinelerra-5.1/cinelerra/attachmentpoint.C @@ -38,7 +38,7 @@ AttachmentPoint::AttachmentPoint(RenderEngine *renderengine, { reset_parameters(); this->plugin = plugin; - this->plugin_id = plugin->id; + this->plugin_id = plugin->orig_id; this->renderengine = renderengine; this->data_type = data_type; plugin_server = MWindow::scan_plugindb(plugin->title, diff --git a/cinelerra-5.1/cinelerra/edit.C b/cinelerra-5.1/cinelerra/edit.C index f716bb42..f5a06bbf 100644 --- a/cinelerra-5.1/cinelerra/edit.C +++ b/cinelerra-5.1/cinelerra/edit.C @@ -52,6 +52,7 @@ Edit::Edit(EDL *edl, Track *track) this->track = track; if(track) this->edits = track->edits; id = EDL::next_id(); + orig_id = id; } Edit::Edit(EDL *edl, Edits *edits) @@ -61,6 +62,7 @@ Edit::Edit(EDL *edl, Edits *edits) this->edits = edits; if(edits) this->track = edits->track; id = EDL::next_id(); + orig_id = id; } Edit::~Edit() @@ -254,6 +256,7 @@ void Edit::set_selected(int v) void Edit::copy_from(Edit *edit) { + this->orig_id = edit->orig_id; this->nested_edl = edl->nested_edls.get_nested(edit->nested_edl); this->asset = edl->assets->update(edit->asset); this->startsource = edit->startsource; diff --git a/cinelerra-5.1/cinelerra/edit.h b/cinelerra-5.1/cinelerra/edit.h index cc7c7fab..a21df403 100644 --- a/cinelerra-5.1/cinelerra/edit.h +++ b/cinelerra-5.1/cinelerra/edit.h @@ -105,8 +105,8 @@ public: int64_t length; // Channel or layer of source int channel; -// ID for resource pixmaps - int id; +// ID for resource pixmaps, plugins + int id, orig_id; // ID for selection groups int group_id; // User defined title for timeline diff --git a/cinelerra-5.1/cinelerra/edl.C b/cinelerra-5.1/cinelerra/edl.C index c4576c99..25496d4b 100644 --- a/cinelerra-5.1/cinelerra/edl.C +++ b/cinelerra-5.1/cinelerra/edl.C @@ -2134,6 +2134,7 @@ void EDL::paste_edits(EDL *clip, Track *first_track, double position, int overwr Plugin *new_plugin = dst_plugin_set->insert_plugin(plugin->title, start, end-start, plugin->plugin_type, &plugin->shared_location, (KeyFrame*)plugin->keyframes->default_auto, 0); + new_plugin->on = plugin->on; KeyFrame *keyframe = (KeyFrame*)plugin->keyframes->first; for( ; keyframe; keyframe=(KeyFrame*)keyframe->next ) { int64_t keyframe_pos = pos + keyframe->position; diff --git a/cinelerra-5.1/cinelerra/ffmpeg.C b/cinelerra-5.1/cinelerra/ffmpeg.C index 485385b4..a6f67d85 100644 --- a/cinelerra-5.1/cinelerra/ffmpeg.C +++ b/cinelerra-5.1/cinelerra/ffmpeg.C @@ -2973,7 +2973,20 @@ int FFMPEG::encode_activate() fmt_ctx->url); return -1; } - + if( !strcmp(file_format, "image2") ) { + Asset *asset = file_base->asset; + const char *filename = asset->path; + FILE *fp = fopen(filename,"w"); + if( !fp ) { + eprintf(_("Cant write image2 header file: %s\n %m"), filename); + return 1; + } + fprintf(fp, "IMAGE2\n"); + fprintf(fp, "# Frame rate: %f\n", asset->frame_rate); + fprintf(fp, "# Width: %d\n", asset->width); + fprintf(fp, "# Height: %d\n", asset->height); + fclose(fp); + } int prog_id = 1; AVProgram *prog = av_new_program(fmt_ctx, prog_id); for( int i=0; i< ffvideo.size(); ++i ) diff --git a/cinelerra-5.1/cinelerra/keyframegui.C b/cinelerra-5.1/cinelerra/keyframegui.C index 744106b9..f590571d 100644 --- a/cinelerra-5.1/cinelerra/keyframegui.C +++ b/cinelerra-5.1/cinelerra/keyframegui.C @@ -46,7 +46,7 @@ KeyFrameThread::KeyFrameThread(MWindow *mwindow) : BC_DialogThread() { this->mwindow = mwindow; - plugin = 0; + plugin_id = -1; keyframe = 0; keyframe_data = new ArrayList[KEYFRAME_COLUMNS]; plugin_title[0] = 0; @@ -92,7 +92,8 @@ void KeyFrameThread::update_values() // Must lock main window to read keyframe mwindow->gui->lock_window("KeyFrameThread::update_values"); - if( !plugin || !mwindow->edl->tracks->plugin_exists(plugin) ) { + Plugin *plugin = mwindow->edl->tracks->plugin_exists(plugin_id); + if( !plugin ) { mwindow->gui->unlock_window(); return; } @@ -147,9 +148,9 @@ void KeyFrameThread::start_window(Plugin *plugin, KeyFrame *keyframe) { if( !BC_DialogThread::is_running() ) { - if( !mwindow->edl->tracks->plugin_exists(plugin) ) return; + if( !mwindow->edl->tracks->plugin_exists(plugin->orig_id) ) return; this->keyframe = keyframe; - this->plugin = plugin; + this->plugin_id = plugin->orig_id; this->preset_text[0] = 0; plugin->calculate_title(plugin_title, 0); sprintf(window_title, _("%s: %s Keyframe"), _(PROGRAM_NAME), plugin_title); @@ -213,7 +214,7 @@ void KeyFrameThread::handle_done_event(int result) void KeyFrameThread::handle_close_event(int result) { - plugin = 0; + plugin_id = -1; keyframe = 0; } @@ -292,7 +293,8 @@ void KeyFrameThread::save_preset(const char *title, int is_factory) mwindow->gui->lock_window("KeyFrameThread::save_preset"); // Test EDL for plugin existence - if( !mwindow->edl->tracks->plugin_exists(plugin) ) { + Plugin *plugin = mwindow->edl->tracks->plugin_exists(plugin_id); + if( !plugin ) { mwindow->gui->unlock_window(); get_gui()->lock_window("KeyFrameThread::save_preset 2"); return; @@ -323,7 +325,8 @@ void KeyFrameThread::delete_preset(const char *title, int is_factory) mwindow->gui->lock_window("KeyFrameThread::save_preset"); // Test EDL for plugin existence - if( !mwindow->edl->tracks->plugin_exists(plugin) ) { + Plugin *plugin = mwindow->edl->tracks->plugin_exists(plugin_id); + if( !plugin ) { mwindow->gui->unlock_window(); get_gui()->lock_window("KeyFrameThread::delete_preset 1"); return; @@ -348,7 +351,8 @@ void KeyFrameThread::apply_preset(const char *title, int is_factory) mwindow->gui->lock_window("KeyFrameThread::apply_preset"); // Test EDL for plugin existence - if( !mwindow->edl->tracks->plugin_exists(plugin) ) { + Plugin *plugin = mwindow->edl->tracks->plugin_exists(plugin_id); + if( !plugin ) { mwindow->gui->unlock_window(); get_gui()->lock_window("KeyFrameThread::apply_preset 1"); return; @@ -402,7 +406,8 @@ void KeyFrameThread::apply_value() get_gui()->unlock_window(); mwindow->gui->lock_window("KeyFrameThread::apply_value"); - if( plugin && mwindow->edl->tracks->plugin_exists(plugin) ) { + Plugin *plugin = mwindow->edl->tracks->plugin_exists(plugin_id); + if( plugin ) { mwindow->undo->update_undo_before(); if( mwindow->session->keyframedialog_all ) { // Search for all keyframes in selection but don't create a new one. diff --git a/cinelerra-5.1/cinelerra/keyframegui.h b/cinelerra-5.1/cinelerra/keyframegui.h index c6cdb85c..fd10d44b 100644 --- a/cinelerra-5.1/cinelerra/keyframegui.h +++ b/cinelerra-5.1/cinelerra/keyframegui.h @@ -58,7 +58,7 @@ public: void close_window(); ArrayList *keyframe_data; - Plugin *plugin; + int plugin_id; KeyFrame *keyframe; MWindow *mwindow; char window_title[BCTEXTLEN]; diff --git a/cinelerra-5.1/cinelerra/module.C b/cinelerra-5.1/cinelerra/module.C index 3c21504e..01f3095f 100644 --- a/cinelerra-5.1/cinelerra/module.C +++ b/cinelerra-5.1/cinelerra/module.C @@ -50,7 +50,7 @@ Module::Module(RenderEngine *renderengine, this->commonrender = commonrender; this->plugin_array = plugin_array; this->track = track; - transition = 0; + transition_id = -1; transition_server = 0; attachments = 0; total_attachments = 0; @@ -283,8 +283,9 @@ int Module::test_plugins() void Module::update_transition(int64_t current_position, int direction) { - transition = track->get_current_transition(current_position, + Plugin *transition = track->get_current_transition(current_position, direction, 0, 0); + transition_id = transition ? transition->orig_id : -1; // For situations where we had a transition but not anymore, // keep the server open. @@ -295,13 +296,14 @@ void Module::update_transition(int64_t current_position, // If the current transition differs from the previous transition, delete the // server. if (transition && transition_server) { - if (strcmp(transition->title, transition_server->plugin->title)) { + Plugin *plugin = transition->edl->tracks->plugin_exists(transition_server->plugin_id); + if (!plugin || strcmp(transition->title, plugin->title)) { transition_server->close_plugin(); delete transition_server; transition_server = 0; } else { - transition_server->plugin = transition; + transition_server->plugin_id = transition_id; } } diff --git a/cinelerra-5.1/cinelerra/module.h b/cinelerra-5.1/cinelerra/module.h index 590987b2..85b50677 100644 --- a/cinelerra-5.1/cinelerra/module.h +++ b/cinelerra-5.1/cinelerra/module.h @@ -99,8 +99,8 @@ public: // TRACK_AUDIO or TRACK_VIDEO int data_type; -// Pointer to transition in EDL - Plugin *transition; +// transition in EDL + int transition_id; // PluginServer for transition PluginServer *transition_server; diff --git a/cinelerra-5.1/cinelerra/mwindow.C b/cinelerra-5.1/cinelerra/mwindow.C index c959af27..63522d68 100644 --- a/cinelerra-5.1/cinelerra/mwindow.C +++ b/cinelerra-5.1/cinelerra/mwindow.C @@ -3258,10 +3258,9 @@ void MWindow::show_keyframe_gui(Plugin *plugin) { keyframe_gui_lock->lock("MWindow::show_keyframe_gui"); // Find existing thread - for(int i = 0; i < keyframe_threads->size(); i++) - { - if(keyframe_threads->get(i)->plugin == plugin) - { + for( int i=0; isize(); ++i ) { + int plugin_id = keyframe_threads->get(i)->plugin_id; + if( plugin_id == plugin->orig_id ) { keyframe_threads->get(i)->start_window(plugin, 0); keyframe_gui_lock->unlock(); return; @@ -3269,10 +3268,8 @@ void MWindow::show_keyframe_gui(Plugin *plugin) } // Find unused thread - for(int i = 0; i < keyframe_threads->size(); i++) - { - if(!keyframe_threads->get(i)->plugin) - { + for( int i=0; isize(); ++i ) { + if( keyframe_threads->get(i)->plugin_id < 0 ) { keyframe_threads->get(i)->start_window(plugin, 0); keyframe_gui_lock->unlock(); return; @@ -3283,7 +3280,6 @@ void MWindow::show_keyframe_gui(Plugin *plugin) KeyFrameThread *thread = new KeyFrameThread(this); keyframe_threads->append(thread); thread->start_window(plugin, 0); - keyframe_gui_lock->unlock(); } @@ -3301,14 +3297,12 @@ SET_TRACE //printf("MWindow::show_plugin %d\n", __LINE__); SET_TRACE - plugin_gui_lock->lock("MWindow::show_plugin"); - for(int i = 0; i < plugin_guis->total; i++) - { -// Pointer comparison - if(plugin_guis->get(i)->plugin == plugin) - { - plugin_guis->get(i)->raise_window(); + for( int i=0; itotal; ++i ) { +// Pointer/id comparison + PluginServer *plugin_gui = plugin_guis->get(i); + if( plugin_gui->plugin_id == plugin->orig_id ) { + plugin_gui->raise_window(); done = 1; break; } @@ -3348,23 +3342,26 @@ SET_TRACE void MWindow::hide_plugin(Plugin *plugin, int lock) { plugin->show = 0; + return hide_plugin(plugin->orig_id, lock); +} + +void MWindow::hide_plugin(int plugin_id, int lock) +{ // Update the toggle gui->lock_window("MWindow::hide_plugin"); gui->update(0, NORMAL_DRAW, 0, 0, 0, 0, 0); gui->unlock_window(); if(lock) plugin_gui_lock->lock("MWindow::hide_plugin"); - for(int i = 0; i < plugin_guis->total; i++) - { - if(plugin_guis->get(i)->plugin == plugin) - { - PluginServer *ptr = plugin_guis->get(i); - plugin_guis->remove(ptr); + for( int i=0; itotal; ++i ) { + PluginServer *plugin_gui = plugin_guis->get(i); + if( plugin_gui->plugin_id == plugin_id ) { + plugin_guis->remove(plugin_gui); if(lock) plugin_gui_lock->unlock(); // Last command executed in client side close // Schedule for deletion - ptr->hide_gui(); - delete_plugin(ptr); + plugin_gui->hide_gui(); + delete_plugin(plugin_gui); //sleep(1); return; } @@ -3413,11 +3410,10 @@ void MWindow::hide_keyframe_guis() void MWindow::hide_keyframe_gui(Plugin *plugin) { keyframe_gui_lock->lock("MWindow::hide_keyframe_gui"); - for(int i = 0; i < keyframe_threads->size(); i++) - { - if(keyframe_threads->get(i)->plugin == plugin) - { - keyframe_threads->get(i)->close_window(); + for( int i = 0; i < keyframe_threads->size(); i++) { + KeyFrameThread *keyframe_gui = keyframe_threads->get(i); + if( keyframe_gui->plugin_id == plugin->orig_id ) { + keyframe_gui->close_window(); break; } } @@ -3491,15 +3487,13 @@ void MWindow::update_keyframe_guis() { // Send new configuration to keyframe GUI's keyframe_gui_lock->lock("MWindow::update_keyframe_guis"); - for(int i = 0; i < keyframe_threads->size(); i++) - { - KeyFrameThread *ptr = keyframe_threads->get(i); - if(edl->tracks->plugin_exists(ptr->plugin)) - ptr->update_gui(1); + for( int i=0; isize(); ++i ) { + KeyFrameThread *keyframe_gui = keyframe_threads->get(i); + Plugin *plugin = edl->tracks->plugin_exists(keyframe_gui->plugin_id); + if( plugin ) + keyframe_gui->update_gui(1); else - { - ptr->close_window(); - } + keyframe_gui->close_window(); } keyframe_gui_lock->unlock(); } @@ -3509,55 +3503,42 @@ void MWindow::update_plugin_guis(int do_keyframe_guis) // Send new configuration to plugin GUI's plugin_gui_lock->lock("MWindow::update_plugin_guis"); - for(int i = 0; i < plugin_guis->size(); i++) - { - PluginServer *ptr = plugin_guis->get(i); - if(edl->tracks->plugin_exists(ptr->plugin)) - ptr->update_gui(); - else - { -// Schedule for deletion if no plugin - plugin_guis->remove_number(i); - i--; - - ptr->hide_gui(); - delete_plugin(ptr); + for( int i=0; isize(); ++i ) { + PluginServer *plugin_gui = plugin_guis->get(i); + Plugin *plugin = edl->tracks->plugin_exists(plugin_gui->plugin_id); + if( plugin && plugin->show ) + plugin_gui->update_gui(); + else { +// Schedule for deletion if no plugin or not shown + plugin_guis->remove_number(i--); + plugin_gui->hide_gui(); + delete_plugin(plugin_gui); } } // Change plugin variable if not visible Track *track = edl->tracks->first; - while(track) - { - for(int i = 0; i < track->plugin_set.size(); i++) - { + for( ; track; track=track->next ) { + for( int i=0; i < track->plugin_set.size(); ++i ) { Plugin *plugin = (Plugin*)track->plugin_set[i]->first; - while(plugin) - { + for( ; plugin; plugin = (Plugin*)plugin->next ) { int got_it = 0; - for(int i = 0; i < plugin_guis->size(); i++) - { + for( int i=0; isize(); ++i ) { PluginServer *server = plugin_guis->get(i); - if(server->plugin == plugin) - { + if( server->plugin_id == plugin->orig_id ) { got_it = 1; break; } } - - if(!got_it) plugin->show = 0; - plugin = (Plugin*)plugin->next; + if( !got_it ) plugin->show = 0; } } - - track = track->next; } plugin_gui_lock->unlock(); - - - if(do_keyframe_guis) update_keyframe_guis(); + if( do_keyframe_guis ) + update_keyframe_guis(); } void MWindow::stop_plugin_guis() @@ -3566,10 +3547,8 @@ void MWindow::stop_plugin_guis() plugin_gui_lock->lock("MWindow::stop_plugin_guis"); for( int i=0; isize(); ++i ) { - PluginServer *ptr = plugin_guis->get(i); - if( edl->tracks->plugin_exists(ptr->plugin) ) { - ptr->render_stop(); - } + PluginServer *plugin_gui = plugin_guis->get(i); + plugin_gui->render_stop(); } plugin_gui_lock->unlock(); } @@ -3643,39 +3622,15 @@ int MWindow::get_tracking_direction() void MWindow::update_plugin_states() { plugin_gui_lock->lock("MWindow::update_plugin_states"); - for(int i = 0; i < plugin_guis->total; i++) - { - int result = 0; + for( int i=0; itotal; ++i ) { // Get a plugin GUI - Plugin *src_plugin = plugin_guis->get(i)->plugin; PluginServer *src_plugingui = plugin_guis->get(i); - -// Search for plugin in EDL. Only the master EDL shows plugin GUIs. - for(Track *track = edl->tracks->first; - track && !result; - track = track->next) - { - for(int j = 0; - j < track->plugin_set.total && !result; - j++) - { - PluginSet *plugin_set = track->plugin_set[j]; - for(Plugin *plugin = (Plugin*)plugin_set->first; - plugin && !result; - plugin = (Plugin*)plugin->next) - { - if(plugin == src_plugin && - !strcmp(plugin->title, src_plugingui->title)) result = 1; - } - } - } - - + int plugin_id = src_plugingui->plugin_id; + Plugin *src_plugin = edl->tracks->plugin_exists(plugin_id); // Doesn't exist anymore - if(!result) - { - hide_plugin(src_plugin, 0); - i--; + if( !src_plugin ) { + hide_plugin(plugin_id, 0); + --i; } } plugin_gui_lock->unlock(); @@ -3684,10 +3639,8 @@ void MWindow::update_plugin_states() void MWindow::update_plugin_titles() { - for(int i = 0; i < plugin_guis->total; i++) - { + for( int i=0; itotal; ++i ) plugin_guis->get(i)->update_title(); - } } int MWindow::asset_to_edl(EDL *new_edl, diff --git a/cinelerra-5.1/cinelerra/mwindow.h b/cinelerra-5.1/cinelerra/mwindow.h index ac5d71a3..109f4ece 100644 --- a/cinelerra-5.1/cinelerra/mwindow.h +++ b/cinelerra-5.1/cinelerra/mwindow.h @@ -341,6 +341,7 @@ public: void load_backup(); void show_plugin(Plugin *plugin); void hide_plugin(Plugin *plugin, int lock); + void hide_plugin(int plugin_id, int lock); void hide_plugins(); void delete_plugin(PluginServer *plugin); // Update plugins with configuration changes. diff --git a/cinelerra-5.1/cinelerra/plugin.C b/cinelerra-5.1/cinelerra/plugin.C index 09d003b3..4a34141c 100644 --- a/cinelerra-5.1/cinelerra/plugin.C +++ b/cinelerra-5.1/cinelerra/plugin.C @@ -132,7 +132,7 @@ void Plugin::copy_base(Edit *edit) this->startsource = edit->startsource; this->startproject = edit->startproject; this->length = edit->length; - + this->orig_id = edit->orig_id; this->plugin_type = plugin->plugin_type; this->in = plugin->in; diff --git a/cinelerra-5.1/cinelerra/pluginclient.C b/cinelerra-5.1/cinelerra/pluginclient.C index 333e895a..d5a9b0c8 100644 --- a/cinelerra-5.1/cinelerra/pluginclient.C +++ b/cinelerra-5.1/cinelerra/pluginclient.C @@ -43,6 +43,7 @@ #include "preferences.h" #include "renderengine.h" #include "track.h" +#include "tracks.h" #include "transportque.h" #include @@ -73,7 +74,6 @@ PluginClientThread::PluginClientThread(PluginClient *client) PluginClientThread::~PluginClientThread() { - join(); delete window; delete init_complete; } @@ -102,11 +102,9 @@ void PluginClientThread::run() window->lock_window("PluginClientThread::run"); //printf("PluginClientThread::run %p %d\n", this, __LINE__); window->hide_window(1); + client->save_defaults_xml(); // needs window lock window->unlock_window(); window->done_event(result); -// Can't save defaults in the destructor because it's not called immediately -// after closing. - /* if(client->defaults) */ client->save_defaults_xml(); /* This is needed when the GUI is closed from itself */ if(result) client->client_side_close(); } @@ -457,13 +455,8 @@ void PluginClient::hide_gui() { if(thread && thread->window) { -//printf("PluginClient::delete_thread %d\n", __LINE__); -/* This is needed when the GUI is closed from elsewhere than itself */ -/* Since we now use autodelete, this is all that has to be done, thread will take care of itself ... */ -/* Thread join will wait if this was not called from the thread itself or go on if it was */ thread->window->lock_window("PluginClient::hide_gui"); thread->window->set_done(0); -//printf("PluginClient::hide_gui %d thread->window=%p\n", __LINE__, thread->window); thread->window->unlock_window(); } } @@ -946,9 +939,10 @@ double PluginClient::get_project_framerate() const char *PluginClient::get_source_path() { - if( server->plugin ) return 0; - int64_t source_position = server->plugin->startproject; - Edit *edit = server->plugin->track->edits->editof(source_position,PLAY_FORWARD,0); + EDL *edl = get_edl(); + Plugin *plugin = edl->tracks->plugin_exists(server->plugin_id); + int64_t source_position = plugin->startproject; + Edit *edit = plugin->track->edits->editof(source_position,PLAY_FORWARD,0); Indexable *indexable = edit ? edit->get_source() : 0; return indexable ? indexable->path : 0; } @@ -1130,7 +1124,8 @@ void PluginClient::output_to_track(float ox, float oy, float &tx, float &ty) EDL *edl = get_edl(); projector_x += edl->session->output_w / 2; projector_y += edl->session->output_h / 2; - Track *track = server->plugin ? server->plugin->track : 0; + Plugin *plugin = edl->tracks->plugin_exists(server->plugin_id); + Track *track = plugin ? plugin->track : 0; int track_w = track ? track->track_w : edl->session->output_w; int track_h = track ? track->track_h : edl->session->output_h; tx = (ox - projector_x) / projector_z + track_w / 2; @@ -1145,7 +1140,8 @@ void PluginClient::track_to_output(float tx, float ty, float &ox, float &oy) EDL *edl = get_edl(); projector_x += edl->session->output_w / 2; projector_y += edl->session->output_h / 2; - Track *track = server->plugin ? server->plugin->track : 0; + Plugin *plugin = edl->tracks->plugin_exists(server->plugin_id); + Track *track = plugin ? plugin->track : 0; int track_w = track ? track->track_w : edl->session->output_w; int track_h = track ? track->track_h : edl->session->output_h; ox = (tx - track_w / 2) * projector_z + projector_x; diff --git a/cinelerra-5.1/cinelerra/plugindialog.C b/cinelerra-5.1/cinelerra/plugindialog.C index 8e08d2f1..f9c24fff 100644 --- a/cinelerra-5.1/cinelerra/plugindialog.C +++ b/cinelerra-5.1/cinelerra/plugindialog.C @@ -44,7 +44,7 @@ PluginDialogThread::PluginDialogThread(MWindow *mwindow) : BC_DialogThread() { this->mwindow = mwindow; - this->plugin = 0; + this->plugin_id = -1; this->plugin_type = PLUGIN_NONE; } @@ -62,7 +62,6 @@ void PluginDialogThread::start_window(Track *track, // mwindow->gui->lock_window("PluginDialogThread::start_window"); this->track = track; this->data_type = data_type; - this->plugin = plugin; this->is_mainmenu = is_mainmenu; single_standalone = mwindow->edl->session->single_standalone; @@ -71,6 +70,7 @@ void PluginDialogThread::start_window(Track *track, plugin->calculate_title(plugin_title, 0); this->shared_location = plugin->shared_location; this->plugin_type = plugin->plugin_type; + this->plugin_id = plugin->orig_id; } else { @@ -78,6 +78,7 @@ void PluginDialogThread::start_window(Track *track, this->shared_location.plugin = -1; this->shared_location.module = -1; this->plugin_type = PLUGIN_NONE; + this->plugin_id = -1; } strcpy(this->window_title, title); @@ -413,7 +414,7 @@ void PluginDialog::clear_selection() selected_available = -1; selected_shared = -1; selected_modules = -1; - thread->plugin = 0; + thread->plugin_id = -1; thread->plugin_type = PLUGIN_NONE; } @@ -444,17 +445,14 @@ void PluginDialogThread::apply() data_type, plugin_type, single_standalone); } else { + Plugin *plugin = mwindow->edl->tracks->plugin_exists(plugin_id); if( plugin ) { - if( mwindow->edl->tracks->plugin_exists(plugin) ) { - plugin->change_plugin(plugin_title, - &shared_location, plugin_type); - } + plugin->change_plugin(plugin_title, + &shared_location, plugin_type); } - else { - if( mwindow->edl->tracks->track_exists(track) ) { + else if( mwindow->edl->tracks->track_exists(track) ) { mwindow->insert_effect(plugin_title, &shared_location, - track, 0, 0, 0, plugin_type); - } + track, 0, 0, 0, plugin_type); } } @@ -466,7 +464,7 @@ void PluginDialogThread::apply() mwindow->gui->update(1, NORMAL_DRAW, 0, 0, 1, 0, 0); mwindow->gui->unlock_window(); } - plugin = 0; + plugin_id = -1; } PluginDialogApply::PluginDialogApply(PluginDialog *dialog, int x, int y) diff --git a/cinelerra-5.1/cinelerra/plugindialog.h b/cinelerra-5.1/cinelerra/plugindialog.h index 3511c76e..39f9a78f 100644 --- a/cinelerra-5.1/cinelerra/plugindialog.h +++ b/cinelerra-5.1/cinelerra/plugindialog.h @@ -57,7 +57,7 @@ public: int data_type; Transition *transition; // Plugin being modified if there is one - Plugin *plugin; + int plugin_id; char window_title[BCTEXTLEN]; // If attaching from main menu int is_mainmenu; diff --git a/cinelerra-5.1/cinelerra/pluginlv2client.C b/cinelerra-5.1/cinelerra/pluginlv2client.C index d416987f..b0a39108 100644 --- a/cinelerra-5.1/cinelerra/pluginlv2client.C +++ b/cinelerra-5.1/cinelerra/pluginlv2client.C @@ -39,6 +39,7 @@ #include "pluginset.h" #include "samples.h" #include "track.h" +#include "tracks.h" #include #include @@ -95,46 +96,40 @@ PluginLV2ParentUI *PluginLV2UIs::add_ui(PluginLV2ParentUI *ui, PluginLV2Client * return ui; } -PluginLV2ParentUI *PluginLV2UIs::search_ui(Plugin *plugin) +PluginLV2ParentUI *PluginLV2UIs::search_ui(int plugin_id) { - int64_t position = plugin->startproject; - PluginSet *plugin_set = plugin->plugin_set; - int set_no = plugin_set->get_number(); - int track_no = plugin_set->track->number_of(); - PluginLV2ParentUI *ui = 0; for( int i=size(); !ui && --i>=0; ) { PluginLV2ParentUI *parent_ui = get(i); - if( parent_ui->position != position ) continue; - if( parent_ui->set_no != set_no ) continue; - if( parent_ui->track_no == track_no ) ui = parent_ui; + if( parent_ui->plugin_id == plugin_id ) + ui = parent_ui; } return ui; } -PluginLV2ParentUI *PluginLV2UIs::find_ui(Plugin *plugin) +PluginLV2ParentUI *PluginLV2UIs::find_ui(int plugin_id) { - if( !plugin ) return 0; + if( plugin_id < 0 ) return 0; lock("PluginLV2UIs::find_ui"); - PluginLV2ParentUI *ui = search_ui(plugin); + PluginLV2ParentUI *ui = search_ui(plugin_id); unlock(); return ui; } PluginLV2ParentUI *PluginLV2Client::find_ui() { - return PluginLV2ParentUI::plugin_lv2.find_ui(server->plugin); + return PluginLV2ParentUI::plugin_lv2.find_ui(server->plugin_id); } PluginLV2ParentUI *PluginLV2ClientWindow::find_ui() { - return PluginLV2ParentUI::plugin_lv2.find_ui(client->server->plugin); + return PluginLV2ParentUI::plugin_lv2.find_ui(client->server->plugin_id); } PluginLV2ParentUI *PluginLV2UIs::get_ui(PluginLV2Client *client) { lock("PluginLV2UIs::get_ui"); - Plugin *plugin = client->server->plugin; - PluginLV2ParentUI *ui = search_ui(plugin); - if( !ui ) ui = add_ui(new PluginLV2ParentUI(plugin), client); + int plugin_id = client->server->plugin_id; + PluginLV2ParentUI *ui = plugin_id >= 0 ? search_ui(plugin_id) : 0; + if( !ui ) ui = add_ui(new PluginLV2ParentUI(plugin_id), client); unlock(); return ui; } @@ -251,8 +246,10 @@ void PluginLV2Client::read_data(KeyFrame *keyframe) if( !input.tag.title_is(name) ) continue; for( int i=0; iget_symbol(), 0.); - opt->set_value(value); + float v = opt->get_value(); + float value = input.tag.get_property(opt->get_symbol(), v); + if( value != v ) + opt->set_value(value); } } } @@ -415,17 +412,9 @@ printf("LOAD: %s\n", uri); return 0; } -PluginLV2ParentUI::PluginLV2ParentUI(Plugin *plugin) +PluginLV2ParentUI::PluginLV2ParentUI(int plugin_id) { - this->position = plugin->startproject; - PluginSet *plugin_set = plugin->plugin_set; - if( plugin_set ) { - this->set_no = plugin_set->get_number(); - this->track_no = plugin_set->track->number_of(); - } - else - this->track_no = this->set_no = -1; - + this->plugin_id = plugin_id; output_bfr = new Condition(0, "PluginLV2ParentUI::output_bfr", 1); client = 0; gui = 0; diff --git a/cinelerra-5.1/cinelerra/pluginlv2client.h b/cinelerra-5.1/cinelerra/pluginlv2client.h index 80654ef5..f1162919 100644 --- a/cinelerra-5.1/cinelerra/pluginlv2client.h +++ b/cinelerra-5.1/cinelerra/pluginlv2client.h @@ -22,8 +22,8 @@ public: PluginLV2ParentUI *del_ui(PluginLV2Client *client); PluginLV2ParentUI *del_ui(PluginLV2ClientWindow *gui); PluginLV2ParentUI *add_ui(PluginLV2ParentUI *ui, PluginLV2Client *client); - PluginLV2ParentUI *search_ui(Plugin *plugin); - PluginLV2ParentUI *find_ui(Plugin *plugin); + PluginLV2ParentUI *search_ui(int plugin_id); + PluginLV2ParentUI *find_ui(int plugin_id); PluginLV2ParentUI *get_ui(PluginLV2Client *client); }; @@ -31,7 +31,7 @@ public: class PluginLV2ParentUI : public ForkParent { public: - PluginLV2ParentUI(Plugin *plugin); + PluginLV2ParentUI(int plugin_id); ~PluginLV2ParentUI(); ForkChild* new_fork(); void start_parent(PluginLV2Client *client); @@ -41,15 +41,11 @@ public: PluginLV2Client *client; PluginLV2ClientWindow *gui; + int plugin_id; int hidden; int show(); int hide(); -//from Plugin::identitical_location - int64_t position; - int set_no; - int track_no; - static PluginLV2UIs plugin_lv2; }; diff --git a/cinelerra-5.1/cinelerra/pluginserver.C b/cinelerra-5.1/cinelerra/pluginserver.C index 02f19f33..f8e8a8f9 100644 --- a/cinelerra-5.1/cinelerra/pluginserver.C +++ b/cinelerra-5.1/cinelerra/pluginserver.C @@ -53,6 +53,7 @@ #include "mainsession.h" #include "theme.h" #include "trackcanvas.h" +#include "tracks.h" #include "transportque.h" #include "vdevicex11.h" #include "vframe.h" @@ -81,6 +82,7 @@ void PluginServer::init() nodes = new ArrayList; tip = 0; gui_id = -1; + plugin_id = -1; } PluginServer::PluginServer() @@ -204,7 +206,7 @@ int PluginServer::cleanup_plugin() new_buffers = 0; written_samples = written_frames = 0; gui_on = 0; - plugin = 0; + plugin_id = -1; plugin_open = 0; return 0; } @@ -300,6 +302,7 @@ void PluginServer::generate_display_title(char *string) else BC_Resources::encode(BC_Resources::encoding, 0, _(title),strlen(title)+1, ltitle,BCTEXTLEN); + Plugin *plugin = edl->tracks->plugin_exists(plugin_id); if( plugin && plugin->track ) sprintf(string, "%s: %s", plugin->track->title, ltitle); else @@ -347,7 +350,7 @@ int PluginServer::open_plugin(int master, if( plugin_open ) return 0; this->preferences = preferences; - this->plugin = plugin; + this->plugin_id = plugin ? plugin->orig_id : -1; this->edl = edl; if( !is_ffmpeg() && !is_lv2() && !is_executable() && !load_obj() ) { // If the load failed, can't use error string to detect executable @@ -427,14 +430,7 @@ int PluginServer::open_plugin(int master, int PluginServer::close_plugin() { if( !plugin_open ) return 0; - - if( client ) { -// Defaults are saved in the thread. -// if( client->defaults ) client->save_defaults(); - delete client; - } - -// shared object is persistent since plugin deletion would unlink its own object + delete client; plugin_open = 0; cleanup_plugin(); return 0; @@ -443,10 +439,10 @@ int PluginServer::close_plugin() void PluginServer::client_side_close() { // Last command executed in client thread + Plugin *plugin = edl->tracks->plugin_exists(plugin_id); if( plugin ) mwindow->hide_plugin(plugin, 1); - else - if( prompt ) { + else if( prompt ) { prompt->lock_window(); prompt->set_done(1); prompt->unlock_window(); @@ -568,6 +564,7 @@ void PluginServer::process_buffer(VFrame **frame, vclient->output[i] = frame[i]; } + Plugin *plugin = edl->tracks->plugin_exists(plugin_id); if( plugin ) { vclient->source_start = (int64_t)plugin->startproject * frame_rate / vclient->project_frame_rate; @@ -608,6 +605,7 @@ void PluginServer::process_buffer(Samples **buffer, aclient->in_buffer_size = aclient->out_buffer_size = fragment_size; aclient->output_buffers = buffer; + Plugin *plugin = edl->tracks->plugin_exists(plugin_id); if( plugin ) aclient->source_start = plugin->startproject * sample_rate / @@ -686,7 +684,9 @@ PluginServer *PluginGUIs::gui_server(int gui_id) void PluginServer::reset_gui_frames() { - mwindow->reset_plugin_gui_frames(plugin); + Plugin *plugin = edl->tracks->plugin_exists(plugin_id); + if( plugin ) + mwindow->reset_plugin_gui_frames(plugin); } void PluginServer::reset_plugin_gui_frames() @@ -697,7 +697,9 @@ void PluginServer::reset_plugin_gui_frames() void PluginServer::render_gui_frames(PluginClientFrames *frames) { - mwindow->render_plugin_gui_frames(frames, plugin); + Plugin *plugin = edl->tracks->plugin_exists(plugin_id); + if( plugin ) + mwindow->render_plugin_gui_frames(frames, plugin); } void PluginServer::render_plugin_gui_frames(PluginClientFrames *frames) @@ -897,6 +899,7 @@ int PluginServer::read_frame(VFrame *buffer, // Called by client int PluginServer::get_gui_status() { + Plugin *plugin = edl->tracks->plugin_exists(plugin_id); if( plugin ) return plugin->show ? GUI_ON : GUI_OFF; else @@ -912,6 +915,7 @@ void PluginServer::raise_window() void PluginServer::show_gui() { if( !plugin_open ) return; + Plugin *plugin = edl->tracks->plugin_exists(plugin_id); if( plugin ) { plugin->gui_id = gui_id; client->total_len = plugin->length; @@ -936,6 +940,7 @@ void PluginServer::show_gui() void PluginServer::hide_gui() { if( !plugin_open ) return; + Plugin *plugin = edl->tracks->plugin_exists(plugin_id); if( plugin ) plugin->gui_id = -1; if( client->defaults ) client->save_defaults(); client->hide_gui(); @@ -943,7 +948,9 @@ void PluginServer::hide_gui() void PluginServer::update_gui() { - if( !plugin_open || !plugin ) return; + if( !plugin_open ) return; + Plugin *plugin = edl->tracks->plugin_exists(plugin_id); + if( !plugin ) return; client->total_len = plugin->length; client->source_start = plugin->startproject; @@ -1006,14 +1013,24 @@ void PluginServer::run_opengl(PluginClient *plugin_client) void PluginServer::get_defaults_path(char *path) { -// Get plugin name from path - char *ptr1 = strrchr(get_path(), '/'); - char *ptr2 = strrchr(get_path(), '.'); - if( !ptr1 ) ptr1 = get_path(); - if( !ptr2 ) ptr2 = get_path() + strlen(get_path()); - char string2[BCTEXTLEN], *ptr3 = string2; - while( ptr1 < ptr2 ) *ptr3++ = *ptr1++; - *ptr3 = 0; + char string2[BCTEXTLEN]; + switch( plugin_type ) { + case PLUGIN_TYPE_FFMPEG: + case PLUGIN_TYPE_LV2: + strcpy(string2, client->plugin_title()); + break; + case PLUGIN_TYPE_BUILTIN: + case PLUGIN_TYPE_LADSPA: + default: { // Get plugin name from path + char *ptr1 = strrchr(get_path(), '/'); + char *ptr2 = strrchr(get_path(), '.'); + if( !ptr1 ) ptr1 = get_path(); + if( !ptr2 ) ptr2 = get_path() + strlen(get_path()); + char *ptr3 = string2; + while( ptr1 < ptr2 ) *ptr3++ = *ptr1++; + *ptr3 = 0; + break; } + } sprintf(path, "%s/%s.xml", File::get_config_path(), string2); } @@ -1118,6 +1135,7 @@ void PluginServer::save_data(KeyFrame *keyframe) KeyFrame* PluginServer::get_prev_keyframe(int64_t position) { KeyFrame *result = 0; + Plugin *plugin = edl->tracks->plugin_exists(plugin_id); if( plugin ) result = plugin->get_prev_keyframe(position, client->direction); else @@ -1127,6 +1145,7 @@ KeyFrame* PluginServer::get_prev_keyframe(int64_t position) KeyFrame* PluginServer::get_next_keyframe(int64_t position) { + Plugin *plugin = edl->tracks->plugin_exists(plugin_id); KeyFrame *result = !plugin ? 0 : plugin->get_next_keyframe(position, client->direction); return result; @@ -1135,6 +1154,7 @@ KeyFrame* PluginServer::get_next_keyframe(int64_t position) // Called for KeyFrame* PluginServer::get_keyframe() { + Plugin *plugin = edl->tracks->plugin_exists(plugin_id); if( plugin ) // Realtime plugin case return plugin->get_keyframe(); @@ -1145,6 +1165,7 @@ KeyFrame* PluginServer::get_keyframe() void PluginServer::apply_keyframe(KeyFrame *src) { + Plugin *plugin = edl->tracks->plugin_exists(plugin_id); if( !plugin ) keyframe->copy_data(src); else @@ -1156,19 +1177,26 @@ void PluginServer::apply_keyframe(KeyFrame *src) void PluginServer::get_camera(float *x, float *y, float *z, int64_t position, int direction) { - plugin->track->automation->get_camera(x, y, z, position, direction); + Plugin *plugin = edl->tracks->plugin_exists(plugin_id); + if( plugin ) + plugin->track->automation->get_camera(x, y, z, position, direction); } void PluginServer::get_projector(float *x, float *y, float *z, int64_t position, int direction) { - plugin->track->automation->get_projector(x, y, z, position, direction); + Plugin *plugin = edl->tracks->plugin_exists(plugin_id); + if( plugin ) + plugin->track->automation->get_projector(x, y, z, position, direction); } int PluginServer::get_interpolation_type() { - return plugin->edl->session->interpolation_type; + Plugin *plugin = edl->tracks->plugin_exists(plugin_id); + if( plugin ) + return plugin->edl->session->interpolation_type; + return NEAREST_NEIGHBOR; } Theme* PluginServer::new_theme() @@ -1247,10 +1275,12 @@ void PluginServer::sync_parameters() int64_t PluginServer::get_startproject() { + Plugin *plugin = edl->tracks->plugin_exists(plugin_id); return !plugin ? -1 : plugin->startproject; } int64_t PluginServer::get_endproject() { + Plugin *plugin = edl->tracks->plugin_exists(plugin_id); return !plugin ? -1 : plugin->startproject + plugin->length; } diff --git a/cinelerra-5.1/cinelerra/pluginserver.h b/cinelerra-5.1/cinelerra/pluginserver.h index fd01f396..296d335b 100644 --- a/cinelerra-5.1/cinelerra/pluginserver.h +++ b/cinelerra-5.1/cinelerra/pluginserver.h @@ -368,6 +368,7 @@ public: // client origin int plugin_type; + int plugin_id; // buffers int64_t out_buffer_size; // size of a send buffer to the plugin @@ -431,8 +432,6 @@ public: // Pointer to keyframe when plugin is not available KeyFrame *keyframe; AttachmentPoint *attachment; -// Storage of keyframes and GUI status - Plugin *plugin; // Storage of session parameters EDL *edl; diff --git a/cinelerra-5.1/cinelerra/track.C b/cinelerra-5.1/cinelerra/track.C index 91bf401a..1bffff71 100644 --- a/cinelerra-5.1/cinelerra/track.C +++ b/cinelerra-5.1/cinelerra/track.C @@ -1795,26 +1795,21 @@ int64_t Track::frame_align(int64_t position, int round) return position; } -int Track::plugin_exists(Plugin *plugin) -{ - for(int number = 0; number < plugin_set.size(); number++) - { - PluginSet *ptr = plugin_set.get(number); - for(Plugin *current_plugin = (Plugin*)ptr->first; - current_plugin; - current_plugin = (Plugin*)current_plugin->next) - { - if(current_plugin == plugin) return 1; +Plugin *Track::plugin_exists(int plugin_id) +{ + for( int i=0; ifirst; + for( ; plugin; plugin=(Plugin*)plugin->next ) { + if( plugin->orig_id == plugin_id ) + return plugin; } } - - for(Edit *current = edits->first; current; current = NEXT) - { - if(current->transition && - (Plugin*)current->transition == plugin) return 1; + for( Edit *current=edits->first; current; current=NEXT ) { + Plugin *plugin = (Plugin *)current->transition; + if( plugin && plugin->orig_id == plugin_id ) + return plugin; } - - return 0; } diff --git a/cinelerra-5.1/cinelerra/track.h b/cinelerra-5.1/cinelerra/track.h index c2c43302..679c3a49 100644 --- a/cinelerra-5.1/cinelerra/track.h +++ b/cinelerra-5.1/cinelerra/track.h @@ -165,7 +165,7 @@ public: void shift_effects(int64_t position, int64_t length, int edit_autos, Edits *trim_edits); void change_plugins(SharedLocation &old_location, SharedLocation &new_location, int do_swap); void change_modules(int old_location, int new_location, int do_swap); - int plugin_exists(Plugin *plugin); + Plugin *plugin_exists(int plugin_id); EDL *edl; Tracks *tracks; diff --git a/cinelerra-5.1/cinelerra/tracks.C b/cinelerra-5.1/cinelerra/tracks.C index bb31f6db..7fdf4921 100644 --- a/cinelerra-5.1/cinelerra/tracks.C +++ b/cinelerra-5.1/cinelerra/tracks.C @@ -695,13 +695,14 @@ int Tracks::total_playable_vtracks() return result; } -int Tracks::plugin_exists(Plugin *plugin) +Plugin *Tracks::plugin_exists(int plugin_id) { - for(Track *track = first; track; track = track->next) - { - if(track->plugin_exists(plugin)) return 1; + if( plugin_id < 0 ) return 0; + Plugin *plugin = 0; + for( Track *track=first; !plugin && track; track=track->next ) { + plugin = track->plugin_exists(plugin_id); } - return 0; + return plugin; } int Tracks::track_exists(Track *track) diff --git a/cinelerra-5.1/cinelerra/tracks.h b/cinelerra-5.1/cinelerra/tracks.h index 63a98a52..88a96e48 100644 --- a/cinelerra-5.1/cinelerra/tracks.h +++ b/cinelerra-5.1/cinelerra/tracks.h @@ -81,7 +81,7 @@ public: void paste_video_transition(PluginServer *server, int first_track = 0); // Only tests effects - int plugin_exists(Plugin *plugin); + Plugin *plugin_exists(int plugin_id); int track_exists(Track *track); void paste_transition(PluginServer *server, Edit *dest_edit); diff --git a/cinelerra-5.1/cinelerra/transitionpopup.C b/cinelerra-5.1/cinelerra/transitionpopup.C index ff19113b..58a05e58 100644 --- a/cinelerra-5.1/cinelerra/transitionpopup.C +++ b/cinelerra-5.1/cinelerra/transitionpopup.C @@ -68,6 +68,7 @@ BC_Window* TransitionLengthThread::new_gui() void TransitionLengthThread::handle_close_event(int result) { + if( mwindow->in_destructor ) return; if( !result ) { if( transition ) mwindow->set_transition_length(transition, new_length); diff --git a/cinelerra-5.1/cinelerra/vmodule.C b/cinelerra-5.1/cinelerra/vmodule.C index 88d1c010..6659dd45 100644 --- a/cinelerra-5.1/cinelerra/vmodule.C +++ b/cinelerra-5.1/cinelerra/vmodule.C @@ -693,6 +693,7 @@ int VModule::render(VFrame *output, VEdit* previous_edit = 0; //printf("VModule::render %d %p %ld %d\n", __LINE__, current_edit, start_position_project, direction); + Plugin *transition = get_edl()->tracks->plugin_exists(transition_id); if( debug_render ) printf(" VModule::render %d %d %jd %s transition=%p opengl=%d current_edit=%p output=%p\n", __LINE__, use_nudge, start_position_project, track->title, diff --git a/cinelerra-5.1/plugins/bluebanana/bluebananawindow.C b/cinelerra-5.1/plugins/bluebanana/bluebananawindow.C index 99146bc7..b7db7a0c 100644 --- a/cinelerra-5.1/plugins/bluebanana/bluebananawindow.C +++ b/cinelerra-5.1/plugins/bluebanana/bluebananawindow.C @@ -22,16 +22,18 @@ #include #include "bcdisplayinfo.h" #include "bcsignals.h" +#include "brender.h" #include "cursors.h" -#include "bluebanana.h" -#include "bluebananaconfig.h" -#include "bluebananaslider.h" -#include "bluebananawindow.h" +#include "edl.h" #include "keys.h" #include "language.h" #include "plugin.h" -#include "brender.h" +#include "tracks.h" +#include "bluebanana.h" +#include "bluebananaconfig.h" +#include "bluebananaslider.h" +#include "bluebananawindow.h" #include "bluebananacolor.c" @@ -2478,8 +2480,10 @@ int BluebananaWindow::repeat_event(int64_t d){ if(config_consume!=config_produce) flush_config_change(); } - if(!plugin->server->plugin) return 0; - if(!plugin->server->plugin->on) return 0; + PluginServer *server = plugin->server; + int plugin_id = server->plugin_id; + Plugin *gui_plugin = server->edl->tracks->plugin_exists(plugin_id); + if(!gui_plugin || !gui_plugin->on) return 0; if(d==207){ /* if background render is active and we're showing the zebra, mark diff --git a/cinelerra-5.1/plugins/findobj/findobj.C b/cinelerra-5.1/plugins/findobj/findobj.C index b54b1c72..c445bff3 100644 --- a/cinelerra-5.1/plugins/findobj/findobj.C +++ b/cinelerra-5.1/plugins/findobj/findobj.C @@ -21,6 +21,8 @@ #include "affine.h" #include "bccolors.h" #include "clip.h" +#include "edl.h" +#include "edlsession.h" #include "filexml.h" #include "language.h" #include "findobj.h" @@ -30,6 +32,7 @@ #include "plugin.h" #include "pluginserver.h" #include "track.h" +#include "tracks.h" #include #include @@ -311,6 +314,13 @@ void FindObjMain::read_data(KeyFrame *keyframe) config.boundaries(); } +Track *FindObjMain::get_plugin_track() +{ + int plugin_id = server->plugin_id; + Plugin *plugin = server->edl->tracks->plugin_exists(plugin_id); + return !plugin ? 0 : plugin->track; +} + void FindObjMain::draw_line(VFrame *vframe, int x1, int y1, int x2, int y2) { vframe->draw_line(x1, y1, x2, y2); @@ -716,9 +726,9 @@ int FindObjMain::process_buffer(VFrame **frame, int64_t start_position, double f object_layer = config.object_layer; scene_layer = config.scene_layer; replace_layer = config.replace_layer; - Track *track = server->plugin->track; - w = track->track_w; - h = track->track_h; + Track *track = get_plugin_track(); + w = track ? track->track_w : get_edl()->session->output_w; + h = track ? track->track_h : get_edl()->session->output_h; int max_layer = PluginClient::get_total_buffers() - 1; object_layer = bclip(config.object_layer, 0, max_layer); diff --git a/cinelerra-5.1/plugins/findobj/findobj.h b/cinelerra-5.1/plugins/findobj/findobj.h index 7823b87f..2f4f45b2 100644 --- a/cinelerra-5.1/plugins/findobj/findobj.h +++ b/cinelerra-5.1/plugins/findobj/findobj.h @@ -43,6 +43,7 @@ #include "findobj.inc" #include "overlayframe.inc" #include "pluginvclient.h" +#include "track.inc" #include "vframe.inc" #define Mutex CvMutex @@ -162,6 +163,7 @@ public: void save_data(KeyFrame *keyframe); void read_data(KeyFrame *keyframe); void update_gui(); + Track *get_plugin_track(); PLUGIN_CLASS_MEMBERS2(FindObjConfig) diff --git a/cinelerra-5.1/plugins/findobj/findobjwindow.C b/cinelerra-5.1/plugins/findobj/findobjwindow.C index f9302a7c..06da64c7 100644 --- a/cinelerra-5.1/plugins/findobj/findobjwindow.C +++ b/cinelerra-5.1/plugins/findobj/findobjwindow.C @@ -104,8 +104,9 @@ void FindObjWindow::create_objects() y1 = y; add_subwindow(title = new BC_Title(x1, y + ys10, _("Scene X:"))); - Track *track = plugin->server->plugin->track; - int trk_w = track->track_w, trk_h = track->track_h; + Track *track = plugin->get_plugin_track(); + int trk_w = track ? track->track_w : plugin->get_edl()->session->output_w; + int trk_h = track ? track->track_h : plugin->get_edl()->session->output_h; float drag_w = trk_w * plugin->config.scene_w / 100.; float drag_h = trk_h * plugin->config.scene_h / 100.; float ctr_x = trk_w * plugin->config.scene_x / 100.; @@ -535,15 +536,17 @@ int FindObjDragScene::handle_event() plugin->send_configure_change(); return ret; } + Track *FindObjDragScene::get_drag_track() { - return !plugin->server->plugin ? 0 : - plugin->server->plugin->track; + return plugin->get_plugin_track(); } + int64_t FindObjDragScene::get_drag_position() { return plugin->get_source_position(); } + void FindObjDragScene::update_gui() { bound(); @@ -577,15 +580,17 @@ int FindObjDragObject::handle_event() plugin->send_configure_change(); return ret; } + Track *FindObjDragObject::get_drag_track() { - return !plugin->server->plugin ? 0 : - plugin->server->plugin->track; + return plugin->get_plugin_track(); } + int64_t FindObjDragObject::get_drag_position() { return plugin->get_source_position(); } + void FindObjDragObject::update_gui() { bound(); @@ -621,13 +626,14 @@ int FindObjDragReplace::handle_event() } Track *FindObjDragReplace::get_drag_track() { - return !plugin->server->plugin ? 0 : - plugin->server->plugin->track; + return plugin->get_plugin_track(); } + int64_t FindObjDragReplace::get_drag_position() { return plugin->get_source_position(); } + void FindObjDragReplace::update_gui() { bound(); diff --git a/cinelerra-5.1/plugins/puzzleobj/puzzleobjwindow.C b/cinelerra-5.1/plugins/puzzleobj/puzzleobjwindow.C index 18573fdb..d7829956 100644 --- a/cinelerra-5.1/plugins/puzzleobj/puzzleobjwindow.C +++ b/cinelerra-5.1/plugins/puzzleobj/puzzleobjwindow.C @@ -41,7 +41,7 @@ PuzzleObjWindow::~PuzzleObjWindow() void PuzzleObjWindow::create_objects() { - int xs10 = xS(10), xs50 = xS(50), xs80 = xS(80), xs180 = xS(180); + int xs10 = xS(10), xs80 = xS(80), xs180 = xS(180); int ys10 = yS(10); int x = xs10, y = ys10; BC_Title *title = new BC_Title(x, y, _("PuzzleObj")); diff --git a/cinelerra-5.1/plugins/titler/titlerwindow.C b/cinelerra-5.1/plugins/titler/titlerwindow.C index 4c879158..644cd67d 100644 --- a/cinelerra-5.1/plugins/titler/titlerwindow.C +++ b/cinelerra-5.1/plugins/titler/titlerwindow.C @@ -40,6 +40,7 @@ #include "pluginserver.h" #include "theme.h" #include "track.h" +#include "tracks.h" #include "titlerwindow.h" #include "bcfontentry.h" @@ -1237,8 +1238,10 @@ TitleDrag::TitleDrag(TitleMain *client, TitleWindow *window, int x, int y) Track *TitleDrag::get_drag_track() { - return !client->server->plugin ? 0 : - client->server->plugin->track; + PluginServer *server = client->server; + int plugin_id = server->plugin_id; + Plugin *plugin = server->edl->tracks->plugin_exists(plugin_id); + return !plugin ? 0 : plugin->track; } int64_t TitleDrag::get_drag_position() {