change to id based refs for plugins, save plugin on/off in edit drag/drop, fix transi...
authorGood Guy <[email protected]>
Sun, 8 Mar 2020 18:14:36 +0000 (12:14 -0600)
committerGood Guy <[email protected]>
Sun, 8 Mar 2020 18:14:36 +0000 (12:14 -0600)
33 files changed:
cinelerra-5.1/blds/bld_prepare.sh
cinelerra-5.1/cinelerra/amodule.C
cinelerra-5.1/cinelerra/attachmentpoint.C
cinelerra-5.1/cinelerra/edit.C
cinelerra-5.1/cinelerra/edit.h
cinelerra-5.1/cinelerra/edl.C
cinelerra-5.1/cinelerra/ffmpeg.C
cinelerra-5.1/cinelerra/keyframegui.C
cinelerra-5.1/cinelerra/keyframegui.h
cinelerra-5.1/cinelerra/module.C
cinelerra-5.1/cinelerra/module.h
cinelerra-5.1/cinelerra/mwindow.C
cinelerra-5.1/cinelerra/mwindow.h
cinelerra-5.1/cinelerra/plugin.C
cinelerra-5.1/cinelerra/pluginclient.C
cinelerra-5.1/cinelerra/plugindialog.C
cinelerra-5.1/cinelerra/plugindialog.h
cinelerra-5.1/cinelerra/pluginlv2client.C
cinelerra-5.1/cinelerra/pluginlv2client.h
cinelerra-5.1/cinelerra/pluginserver.C
cinelerra-5.1/cinelerra/pluginserver.h
cinelerra-5.1/cinelerra/track.C
cinelerra-5.1/cinelerra/track.h
cinelerra-5.1/cinelerra/tracks.C
cinelerra-5.1/cinelerra/tracks.h
cinelerra-5.1/cinelerra/transitionpopup.C
cinelerra-5.1/cinelerra/vmodule.C
cinelerra-5.1/plugins/bluebanana/bluebananawindow.C
cinelerra-5.1/plugins/findobj/findobj.C
cinelerra-5.1/plugins/findobj/findobj.h
cinelerra-5.1/plugins/findobj/findobjwindow.C
cinelerra-5.1/plugins/puzzleobj/puzzleobjwindow.C
cinelerra-5.1/plugins/titler/titlerwindow.C

index 3c34ff6a07d4a51ba6581c57f1fff7b7f30b27f1..f5201e64bf761fe43cd09858276f174a1f26bf64 100755 (executable)
@@ -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"
index fb102c5cf703d7ebbdc25fd66f9bf8075659382f..c45935e5aff9ae3c04c322d21ac3a36106c9f038 100644 (file)
@@ -49,6 +49,7 @@
 #include "theme.h"
 #include "transition.h"
 #include "transportque.h"
+#include "tracks.h"
 #include <string.h>
 
 
@@ -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)
index adc1c4acb8c557357588886f45d73feb91bce5c3..0d80cb37530364479b870fdaa7c3dcb1531e7c1a 100644 (file)
@@ -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,
index f716bb42727f7e1c463b622ddb768a74fc50cb6a..f5a06bbf0dd54db600879661d7aa820acf93b6c6 100644 (file)
@@ -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;
index cc7c7fab51ba7706df04ae7364f67f7d952bcea8..a21df40388ff0423709246cff713eaf26c4d47d3 100644 (file)
@@ -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
index c4576c99efdbee94234eb31545e33e0bce59e083..25496d4b8d6b01bcf66de94f30917b9e26079549 100644 (file)
@@ -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;
index 485385b4138bffd4cd822551766a8506521c9b96..a6f67d85eb3d54fcb804e28b85eb49ea73f18846 100644 (file)
@@ -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 )
index 744106b9fd48b6598dcccb383813505fba9d521d..f590571d8be69916cd24958de728134fd6c8dc9a 100644 (file)
@@ -46,7 +46,7 @@ KeyFrameThread::KeyFrameThread(MWindow *mwindow)
  : BC_DialogThread()
 {
        this->mwindow = mwindow;
-       plugin = 0;
+       plugin_id = -1;
        keyframe = 0;
        keyframe_data = new ArrayList<BC_ListBoxItem*>[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.
index c6cdb85c0c4e4660cce7a8bc8c56335a17616119..fd10d44b4e5b39a9939bc1eaf09b3d8971ecd5c4 100644 (file)
@@ -58,7 +58,7 @@ public:
        void close_window();
 
        ArrayList<BC_ListBoxItem*> *keyframe_data;
-       Plugin *plugin;
+       int plugin_id;
        KeyFrame *keyframe;
        MWindow *mwindow;
        char window_title[BCTEXTLEN];
index 3c21504e6a7e30471c91866bd50774cd447d6f60..01f3095f1c69d2e8d0b87ee726d1128fb9dd216d 100644 (file)
@@ -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;
                }
        }
 
index 590987b2ef3d6b3996eeebc7409d56e26540733d..85b506774823e1507b881b578c5d9d23e8e8a05d 100644 (file)
@@ -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;
 
