[vlc-commits] [Git][videolan/vlc][master] 7 commits: vlc_config_cat: add new vlc_config_*cat_Find()

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Sat Aug 12 18:26:30 UTC 2023



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
8ecf5b33 by Alexandre Janniaux at 2023-08-12T18:08:59+00:00
vlc_config_cat: add new vlc_config_*cat_Find()

The functions will be used to fetch from the internal categories and
subcategories arrays, and replace the manual lookup into the table, so
as to render the vlc_config_*cat_IndexOf functions obsolete.

- - - - -
176a8133 by Alexandre Janniaux at 2023-08-12T18:08:59+00:00
vlc_config_cat: refactor inline functions

Use the new vlc_config_*cat_Find() functions to look into the categories
and subcategories tables.

- - - - -
8ecb2d01 by Alexandre Janniaux at 2023-08-12T18:08:59+00:00
vlc_config_cat: add GetAt/Count functions

- - - - -
f7afe552 by Alexandre Janniaux at 2023-08-12T18:08:59+00:00
qt: complete_preferences: use new vlc_config_cat funtions

vlc_config_cat_IndexOf will disappear in the next commits, so use the
new get/count/lookup functions instead.

- - - - -
c9a0078e by Alexandre Janniaux at 2023-08-12T18:08:59+00:00
qt: complete_preferences: switch to unordered_map

The previous map was based on the number of categories exposed, but this
will not be available anymore. Instead, exposed a enum -> value map that
will increase when we lookup the categories.

- - - - -
6b492e7d by Alexandre Janniaux at 2023-08-12T18:08:59+00:00
macosx: prefs: use new vlc_config_cat helpers

The categories_array will become unavailable for the modules in the next
commit, so use the helpers instead.

- - - - -
d3898bdd by Alexandre Janniaux at 2023-08-12T18:08:59+00:00
vlc_config_cat: move functions and tables to src/

Those tables were defined in every different target including them, and
meant that including vlc_config_cat.h exposed non-namespaced
categories_array and subcategories_array variables.

Instead, expose functions to count, fetch and lookup.

- - - - -


8 changed files:

- include/vlc_config_cat.h
- modules/gui/macosx/preferences/prefs.m
- modules/gui/qt/dialogs/preferences/complete_preferences.cpp
- modules/gui/qt/dialogs/preferences/complete_preferences.hpp
- src/Makefile.am
- + src/config/cat.c
- src/libvlccore.sym
- src/meson.build


Changes:

=====================================
include/vlc_config_cat.h
=====================================
@@ -2,9 +2,11 @@
  * vlc_config_cat.h : Definition of configuration categories
  *****************************************************************************
  * Copyright (C) 2003 VLC authors and VideoLAN
+ * Copyright (C) 2023 Videolabs
  *
  * Authors: Clément Stenac <zorglub at videolan.org>
  *          Anil Daoud <anil at videolan.org>
+ *          Alexandre Janniaux <ajanni at videolabs.io>
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as published by
@@ -26,6 +28,8 @@
 
 # include <vlc_plugin.h>
 
+# include <assert.h>
+
 #define MAIN_TITLE N_( "VLC preferences" )
 
 /*  - Titles -
@@ -160,93 +164,26 @@ struct config_subcategory_t
     const char *help;
 };
 
-static const struct config_category_t categories_array[] =
-{
-    { CAT_PLAYLIST,   SUBCAT_PLAYLIST_GENERAL,   PLAYLIST_HELP  },
-    { CAT_INTERFACE,  SUBCAT_INTERFACE_GENERAL,  INTF_HELP      },
-    { CAT_AUDIO,      SUBCAT_AUDIO_GENERAL,      AUDIO_HELP     },
-    { CAT_VIDEO,      SUBCAT_VIDEO_GENERAL,      VIDEO_HELP     },
-    { CAT_INPUT,      SUBCAT_INPUT_GENERAL,      INPUT_HELP     },
-    { CAT_SOUT,       SUBCAT_SOUT_GENERAL,       SOUT_HELP      },
-    { CAT_ADVANCED,   SUBCAT_ADVANCED_MISC,      AADVANCED_HELP },
-};
+/**
+ * Fetch category information from VLC
+ */
+VLC_API VLC_USED const struct config_category_t *
+vlc_config_cat_Find(enum vlc_config_cat cat);
 
