[vlc-commits] [Git][videolan/vlc][master] 6 commits: vlc_plugin: define config types based on the stored typed

Steve Lhomme (@robUx4) gitlab at videolan.org
Sun Dec 3 09:12:27 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
644dc6eb by Steve Lhomme at 2023-12-03T08:36:03+00:00
vlc_plugin: define config types based on the stored typed

Only a few values correspond to a type when using the CONFIG_CLASS mask.

- - - - -
7c16f0fa by Steve Lhomme at 2023-12-03T08:36:03+00:00
config: assert when a storage type is not handled in the command-line

New storage types can be added, but they need to be handled here.

- - - - -
a499450e by Steve Lhomme at 2023-12-03T08:36:03+00:00
vlc_interface: remove unused vlc_value_t in interaction_dialog_t

- - - - -
63556b9a by Steve Lhomme at 2023-12-03T08:36:03+00:00
vlc_variables: move list_callback signature in vlc_variables.h

It's not needed outside of variables.

- - - - -
44dc55e3 by Steve Lhomme at 2023-12-03T08:36:03+00:00
vlc_variables: move vlc_callback_t signature in vlc_variables.h

It's mostly used for var_AddCallback() and filter callbacks. But vlc_common.h
currently includes vlc_variables.h so it's still available there.

- - - - -
041b39df by Steve Lhomme at 2023-12-03T08:36:03+00:00
vlc_variables: move vlc_value_t structure in vlc_variables.h

It's only referenced in that header.

- - - - -


5 changed files:

- include/vlc_common.h
- include/vlc_interface.h
- include/vlc_plugin.h
- include/vlc_variables.h
- src/config/cmdline.c


Changes:

=====================================
include/vlc_common.h
=====================================
@@ -480,20 +480,6 @@ typedef struct addon_entry_t addon_entry_t;
 /* Update */
 typedef struct update_t update_t;
 
-/**
- * VLC value structure
- */
-typedef union
-{
-    int64_t         i_int;
-    bool            b_bool;
-    float           f_float;
-    char *          psz_string;
-    void *          p_address;
-    struct { int32_t x; int32_t y; } coords;
-
-} vlc_value_t;
-
 /**
  * \defgroup errors Error codes
  * \ingroup cext
@@ -518,24 +504,6 @@ typedef union
 
 /** @} */
 
-/*****************************************************************************
- * Variable callbacks: called when the value is modified
- *****************************************************************************/
-typedef int ( * vlc_callback_t ) ( vlc_object_t *,      /* variable's object */
-                                   char const *,            /* variable name */
-                                   vlc_value_t,                 /* old value */
-                                   vlc_value_t,                 /* new value */
-                                   void * );                /* callback data */
-
-/*****************************************************************************
- * List callbacks: called when elements are added/removed from the list
- *****************************************************************************/
-typedef int ( * vlc_list_callback_t ) ( vlc_object_t *,      /* variable's object */
-                                        char const *,            /* variable name */
-                                        int,                  /* VLC_VAR_* action */
-                                        vlc_value_t *,      /* new/deleted value  */
-                                        void *);                 /* callback data */
-
 /*****************************************************************************
  * OS-specific headers and thread types
  *****************************************************************************/


=====================================
include/vlc_interface.h
=====================================
@@ -270,7 +270,6 @@ typedef struct interaction_dialog_t
 
     char           *psz_returned[1];    ///< returned responses from the user
 
-    vlc_value_t     val;                ///< value coming from core for dialogue
     int             i_timeToGo;         ///< time (in sec) until shown progress is finished
     bool      b_cancelled;        ///< was the dialogue cancelled ?
 


=====================================
include/vlc_plugin.h
=====================================
@@ -117,21 +117,21 @@ enum vlc_module_properties
 #define CONFIG_SECTION                      0x08 /* Start of new section */
 
 /* Configuration item types */
