audio chan pos rework, batchrender deadlock, titler/crikey grab_event tweak, thread...
[goodguy/history.git] / cinelerra-5.1 / cinelerra / preferences.C
index ee7c5d180f5a0890ebcf4b295eac09bba9e60a0c..edeee836eb0be3cde6a579c29398eadc35a9458c 100644 (file)
@@ -31,6 +31,7 @@
 #include "filesystem.h"
 #include "guicast.h"
 #include "indexfile.h"
+#include "maxchannels.h"
 #include "mutex.h"
 #include "preferences.h"
 #include "probeprefs.h"
@@ -60,7 +61,7 @@ Preferences::Preferences()
        sprintf(index_directory, "%s/", File::get_config_path());
        if(strlen(index_directory))
                fs.complete_path(index_directory);
-       cache_size = 0x1000000;
+       cache_size = 0x10000000;
        index_size = 0x400000;
        index_count = 500;
        use_thumbnails = 1;
@@ -69,6 +70,7 @@ Preferences::Preferences()
        trap_sigintr = 1;
        theme[0] = 0;
        plugin_icons[0] = 0;
+       strcpy(snapshot_path, "/tmp");
        use_renderfarm = 0;
        force_uniprocessor = 0;
        renderfarm_port = DEAMON_PORT;
@@ -89,6 +91,8 @@ Preferences::Preferences()
        forward_render_displacement = 0;
        dvd_yuv420p_interlace = 0;
        highlight_inverse = 0xffffff;
+       yuv_color_space = 0; // bt601
+       yuv_color_range = 0; // jpeg
 
 // Default brender asset
        brender_asset = new Asset;
@@ -109,14 +113,12 @@ Preferences::Preferences()
        android_port = 23432;
        strcpy(android_pin, "cinelerra");
 
-       for(int i = 0; i < MAXCHANNELS; i++)
-       {
-               for(int j = 0; j < i + 1; j++)
-               {
-                       int position = 180 - (360 * j / (i + 1));
-                       while(position < 0) position += 360;
-                       channel_positions[i * MAXCHANNELS + j] = position;
-               }
+       memset(channel_positions, 0, sizeof(channel_positions));
+       int channels = 0;
+       while( channels < MAXCHANNELS ) {
+               int *positions = channel_positions[channels++];
+               for( int i=0; i<channels; ++i )
+                       positions[i] = default_audio_channel_position(i, channels);
        }
 }
 
@@ -177,6 +179,7 @@ void Preferences::copy_from(Preferences *that)
        keyframe_reticle = that->keyframe_reticle;
        strcpy(theme, that->theme);
        strcpy(plugin_icons, that->plugin_icons);
+       strcpy(snapshot_path, that->snapshot_path);
 
        use_tipwindow = that->use_tipwindow;
        scan_commercials = that->scan_commercials;
@@ -206,6 +209,8 @@ void Preferences::copy_from(Preferences *that)
        forward_render_displacement = that->forward_render_displacement;
        dvd_yuv420p_interlace = that->dvd_yuv420p_interlace;
        highlight_inverse = that->highlight_inverse;
+       yuv_color_space = that->yuv_color_space;
+       yuv_color_range = that->yuv_color_range;
        renderfarm_nodes.remove_all_objects();
        renderfarm_ports.remove_all();
        renderfarm_enabled.remove_all();
@@ -324,31 +329,17 @@ int Preferences::load_defaults(BC_Hash *defaults)
        strcpy(plugin_icons, DEFAULT_PICON);
        defaults->get("THEME", theme);
        defaults->get("PLUGIN_ICONS", plugin_icons);
+       strcpy(snapshot_path, "/tmp");
+       defaults->get("SNAPSHOT_PATH", snapshot_path);
 