-static const struct config_subcategory_t subcategories_array[] =
-{
-    { SUBCAT_PLAYLIST_GENERAL,     CAT_PLAYLIST,   PLAYLIST_TITLE,            PGENERAL_HELP      },
-    { SUBCAT_PLAYLIST_EXPORT,      CAT_PLAYLIST,   N_("Export"),              PEXPORT_HELP       },
-    { SUBCAT_PLAYLIST_SD,          CAT_PLAYLIST,   N_("Services discovery"),  SD_HELP            },
-
-    { SUBCAT_INTERFACE_GENERAL,    CAT_INTERFACE,  INTF_TITLE,                INTF_GENERAL_HELP  },
-    { SUBCAT_INTERFACE_CONTROL,    CAT_INTERFACE,  N_("Control interfaces"),  INTF_CONTROL_HELP  },
-    { SUBCAT_INTERFACE_HOTKEYS,    CAT_INTERFACE,  N_("Hotkeys settings"),    INTF_HOTKEYS_HELP  },
-    { SUBCAT_INTERFACE_MAIN,       CAT_INTERFACE,  N_("Main interfaces"),     INTF_MAIN_HELP     },
-
-    { SUBCAT_AUDIO_GENERAL,        CAT_AUDIO,      AUDIO_TITLE,               AUDIO_GENERAL_HELP },
-    { SUBCAT_AUDIO_RESAMPLER,      CAT_AUDIO,      N_("Audio resampler"),     AFILTER_HELP       },
-    { SUBCAT_AUDIO_AFILTER,        CAT_AUDIO,      N_("Filters"),             AFILTER_HELP       },
-    { SUBCAT_AUDIO_AOUT,           CAT_AUDIO,      N_("Output modules"),      AOUT_HELP          },
-    { SUBCAT_AUDIO_VISUAL,         CAT_AUDIO,      N_("Visualizations"),      AVISUAL_HELP       },
-
-    { SUBCAT_VIDEO_GENERAL,        CAT_VIDEO,      VIDEO_TITLE,               VIDEO_GENERAL_HELP },
-    { SUBCAT_VIDEO_VFILTER,        CAT_VIDEO,      N_("Filters"),             VFILTER_HELP       },
-    { SUBCAT_VIDEO_VOUT,           CAT_VIDEO,      N_("Output modules"),      VOUT_HELP          },
-    { SUBCAT_VIDEO_SPLITTER,       CAT_VIDEO,      N_("Splitters"),           SPLITTER_HELP      },
-    { SUBCAT_VIDEO_SUBPIC,         CAT_VIDEO,      N_("Subtitles / OSD"),     SUBPIC_HELP        },
-
-    { SUBCAT_INPUT_GENERAL,        CAT_INPUT,      INPUT_TITLE,               INPUT_HELP         },
-    { SUBCAT_INPUT_ACCESS,         CAT_INPUT,      N_("Access modules"),      ACCESS_HELP        },
-    { SUBCAT_INPUT_ACODEC,         CAT_INPUT,      N_("Audio codecs"),        ADEC_HELP          },
-    { SUBCAT_INPUT_DEMUX,          CAT_INPUT,      N_("Demuxers"),            DEMUX_HELP         },
-    { SUBCAT_INPUT_STREAM_FILTER,  CAT_INPUT,      N_("Stream filters"),      STREAM_FILTER_HELP },
-    { SUBCAT_INPUT_SCODEC,         CAT_INPUT,      N_("Subtitle codecs"),     SDEC_HELP          },
-    { SUBCAT_INPUT_VCODEC,         CAT_INPUT,      N_("Video codecs"),        VDEC_HELP          },
-
-    { SUBCAT_SOUT_GENERAL,         CAT_SOUT,       SOUT_TITLE,                SOUT_GENERAL_HELP  },
-    { SUBCAT_SOUT_ACO,             CAT_SOUT,       N_("Access output"),       SOUT_ACO_HELP      },
-    { SUBCAT_SOUT_MUX,             CAT_SOUT,       N_("Muxers"),              SOUT_MUX_HELP      },
-    { SUBCAT_SOUT_PACKETIZER,      CAT_SOUT,       N_("Packetizers"),         SOUT_PACKET_HELP   },
-    { SUBCAT_SOUT_RENDERER,        CAT_SOUT,       N_("Renderers"),           SOUT_RENDER_HELP   },
-    { SUBCAT_SOUT_STREAM,          CAT_SOUT,       N_("Sout stream"),         SOUT_STREAM_HELP   },
-    { SUBCAT_SOUT_VOD,             CAT_SOUT,       N_("VOD"),                 SOUT_VOD_HELP      },
-
-    { SUBCAT_ADVANCED_MISC,        CAT_ADVANCED,   AADVANCED_TITLE,           AADVANCED_HELP     },
-    { SUBCAT_ADVANCED_NETWORK,     CAT_ADVANCED,   N_("Network"),             ANETWORK_HELP      },
-
-    { SUBCAT_HIDDEN,               CAT_HIDDEN,     NULL,                      NULL               },
-};
+VLC_API VLC_USED const struct config_category_t *
+vlc_config_cat_GetAt(size_t index);
 