-#define CONFIG_ITEM_FLOAT                   0x20  /* Float option */
-#define CONFIG_ITEM_INTEGER                 0x40  /* Integer option */
-#define CONFIG_ITEM_RGB                     0x41  /* RGB color option */
-#define CONFIG_ITEM_BOOL                    0x60  /* Bool option */
-#define CONFIG_ITEM_STRING                  0x80  /* String option */
-#define CONFIG_ITEM_PASSWORD                0x81  /* Password option (*) */
-#define CONFIG_ITEM_KEY                     0x82  /* Hot key option */
-#define CONFIG_ITEM_MODULE                  0x84  /* Module option */
-#define CONFIG_ITEM_MODULE_CAT              0x85  /* Module option */
-#define CONFIG_ITEM_MODULE_LIST             0x86  /* Module option */
-#define CONFIG_ITEM_MODULE_LIST_CAT         0x87  /* Module option */
-#define CONFIG_ITEM_LOADFILE                0x8C  /* Read file option */
-#define CONFIG_ITEM_SAVEFILE                0x8D  /* Written file option */
-#define CONFIG_ITEM_DIRECTORY               0x8E  /* Directory option */
-#define CONFIG_ITEM_FONT                    0x8F  /* Font option */
+#define CONFIG_ITEM_FLOAT                   (1 << 5)  /* Float option */
+#define CONFIG_ITEM_INTEGER                 (2 << 5)  /* Integer option */
+#define CONFIG_ITEM_RGB                     (CONFIG_ITEM_INTEGER | 0x01)  /* RGB color option */
+#define CONFIG_ITEM_BOOL                    (3 << 5)  /* Bool option */
+#define CONFIG_ITEM_STRING                  (4 << 5)  /* String option */
+#define CONFIG_ITEM_PASSWORD                (CONFIG_ITEM_STRING | 0x01)  /* Password option (*) */
+#define CONFIG_ITEM_KEY                     (CONFIG_ITEM_STRING | 0x02)  /* Hot key option */
+#define CONFIG_ITEM_MODULE                  (CONFIG_ITEM_STRING | 0x04)  /* Module option */
+#define CONFIG_ITEM_MODULE_CAT              (CONFIG_ITEM_STRING | 0x05)  /* Module option */
+#define CONFIG_ITEM_MODULE_LIST             (CONFIG_ITEM_STRING | 0x06)  /* Module option */
+#define CONFIG_ITEM_MODULE_LIST_CAT         (CONFIG_ITEM_STRING | 0x07)  /* Module option */
+#define CONFIG_ITEM_LOADFILE                (CONFIG_ITEM_STRING | 0x0C)  /* Read file option */
+#define CONFIG_ITEM_SAVEFILE                (CONFIG_ITEM_STRING | 0x0D)  /* Written file option */
+#define CONFIG_ITEM_DIRECTORY               (CONFIG_ITEM_STRING | 0x0E)  /* Directory option */
+#define CONFIG_ITEM_FONT                    (CONFIG_ITEM_STRING | 0x0F)  /* Font option */
 
 /* reduce specific type to type class */
 #define CONFIG_CLASS(x) ((x) & ~0x1F)


=====================================
include/vlc_variables.h
=====================================
@@ -114,6 +114,38 @@ enum vlc_var_atomic_op {
     VLC_VAR_INTEGER_NAND,/**< Binary NAND over an integer bits field */
 };
 
+/**
+ * VLC value structure
+ */
+typedef union
+{
+    int64_t         i_int;
+    bool            b_bool;
+    float           f_float;
+    char *          psz_string;
+    void *          p_address;
+    struct { int32_t x; int32_t y; } coords;
+
+} vlc_value_t;
+
+/*****************************************************************************
+ * Variable callbacks: called when the value is modified
+ *****************************************************************************/
+typedef int ( * vlc_callback_t ) ( vlc_object_t *,      /* variable's object */
+                                   char const *,            /* variable name */
+                                   vlc_value_t,                 /* old value */
+                                   vlc_value_t,                 /* new value */
+                                   void * );                /* callback data */
+
+/*****************************************************************************
+ * List callbacks: called when elements are added/removed from the list
+ *****************************************************************************/
+typedef int ( * vlc_list_callback_t ) ( vlc_object_t *,      /* variable's object */
+                                        char const *,            /* variable name */
+                                        int,                  /* VLC_VAR_* action */
+                                        vlc_value_t *,      /* new/deleted value  */
+                                        void *);                 /* callback data */
+
 /**
  * Creates a VLC object variable.
  *


=====================================
src/config/cmdline.c
=====================================
@@ -336,6 +336,8 @@ int config_LoadCmdLine( libvlc_int_t *p_this, int i_argc,
                         var_Create( p_this, psz_name, VLC_VAR_BOOL );
                         var_SetBool( p_this, psz_name, !flag );
                         break;
+                    default:
+                        vlc_assert_unreachable();
                 }
                 continue;
             }
@@ -372,6 +374,8 @@ int config_LoadCmdLine( libvlc_int_t *p_this, int i_argc,
                     var_Create( p_this, name, VLC_VAR_BOOL );
                     var_SetBool( p_this, name, true );
                     break;
+                default:
+                    vlc_assert_unreachable();
             }
 
             continue;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/4464af834ec0617ff6d6f4b39438c8112ce8d273...041b39df69106a03dcf6d9feb7f74f213528ed01

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/4464af834ec0617ff6d6f4b39438c8112ce8d273...041b39df69106a03dcf6d9feb7f74f213528ed01
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