From: Good Guy Date: Tue, 5 May 2020 02:03:48 +0000 (-0600) Subject: fix transition at media start in opengl, fix circular shared tracks X-Git-Tag: 2020-05~11 X-Git-Url: https://cinelerra-gg.org/git/?a=commitdiff_plain;h=9782ed720c4e992ed0427de68c6646720c9b44e4;p=goodguy%2Fcinelerra.git fix transition at media start in opengl, fix circular shared tracks --- diff --git a/cinelerra-5.1/cinelerra/pluginclient.C b/cinelerra-5.1/cinelerra/pluginclient.C index d5a9b0c8..467fa2aa 100644 --- a/cinelerra-5.1/cinelerra/pluginclient.C +++ b/cinelerra-5.1/cinelerra/pluginclient.C @@ -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; diff --git a/cinelerra-5.1/cinelerra/pluginclient.h b/cinelerra-5.1/cinelerra/pluginclient.h index 068f5eac..8abf7666 100644 --- a/cinelerra-5.1/cinelerra/pluginclient.h +++ b/cinelerra-5.1/cinelerra/pluginclient.h @@ -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(); diff --git a/cinelerra-5.1/cinelerra/pluginserver.C b/cinelerra-5.1/cinelerra/pluginserver.C index cf40152a..a12eaac6 100644 --- a/cinelerra-5.1/cinelerra/pluginserver.C +++ b/cinelerra-5.1/cinelerra/pluginserver.C @@ -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) { diff --git a/cinelerra-5.1/cinelerra/pluginserver.h b/cinelerra-5.1/cinelerra/pluginserver.h index 296d335b..f0c8500d 100644 --- a/cinelerra-5.1/cinelerra/pluginserver.h +++ b/cinelerra-5.1/cinelerra/pluginserver.h @@ -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 diff --git a/cinelerra-5.1/cinelerra/virtualnode.C b/cinelerra-5.1/cinelerra/virtualnode.C index f773d3ee..92701bdd 100644 --- a/cinelerra-5.1/cinelerra/virtualnode.C +++ b/cinelerra-5.1/cinelerra/virtualnode.C @@ -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); diff --git a/cinelerra-5.1/cinelerra/virtualnode.h b/cinelerra-5.1/cinelerra/virtualnode.h index 5a114ed4..56dc8f75 100644 --- a/cinelerra-5.1/cinelerra/virtualnode.h +++ b/cinelerra-5.1/cinelerra/virtualnode.h @@ -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.