-       for(int i = 0; i < MAXCHANNELS; i++)
-       {
+       for( int i=0; i<MAXCHANNELS; ++i ) {
                char string2[BCTEXTLEN];
                sprintf(string, "CHANNEL_POSITIONS%d", i);
-               print_channels(string2,
-                       &channel_positions[i * MAXCHANNELS],
-                       i + 1);
-
+               print_channels(string2, &channel_positions[i][0], i+1);
                defaults->get(string, string2);
-
-               scan_channels(string2,
-                       &channel_positions[i * MAXCHANNELS],
-                       i + 1);
+               scan_channels(string2, &channel_positions[i][0], i+1);
        }
-
-       brender_asset->load_defaults(defaults,
-               "BRENDER_",
-               1,
-               1,
-               1,
-               0,
-               0);
-
-
+       brender_asset->load_defaults(defaults, "BRENDER_", 1, 1, 1, 0, 0);
 
        project_smp = defaults->get("PROJECT_SMP", project_smp);
        force_uniprocessor = defaults->get("FORCE_UNIPROCESSOR", force_uniprocessor);
@@ -362,6 +353,8 @@ int Preferences::load_defaults(BC_Hash *defaults)
        forward_render_displacement = defaults->get("FORWARD_RENDER_DISPLACEMENT", forward_render_displacement);
        dvd_yuv420p_interlace = defaults->get("DVD_YUV420P_INTERLACE", dvd_yuv420p_interlace);
        highlight_inverse = defaults->get("HIGHLIGHT_INVERSE", highlight_inverse);
+       yuv_color_space = defaults->get("YUV_COLOR_SPACE", yuv_color_space);
+       yuv_color_range = defaults->get("YUV_COLOR_RANGE", yuv_color_range);
        use_brender = defaults->get("USE_BRENDER", use_brender);
        brender_fragment = defaults->get("BRENDER_FRAGMENT", brender_fragment);
        cache_size = defaults->get("CACHE_SIZE", cache_size);
@@ -410,6 +403,7 @@ int Preferences::load_defaults(BC_Hash *defaults)
                shbtn_prefs.append(new ShBtnPref(_("Original Manual"), "$CIN_BROWSER file://$CIN_DAT/doc/cinelerra.html", 0));
                shbtn_prefs.append(new ShBtnPref(_("Setting Shell Commands"), "$CIN_BROWSER file://$CIN_DAT/doc/ShellCmds.html", 0));
                shbtn_prefs.append(new ShBtnPref(_("Shortcuts"), "$CIN_BROWSER file://$CIN_DAT/doc/shortcuts.html", 0));
+               shbtn_prefs.append(new ShBtnPref(_("RenderMux"), "$CIN_DAT/doc/RenderMux.sh",0));
                shbtns_total = 0;
        }
        for( int i=0; i<shbtns_total; ++i ) {
@@ -472,13 +466,13 @@ int Preferences::save_defaults(BC_Hash *defaults)
        defaults->update("TRAP_SIGINTR", trap_sigintr);
        defaults->update("THEME", theme);
        defaults->update("PLUGIN_ICONS", plugin_icons);
-
+       defaults->update("SNAPSHOT_PATH", snapshot_path);
 
        for(int i = 0; i < MAXCHANNELS; i++)
        {
                char string2[BCTEXTLEN];
                sprintf(string, "CHANNEL_POSITIONS%d", i);
-               print_channels(string2, &channel_positions[i * MAXCHANNELS], i + 1);
+               print_channels(string2, &channel_positions[i][0], i + 1);
                defaults->update(string, string2);
        }
 
@@ -494,6 +488,8 @@ int Preferences::save_defaults(BC_Hash *defaults)
        defaults->update("FORWARD_RENDER_DISPLACEMENT", forward_render_displacement);
        defaults->update("DVD_YUV420P_INTERLACE", dvd_yuv420p_interlace);
        defaults->update("HIGHLIGHT_INVERSE", highlight_inverse);
+       defaults->update("YUV_COLOR_SPACE", yuv_color_space);
+       defaults->update("YUV_COLOR_RANGE", yuv_color_range);
        brender_asset->save_defaults(defaults, "BRENDER_", 1, 1, 1, 0, 0);
        defaults->update("USE_BRENDER", use_brender);
        defaults->update("BRENDER_FRAGMENT", brender_fragment);