[vlc-commits] [Git][videolan/vlc][master] 2 commits: medialibrary: Add control to add labels

Felix Paul Kühne (@fkuehne) gitlab at videolan.org
Mon Sep 7 14:42:00 UTC 2026



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


Commits:
293ef849 by Claudio Cambra at 2026-09-07T16:21:46+02:00
medialibrary: Add control to add labels

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
18c38d1f by Claudio Cambra at 2026-09-07T16:21:46+02:00
medialibrary: Add control to remove labels

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -


3 changed files:

- include/vlc_media_library.h
- modules/misc/medialibrary/medialibrary.cpp
- modules/misc/medialibrary/medialibrary.h


Changes:

=====================================
include/vlc_media_library.h
=====================================
@@ -640,6 +640,8 @@ enum vlc_ml_control
     VLC_ML_MEDIA_SET_TYPE,                  /**< arg1: media id; arg2: vlc_ml_media_type_t */
     VLC_ML_MEDIA_SET_PLAYED,                /**< arg1: media id; arg2: bool */
     VLC_ML_MEDIA_SET_FAVORITE,              /**< arg1: media id; arg2: bool */
+    VLC_ML_MEDIA_ADD_LABEL,                 /**< arg1: media id; arg2: label name */
+    VLC_ML_MEDIA_REMOVE_LABEL,              /**< arg1: media id; arg2: label name */
     VLC_ML_MEDIA_ADD_BOOKMARK,              /**< arg1: media id; arg2: int64_t */
     VLC_ML_MEDIA_REMOVE_BOOKMARK,           /**< arg1: media id; arg2: int64_t */
     VLC_ML_MEDIA_REMOVE_ALL_BOOKMARKS,      /**< arg1: media id */
@@ -1113,6 +1115,20 @@ static inline int vlc_ml_remove_stream( vlc_medialibrary_t* p_ml, int64_t i_medi
     return vlc_ml_control(p_ml, VLC_ML_REMOVE_STREAM, i_media_id);
 }
 
+static inline int vlc_ml_media_add_label( vlc_medialibrary_t* p_ml,
+                                          int64_t i_media_id,
+                                          const char* psz_label )
+{
+    return vlc_ml_control(p_ml, VLC_ML_MEDIA_ADD_LABEL, i_media_id, psz_label);
+}
+
+static inline int vlc_ml_media_remove_label( vlc_medialibrary_t* p_ml,
+                                             int64_t i_media_id,
+                                             const char* psz_label )
+{
+    return vlc_ml_control(p_ml, VLC_ML_MEDIA_REMOVE_LABEL, i_media_id, psz_label);
+}
+
 static inline int vlc_ml_media_update_progress( vlc_medialibrary_t* p_ml, int64_t i_media_id,
                                                 double progress )
 {


=====================================
modules/misc/medialibrary/medialibrary.cpp
=====================================
@@ -666,6 +666,8 @@ int MediaLibrary::Control( int query, va_list args )
         case VLC_ML_MEDIA_SET_TYPE:
         case VLC_ML_MEDIA_SET_PLAYED:
         case VLC_ML_MEDIA_SET_FAVORITE:
+        case VLC_ML_MEDIA_ADD_LABEL:
+        case VLC_ML_MEDIA_REMOVE_LABEL:
         case VLC_ML_MEDIA_ADD_BOOKMARK:
         case VLC_ML_MEDIA_REMOVE_BOOKMARK:
         case VLC_ML_MEDIA_REMOVE_ALL_BOOKMARKS:
@@ -1974,6 +1976,33 @@ int MediaLibrary::controlMedia( int query, va_list args )
             
             return VLC_SUCCESS;
         }
+        case VLC_ML_MEDIA_ADD_LABEL:
+        {
+            const char * const labelName = va_arg( args, const char* );
+            if ( labelName == nullptr )
+                return VLC_EINVAL;
+            auto label = m_ml->createLabel( labelName );
+            if ( label == nullptr || m->addLabel( label ) == false )
+                return VLC_EGENERIC;
+            return VLC_SUCCESS;
+        }
+        case VLC_ML_MEDIA_REMOVE_LABEL:
+        {
+            const char * const labelName = va_arg( args, const char* );
+            if ( labelName == nullptr )
+                return VLC_EINVAL;
+
+            auto labels = m->labels();
+            if ( labels == nullptr )
+                return VLC_EGENERIC;
+
+            for ( const auto& label : labels->all() )
+            {
+                if ( label != nullptr && label->name() == labelName )
+                    return m->removeLabel( label ) ? VLC_SUCCESS : VLC_EGENERIC;
+            }
+            return VLC_EGENERIC;
+        }
         case VLC_ML_MEDIA_ADD_BOOKMARK:
         {
             auto time = va_arg( args, int64_t );


=====================================
modules/misc/medialibrary/medialibrary.h
=====================================
@@ -26,6 +26,7 @@
 #include <medialibrary/parser/IItem.h>
 #include <medialibrary/parser/Parser.h>
 #include <medialibrary/IMedia.h>
+#include <medialibrary/ILabel.h>
 #include <medialibrary/IThumbnailer.h>
 
 #include <vlc_common.h>



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/35dd10350229dd44610e9b87f6baa0bd0ff49176...18c38d1fb8920d7f09f63a572e30ae651a509f3b

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/35dd10350229dd44610e9b87f6baa0bd0ff49176...18c38d1fb8920d7f09f63a572e30ae651a509f3b
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help




More information about the vlc-commits mailing list