From: Good Guy Date: Mon, 13 Jan 2020 01:25:10 +0000 (-0700) Subject: add nested proxy path, rework perpetual session load/save strategy, build cleanups X-Git-Tag: 2020-01~7 X-Git-Url: https://cinelerra-gg.org/git/?a=commitdiff_plain;h=dcaa99e024dc4eac8e22e94ca6c0a92d67570478;p=goodguy%2Fcinelerra.git add nested proxy path, rework perpetual session load/save strategy, build cleanups --- diff --git a/cinelerra-5.1/cinelerra/interfaceprefs.C b/cinelerra-5.1/cinelerra/interfaceprefs.C index 9a861e68..593927e2 100644 --- a/cinelerra-5.1/cinelerra/interfaceprefs.C +++ b/cinelerra-5.1/cinelerra/interfaceprefs.C @@ -62,7 +62,7 @@ InterfacePrefs::~InterfacePrefs() void InterfacePrefs::create_objects() { int xs4 = xS(4), xs5 = xS(5), xs10 = xS(10), xs30 = xS(30); - int ys5 = yS(5), ys10 = yS(10), ys20 = yS(20), ys30 = yS(30), ys35 = yS(35); + int ys5 = yS(5), ys10 = yS(10), ys30 = yS(30), ys35 = yS(35); BC_Resources *resources = BC_WindowBase::get_resources(); int margin = mwindow->theme->widget_border; char string[BCTEXTLEN]; @@ -130,26 +130,35 @@ void InterfacePrefs::create_objects() AndroidRemote *android_remote = new AndroidRemote(pwindow, x2, y); add_subwindow(android_remote); y += android_remote->get_h() + ys10; - add_subwindow(title = new BC_Title(x2, y, _("Port:"))); - int x3 = x2 + title->get_w() + margin; + int x3 = x2; + add_subwindow(title = new BC_Title(x3, y, _("Port:"))); + x3 += title->get_w() + margin; AndroidPort *android_port = new AndroidPort(pwindow, x3, y); add_subwindow(android_port); - y += title->get_h() + ys10; - add_subwindow(title = new BC_Title(x2, y, _("PIN:"))); + x3 += android_port->get_w() + 2*margin; + add_subwindow(title = new BC_Title(x3, y, _("PIN:"))); + x3 += title->get_w() + margin; AndroidPIN *android_pin = new AndroidPIN(pwindow, x3, y); add_subwindow(android_pin); - y += title->get_h() + ys20; + y += android_port->get_h() + 3*margin; ShBtnPrefs *shbtn_prefs = new ShBtnPrefs(pwindow, this, x2, y); add_subwindow(shbtn_prefs); - y += shbtn_prefs->get_h() + ys20; + x3 = x2 + shbtn_prefs->get_w() + 2*margin; + add_subwindow(reload_plugins = new PrefsReloadPlugins(pwindow, this, x3, y)); + y += reload_plugins->get_h() + 3*margin; - add_subwindow(reload_plugins = new PrefsReloadPlugins(pwindow, this, x2, y)); - y += reload_plugins->get_h() + ys10; + add_subwindow(title = new BC_Title(x2, y, _("Nested Proxy Path:"))); + y += title->get_h() + ys10; + PrefsNestedProxyPath *nested_proxy_path = new PrefsNestedProxyPath(pwindow, this, + x2, y, get_w()-x2-xs30); + add_subwindow(nested_proxy_path); + y += xs30; add_subwindow(title = new BC_Title(x2, y, _("Default LV2_PATH:"))); y += title->get_h() + ys10; - PrefsLV2PathText *lv2_path_text = new PrefsLV2PathText(pwindow, this, x2, y, get_w()-x2-xs30); + PrefsLV2PathText *lv2_path_text = new PrefsLV2PathText(pwindow, this, + x2, y, get_w()-x2-xs30); add_subwindow(lv2_path_text); y += xs30; @@ -422,7 +431,7 @@ int AndroidRemote::handle_event() } AndroidPIN::AndroidPIN(PreferencesWindow *pwindow, int x, int y) - : BC_TextBox(x, y, xS(240), 1, pwindow->thread->preferences->android_pin) + : BC_TextBox(x, y, xS(180), 1, pwindow->thread->preferences->android_pin) { this->pwindow = pwindow; } @@ -685,3 +694,21 @@ int PrefsLV2PathText::handle_event() return 1; } +PrefsNestedProxyPath::PrefsNestedProxyPath(PreferencesWindow *pwindow, + InterfacePrefs *subwindow, int x, int y, int w) + : BC_TextBox(x, y, w, 1, pwindow->thread->preferences->nested_proxy_path) +{ + this->pwindow = pwindow; + this->subwindow = subwindow; +} + +PrefsNestedProxyPath::~PrefsNestedProxyPath() +{ +} + +int PrefsNestedProxyPath::handle_event() +{ + strcpy(pwindow->thread->preferences->nested_proxy_path, get_text()); + return 1; +} + diff --git a/cinelerra-5.1/cinelerra/interfaceprefs.h b/cinelerra-5.1/cinelerra/interfaceprefs.h index 7a890fb9..5813fe65 100644 --- a/cinelerra-5.1/cinelerra/interfaceprefs.h +++ b/cinelerra-5.1/cinelerra/interfaceprefs.h @@ -308,6 +308,18 @@ public: InterfacePrefs *subwindow; }; +class PrefsNestedProxyPath : public BC_TextBox +{ +public: + PrefsNestedProxyPath(PreferencesWindow *pwindow, + InterfacePrefs *subwindow, int x, int y, int w); + ~PrefsNestedProxyPath(); + + int handle_event(); + PreferencesWindow *pwindow; + InterfacePrefs *subwindow; +}; + class PrefsReloadPlugins : public BC_GenericButton { public: diff --git a/cinelerra-5.1/cinelerra/main.C b/cinelerra-5.1/cinelerra/main.C index 42207c55..8a4815f9 100644 --- a/cinelerra-5.1/cinelerra/main.C +++ b/cinelerra-5.1/cinelerra/main.C @@ -363,7 +363,7 @@ int main(int argc, char *argv[]) MWindow mwindow; mwindow.create_objects(1, !filenames.total, config_path); CommandLineThread *thread = 0; - if( mwindow.preferences->perpetual_session && load_perpetual ) + if( load_perpetual ) mwindow.load_undo_data(); //SET_TRACE // load the initial files on seperate tracks @@ -399,8 +399,7 @@ int main(int argc, char *argv[]) done = 1; mwindow.save_defaults(); - if( mwindow.preferences->perpetual_session ) - mwindow.save_undo_data(); + mwindow.save_undo_data(); //PRINT_TRACE filenames.remove_all_objects(); delete thread; diff --git a/cinelerra-5.1/cinelerra/maskauto.C b/cinelerra-5.1/cinelerra/maskauto.C index 1d3e9821..47fb3f42 100644 --- a/cinelerra-5.1/cinelerra/maskauto.C +++ b/cinelerra-5.1/cinelerra/maskauto.C @@ -100,7 +100,7 @@ void SubMask::copy_from(SubMask& ptr, int do_name) { if( do_name ) { memset(name, 0, sizeof(name)); - strncpy(name, ptr.name, sizeof(name-1)); + strncpy(name, ptr.name, sizeof(name)-1); } fader = ptr.fader; feather = ptr.feather; diff --git a/cinelerra-5.1/cinelerra/mwindow.C b/cinelerra-5.1/cinelerra/mwindow.C index cf998890..bd75cbba 100644 --- a/cinelerra-5.1/cinelerra/mwindow.C +++ b/cinelerra-5.1/cinelerra/mwindow.C @@ -4124,6 +4124,7 @@ void MWindow::save_backup() sprintf(string2, _("Couldn't open %s for writing."), backup_path); gui->show_message(string2); } + save_undo_data(); } void MWindow::load_backup() @@ -4151,8 +4152,8 @@ void MWindow::load_backup() void MWindow::save_undo_data() { - undo_before(); - undo_after(_("perpetual session"), LOAD_ALL); + if( stack.size() > 0 ) return; + if( !preferences->perpetual_session ) return; char perpetual_path[BCTEXTLEN]; snprintf(perpetual_path, sizeof(perpetual_path), "%s/%s", File::get_config_path(), PERPETUAL_FILE); @@ -4164,15 +4165,27 @@ void MWindow::save_undo_data() void MWindow::load_undo_data() { + if( stack.size() > 0 ) return; + if( !preferences->perpetual_session ) return; char perpetual_path[BCTEXTLEN]; snprintf(perpetual_path, sizeof(perpetual_path), "%s/%s", File::get_config_path(), PERPETUAL_FILE); FILE *fp = fopen(perpetual_path,"r"); if( !fp ) return; undo->load(fp); + undo_before(); + undo_after(_("perpetual load"), LOAD_ALL); fclose(fp); } +void MWindow::remove_undo_data() +{ + if( stack.size() > 0 ) return; + char perpetual_path[BCTEXTLEN]; + snprintf(perpetual_path, sizeof(perpetual_path), "%s/%s", + File::get_config_path(), PERPETUAL_FILE); + ::remove(perpetual_path); +} int MWindow::copy_target(const char *path, const char *target) { diff --git a/cinelerra-5.1/cinelerra/mwindow.h b/cinelerra-5.1/cinelerra/mwindow.h index afbf3564..c35d62ba 100644 --- a/cinelerra-5.1/cinelerra/mwindow.h +++ b/cinelerra-5.1/cinelerra/mwindow.h @@ -549,6 +549,7 @@ public: void redo_entry(BC_WindowBase *calling_window_gui); void save_undo_data(); void load_undo_data(); + void remove_undo_data(); int copy_target(const char *path, const char *target); int link_target(const char *real_path, const char *link_path, int relative); void save_project(const char *dir, int save_mode, int overwrite, int reload); diff --git a/cinelerra-5.1/cinelerra/preferences.C b/cinelerra-5.1/cinelerra/preferences.C index 30a99ca3..ba69bd48 100644 --- a/cinelerra-5.1/cinelerra/preferences.C +++ b/cinelerra-5.1/cinelerra/preferences.C @@ -65,6 +65,7 @@ Preferences::Preferences() keyframe_reticle = HAIRLINE_DRAGGING; perpetual_session = 0; strcpy(lv2_path, DEFAULT_LV2_PATH); + strcpy(nested_proxy_path, DEFAULT_NESTED_PROXY_PATH); autostart_lv2ui = 0; trap_sigsegv = 1; trap_sigintr = 1; @@ -206,6 +207,7 @@ void Preferences::copy_from(Preferences *that) force_uniprocessor = that->force_uniprocessor; strcpy(lv2_path, that->lv2_path); autostart_lv2ui = that->autostart_lv2ui; + strcpy(nested_proxy_path, that->nested_proxy_path); trap_sigsegv = that->trap_sigsegv; trap_sigintr = that->trap_sigintr; processors = that->processors; @@ -330,6 +332,8 @@ int Preferences::load_defaults(BC_Hash *defaults) strcpy(lv2_path, DEFAULT_LV2_PATH); defaults->get("LV2_PATH", lv2_path); autostart_lv2ui = defaults->get("AUTOSTART_LV2UI", autostart_lv2ui); + strcpy(nested_proxy_path, DEFAULT_NESTED_PROXY_PATH); + defaults->get("NESTED_PROXY_PATH", nested_proxy_path); trap_sigsegv = defaults->get("TRAP_SIGSEGV", trap_sigsegv); trap_sigintr = defaults->get("TRAP_SIGINTR", trap_sigintr); @@ -482,6 +486,7 @@ int Preferences::save_defaults(BC_Hash *defaults) defaults->update("PERPETUAL_SESSION", perpetual_session); defaults->update("LV2_PATH", lv2_path); defaults->update("AUTOSTART_LV2UI", autostart_lv2ui); + defaults->update("NESTED_PROXY_PATH", nested_proxy_path); defaults->update("TRAP_SIGSEGV", trap_sigsegv); defaults->update("TRAP_SIGINTR", trap_sigintr); defaults->update("AWINDOW_PICON_H", awindow_picon_h); diff --git a/cinelerra-5.1/cinelerra/preferences.h b/cinelerra-5.1/cinelerra/preferences.h index 3b46f5f9..f20a791b 100644 --- a/cinelerra-5.1/cinelerra/preferences.h +++ b/cinelerra-5.1/cinelerra/preferences.h @@ -189,6 +189,7 @@ public: char plugin_dir[BCTEXTLEN]; char lv2_path[BCTEXTLEN]; int autostart_lv2ui; + char nested_proxy_path[BCTEXTLEN]; // Required when updating renderfarm rates Mutex *preferences_lock; diff --git a/cinelerra-5.1/cinelerra/preferences.inc b/cinelerra-5.1/cinelerra/preferences.inc index 0d6e5330..5cf15903 100644 --- a/cinelerra-5.1/cinelerra/preferences.inc +++ b/cinelerra-5.1/cinelerra/preferences.inc @@ -31,6 +31,7 @@ #define LAYOUT_NAME_LEN 8 #define LAYOUTS_MAX 4 #define DEFAULT_LV2_PATH CINDAT_DIR "/lv2" +#define DEFAULT_NESTED_PROXY_PATH NESTED_DIR #define FFMPEG_EARLY_TIP _("Currently: Try FFMpeg first\n Click to: Try FFMpeg last") #define FFMPEG_LATE_TIP _("Currently: Try FFMpeg last\n Click to: Try FFMpeg first") diff --git a/cinelerra-5.1/cinelerra/preferencesthread.C b/cinelerra-5.1/cinelerra/preferencesthread.C index e4f050be..4c9561b0 100644 --- a/cinelerra-5.1/cinelerra/preferencesthread.C +++ b/cinelerra-5.1/cinelerra/preferencesthread.C @@ -251,6 +251,9 @@ int PreferencesThread::apply_settings() mwindow->restart_status = -1; } + if( mwindow->preferences->perpetual_session && !preferences->perpetual_session ) + mwindow->remove_undo_data(); + mwindow->edl->copy_session(edl, 1); mwindow->update_preferences(preferences); diff --git a/cinelerra-5.1/cinelerra/proxy.C b/cinelerra-5.1/cinelerra/proxy.C index 3165ad0e..edeb394a 100644 --- a/cinelerra-5.1/cinelerra/proxy.C +++ b/cinelerra-5.1/cinelerra/proxy.C @@ -195,7 +195,16 @@ void ProxyRender::to_proxy_path(char *new_path, Indexable *indexable, int scale) { // path is already a proxy if( strstr(indexable->path, ".proxy") ) return; - strcpy(new_path, indexable->path); + if( !indexable->is_asset ) { + char *ifn = indexable->path, *cp = strrchr(ifn, '/'); + if( cp ) ifn = cp+1; + char proxy_path[BCTEXTLEN]; + File::getenv_path(proxy_path, + mwindow->preferences->nested_proxy_path); + sprintf(new_path, "%s/%s", proxy_path, ifn); + } + else + strcpy(new_path, indexable->path); char prxy[BCSTRLEN]; int n = sprintf(prxy, ".proxy%d", scale); // insert proxy, path.sfx => path.proxy#-sfx.ext @@ -265,8 +274,18 @@ Asset *ProxyRender::add_original(Indexable *idxbl, int new_scale) if( strstr(idxbl->path,".proxy") ) return 0; char new_path[BCTEXTLEN]; to_proxy_path(new_path, idxbl, new_scale); -// don't proxy if not readable +// don't proxy if not readable, or proxy_path not writable if( idxbl->is_asset && access(idxbl->path, R_OK) ) return 0; + int ret = access(new_path, W_OK); + if( ret ) { + int fd = ::open(new_path,O_WRONLY); + if( fd < 0 ) fd = open(new_path,O_WRONLY+O_CREAT,0666); + if( fd >= 0 ) { close(fd); ret = 0; } + } + if( ret ) { + eprintf(_("bad proxy path: %s\n"), new_path); + return 0; + } // add to orig_idxbls & orig_proxies if it isn't already there. int got_it = 0; for( int i = 0; !got_it && i UNDOLEVELS ) { + while( total() > UNDOLEVELS ) { UndoStackItem *item = first, *key = item; #ifdef UNDO_INCREMENTAL for( int i=2; --i>=0; item=item->next ); diff --git a/cinelerra-5.1/configure.ac b/cinelerra-5.1/configure.ac index 5067c681..92688079 100644 --- a/cinelerra-5.1/configure.ac +++ b/cinelerra-5.1/configure.ac @@ -48,6 +48,7 @@ CHECK_WITH([cindat],[cinelerra share path],[CINDAT_DIR],[auto]) CHECK_WITH([plugin-dir],[plugin install dir],[PLUGIN_DIR],[auto]) CHECK_WITH([ladspa-dir],[ladspa install dir],[LADSPA_DIR],[auto]) CHECK_WITH([config-dir],[.bcast config dir],[CONFIG_DIR],[$$HOME/.bcast5]) +CHECK_WITH([nested-dir],[nested proxy dir],[NESTED_DIR],[$$HOME/Videos]) CHECK_WITH([browser],[cin_browser path],[CIN_BROWSER],[firefox]) CHECK_WITH([git-ffmpeg],[git ffmpeg using url],[GIT_FFMPEG],[no]) CHECK_WITH([noelision],[use noelision/libpthread],[NOELISION],[auto]) @@ -748,8 +749,9 @@ EXROStream() : Imf::OStream("mypath") {} }; ]])], [HAVE_OPENEXR=yes], [HAVE_OPENEXR=no]) RESULT="$HAVE_OPENEXR" if test "x$RESULT" = "xyes"; then - SHARED_openexr="$LIBS" - CFG_CFLAGS+=" -I/usr/include/OpenEXR -I/usr/local/include/OpenEXR" + SHARED_openexr="$LIBS" + SHARED_LIBS+=" $LIBS" + CFG_CFLAGS+=" -I/usr/include/OpenEXR -I/usr/local/include/OpenEXR" fi LIBS="$saved_LIBS" CXXFLAGS="$saved_CXXFLAGS" @@ -966,6 +968,7 @@ echo " using: exec-name = $WANT_CIN" echo " using: with-cinlib = $WANT_CINLIB_DIR" echo " using: with-cindat = $WANT_CINDAT_DIR" echo " using: with-config-dir = $WANT_CONFIG_DIR" +echo " using: with-nested-dir = $WANT_NESTED_DIR" echo " using: with-browser = $WANT_CIN_BROWSER" echo " using: with-plugin-dir = $WANT_PLUGIN_DIR" echo " using: with-ladspa-dir = $WANT_LADSPA_DIR" @@ -1049,6 +1052,7 @@ echo "CFLAGS += '-DCIN=\"\$(WANT_CIN)\"'" echo "CFLAGS += '-DCINLIB_DIR=\"$WANT_CINLIB_DIR\"'" echo "CFLAGS += '-DCINDAT_DIR=\"$WANT_CINDAT_DIR\"'" echo "CFLAGS += '-DCONFIG_DIR=\"$WANT_CONFIG_DIR\"'" +echo "CFLAGS += '-DNESTED_DIR=\"$WANT_NESTED_DIR\"'" echo "CFLAGS += '-DPLUGIN_DIR=\"$WANT_PLUGIN_DIR\"'" echo "CFLAGS += '-DLOCALE_DIR=\"$WANT_LOCALE_DIR\"'" echo "CFLAGS += '-DLADSPA_DIR=\"$WANT_LADSPA_DIR\"'" diff --git a/cinelerra-5.1/guicast/bctexture.C b/cinelerra-5.1/guicast/bctexture.C index 52787e1a..e3eda5fa 100644 --- a/cinelerra-5.1/guicast/bctexture.C +++ b/cinelerra-5.1/guicast/bctexture.C @@ -249,7 +249,7 @@ void BC_Texture::write_tex(const char *fn, int id) uint8_t *img = new uint8_t[w*h*3]; glGetTexImage(GL_TEXTURE_2D, 0, GL_RGB, GL_UNSIGNED_BYTE, img); write_ppm(img, w, h, "%s", fn); - delete img; + delete [] img; glActiveTexture(prev_id); #endif }