patch 005 more WIP but at least it seems to look into selected folder in addition to default plugin dir...
other patches just my attempt at fixing few cppcheck errs/warnings and more space/time savings in libaom build (but if you want to have aomdec/aomenc in thirdparty/libaom you probably do not want this patch) On Monday, October 11, 2021, Andrew Randrianasulu <[email protected]> wrote: > Basically just monkeying around (it does not do anything with local plugin > set) but I can try and push this a bit more so it will actually search > plugins in second location > > I think main idea was to allow 'favorities' set of plugins somewhere in > user dir, if user can't change stuff in /usr. Today Cingg can look in > dufferent places for plugins depending on env. variables, still gui might > be handy for some users. > > Also, it show how to add new category in oreferences, so we can offload > few things into new tab in the future (or just add them there) >
From 0bc1ce71b5b16f78299118786576ec6f2819cc8b Mon Sep 17 00:00:00 2001 From: Andrew Randrianasulu <[email protected]> Date: Mon, 11 Oct 2021 11:53:51 +0300 Subject: [PATCH 1/6] Initialize more in vrender.C constructor (cppcheck) --- cinelerra-5.1/cinelerra/vrender.C | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cinelerra-5.1/cinelerra/vrender.C b/cinelerra-5.1/cinelerra/vrender.C index be3d0c3b..03b1421d 100644 --- a/cinelerra-5.1/cinelerra/vrender.C +++ b/cinelerra-5.1/cinelerra/vrender.C @@ -70,6 +70,11 @@ VRender::VRender(RenderEngine *renderengine) asynchronous = 0; // render 1 frame at a time framerate_counter = 0; video_out = 0; + track_w = track_h = 0; + output_w = output_h = 0; + first_frame = 0; + output_offset = 0; + source_length = 0; render_strategy = -1; } -- 2.33.0
From 72f59dcffe5f741facb30827c798fb1999ae9b9b Mon Sep 17 00:00:00 2001 From: Andrew Randrianasulu <[email protected]> Date: Mon, 11 Oct 2021 12:04:24 +0300 Subject: [PATCH 5/6] WIP: reconnect/fix local plugin dir setting --- cinelerra-5.1/cinelerra/Makefile | 1 + cinelerra-5.1/cinelerra/mwindow.C | 51 +++++++++++++++++++++ cinelerra-5.1/cinelerra/mwindow.inc | 1 + cinelerra-5.1/cinelerra/pluginprefs.C | 19 ++++---- cinelerra-5.1/cinelerra/pluginprefs.h | 1 + cinelerra-5.1/cinelerra/preferences.C | 5 ++ cinelerra-5.1/cinelerra/preferences.h | 1 + cinelerra-5.1/cinelerra/preferences.inc | 1 + cinelerra-5.1/cinelerra/preferencesthread.C | 7 +++ cinelerra-5.1/cinelerra/preferencesthread.h | 3 +- 10 files changed, 81 insertions(+), 9 deletions(-) diff --git a/cinelerra-5.1/cinelerra/Makefile b/cinelerra-5.1/cinelerra/Makefile index c660ee37..cd4df41b 100644 --- a/cinelerra-5.1/cinelerra/Makefile +++ b/cinelerra-5.1/cinelerra/Makefile @@ -252,6 +252,7 @@ OBJS := $(OVERLAYS) \ $(OBJDIR)/pluginlv2client.o \ $(OBJDIR)/pluginlv2gui.o \ $(OBJDIR)/plugin.o \ + $(OBJDIR)/pluginprefs.o \ $(OBJDIR)/pluginpopup.o \ $(OBJDIR)/pluginserver.o \ $(OBJDIR)/pluginset.o \ diff --git a/cinelerra-5.1/cinelerra/mwindow.C b/cinelerra-5.1/cinelerra/mwindow.C index b0e064ed..1bcab625 100644 --- a/cinelerra-5.1/cinelerra/mwindow.C +++ b/cinelerra-5.1/cinelerra/mwindow.C @@ -653,15 +653,29 @@ int MWindow::init_plugins(MWindow *mwindow, Preferences *preferences) plugindb = new ArrayList<PluginServer*>; init_ffmpeg(); char index_path[BCTEXTLEN], plugin_path[BCTEXTLEN]; + char index_path1[BCTEXTLEN], local_plugin_path[BCTEXTLEN]; create_defaults_path(index_path, PLUGIN_FILE); + create_defaults_path(index_path1, LOCAL_PLUGIN_FILE); char *plugin_dir = FileSystem::basepath(preferences->plugin_dir); strcpy(plugin_path, plugin_dir); delete [] plugin_dir; + char *local_plugin_dir = FileSystem::basepath(preferences->local_plugin_dir); + strcpy(local_plugin_path, local_plugin_dir); delete [] local_plugin_dir; + FILE *fp = fopen(index_path,"a+"); if( !fp ) { fprintf(stderr,_("MWindow::init_plugins: " "can't open plugin index: %s\n"), index_path); return -1; } + + FILE *fp1 = fopen(index_path1,"a+"); + if( !fp1 ) { + fprintf(stderr,_("MWindow::init_plugins: " + "can't open plugin index: %s\n"), index_path1); + return -1; + } + + int fd = fileno(fp), ret = -1; if( !flock(fd, LOCK_EX) ) { fseek(fp, 0, SEEK_SET); @@ -670,12 +684,16 @@ int MWindow::init_plugins(MWindow *mwindow, Preferences *preferences) if( ret > 0 ) { ftruncate(fd, 0); fseek(fp, 0, SEEK_SET); + + printf("init plugin index: %s\n", plugin_path); fprintf(fp, "%d\n", PLUGIN_FILE_VERSION); fprintf(fp, "%s\n", plugin_path); init_plugin_index(mwindow, preferences, fp, plugin_path); + init_ffmpeg_index(mwindow, preferences, fp); init_lv2_index(mwindow, preferences, fp); + fseek(fp, 0, SEEK_SET); ret = load_plugin_index(mwindow, fp, plugin_path); } @@ -684,6 +702,36 @@ int MWindow::init_plugins(MWindow *mwindow, Preferences *preferences) "can't %s plugin index: %s\n"), ret>0 ? _("create") : _("lock"), index_path); } + + + int fd1 = fileno(fp1), ret1 = -1; + if( !flock(fd1, LOCK_EX) ) { + fseek(fp1, 0, SEEK_SET); + ret1 = load_plugin_index(mwindow, fp1, plugin_path); + } + if( ret1 > 0 ) { + ftruncate(fd1, 0); + fseek(fp1, 0, SEEK_SET); + + + printf("init plugin index: %s\n", local_plugin_path); + fprintf(fp1, "%d\n", PLUGIN_FILE_VERSION); + fprintf(fp1, "%s\n", local_plugin_path); + init_plugin_index(mwindow, preferences, fp1, local_plugin_path); + + fseek(fp1, 0, SEEK_SET); + ret1 = load_plugin_index(mwindow, fp1, local_plugin_path); + } + if( ret1 ) { + fprintf(stderr,_("MWindow::init_plugins: " + "can't %s plugin index: %s\n"), + ret>0 ? _("create") : _("lock"), index_path1); + } + + + + + fclose(fp1); fclose(fp); return ret; } @@ -961,6 +1009,9 @@ void MWindow::remove_plugin_index() char index_path[BCTEXTLEN]; MWindow::create_defaults_path(index_path, PLUGIN_FILE); ::remove(index_path); + MWindow::create_defaults_path(index_path, LOCAL_PLUGIN_FILE); + ::remove(index_path); + } void MWindow::init_preferences() diff --git a/cinelerra-5.1/cinelerra/mwindow.inc b/cinelerra-5.1/cinelerra/mwindow.inc index f1847175..409f4d00 100644 --- a/cinelerra-5.1/cinelerra/mwindow.inc +++ b/cinelerra-5.1/cinelerra/mwindow.inc @@ -35,6 +35,7 @@ #define FACTORY_FILE "Cinelerra_factory" #define PICTURE_FILE "Cinelerra_picture" #define PLUGIN_FILE "Cinelerra_plugins" +#define LOCAL_PLUGIN_FILE "Cinelerra_local_plugins" #define LADSPA_FILE "ladspa_plugins." #define PLUGIN_FILE_VERSION 4 diff --git a/cinelerra-5.1/cinelerra/pluginprefs.C b/cinelerra-5.1/cinelerra/pluginprefs.C index 2a3f7878..9bb52423 100644 --- a/cinelerra-5.1/cinelerra/pluginprefs.C +++ b/cinelerra-5.1/cinelerra/pluginprefs.C @@ -19,6 +19,7 @@ * */ +#include "mwindow.h" #include "pluginprefs.h" #include "preferences.h" #include <string.h> @@ -45,7 +46,7 @@ PluginPrefs::~PluginPrefs() void PluginPrefs::create_objects() { - char string[1024]; + char string[BCTEXTLEN]; int xs5 = xS(5), xs10 = xS(10), xs20 = xS(20), xs30 = xS(30); int ys5 = yS(5), ys10 = yS(10), ys20 = yS(20), ys30 = yS(30); int x = xs5, y = ys5; @@ -57,13 +58,13 @@ void PluginPrefs::create_objects() // get_resources()->get_bg_light1()); add_subwindow(new BC_Title(x, y, _("Plugin Set"), LARGEFONT, BLACK)); - y += ys35; + y += ys30; add_subwindow(new BC_Title(x, y, _("Look for global plugins here"), MEDIUMFONT, BLACK)); y += ys20; add_subwindow(ipathtext = new PluginGlobalPathText(x, y, - pwindow, pwindow->thread->preferences->global_plugin_dir)); - add_subwindow(ipath = new BrowseButton(mwindow, this, ipathtext, - xS(215), y, pwindow->thread->preferences->global_plugin_dir, + pwindow, pwindow->thread->preferences->plugin_dir)); + add_subwindow(ipath = new BrowseButton(mwindow->theme, this, ipathtext, + xS(215), y, pwindow->thread->preferences->plugin_dir, _("Global Plugin Path"), _("Select the directory for plugins"), 1)); @@ -72,7 +73,7 @@ void PluginPrefs::create_objects() y += 20; add_subwindow(lpathtext = new PluginLocalPathText(x, y, pwindow, pwindow->thread->preferences->local_plugin_dir)); - add_subwindow(lpath = new BrowseButton(mwindow, this, lpathtext, + add_subwindow(lpath = new BrowseButton(mwindow->theme, this, lpathtext, xS(215), y, pwindow->thread->preferences->local_plugin_dir, _("Personal Plugin Path"), _("Select the directory for plugins"), 1)); @@ -92,7 +93,8 @@ PluginGlobalPathText::~PluginGlobalPathText() {} int PluginGlobalPathText::handle_event() { - strcpy(pwindow->thread->preferences->global_plugin_dir, get_text()); + strcpy(pwindow->thread->preferences->plugin_dir, get_text()); + return 1; } @@ -100,7 +102,7 @@ int PluginGlobalPathText::handle_event() PluginLocalPathText::PluginLocalPathText(int x, int y, PreferencesWindow *pwindow, char *text) - : BC_TextBox(x, y, xs(200), 1, text) + : BC_TextBox(x, y, xS(200), 1, text) { this->pwindow = pwindow; } @@ -110,4 +112,5 @@ PluginLocalPathText::~PluginLocalPathText() {} int PluginLocalPathText::handle_event() { strcpy(pwindow->thread->preferences->local_plugin_dir, get_text()); + return 1; } diff --git a/cinelerra-5.1/cinelerra/pluginprefs.h b/cinelerra-5.1/cinelerra/pluginprefs.h index a6f46032..6cb96787 100644 --- a/cinelerra-5.1/cinelerra/pluginprefs.h +++ b/cinelerra-5.1/cinelerra/pluginprefs.h @@ -28,6 +28,7 @@ class PluginLocalPathText; #include "browsebutton.h" #include "preferencesthread.h" + class PluginPrefs : public PreferencesDialog { public: diff --git a/cinelerra-5.1/cinelerra/preferences.C b/cinelerra-5.1/cinelerra/preferences.C index 2b8d84bd..d2abdcc1 100644 --- a/cinelerra-5.1/cinelerra/preferences.C +++ b/cinelerra-5.1/cinelerra/preferences.C @@ -66,6 +66,7 @@ Preferences::Preferences() keyframe_reticle = HAIRLINE_DRAGGING; perpetual_session = 0; strcpy(lv2_path, DEFAULT_LV2_PATH); + strcpy(local_plugin_dir, DEFAULT_LOCAL_PLUG_PATH); strcpy(nested_proxy_path, DEFAULT_NESTED_PROXY_PATH); autostart_lv2ui = 0; trap_sigsegv = 1; @@ -219,6 +220,7 @@ void Preferences::copy_from(Preferences *that) project_smp = that->project_smp; force_uniprocessor = that->force_uniprocessor; strcpy(lv2_path, that->lv2_path); + strcpy(local_plugin_dir, that->local_plugin_dir); autostart_lv2ui = that->autostart_lv2ui; strcpy(nested_proxy_path, that->nested_proxy_path); trap_sigsegv = that->trap_sigsegv; @@ -350,6 +352,8 @@ int Preferences::load_defaults(BC_Hash *defaults) perpetual_session = defaults->get("PERPETUAL_SESSION", perpetual_session); strcpy(lv2_path, DEFAULT_LV2_PATH); defaults->get("LV2_PATH", lv2_path); + strcpy(local_plugin_dir, DEFAULT_LOCAL_PLUG_PATH); + defaults->get("LOCAL_PLUGIN_DIR", local_plugin_dir); autostart_lv2ui = defaults->get("AUTOSTART_LV2UI", autostart_lv2ui); strcpy(nested_proxy_path, DEFAULT_NESTED_PROXY_PATH); defaults->get("NESTED_PROXY_PATH", nested_proxy_path); @@ -515,6 +519,7 @@ int Preferences::save_defaults(BC_Hash *defaults) defaults->update("KEYFRAME_RETICLE", keyframe_reticle); defaults->update("PERPETUAL_SESSION", perpetual_session); defaults->update("LV2_PATH", lv2_path); + defaults->update("LOCAL_PLUGIN_DIR", local_plugin_dir); defaults->update("AUTOSTART_LV2UI", autostart_lv2ui); defaults->update("NESTED_PROXY_PATH", nested_proxy_path); defaults->update("TRAP_SIGSEGV", trap_sigsegv); diff --git a/cinelerra-5.1/cinelerra/preferences.h b/cinelerra-5.1/cinelerra/preferences.h index 4f743975..d41865cb 100644 --- a/cinelerra-5.1/cinelerra/preferences.h +++ b/cinelerra-5.1/cinelerra/preferences.h @@ -199,6 +199,7 @@ public: // ====================================== Plugin Set ============================== char plugin_dir[BCTEXTLEN]; + char local_plugin_dir[BCTEXTLEN]; char lv2_path[BCTEXTLEN]; int autostart_lv2ui; char nested_proxy_path[BCTEXTLEN]; diff --git a/cinelerra-5.1/cinelerra/preferences.inc b/cinelerra-5.1/cinelerra/preferences.inc index f941c1b8..9c6cd982 100644 --- a/cinelerra-5.1/cinelerra/preferences.inc +++ b/cinelerra-5.1/cinelerra/preferences.inc @@ -33,6 +33,7 @@ #define DEFAULT_LOCALE "sys" #define LOCALE_LIST DEFAULT_LOCALE, "en", "fr", "de", "ru", "es", "it", "nb" #define DEFAULT_LV2_PATH CINDAT_DIR "/lv2" +#define DEFAULT_LOCAL_PLUG_PATH CINDAT_DIR "cingg" #define DEFAULT_NESTED_PROXY_PATH NESTED_DIR #define DEFAULT_SNAPSHOT_PATH SNAP_DIR #define FFMPEG_EARLY_TIP _("Currently: Try FFMpeg first\n Click to: Try FFMpeg last") diff --git a/cinelerra-5.1/cinelerra/preferencesthread.C b/cinelerra-5.1/cinelerra/preferencesthread.C index 3ca281e5..95691aa7 100644 --- a/cinelerra-5.1/cinelerra/preferencesthread.C +++ b/cinelerra-5.1/cinelerra/preferencesthread.C @@ -51,6 +51,7 @@ #include "performanceprefs.h" #include "playbackengine.h" #include "playbackprefs.h" +#include "pluginprefs.h" #include "preferences.h" #include "record.h" #include "recordprefs.h" @@ -407,6 +408,8 @@ const char* PreferencesThread::category_to_text(int category) return _("Interface"); case APPEARANCE: return _("Appearance"); + case PLUGINPREF: + return _("Plugin set"); case ABOUT: return _("About"); } @@ -585,6 +588,10 @@ int PreferencesWindow::set_current_dialog(int number) case PreferencesThread::APPEARANCE: add_subwindow(dialog = new AppearancePrefs(mwindow, this)); break; + + case PreferencesThread::PLUGINPREF: + add_subwindow(dialog = new PluginPrefs(mwindow, this)); + break; case PreferencesThread::ABOUT: add_subwindow(dialog = new AboutPrefs(mwindow, this)); diff --git a/cinelerra-5.1/cinelerra/preferencesthread.h b/cinelerra-5.1/cinelerra/preferencesthread.h index 653199b6..4070b8df 100644 --- a/cinelerra-5.1/cinelerra/preferencesthread.h +++ b/cinelerra-5.1/cinelerra/preferencesthread.h @@ -79,7 +79,7 @@ public: EDL *edl; // Categories -#define CATEGORIES 7 +#define CATEGORIES 8 enum { PLAYBACK_A, @@ -88,6 +88,7 @@ public: PERFORMANCE, INTERFACE, APPEARANCE, + PLUGINPREF, ABOUT }; }; -- 2.33.0
From 7b2047f6c4c81b70194b03a590bf1fc7af9a21c2 Mon Sep 17 00:00:00 2001 From: Andrew Randrianasulu <[email protected]> Date: Mon, 11 Oct 2021 11:56:05 +0300 Subject: [PATCH 3/6] cppcheck in cursor.C --- cinelerra-5.1/cinelerra/cursor.C | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cinelerra-5.1/cinelerra/cursor.C b/cinelerra-5.1/cinelerra/cursor.C index b392dda1..87f932bb 100644 --- a/cinelerra-5.1/cinelerra/cursor.C +++ b/cinelerra-5.1/cinelerra/cursor.C @@ -51,6 +51,7 @@ return 0; int Cursor_::draw(int flash, long selectionstart, long selectionend, long zoom_sample, long viewstart, int vertical) { return 0; +#if 0 if(canvas->get_h() * canvas->get_w() == 0) return 1; if(zoom_sample == 0) return 1; // no canvas @@ -93,6 +94,7 @@ return 0; canvas->set_opaque(); } if(flash) canvas->flash(); +#endif } int Cursor_::resize(int w, int h) -- 2.33.0
From f1786bc09e29c87bddd55f45bfa88cc1f1682d65 Mon Sep 17 00:00:00 2001 From: Andrew Randrianasulu <[email protected]> Date: Mon, 11 Oct 2021 11:55:08 +0300 Subject: [PATCH 2/6] mem and resource leaks in indexfile/indextate (cppcheck) --- cinelerra-5.1/cinelerra/indexfile.C | 3 ++- cinelerra-5.1/cinelerra/indexstate.C | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/cinelerra-5.1/cinelerra/indexfile.C b/cinelerra-5.1/cinelerra/indexfile.C index 977ad1cb..2e1b0c73 100644 --- a/cinelerra-5.1/cinelerra/indexfile.C +++ b/cinelerra-5.1/cinelerra/indexfile.C @@ -859,7 +859,8 @@ int IndexFile::read_info(Indexable *test_indexable) data = new char[index_state->index_start]; temp = fread(data, index_state->index_start - sizeof(int64_t), 1, fd); - if(!temp) return 1; + if(!temp) { delete [] data; + return 1;} data[index_state->index_start - sizeof(int64_t)] = 0; FileXML xml; diff --git a/cinelerra-5.1/cinelerra/indexstate.C b/cinelerra-5.1/cinelerra/indexstate.C index 803c4f0b..87d907a1 100644 --- a/cinelerra-5.1/cinelerra/indexstate.C +++ b/cinelerra-5.1/cinelerra/indexstate.C @@ -304,6 +304,7 @@ int IndexState::read_markers(char *index_dir, char *file_path) if( memcmp(version, MARKER_MAGIC_VERSION, vsz) ) { eprintf(_("IndexState::read_markers marker file version mismatched\n: %s\n"), marker_path); + fclose(fp); return 1; } ret = read_marks(fp); -- 2.33.0
From a629f9a62e81132ca2790afbf22a1bffe1a8a775 Mon Sep 17 00:00:00 2001 From: Andrew Randrianasulu <[email protected]> Date: Mon, 11 Oct 2021 12:05:38 +0300 Subject: [PATCH 6/6] libaom disable all examples --- cinelerra-5.1/thirdparty/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cinelerra-5.1/thirdparty/Makefile b/cinelerra-5.1/thirdparty/Makefile index 5e1a1c63..63adb5be 100644 --- a/cinelerra-5.1/thirdparty/Makefile +++ b/cinelerra-5.1/thirdparty/Makefile @@ -201,7 +201,7 @@ lame.cfg_params?=--enable-shared=no lame.mak_params?= ; cd $(call bld_path,lame,include); ln -sf . lame libaom.cfg_vars?= mkdir aom.build && cd aom.build && $(call cmake_config,..) libaom.cfg_params?= -DENABLE_TESTS=no -DCMAKE_BUILD_TYPE=Release -DENABLE_DOCS=no -DENABLE_SHARED=no -DCMAKE_INSTALL_LIBDIR=lib \ - -DCMAKE_INSTALL_PREFIX=$(call bld_path,libaom)/usr/local + -DENABLE_EXAMPLES=no -DCMAKE_INSTALL_PREFIX=$(call bld_path,libaom)/usr/local libaom.mak_params?= ; $(MAKE) -C libaom*/aom.build install dav1d.cfg_vars?=echo "echo dav1d custom make" >> configure; chmod +x ./configure; dav1d.mak_params?=; $(MAKE) -C dav1d* install DESTDIR="$(call bld_path,dav1d)" -- 2.33.0
From 2e4eb6959dd8360816ad28559b4f0ef6036ae54c Mon Sep 17 00:00:00 2001 From: Andrew Randrianasulu <[email protected]> Date: Mon, 11 Oct 2021 11:56:57 +0300 Subject: [PATCH 4/6] cppcheck in resourcepixmap.C --- cinelerra-5.1/cinelerra/resourcepixmap.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cinelerra-5.1/cinelerra/resourcepixmap.C b/cinelerra-5.1/cinelerra/resourcepixmap.C index 1406dd2d..5b5a12f8 100644 --- a/cinelerra-5.1/cinelerra/resourcepixmap.C +++ b/cinelerra-5.1/cinelerra/resourcepixmap.C @@ -238,7 +238,7 @@ VFrame *ResourcePixmap::change_title_color(VFrame *title_bg, int color) c.r = color>>16; c.g = color>>8; c.b = color>>0; c.a = 0xff; if( BC_CModels::has_alpha(colormodel) && // fast path BC_CModels::calculate_pixelsize(colormodel) == sizeof(unsigned) ) { - const unsigned gap_rgba = (0xff<<24) | + const unsigned gap_rgba = ((uint32_t)(0xff)<<24) | (gap_grey<<16) | (gap_grey<<8) | (gap_grey<<0); if( th > 0 ) { unsigned *bp = (unsigned *)bar_rows[0]; -- 2.33.0
-- Cin mailing list [email protected] https://lists.cinelerra-gg.org/mailman/listinfo/cin