-/** Get the table index for the given category entry. */
-VLC_USED
-static inline int vlc_config_cat_IndexOf( enum vlc_config_cat cat )
-{
-    int index = -1;
-    for( unsigned i = 0; i < ARRAY_SIZE(categories_array); i++ )
-    {
-        if( categories_array[i].id == cat )
-        {
-            index = i;
-            break;
-        }
-    }
-    return index;
-}
+VLC_API VLC_USED const struct config_subcategory_t *
+vlc_config_subcat_Find(enum vlc_config_subcat subcat);
 
-/** Get the table index for the given subcategory entry. */
-VLC_USED
-static inline int vlc_config_subcat_IndexOf( enum vlc_config_subcat subcat )
-{
-    int index = -1;
-    for( unsigned i = 0; i < ARRAY_SIZE(subcategories_array); i++ )
-    {
-        if( subcategories_array[i].id == subcat )
-        {
-            index = i;
-            break;
-        }
-    }
-    return index;
-}
+VLC_API VLC_USED const struct config_subcategory_t *
+vlc_config_subcat_GetAt(size_t index);
+
+VLC_API VLC_USED size_t
+vlc_config_cat_Count(void);
+
+VLC_API VLC_USED size_t
+vlc_config_subcat_Count(void);
 
 /** Get the "general" subcategory for a given category.
  *
@@ -266,24 +203,30 @@ static inline int vlc_config_subcat_IndexOf( enum vlc_config_subcat subcat )
 VLC_USED
 static inline enum vlc_config_subcat vlc_config_cat_GetGeneralSubcat( enum vlc_config_cat cat )
 {
-    int i = vlc_config_cat_IndexOf( cat );
-    return (i != -1) ? categories_array[i].general_subcat : SUBCAT_UNKNOWN;
+    const struct config_category_t *c = vlc_config_cat_Find(cat);
+    if (c == NULL)
+        return SUBCAT_UNKNOWN;
+    return c->general_subcat;
 }
 
 /** Get the name for a subcategory. */
 VLC_USED
 static inline const char *vlc_config_subcat_GetName( enum vlc_config_subcat subcat )
 {
-    int i = vlc_config_subcat_IndexOf( subcat );
-    return (i != -1) ? vlc_gettext(subcategories_array[i].name) : NULL;
+    const struct config_subcategory_t *s = vlc_config_subcat_Find(subcat);
+    if (s == NULL)
+        return NULL;
+    return vlc_gettext(s->name);
 }
 
 /** Get the help text for a subcategory. */
 VLC_USED
 static inline const char *vlc_config_subcat_GetHelp( enum vlc_config_subcat subcat )
 {
-    int i = vlc_config_subcat_IndexOf( subcat );
-    return (i != -1) ? vlc_gettext(subcategories_array[i].help) : NULL;
+    const struct config_subcategory_t *s = vlc_config_subcat_Find(subcat);
+    if (s == NULL)
+        return NULL;
+    return vlc_gettext(s->help);
 }
 
 /** Get the name for a category. */
