ffmpeg api3 upgrade, rework bs filts, rm faac/d, fixes
[goodguy/history.git] / cinelerra-5.1 / cinelerra / preferences.C
index 5d4692204ed20922388c7dffbb36867778020301..f69ab3e847898b9e5520b194df0174b0fb0b529c 100644 (file)
@@ -27,7 +27,7 @@
 #include "cache.inc"
 #include "clip.h"
 #include "bchash.h"
-#include "file.inc"
+#include "file.h"
 #include "filesystem.h"
 #include "guicast.h"
 #include "indexfile.h"
@@ -54,17 +54,16 @@ Preferences::Preferences()
        preferences_lock = new Mutex("Preferences::preferences_lock");
 
 
-
-       get_exe_path(plugin_dir);
-       strcat(plugin_dir,"/plugins");
-
-       sprintf(index_directory, BCASTDIR);
+// initial plugin path from build -DPLUGIN_DIR="..."
+       sprintf(plugin_dir, "%s/", File::get_plugin_path());
+       sprintf(index_directory, "%s/", File::get_config_path());
        if(strlen(index_directory))
                fs.complete_path(index_directory);
        cache_size = 0x1000000;
        index_size = 0x400000;
        index_count = 500;
        use_thumbnails = 1;
+       keyframe_reticle = HAIRLINE_DRAGGING;
        trap_sigsegv = 1;
        trap_sigintr = 1;
        theme[0] = 0;
@@ -76,11 +75,16 @@ Preferences::Preferences()
        renderfarm_mountpoint[0] = 0;
        renderfarm_vfs = 0;
        renderfarm_job_count = 20;
-       processors = calculate_processors(0);
+       project_smp = processors = calculate_processors(0);
        real_processors = calculate_processors(1);
-       ffmpeg_early_probe = 0;
+       ffmpeg_early_probe = 1;
        ffmpeg_marker_indexes = 1;
        warn_indexes = 1;
+       warn_version = 1;
+       bd_warn_root = 1;
+       popupmenu_btnup = 1;
+       textbox_focus_policy = 0;
+       dvd_yuv420p_interlace = 0;
 
 // Default brender asset
        brender_asset = new Asset;
@@ -165,6 +169,7 @@ void Preferences::copy_from(Preferences *that)
        index_size = that->index_size;
        index_count = that->index_count;
        use_thumbnails = that->use_thumbnails;
+       keyframe_reticle = that->keyframe_reticle;
        strcpy(theme, that->theme);
 
        use_tipwindow = that->use_tipwindow;
@@ -176,6 +181,7 @@ void Preferences::copy_from(Preferences *that)
        for( int i=0; i<that->shbtn_prefs.size(); ++i )
                this->shbtn_prefs.append(new ShBtnPref(*that->shbtn_prefs[i]));
        cache_size = that->cache_size;
+       project_smp = that->project_smp;
        force_uniprocessor = that->force_uniprocessor;
        trap_sigsegv = that->trap_sigsegv;
        trap_sigintr = that->trap_sigintr;
@@ -184,6 +190,11 @@ void Preferences::copy_from(Preferences *that)
        ffmpeg_early_probe = that->ffmpeg_early_probe;
        ffmpeg_marker_indexes = that->ffmpeg_marker_indexes;
        warn_indexes = that->warn_indexes;
+       warn_version = that->warn_version;
+       bd_warn_root = that->bd_warn_root;
+       popupmenu_btnup = that->popupmenu_btnup;
+       textbox_focus_policy = that->textbox_focus_policy;
+       dvd_yuv420p_interlace = that->dvd_yuv420p_interlace;
        renderfarm_nodes.remove_all_objects();
        renderfarm_ports.remove_all();
        renderfarm_enabled.remove_all();
@@ -294,6 +305,7 @@ int Preferences::load_defaults(BC_Hash *defaults)
        index_size = defaults->get("INDEX_SIZE", index_size);
        index_count = defaults->get("INDEX_COUNT", index_count);
        use_thumbnails = defaults->get("USE_THUMBNAILS", use_thumbnails);
+       keyframe_reticle = defaults->get("KEYFRAME_RETICLE", keyframe_reticle);
        trap_sigsegv = defaults->get("TRAP_SIGSEGV", trap_sigsegv);
        trap_sigintr = defaults->get("TRAP_SIGINTR", trap_sigintr);
 
@@ -325,10 +337,16 @@ int Preferences::load_defaults(BC_Hash *defaults)
 
 
 
+       project_smp = defaults->get("PROJECT_SMP", project_smp);
        force_uniprocessor = defaults->get("FORCE_UNIPROCESSOR", force_uniprocessor);
        ffmpeg_early_probe = defaults->get("FFMPEG_EARLY_PROBE", ffmpeg_early_probe);
        ffmpeg_marker_indexes = defaults->get("FFMPEG_MARKER_INDEXES", ffmpeg_marker_indexes);
        warn_indexes = defaults->get("WARN_INDEXES", warn_indexes);
