[shotwell/shotwell-0.30] Remove video interpreter state handling



commit 5a7aad99aa36ac692fecad6ca99a65d46a55b9b0
Author: Jens Georg <mail jensge org>
Date:   Wed Sep 14 20:59:52 2022 +0200

    Remove video interpreter state handling
    
    This was more or less completely random. the state cookie was updated
    each process start and by accident ended up at the same number on
    subsequent starts of shotwell.
    
    Even if it was ending up with the same number there was no guarantee
    that the plugins didn't change

 misc/org.yorba.shotwell.gschema.xml     |  9 --------
 src/VideoSupport.vala                   | 40 +++------------------------------
 src/config/Config.vala                  |  2 --
 src/config/ConfigurationInterfaces.vala | 27 ----------------------
 src/config/GSettingsEngine.vala         |  3 ---
 5 files changed, 3 insertions(+), 78 deletions(-)
---
diff --git a/misc/org.yorba.shotwell.gschema.xml b/misc/org.yorba.shotwell.gschema.xml
index d21de4eb..38519fe8 100644
--- a/misc/org.yorba.shotwell.gschema.xml
+++ b/misc/org.yorba.shotwell.gschema.xml
@@ -3,7 +3,6 @@
 <schema id="org.yorba.shotwell" path="/org/yorba/shotwell/">
     <child name="preferences" schema="org.yorba.shotwell.preferences" />
     <child name="sharing" schema="org.yorba.shotwell.sharing" />
-    <child name="video" schema="org.yorba.shotwell.video" />
     <child name="printing" schema="org.yorba.shotwell.printing" />
     <child name="plugins" schema="org.yorba.shotwell.plugins" />
 </schema>
@@ -634,14 +633,6 @@
     </key>
 </schema>
 
-<schema id="org.yorba.shotwell.video" path="/org/yorba/shotwell/video/">
-    <key name="interpreter-state-cookie" type="i">
-        <default>-1</default>
-        <summary>interpreter state cookie</summary>
-        <description>A numeric code that captures the state of the GStreamer plug-in 
environment</description>
-    </key>
-</schema>
-
 <schema id="org.yorba.shotwell.printing" path="/org/yorba/shotwell/printing/">
     <key name="content-layout" type="i">
         <default>3</default>
diff --git a/src/VideoSupport.vala b/src/VideoSupport.vala
index 533dfe67..ec827eae 100644
--- a/src/VideoSupport.vala
+++ b/src/VideoSupport.vala
@@ -359,8 +359,6 @@ public class Video : VideoSource, Flaggable, Monitorable, Dateable {
         }
     }
     
-    private static bool interpreter_state_changed;
-    private static int current_state;
     private static bool normal_regen_complete;
     private static bool offline_regen_complete;
     public static VideoSourceCollection global;