index c959af278e7dd832f0a173c6ba3b8df2fe8b2a50..63522d6872690e155ccc96e351a6e4dc02eb53db 100644 (file)
@@ -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; i<keyframe_threads->size(); ++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; i<keyframe_threads->size(); ++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; i<plugin_guis->total; ++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; i<plugin_guis->total; ++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; i<keyframe_threads->size(); ++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; i<plugin_guis->size(); ++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; i<plugin_guis->size(); ++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; i<plugin_guis->size(); ++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; i<plugin_guis->total; ++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; i<plugin_guis->total; ++i )
                plugin_guis->get(i)->update_title();
-       }
 }
 
 int MWindow::asset_to_edl(EDL *new_edl,
index ac5d71a32f818f02f4a2a3ce96ae96648fb741ba..109f4ecece9f9a600c1663a5a97d9349dad8dabe 100644 (file)
@@ -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.
index 09d003b318c77513d1babf62bc505f9fc34fd974..4a34141c5cd837dd8826f0ee07118f88cc9f5581 100644 (file)
@@ -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;
index 333e895a13fa2878e60c94862bf28e7e10d905f0..d5a9b0c88a1e5b7b376dfccc65c710dd6e3be80a 100644 (file)
@@ -43,6 +43,7 @@
 #include "preferences.h"
 #include "renderengine.h"
 #include "track.h"
+#include "tracks.h"
 #include "transportque.h"
 
 #include <stdio.h>
@@ -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;
index 8e08d2f17313d3326f0cebb65f87b8f179a855c4..f9c24fffb9c41c8948f2b254e9b6dabbe8fde1c6 100644 (file)
@@ -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)
index 3511c76e13d22008f68bb1d37931d703b1847c5f..39f9a78fb210cbd78740e098907f2c27009362e7 100644 (file)
@@ -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;
index d416987f7d92b88113d400171837a2d398b6ce87..b0a391087154d6adb1f8a88b7ed99b802c49f790 100644 (file)
@@ -39,6 +39,7 @@
 #include "pluginset.h"
 #include "samples.h"
 #include "track.h"
+#include "tracks.h"
 
 #include <ctype.h>
 #include <string.h>
@@ -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; i<config.size(); ++i ) {
                        PluginLV2Client_Opt *opt = config[i];
-                       float value = input.tag.get_property(opt->get_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;
index 80654ef557121d9d1f593aa8fe2d756792bd3698..f11629193e7840ff9dd15a8b7e3e6bc43c9dfd82 100644 (file)
@@ -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;
 };
 
index 02f19f33ac35d7090d48413186b2c62e12116d32..f8e8a8f9f80a8cf662fd0c63fba2aa6eb1c81eed 100644 (file)
@@ -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<VirtualNode*>;
        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;
 }
 
index fd01f396a0c5e9154a4f3e73c766754b9dd21d8e..296d335b1f403a8b591e22de7f6b8a1c285b4744 100644 (file)
@@ -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;
index 91bf401afb22a675bd22c2092aec9927a01f2a1e..1bffff714ff8693569a681d05138ab4e3487ea27 100644 (file)
@@ -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; i<plugin_set.size(); ++i ) {
+               PluginSet *set = plugin_set.get(i);
+               Plugin *plugin = (Plugin*)set->first;
+               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;
 }
 
index c2c43302f9aceb470f4b74bdb704328fe5ee3d9a..679c3a4997aeda50662464f5cbbdc5d113d721b0 100644 (file)
@@ -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;
index bb31f6dbecd2fa59c492101819bf5aae192244cb..7fdf492124b4a03808bbc7931d65b07a874b837c 100644 (file)
@@ -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)
index 63a98a5230d34e806094b2c3a2e17a1d80154df4..88a96e484e39767725cc1cdbc1fe8057bb8ea9e3 100644 (file)
@@ -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);
index ff19113b5e8bca9487b28c3eb8e95878a2e87573..58a05e588872a79239302e460b1c5957dda8c266 100644 (file)
@@ -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);
index 88d1c010f82f5edb3caaf3dc128b29f9fac00221..6659dd4529e5305b11a053fc4b9c4b6ee47b9a03 100644 (file)
@@ -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,
index 99146bc7d9f94c0054b21f78d8134c738c863140..b7db7a0cc81b307dd6ba1b75b722c356e211fbcf 100644 (file)
 #include <math.h>
 #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
index b54b1c727f7ec8cfc0d5cd02927ca27f0b950839..c445bff37a69ad2d986c9966cf4c85d96ba55eb7 100644 (file)
@@ -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 <errno.h>
 #include <exception>
@@ -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);
index 7823b87f8dcac13b3217c5ea7a05319285841f24..2f4f45b2086c1628c43525f7e7b8e8a0f5c65d78 100644 (file)
@@ -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)
 
index f9302a7c081a3488a895b538cd1e7069606d7cb1..06da64c7d0aec78cdef564b4ca505c788cdd6af7 100644 (file)
@@ -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();
index 18573fdb5207fecade7a959c7dd3ef0bf4a4c33b..d782995687adbc81e8949218e8bc15c3c6cb4a01 100644 (file)
@@ -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"));
index 4c8791582d02705f47420c2d82bfa2dcb82e4bcd..644cd67d1220bd3b75570f1f882830b798a7aab2 100644 (file)
@@ -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()
 {