+       warn_version = defaults->get("WARN_VERSION", warn_version);
+       bd_warn_root = defaults->get("BD_WARN_ROOT", bd_warn_root);
+       popupmenu_btnup = defaults->get("POPUPMENU_BTNUP", popupmenu_btnup);
+       textbox_focus_policy = defaults->get("TEXTBOX_FOCUS_POLICY", textbox_focus_policy);
+       dvd_yuv420p_interlace = defaults->get("DVD_YUV420P_INTERLACE", dvd_yuv420p_interlace);
        use_brender = defaults->get("USE_BRENDER", use_brender);
        brender_fragment = defaults->get("BRENDER_FRAGMENT", brender_fragment);
        cache_size = defaults->get("CACHE_SIZE", cache_size);
@@ -372,8 +390,9 @@ int Preferences::load_defaults(BC_Hash *defaults)
        shbtn_prefs.remove_all_objects();
        int shbtns_total = defaults->get("SHBTNS_TOTAL", -1);
        if( shbtns_total < 0 ) {
-               shbtn_prefs.append(new ShBtnPref("manual", "firefox file:///$CINELERRA_PATH/manual.pdf", 0));
-               shbtn_prefs.append(new ShBtnPref("online help", "firefox http://cinelerra.org/help.php/", 0));
+               shbtn_prefs.append(new ShBtnPref("Features5", "firefox file://$CIN_DAT/doc/Features5.pdf", 0));
+               shbtn_prefs.append(new ShBtnPref("Online Help", "firefox https://cinelerra-cv.org/docs.php", 0));
+               shbtn_prefs.append(new ShBtnPref("Orignal Manual", "firefox file://$CIN_DAT/doc/cinelerra.html", 0));
                shbtns_total = 0;
        }
        for( int i=0; i<shbtns_total; ++i ) {
@@ -409,6 +428,7 @@ int Preferences::save_defaults(BC_Hash *defaults)
        defaults->update("INDEX_SIZE", index_size);
        defaults->update("INDEX_COUNT", index_count);
        defaults->update("USE_THUMBNAILS", use_thumbnails);
+       defaults->update("KEYFRAME_RETICLE", keyframe_reticle);
        defaults->update("TRAP_SIGSEGV", trap_sigsegv);
        defaults->update("TRAP_SIGINTR", trap_sigintr);
 //     defaults->update("GLOBAL_PLUGIN_DIR", global_plugin_dir);
@@ -423,17 +443,17 @@ int Preferences::save_defaults(BC_Hash *defaults)
                defaults->update(string, string2);
        }
 
+       defaults->update("PROJECT_SMP", project_smp);
        defaults->update("FORCE_UNIPROCESSOR", force_uniprocessor);
        defaults->update("FFMPEG_EARLY_PROBE", ffmpeg_early_probe);
        defaults->update("FFMPEG_MARKER_INDEXES", ffmpeg_marker_indexes);
        defaults->update("WARN_INDEXES", warn_indexes);
-       brender_asset->save_defaults(defaults,
-               "BRENDER_",
-               1,
-               1,
-               1,
-               0,
-               0);
+       defaults->update("WARN_VERSION", warn_version);
+       defaults->update("BD_WARN_ROOT", bd_warn_root);
+       defaults->update("POPUPMENU_BTNUP", popupmenu_btnup);
+       defaults->update("TEXTBOX_FOCUS_POLICY", textbox_focus_policy);
+       defaults->update("DVD_YUV420P_INTERLACE", dvd_yuv420p_interlace);
+       brender_asset->save_defaults(defaults, "BRENDER_", 1, 1, 1, 0, 0);
        defaults->update("USE_BRENDER", use_brender);
        defaults->update("BRENDER_FRAGMENT", brender_fragment);
        defaults->update("USE_RENDERFARM", use_renderfarm);
@@ -698,18 +718,17 @@ int Preferences::get_node_port(int number)
 int Preferences::get_asset_file_path(Asset *asset, char *path)
 {
        strcpy(path, asset->path);
-       int result = access(path, R_OK);
-       if( !result && asset->format == FILE_MPEG ) {
-               char source_filename[BCTEXTLEN];
-               char index_filename[BCTEXTLEN];
+       int result = !access(path, R_OK) ? 0 : -1;
+       if( !result && ( asset->format == FILE_MPEG || asset->format == FILE_AC3 ||
+               asset->format == FILE_VMPEG || asset->format == FILE_AMPEG ) ) {
+               char source_filename[BCTEXTLEN], index_filename[BCTEXTLEN];
                IndexFile::get_index_filename(source_filename,
-                       index_directory, index_filename,
-                       asset->path, ".toc");
-               struct stat st;
-               if( !access(index_filename, R_OK) &&
-                   !stat(index_filename,&st) && st.st_size > 0 )
+                       index_directory, index_filename, asset->path, ".toc");
                strcpy(path, index_filename);
+               if( access(path, R_OK) )
+                       result = 1;
        }
+// result = 0, asset->path/toc exist, -1 no asset, 1 no toc
        return result;
 }