fix transition at media start in opengl, fix circular shared tracks
authorGood Guy <[email protected]>
Tue, 5 May 2020 02:03:48 +0000 (20:03 -0600)
committerGood Guy <[email protected]>
Tue, 5 May 2020 02:03:48 +0000 (20:03 -0600)
cinelerra-5.1/cinelerra/pluginclient.C
cinelerra-5.1/cinelerra/pluginclient.h
cinelerra-5.1/cinelerra/pluginserver.C
cinelerra-5.1/cinelerra/pluginserver.h
cinelerra-5.1/cinelerra/virtualnode.C
cinelerra-5.1/cinelerra/virtualnode.h

index d5a9b0c88a1e5b7b376dfccc65c710dd6e3be80a..467fa2aa8346bb3909698f9135dc8bde924b9799 100644 (file)
@@ -1044,6 +1044,11 @@ int PluginClient::get_use_opengl()
        return server->get_use_opengl();
 }
 
+int PluginClient::to_ram(VFrame *vframe)
+{
+       return server->to_ram(vframe);
+}
+
 int PluginClient::get_total_buffers()
 {
        return total_in_buffers;
index 068f5eace15fa8f3a87a02fa759d2c835d208da6..8abf7666dbf39ea4877a160dc5605e7045027133 100644 (file)
@@ -426,6 +426,7 @@ public:
 // Plugin must call this before performing OpenGL operations.
 // Returns 1 if the user supports opengl buffers.
        int get_use_opengl();
+       int to_ram(VFrame *vframe);
 
 // Get total tracks to process
        int get_total_buffers();
index cf40152a86e6da4312b1b596422c4439ea1394db..a12eaac6245667ea02b45352ecb1f30f75a6176b 100644 (file)
@@ -509,6 +509,8 @@ void PluginServer::process_transition(VFrame *input,
 {
        if( !plugin_open ) return;
        PluginVClient *vclient = (PluginVClient*)client;
+       to_ram(input);
+       to_ram(output);
 
        vclient->source_position = current_position;
        vclient->source_start = 0;
@@ -1002,6 +1004,15 @@ int PluginServer::get_use_opengl()
        return use_opengl;
 }
 
+int PluginServer::to_ram(VFrame *vframe)
+{
+       if( vframe->get_opengl_state() == VFrame::RAM ) return 0;
+       if( !vdevice ) return -1;
+       VDeviceX11 *vdevice_x11 = (VDeviceX11*) vdevice->get_output_base();
+       int vw = vframe->get_w(), vh = vframe->get_h();
+       vdevice_x11->do_camera(vframe, vframe, 0,0,vw,vh, 0,0,vw,vh); // copy to ram
+       return 1;
+}
 
 void PluginServer::run_opengl(PluginClient *plugin_client)
 {
index 296d335b1f403a8b591e22de7f6b8a1c285b4744..f0c8500de5bee094dcebf8bac8671807cfd235ec 100644 (file)
@@ -216,6 +216,7 @@ public:
        void set_use_opengl(int value, VideoDevice *vdevice);
 // Plugin must call this before performing OpenGL operations.
        int get_use_opengl();
+       int to_ram(VFrame *vframe);
 
 // Called from plugin client
 // Returns 1 if a GUI is open so OpenGL routines can determine if
index f773d3eec24bf7a78259f1da0bda17a7d98e3af3..92701bdd3b38056326224b0a704f7b3318210e4c 100644 (file)
@@ -28,6 +28,7 @@
 #include "floatautos.h"
 #include "intauto.h"
 #include "intautos.h"
+#include "mainerror.h"
 #include "mwindow.h"
 #include "module.h"
 #include "panauto.h"
@@ -286,29 +287,29 @@ int VirtualNode::expand_as_plugin(int duplicate)
        return 0;
 }
 
-int VirtualNode::attach_virtual_module(Plugin *plugin,
-       int plugin_number,
-       int duplicate,
-       int64_t current_position)
+int VirtualNode::check_circular(Track *track)
 {
-       if(plugin->on)
-       {
-               int real_module_number = plugin->shared_location.module;
-               Module *real_module = vconsole->module_number(real_module_number);
-// If a track is deleted real_module is not found
-               if(!real_module) return 1;
-
-               Track *track = real_module->track;
+       if( real_module && real_module->track == track ) return 1;
+       return !parent_node ? 0 : parent_node->check_circular(track);
+}
 
+int VirtualNode::attach_virtual_module(Plugin *plugin, int plugin_set_no,
+               int duplicate, int64_t current_position)
+{
+       if( plugin->on ) {
+               int shared_track_no = plugin->shared_location.module;
+               Module *real_module = vconsole->module_number(shared_track_no);
+// If a track is deleted real_module is not found
+               if( !real_module ) return 1;
+               Track *real_track = real_module->track;
 // Switch off if circular reference.  This happens if a track is deleted.
-               if(this->real_module && track == this->real_module->track) return 1;
-
-
-
-
-               VirtualNode *virtual_module = create_module(plugin,
-                       real_module,
-                       track);
+               if( check_circular(real_track) ) {
+                       int plugin_track_no = plugin->track->get_item_number();
+                       eprintf("circular references, track %d, plugin_set %d, plugin %d\n",
+                               plugin_track_no, plugin_set_no, plugin->get_item_number());
+                       return 1;
+               }
+               VirtualNode *virtual_module = create_module(plugin, real_module, real_track);
 
                subnodes.append(virtual_module);
                virtual_module->expand(duplicate, current_position);
index 5a114ed47c8c09f04df6e135f08c243746a879f7..56dc8f75a4ebd5d88522fb3c70cc308d7f0c5a5e 100644 (file)
@@ -76,6 +76,7 @@ public:
                                                        Track *track) { return 0; };
        virtual VirtualNode* create_plugin(Plugin *real_plugin) { return 0; };
 
+       int check_circular(Track *track);
 
 // Called by read_data to get the previous plugin in a parent node's subnode
 // table.