[vlc-commits] [Git][videolan/vlc][master] 2 commits: qt: fix filter change regression

Felix Paul Kühne (@fkuehne) gitlab at videolan.org
Fri Sep 13 09:30:36 UTC 2024



Felix Paul Kühne pushed to branch master at VideoLAN / VLC


Commits:
1ca33194 by Alaric Senat at 2024-09-13T09:18:46+00:00
qt: fix filter change regression

This was forgotten by 0be3282eb6d9a04a86160a74b780b2774e0252fa.
The filter options are now stored in the vout object instead of the
interface.

Fixes #28769

- - - - -
0c0817fa by Alaric Senat at 2024-09-13T09:18:46+00:00
filters: proxy: keep track of the proxied vars state

Since we now assume that the state of the filters parameters should be
stored in the vout (cf. 0be3282eb6d9a04a86160a74b780b2774e0252fa), the
state of the mapped variables should be kept between resets of the
filter chain.

The proxy functions used to create and destroy both the mappings and the
bound callbacks. In a perfect world, the mapping of the variables and
the binding of the callbacks should be decoupled. But for such a small
utility function, we can just stop destroying the state of the variables
between resets.

This patch also reworks the documentation of the modified functions
accordingly.

Refs #28769

- - - - -


3 changed files:

- include/vlc_filter.h
- modules/gui/qt/dialogs/extended/extended_panels.cpp
- src/misc/filter.c


Changes:

=====================================
include/vlc_filter.h
=====================================
@@ -365,8 +365,13 @@ static inline int filter_GetInputAttachments( filter_t *p_filter,
 }
 
 /**
- * This function duplicates every variables from the filter, and adds a proxy
- * callback to trigger filter events from obj.
+ * This function allow dynamically changing filter variables from a different
+ * object via VLC variables mapping.
+ *
+ * It maps the filter's variables on the proxy objects and bind them with a var
+ * callback that forwards changes to the filter.
+ * This is especially useful for manipulating filter chains via a single parent
+ * object.
  *
  * \param obj the object to add the callback proxy to
  * \param filter the filter object for which the callback will be proxified
@@ -379,8 +384,9 @@ VLC_API void filter_AddProxyCallbacks( vlc_object_t *obj, filter_t *filter,
     filter_AddProxyCallbacks(VLC_OBJECT(a), b, c)
 
 /**
- * This function removes the callbacks previously added to every duplicated
- * variables, and removes them afterward.
+ * This function unbind the callbacks from the proxy object.
+ *
+ * \note It does not remove the mapped variable to keep track of their state.
  *
  * \param obj the object to remove the callback proxy from
  * \param filter the filter object for which the callback was proxified


=====================================
modules/gui/qt/dialogs/extended/extended_panels.cpp
=====================================
@@ -297,7 +297,9 @@ void ExtVideo::clean()
 
 static QString ChangeFiltersString( qt_intf_t *p_intf, const char *psz_filter_type, const char *psz_name, bool b_add )
 {
-    char* psz_chain = var_GetString( p_intf, psz_filter_type );
+    char *psz_chain = nullptr;
+    if (const auto vout = THEMIM->getVout(); vout != nullptr)
+        psz_chain = var_GetString( vout.get(), psz_filter_type );
 
     QString const chain = QString( psz_chain ? psz_chain : "" );
     QStringList list = chain.split( ':', Qt::SkipEmptyParts );


=====================================
src/misc/filter.c
=====================================
@@ -56,13 +56,22 @@ void filter_AddProxyCallbacks( vlc_object_t *obj, filter_t *filter,
     {
         char *name = *pname;
         int var_type = var_Type(filter, name);
-        if (var_Type(obj, name) || config_GetType(name) == 0)
+        if (config_GetType(name) == 0)
         {
             free(name);
             continue;
         }
-        var_Create(obj, name,
-                   var_type | VLC_VAR_DOINHERIT | VLC_VAR_ISCOMMAND);
+
+        /* Create a mapping variable of the filter value if it does not exist.
+         * These variables shouldn't be removed on proxy removal as they allow
+         * keeping track of the filter state between filter chain resets. */
+        const bool not_mapped = (var_Type(obj, name) == 0);
+        if (not_mapped)
+        {
+            var_Create(obj, name,
+                       var_type | VLC_VAR_DOINHERIT | VLC_VAR_ISCOMMAND);
+        }
+
         if ((var_type & VLC_VAR_ISCOMMAND))
             var_AddCallback(obj, name, TriggerFilterCallback, filter);
         else
@@ -94,7 +103,6 @@ void filter_DelProxyCallbacks( vlc_object_t *obj, filter_t *filter,
             var_DelCallback(obj, name, TriggerFilterCallback, filter);
         else if (filter_var_type)
             var_DelCallback(obj, name, restart_cb, obj);
-        var_Destroy(obj, name);
         free(name);
     }
     free(names);



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/551b1bd8067087bb80be0194d3b617bd83fcd90c...0c0817fa7bb8d0ac6da51be4daa4f614be209135

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/551b1bd8067087bb80be0194d3b617bd83fcd90c...0c0817fa7bb8d0ac6da51be4daa4f614be209135
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list