From: Good Guy Date: Sun, 3 Nov 2019 01:12:12 +0000 (-0600) Subject: fix segv for plugin render_gui when plugin moved up/dn, opencv build fixes, opts... X-Git-Tag: 2019-11~10 X-Git-Url: https://cinelerra-gg.org/git/?a=commitdiff_plain;h=076da20a596fe698e1152ce2f3f2d75d2daddec8;p=goodguy%2Fcinelerra.git fix segv for plugin render_gui when plugin moved up/dn, opencv build fixes, opts file tweaks --- diff --git a/cinelerra-5.1/cinelerra/mwindow.C b/cinelerra-5.1/cinelerra/mwindow.C index b074950f..e4e6f837 100644 --- a/cinelerra-5.1/cinelerra/mwindow.C +++ b/cinelerra-5.1/cinelerra/mwindow.C @@ -2635,7 +2635,7 @@ void MWindow::create_objects(int want_gui, if(debug) printf("MWindow::create_objects %d total_time=%d\n", __LINE__, (int)timer.get_difference()); - plugin_guis = new ArrayList; + plugin_guis = new PluginGUIs(this); dead_plugins = new ArrayList; keyframe_threads = new ArrayList; @@ -3171,9 +3171,6 @@ void MWindow::show_keyframe_gui(Plugin *plugin) } - - - void MWindow::show_plugin(Plugin *plugin) { int done = 0; @@ -3429,7 +3426,6 @@ void MWindow::update_plugin_guis(int do_keyframe_guis) } if(!got_it) plugin->show = 0; - plugin = (Plugin*)plugin->next; } } @@ -3445,45 +3441,34 @@ void MWindow::update_plugin_guis(int do_keyframe_guis) int MWindow::plugin_gui_open(Plugin *plugin) { - int result = 0; + int gui_id = plugin->gui_id; + if( gui_id < 0 ) return 0; plugin_gui_lock->lock("MWindow::plugin_gui_open"); - for(int i = 0; i < plugin_guis->total; i++) - { - if(plugin_guis->get(i)->plugin->identical_location(plugin)) - { - result = 1; - break; - } - } + PluginServer *plugin_server = plugin_guis->gui_server(gui_id); + int result = plugin_server ? 1 : 0; plugin_gui_lock->unlock(); return result; } void MWindow::render_plugin_gui(void *data, Plugin *plugin) { + int gui_id = plugin->gui_id; + if( gui_id < 0 ) return; plugin_gui_lock->lock("MWindow::render_plugin_gui"); - for(int i = 0; i < plugin_guis->total; i++) - { - if(plugin_guis->get(i)->plugin->identical_location(plugin)) - { - plugin_guis->get(i)->render_gui(data); - break; - } - } + PluginServer *plugin_server = plugin_guis->gui_server(gui_id); + if( plugin_server ) + plugin_server->render_gui(data); plugin_gui_lock->unlock(); } void MWindow::render_plugin_gui(void *data, int size, Plugin *plugin) { + int gui_id = plugin->gui_id; + if( gui_id < 0 ) return; plugin_gui_lock->lock("MWindow::render_plugin_gui"); - for(int i = 0; i < plugin_guis->total; i++) - { - if(plugin_guis->get(i)->plugin->identical_location(plugin)) - { - plugin_guis->get(i)->render_gui(data, size); - break; - } - } + PluginServer *plugin_server = plugin_guis->gui_server(gui_id); + if( plugin_server ) + plugin_server->render_gui(data, size); plugin_gui_lock->unlock(); } diff --git a/cinelerra-5.1/cinelerra/mwindow.h b/cinelerra-5.1/cinelerra/mwindow.h index 6eb384ce..56415212 100644 --- a/cinelerra-5.1/cinelerra/mwindow.h +++ b/cinelerra-5.1/cinelerra/mwindow.h @@ -599,7 +599,7 @@ public: static ArrayList *plugindb; // Currently visible plugins int64_t plugin_visibility; - ArrayList *plugin_guis; + PluginGUIs *plugin_guis; // GUI Plugins to delete ArrayList *dead_plugins; // Keyframe editors diff --git a/cinelerra-5.1/cinelerra/plugin.C b/cinelerra-5.1/cinelerra/plugin.C index 5890808b..e37e930f 100644 --- a/cinelerra-5.1/cinelerra/plugin.C +++ b/cinelerra-5.1/cinelerra/plugin.C @@ -49,6 +49,7 @@ Plugin::Plugin(EDL *edl, Track *track, const char *title) out = 1; show = 0; on = 1; + gui_id = -1; keyframes = new KeyFrames(edl, track); keyframes->create_objects(); } @@ -66,6 +67,7 @@ Plugin::Plugin(EDL *edl, PluginSet *plugin_set, const char *title) out = 1; show = 0; on = 1; + gui_id = -1; keyframes = new KeyFrames(edl, track); keyframes->create_objects(); } @@ -137,6 +139,7 @@ void Plugin::copy_base(Edit *edit) this->out = plugin->out; this->show = plugin->show; this->on = plugin->on; + this->gui_id = plugin->gui_id; // Should reconfigure this based on where the first track is now. this->shared_location = plugin->shared_location; strcpy(this->title, plugin->title); @@ -295,19 +298,6 @@ int Plugin::identical(Plugin *that) ((KeyFrame*)that->keyframes->default_auto))); } -int Plugin::identical_location(Plugin *that) -{ - if(!plugin_set || !plugin_set->track) return 0; - if(!that->plugin_set || !that->plugin_set->track) return 0; - - if(plugin_set->track->number_of() == that->plugin_set->track->number_of() && - plugin_set->get_number() == that->plugin_set->get_number() && - startproject == that->startproject) return 1; - - return 0; - -} - int Plugin::keyframe_exists(KeyFrame *ptr) { for(KeyFrame *current = (KeyFrame*)keyframes->first; @@ -594,8 +584,8 @@ void Plugin::shift(int64_t difference) void Plugin::dump(FILE *fp) { - fprintf(fp," PLUGIN: type=%d title=\"%s\" on=%d track=%d plugin=%d\n", - plugin_type, title, on, shared_location.module, shared_location.plugin); + fprintf(fp," PLUGIN: type=%d title=\"%s\" on=%d track=%d plugin=%d gui_id=%d\n", + plugin_type, title, on, shared_location.module, shared_location.plugin, gui_id); fprintf(fp," startproject %jd length %jd\n", startproject, length); keyframes->dump(fp); diff --git a/cinelerra-5.1/cinelerra/plugin.h b/cinelerra-5.1/cinelerra/plugin.h index 279a7de6..2a5e696c 100644 --- a/cinelerra-5.1/cinelerra/plugin.h +++ b/cinelerra-5.1/cinelerra/plugin.h @@ -84,9 +84,6 @@ public: // Called by == operators, Edit::equivalent output // to test title and keyframe of transition. virtual int identical(Plugin *that); -// Called by render_gui. Only need the track, position, and pluginset -// to determine a corresponding GUI. - int identical_location(Plugin *that); virtual void synchronize_params(Edit *edit); // Used by Edits::insert_edits and Plugin::shift to shift plugin keyframes void shift_keyframes(int64_t position); @@ -140,7 +137,7 @@ public: int plugin_type; // In and out aren't used anymore. int in, out; - int show, on; + int show, on, gui_id; PluginSet *plugin_set; // Data for the plugin is stored here. Default keyframe always exists. diff --git a/cinelerra-5.1/cinelerra/pluginserver.C b/cinelerra-5.1/cinelerra/pluginserver.C index f3240cea..68724f27 100644 --- a/cinelerra-5.1/cinelerra/pluginserver.C +++ b/cinelerra-5.1/cinelerra/pluginserver.C @@ -80,6 +80,7 @@ void PluginServer::init() modules = new ArrayList; nodes = new ArrayList; tip = 0; + gui_id = -1; } PluginServer::PluginServer() @@ -641,6 +642,32 @@ void PluginServer::process_buffer(Samples **buffer, } +PluginGUIs::PluginGUIs(MWindow *mwindow) +{ + this->mwindow = mwindow; + this->next_id = 0; +} +PluginGUIs::~PluginGUIs() +{ +} + +void PluginGUIs::append(PluginServer *server) +{ + server->gui_id = next_id++; + ArrayList::append(server); +} + +PluginServer *PluginGUIs::gui_server(int gui_id) +{ + for( int i=0; igui_id == gui_id ) + return plugin_server; + } + return 0; +} + + void PluginServer::send_render_gui(void *data) { //printf("PluginServer::send_render_gui 1 %p\n", attachmentpoint); @@ -929,8 +956,11 @@ void PluginServer::raise_window() void PluginServer::show_gui() { if(!plugin_open) return; - if(plugin) client->total_len = plugin->length; - if(plugin) client->source_start = plugin->startproject; + if( plugin ) { + plugin->gui_id = gui_id; + client->total_len = plugin->length; + client->source_start = plugin->startproject; + } if(video) { client->source_position = Units::to_int64( @@ -952,6 +982,7 @@ void PluginServer::show_gui() void PluginServer::hide_gui() { if(!plugin_open) return; + if( plugin ) plugin->gui_id = -1; if(client->defaults) client->save_defaults(); client->hide_gui(); } diff --git a/cinelerra-5.1/cinelerra/pluginserver.h b/cinelerra-5.1/cinelerra/pluginserver.h index 862e22eb..5be37a4b 100644 --- a/cinelerra-5.1/cinelerra/pluginserver.h +++ b/cinelerra-5.1/cinelerra/pluginserver.h @@ -74,6 +74,18 @@ public: ~PluginObj() { if( dlobj ) unload(dlobj); } }; +class PluginGUIs : public ArrayList +{ + int next_id; + MWindow *mwindow; +public: + PluginGUIs(MWindow *mwindow); + ~PluginGUIs(); + + void append(PluginServer *server); + PluginServer *gui_server(int gui_id); +}; + class PluginServer { PluginObj *plugin_obj; @@ -419,7 +431,7 @@ public: EDL *edl; Preferences *preferences; MenuEffectPrompt *prompt; - int gui_on; + int gui_on, gui_id; VFrame *temp_frame; diff --git a/cinelerra-5.1/cinelerra/pluginserver.inc b/cinelerra-5.1/cinelerra/pluginserver.inc index 8a93cca0..a0613770 100644 --- a/cinelerra-5.1/cinelerra/pluginserver.inc +++ b/cinelerra-5.1/cinelerra/pluginserver.inc @@ -23,6 +23,7 @@ #define PLUGINSERVER_INC class PluginObj; +class PluginGUIs; class PluginServer; #define PLUGIN_FFMPEG_ID 0 diff --git a/cinelerra-5.1/ffmpeg/video/dvd.dvd b/cinelerra-5.1/ffmpeg/video/dvd.dvd index a5a9ceec..c0296bff 100644 Binary files a/cinelerra-5.1/ffmpeg/video/dvd.dvd and b/cinelerra-5.1/ffmpeg/video/dvd.dvd differ diff --git a/cinelerra-5.1/ffmpeg/video/huffyuv_screencapture.mov b/cinelerra-5.1/ffmpeg/video/huffyuv_screencapture.mov index b0f201d7..ec4951c7 100644 --- a/cinelerra-5.1/ffmpeg/video/huffyuv_screencapture.mov +++ b/cinelerra-5.1/ffmpeg/video/huffyuv_screencapture.mov @@ -1,5 +1,4 @@ mov huffyuv #probesize=100M #thread_queue_size=512 -#pix_fmt=bgra pixel_format=bgra diff --git a/cinelerra-5.1/ffmpeg/video/raw.dvd b/cinelerra-5.1/ffmpeg/video/raw.dvd index a86f0769..f5eeca95 100644 Binary files a/cinelerra-5.1/ffmpeg/video/raw.dvd and b/cinelerra-5.1/ffmpeg/video/raw.dvd differ diff --git a/cinelerra-5.1/opencv_build b/cinelerra-5.1/opencv_build index 20d6ea16..68771bc6 100644 --- a/cinelerra-5.1/opencv_build +++ b/cinelerra-5.1/opencv_build @@ -47,7 +47,7 @@ cpus:=$(shell grep -c "^proc" /proc/cpuinfo) jobs:=-j$(shell echo $$(($(cpus) + $(cpus)/2 +2))) #opencv4 breaks SIFT/SURF findobj -#CFLAGS += -I$(opencv_prefix)/include/opencv4 +CFLAGS += -I$(opencv_prefix)/include/opencv4 CFLAGS += -I$(opencv_prefix)/include ifeq ($(src),git) @@ -87,7 +87,7 @@ $(opencv)/build: $(opencv).src LFLAGS += -Wl,--start-group LFLAGS += $(shell find $(opencv_prefix)/lib* -name "libopencv_*.a" 2> /dev/null) #opencv4 breaks SIFT/SURF findobj -#LFLAGS += $(shell find $(opencv_prefix)/lib64/opencv4/3rdparty/lib* -name "lib*.a" 2> /dev/null) +LFLAGS += $(shell find $(opencv_prefix)/lib64/opencv4/3rdparty/lib* -name "lib*.a" 2> /dev/null) LFLAGS += $(shell find $(opencv_prefix)/share/OpenCV/3rdparty/lib* -name "lib*.a" 2> /dev/null) LFLAGS += -Wl,--end-group else ifeq ($(bld),dyn) @@ -106,7 +106,7 @@ $(opencv)/build: $(opencv).src -DOPENCV_EXTRA_MODULES_PATH="$(opencv)_contrib/modules/" SYSLIB := $(lastword $(wildcard /usr/lib /usrlib32 /usr/lib64)) -CVLIBS := $(dir (shell find $(opencv_prefix) -name libopencv_core.a)) +CVLIBS := $(dir $(shell find $(opencv_prefix) -name libopencv_core.so)) LFLAGS += -L$(CVLIBS) $(patsubst $(CVLIBS)/lib%.so,-l%,$(wildcard $(CVLIBS)/libopencv_*.so)) LFLAGS += $(patsubst $(SYSLIB)/lib%.so,-l%,$(wildcard $(SYSLIB)/lib{Half,Imath,Ilm,Iex}*.so)) static_libs := @@ -119,6 +119,7 @@ LFLAGS += $(patsubst $(SYSLIB)/lib%.so,-l%,$(wildcard $(SYSLIB)/libopencv_*.so)) LFLAGS += $(patsubst $(SYSLIB)/lib%.so,-l%,$(wildcard $(SYSLIB)/lib{Half,Imath,Ilm,Iex}*.so)) static_libs := static_incs := +CFLAGS += -I/usr/include/opencv4 else $(error bld not sta/dyn/sys) endif