@@ -298,16 +241,20 @@ static inline const char *vlc_config_cat_GetName( enum vlc_config_cat cat )
 VLC_USED
 static inline const char *vlc_config_cat_GetHelp( enum vlc_config_cat cat )
 {
-    int i = vlc_config_cat_IndexOf( cat );
-    return (i != -1) ? vlc_gettext(categories_array[i].help) : NULL;
+    const struct config_category_t *c = vlc_config_cat_Find(cat);
+    if (c == NULL)
+        return NULL;
+    return vlc_gettext(c->help);
 }
 
 /** Get the parent category for the given subcategory. */
 VLC_USED
 static inline enum vlc_config_cat vlc_config_cat_FromSubcat( enum vlc_config_subcat subcat )
 {
-    int i = vlc_config_subcat_IndexOf( subcat );
-    return (i != -1) ? subcategories_array[i].cat : CAT_UNKNOWN;
+    const struct config_subcategory_t *s = vlc_config_subcat_Find(subcat);
+    if (s == NULL)
+        return CAT_UNKNOWN;
+    return s->cat;
 }
 
 /** Check if the given subcategory is a "general" one. */


=====================================
modules/gui/macosx/preferences/prefs.m
=====================================
@@ -565,11 +565,11 @@ enum VLCTreeBranchType {
     // Sort the top-level cat items into preferred order
     NSUInteger index = 0;
     NSUInteger childrenCount = [[self children] count];
-    for (unsigned i = 0; i < ARRAY_SIZE(categories_array); i++) {
+    for (unsigned i = 0; i < vlc_config_cat_Count(); i++) {
         // Try to find index of current cat
         for (NSUInteger j = index; j < childrenCount; j++) {
             VLCTreeBranchItem * item = [[self children] objectAtIndex:j];
-            if ([item category] == categories_array[i].id) {
+            if ([item category] == vlc_config_cat_GetAt(i)->id) {
                 if (j != index) {
                     [[self children] exchangeObjectAtIndex:j withObjectAtIndex:index];
                 }


=====================================
modules/gui/qt/dialogs/preferences/complete_preferences.cpp
=====================================
@@ -160,9 +160,10 @@ PrefsTree::PrefsTree( qt_intf_t *_p_intf, QWidget *_parent,
     // the top-level cat nodes into a preferred order.
     sortItems( 0, Qt::AscendingOrder );
     unsigned index = 0;
-    for (unsigned i = 0; i < ARRAY_SIZE(categories_array); i++)
+    for (unsigned i = 0; i < vlc_config_cat_Count(); i++)
     {
-        cat_item = findCatItem( categories_array[i].id );
+        const config_category_t *cat = vlc_config_cat_GetAt(i);
+        cat_item = findCatItem(cat->id);
         if ( cat_item == NULL )
             continue;
         unsigned cur_index = (unsigned)indexOfTopLevelItem( cat_item );
@@ -209,10 +210,8 @@ QTreeWidgetItem *PrefsTree::createCatNode( enum vlc_config_cat cat )
     item->setIcon( 0, icon );
     //current_item->setSizeHint( 0, QSize( -1, ITEM_HEIGHT ) );
 
-    int cat_index = (int) vlc_config_cat_IndexOf( cat );
-    int general_subcat_index = (int) vlc_config_subcat_IndexOf( general_subcat );
-    this->catMap[cat_index] = item;
-    this->subcatMap[general_subcat_index] = item;
+    this->catMap[cat] = item;
+    this->subcatMap[general_subcat] = item;
 
     addTopLevelItem( item );
     expandItem( item );
@@ -235,8 +234,7 @@ QTreeWidgetItem *PrefsTree::createSubcatNode( QTreeWidgetItem * cat, enum vlc_co
     item->setText( 0, item->name );
     //item->setSizeHint( 0, QSize( -1, ITEM_HEIGHT ) );
 
-    int subcat_index = (int) vlc_config_subcat_IndexOf( subcat );
-    this->subcatMap[subcat_index] = item;
+    this->subcatMap[subcat] = item;
 
     cat->addChild( item );
 
@@ -269,14 +267,18 @@ void PrefsTree::createPluginNode( QTreeWidgetItem * parent, module_t *mod )
 
 QTreeWidgetItem *PrefsTree::findCatItem( enum vlc_config_cat cat )
 {
-    int cat_index = vlc_config_cat_IndexOf( cat );
-    return this->catMap[cat_index];
+    auto it = this->catMap.find(cat);
+    if (it == std::end(this->catMap))
+        return NULL;
+    return it->second;
 }
 
 QTreeWidgetItem *PrefsTree::findSubcatItem( enum vlc_config_subcat subcat )
 {
-    int subcat_index = vlc_config_subcat_IndexOf( subcat );
-    return this->subcatMap[subcat_index];
+    auto it = this->subcatMap.find(subcat);
+    if (it == std::end(this->subcatMap))
+        return NULL;
+    return it->second;
 }
 
 void PrefsTree::applyAll()


=====================================
modules/gui/qt/dialogs/preferences/complete_preferences.hpp
=====================================
@@ -36,6 +36,8 @@
 
 #include "qt.hpp"
 
+#include <unordered_map>
+
 /**
  * Notes:
  *
@@ -112,8 +114,8 @@ private:
     qt_intf_t *p_intf;
     module_t *main_module;
     bool b_show_only_loaded;
-    QTreeWidgetItem *catMap[ARRAY_SIZE(categories_array)] = { nullptr };
-    QTreeWidgetItem *subcatMap[ARRAY_SIZE(subcategories_array)] = { nullptr };
+    std::unordered_map<vlc_config_cat, QTreeWidgetItem *> catMap;
+    std::unordered_map<vlc_config_subcat, QTreeWidgetItem *> subcatMap;
 
 private slots:
     void resizeColumns();


=====================================
src/Makefile.am
=====================================
@@ -215,6 +215,7 @@ libvlccore_la_SOURCES = \
 	version.c \
 	config/ansi_term.h \
 	config/configuration.h \
+	config/cat.c \
 	config/core.c \
 	config/chain.c \
 	config/dirs.c \


=====================================
src/config/cat.c
=====================================
@@ -0,0 +1,135 @@
+/*****************************************************************************
+ * vlc_config_cat.h : Definition of configuration categories
+ *****************************************************************************
+ * Copyright (C) 2003 VLC authors and VideoLAN
+ * Copyright (C) 2023 Videolabs
+ *
+ * Authors: Clément Stenac <zorglub at videolan.org>
+ *          Anil Daoud <anil at videolan.org>
+ *          Alexandre Janniaux <ajanni at videolabs.io>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <vlc_common.h>
+#include <vlc_config_cat.h>
+
+static const struct config_category_t categories_array[] =
+{
+    { CAT_PLAYLIST,   SUBCAT_PLAYLIST_GENERAL,   PLAYLIST_HELP  },
+    { CAT_INTERFACE,  SUBCAT_INTERFACE_GENERAL,  INTF_HELP      },
+    { CAT_AUDIO,      SUBCAT_AUDIO_GENERAL,      AUDIO_HELP     },
+    { CAT_VIDEO,      SUBCAT_VIDEO_GENERAL,      VIDEO_HELP     },
+    { CAT_INPUT,      SUBCAT_INPUT_GENERAL,      INPUT_HELP     },
+    { CAT_SOUT,       SUBCAT_SOUT_GENERAL,       SOUT_HELP      },
+    { CAT_ADVANCED,   SUBCAT_ADVANCED_MISC,      AADVANCED_HELP },
+};
+
+static const struct config_subcategory_t subcategories_array[] =
+{
+    { SUBCAT_PLAYLIST_GENERAL,     CAT_PLAYLIST,   PLAYLIST_TITLE,            PGENERAL_HELP      },
+    { SUBCAT_PLAYLIST_EXPORT,      CAT_PLAYLIST,   N_("Export"),              PEXPORT_HELP       },
+    { SUBCAT_PLAYLIST_SD,          CAT_PLAYLIST,   N_("Services discovery"),  SD_HELP            },
+
+    { SUBCAT_INTERFACE_GENERAL,    CAT_INTERFACE,  INTF_TITLE,                INTF_GENERAL_HELP  },
+    { SUBCAT_INTERFACE_CONTROL,    CAT_INTERFACE,  N_("Control interfaces"),  INTF_CONTROL_HELP  },
+    { SUBCAT_INTERFACE_HOTKEYS,    CAT_INTERFACE,  N_("Hotkeys settings"),    INTF_HOTKEYS_HELP  },
+    { SUBCAT_INTERFACE_MAIN,       CAT_INTERFACE,  N_("Main interfaces"),     INTF_MAIN_HELP     },
+
+    { SUBCAT_AUDIO_GENERAL,        CAT_AUDIO,      AUDIO_TITLE,               AUDIO_GENERAL_HELP },
+    { SUBCAT_AUDIO_RESAMPLER,      CAT_AUDIO,      N_("Audio resampler"),     AFILTER_HELP       },
+    { SUBCAT_AUDIO_AFILTER,        CAT_AUDIO,      N_("Filters"),             AFILTER_HELP       },
+    { SUBCAT_AUDIO_AOUT,           CAT_AUDIO,      N_("Output modules"),      AOUT_HELP          },
+    { SUBCAT_AUDIO_VISUAL,         CAT_AUDIO,      N_("Visualizations"),      AVISUAL_HELP       },
+
+    { SUBCAT_VIDEO_GENERAL,        CAT_VIDEO,      VIDEO_TITLE,               VIDEO_GENERAL_HELP },
+    { SUBCAT_VIDEO_VFILTER,        CAT_VIDEO,      N_("Filters"),             VFILTER_HELP       },
+    { SUBCAT_VIDEO_VOUT,           CAT_VIDEO,      N_("Output modules"),      VOUT_HELP          },
+    { SUBCAT_VIDEO_SPLITTER,       CAT_VIDEO,      N_("Splitters"),           SPLITTER_HELP      },
+    { SUBCAT_VIDEO_SUBPIC,         CAT_VIDEO,      N_("Subtitles / OSD"),     SUBPIC_HELP        },
+
+    { SUBCAT_INPUT_GENERAL,        CAT_INPUT,      INPUT_TITLE,               INPUT_HELP         },
+    { SUBCAT_INPUT_ACCESS,         CAT_INPUT,      N_("Access modules"),      ACCESS_HELP        },
+    { SUBCAT_INPUT_ACODEC,         CAT_INPUT,      N_("Audio codecs"),        ADEC_HELP          },
+    { SUBCAT_INPUT_DEMUX,          CAT_INPUT,      N_("Demuxers"),            DEMUX_HELP         },
+    { SUBCAT_INPUT_STREAM_FILTER,  CAT_INPUT,      N_("Stream filters"),      STREAM_FILTER_HELP },
+    { SUBCAT_INPUT_SCODEC,         CAT_INPUT,      N_("Subtitle codecs"),     SDEC_HELP          },
+    { SUBCAT_INPUT_VCODEC,         CAT_INPUT,      N_("Video codecs"),        VDEC_HELP          },
+
+    { SUBCAT_SOUT_GENERAL,         CAT_SOUT,       SOUT_TITLE,                SOUT_GENERAL_HELP  },
+    { SUBCAT_SOUT_ACO,             CAT_SOUT,       N_("Access output"),       SOUT_ACO_HELP      },
+    { SUBCAT_SOUT_MUX,             CAT_SOUT,       N_("Muxers"),              SOUT_MUX_HELP      },
+    { SUBCAT_SOUT_PACKETIZER,      CAT_SOUT,       N_("Packetizers"),         SOUT_PACKET_HELP   },
+    { SUBCAT_SOUT_RENDERER,        CAT_SOUT,       N_("Renderers"),           SOUT_RENDER_HELP   },
+    { SUBCAT_SOUT_STREAM,          CAT_SOUT,       N_("Sout stream"),         SOUT_STREAM_HELP   },
+    { SUBCAT_SOUT_VOD,             CAT_SOUT,       N_("VOD"),                 SOUT_VOD_HELP      },
+
+    { SUBCAT_ADVANCED_MISC,        CAT_ADVANCED,   AADVANCED_TITLE,           AADVANCED_HELP     },
+    { SUBCAT_ADVANCED_NETWORK,     CAT_ADVANCED,   N_("Network"),             ANETWORK_HELP      },
+
+    { SUBCAT_HIDDEN,               CAT_HIDDEN,     NULL,                      NULL               },
+};
+
+const struct config_category_t *
+vlc_config_cat_Find(enum vlc_config_cat cat)
+{
+    for (size_t i=0; i < ARRAY_SIZE(categories_array); i++ )
+    {
+        if( categories_array[i].id == cat )
+            return &categories_array[i];
+    }
+    return NULL;
+}
+
+const struct config_category_t *
+vlc_config_cat_GetAt(size_t index)
+{
+    assert(index < ARRAY_SIZE(categories_array));
+    return &categories_array[index];
+}
+
+const struct config_subcategory_t *
+vlc_config_subcat_Find(enum vlc_config_subcat subcat)
+{
+    for (size_t i=0; i < ARRAY_SIZE(subcategories_array); i++)
+    {
+        if (subcategories_array[i].id == subcat)
+            return &subcategories_array[i];
+    }
+    return NULL;
+}
+
+const struct config_subcategory_t *
+vlc_config_subcat_GetAt(size_t index)
+{
+    assert(index < ARRAY_SIZE(subcategories_array));
+    return &subcategories_array[index];
+}
+
+size_t
+vlc_config_cat_Count(void)
+{
+    return ARRAY_SIZE(categories_array);
+}
+
+size_t
+vlc_config_subcat_Count(void)
+{
+    return ARRAY_SIZE(subcategories_array);
+}


=====================================
src/libvlccore.sym
=====================================
@@ -532,6 +532,12 @@ vlc_cond_init
 vlc_cond_signal
 vlc_cond_timedwait
 vlc_cond_wait
+vlc_config_cat_Count
+vlc_config_cat_Find
+vlc_config_cat_GetAt
+vlc_config_subcat_Count
+vlc_config_subcat_Find
+vlc_config_subcat_GetAt
 vlc_credential_init
 vlc_credential_clean
 vlc_credential_get


=====================================
src/meson.build
=====================================
@@ -74,6 +74,7 @@ libvlccore_sources_base = files(
     'libvlc-module.c',
     'missing.c',
     'version.c',
+    'config/cat.c',
     'config/configuration.h',
     'config/core.c',
     'config/chain.c',



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/d277b0aafc780e56df7ef1aa16efcf3761cb039f...d3898bdd7a491382ac7458ede2b4222d63326cda

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/d277b0aafc780e56df7ef1aa16efcf3761cb039f...d3898bdd7a491382ac7458ede2b4222d63326cda
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