@@ -381,8 +379,6 @@ public class Video : VideoSource, Flaggable, Monitorable, Dateable {
         // Must initialize static variables here.
         // TODO: set values at declaration time once the following Vala bug is fixed:
         //       https://bugzilla.gnome.org/show_bug.cgi?id=655594
-        interpreter_state_changed = false;
-        current_state = -1;
         normal_regen_complete = false;
         offline_regen_complete = false;
     
@@ -392,19 +388,9 @@ public class Video : VideoSource, Flaggable, Monitorable, Dateable {
         Gst.init(ref args);
 
         var registry = Gst.Registry.@get ();
-        int saved_state = Config.Facade.get_instance().get_video_interpreter_state_cookie();
-        current_state = (int) registry.get_feature_list_cookie();
-        if (saved_state == Config.Facade.NO_VIDEO_INTERPRETER_STATE) {
-            message("interpreter state cookie not found; assuming all video thumbnails are out of date");
-            interpreter_state_changed = true;
-        } else if (saved_state != current_state) {
-            message("interpreter state has changed; video thumbnails may be out of date");
-            interpreter_state_changed = true;
-        }
 
-        /* First do the cookie state handling, then update our local registry
-         * to not include vaapi stuff. This is basically to work-around
-         * concurrent access to VAAPI/X11 which it doesn't like, cf
+        /* Update our local registr to not include vaapi stuff. This is basically to
+        * work-around concurrent access to VAAPI/X11 which it doesn't like, cf
          * https://bugzilla.gnome.org/show_bug.cgi?id=762416
          */
 
@@ -427,9 +413,6 @@ public class Video : VideoSource, Flaggable, Monitorable, Dateable {
         for (int ctr = 0; ctr < count; ctr++) {
             Video video = new Video(all.get(ctr));
             
-            if (interpreter_state_changed)
-                video.set_is_interpretable(false);
-            
             if (video.is_trashed())
                 trashed_videos.add(video);
             else if (video.is_offline())
@@ -446,10 +429,6 @@ public class Video : VideoSource, Flaggable, Monitorable, Dateable {
         global.add_many(all_videos);
     }
     
-    public static bool has_interpreter_state_changed() {
-        return interpreter_state_changed;
-    }
-    
     public static void notify_normal_thumbs_regenerated() {
         if (normal_regen_complete)
             return;
@@ -457,8 +436,6 @@ public class Video : VideoSource, Flaggable, Monitorable, Dateable {
         message("normal video thumbnail regeneration completed");
 
         normal_regen_complete = true;
-        if (normal_regen_complete && offline_regen_complete)
-            save_interpreter_state();
     }
 
     public static void notify_offline_thumbs_regenerated() {
@@ -468,17 +445,6 @@ public class Video : VideoSource, Flaggable, Monitorable, Dateable {
         message("offline video thumbnail regeneration completed");
 
         offline_regen_complete = true;
-        if (normal_regen_complete && offline_regen_complete)
-            save_interpreter_state();
-    }
-
-    private static void save_interpreter_state() {
-        if (interpreter_state_changed) {
-            message("saving video interpreter state to configuration system");
-
-            Config.Facade.get_instance().set_video_interpreter_state_cookie(current_state);
-            interpreter_state_changed = false;
-        }
     }
 
     public static void terminate() {
@@ -749,7 +715,7 @@ public class Video : VideoSource, Flaggable, Monitorable, Dateable {
     public override void mark_online() {
         remove_flags(FLAG_OFFLINE);
         
-        if ((!get_is_interpretable()) && has_interpreter_state_changed())
+        if ((!get_is_interpretable()))
             check_is_interpretable().foreground_finish();
     }
 
diff --git a/src/config/Config.vala b/src/config/Config.vala
index 5675567f..0e2798a7 100644
--- a/src/config/Config.vala
+++ b/src/config/Config.vala
@@ -20,8 +20,6 @@ public class Facade : ConfigurationFacade {
     public const int HEIGHT_DEFAULT = 768;
     public const int SIDEBAR_MIN_POSITION = 180;
     public const int SIDEBAR_MAX_POSITION = 1000;
-    public const int NO_VIDEO_INTERPRETER_STATE = -1;
-
 
     private static Facade instance = null;
 
diff --git a/src/config/ConfigurationInterfaces.vala b/src/config/ConfigurationInterfaces.vala
index 8af5a735..a8d81921 100644
--- a/src/config/ConfigurationInterfaces.vala
+++ b/src/config/ConfigurationInterfaces.vala
@@ -90,7 +90,6 @@ public enum ConfigurableProperty {
     SLIDESHOW_SHOW_TITLE,
     USE_24_HOUR_TIME,
     USE_LOWERCASE_FILENAMES,
-    VIDEO_INTERPRETER_STATE_COOKIE,
     
     
     NUM_PROPERTIES;
@@ -307,9 +306,6 @@ public enum ConfigurableProperty {
             case USE_LOWERCASE_FILENAMES:
                 return "USE_LOWERCASE_FILENAMES";
                 
-            case VIDEO_INTERPRETER_STATE_COOKIE:
-                return "VIDEO_INTERPRETER_STATE_COOKIE";
-
             default:
                 error("unknown ConfigurableProperty enumeration value");
         }
@@ -1803,29 +1799,6 @@ public abstract class ConfigurationFacade : Object {
         }
     }
 
-    //
-    // video interpreter state cookie
-    //
-    public virtual int get_video_interpreter_state_cookie() {
-        try {
-            return get_engine().get_int_property(
-                ConfigurableProperty.VIDEO_INTERPRETER_STATE_COOKIE);
-        } catch (ConfigurationError err) {
-            on_configuration_error(err);
-
-            return -1;
-        }
-    }
-
-    public virtual void set_video_interpreter_state_cookie(int state_cookie) {
-        try {
-            get_engine().set_int_property(ConfigurableProperty.VIDEO_INTERPRETER_STATE_COOKIE,
-                state_cookie);
-        } catch (ConfigurationError err) {
-            on_configuration_error(err);
-        }
-    }
-
     //
     // allow plugins to get & set arbitrary properties
     //
diff --git a/src/config/GSettingsEngine.vala b/src/config/GSettingsEngine.vala
index 53c4e3f6..d35eb93e 100644
--- a/src/config/GSettingsEngine.vala
+++ b/src/config/GSettingsEngine.vala
@@ -13,7 +13,6 @@ public class GSettingsConfigurationEngine : ConfigurationEngine, GLib.Object {
     private const string FILES_PREFS_SCHEMA_NAME = PREFS_SCHEMA_NAME + ".files";
     private const string EDITING_PREFS_SCHEMA_NAME = PREFS_SCHEMA_NAME + ".editing";
     private const string EXPORT_PREFS_SCHEMA_NAME = PREFS_SCHEMA_NAME + ".export";
-    private const string VIDEO_SCHEMA_NAME = ROOT_SCHEMA_NAME + ".video";
     private const string PRINTING_SCHEMA_NAME = ROOT_SCHEMA_NAME + ".printing";
     private const string SHARING_SCHEMA_NAME = ROOT_SCHEMA_NAME + ".sharing";
     private const string IMPORTING_SCHEMA_NAME = ROOT_SCHEMA_NAME + ".dataimports";
@@ -100,7 +99,6 @@ public class GSettingsConfigurationEngine : ConfigurationEngine, GLib.Object {
         schema_names[ConfigurableProperty.SLIDESHOW_SHOW_TITLE] = SLIDESHOW_PREFS_SCHEMA_NAME;
         schema_names[ConfigurableProperty.USE_24_HOUR_TIME] = UI_PREFS_SCHEMA_NAME;
         schema_names[ConfigurableProperty.USE_LOWERCASE_FILENAMES] = FILES_PREFS_SCHEMA_NAME;
-        schema_names[ConfigurableProperty.VIDEO_INTERPRETER_STATE_COOKIE] = VIDEO_SCHEMA_NAME;
         
         key_names = new string[ConfigurableProperty.NUM_PROPERTIES];
         
@@ -174,7 +172,6 @@ public class GSettingsConfigurationEngine : ConfigurationEngine, GLib.Object {
         key_names[ConfigurableProperty.SLIDESHOW_SHOW_TITLE] = "show-title";
         key_names[ConfigurableProperty.USE_24_HOUR_TIME] = "use-24-hour-time";
         key_names[ConfigurableProperty.USE_LOWERCASE_FILENAMES] = "use-lowercase-filenames";
-        key_names[ConfigurableProperty.VIDEO_INTERPRETER_STATE_COOKIE] = "interpreter-state-cookie";
     }
 
     private Settings get_settings(string schema) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]