[vlc-commits] [Git][videolan/vlc][master] 2 commits: macosx: Notify when preparse starts in media source

Steve Lhomme (@robUx4) gitlab at videolan.org
Tue Aug 4 03:24:14 UTC 2026



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
2d8ba050 by Claudio Cambra at 2026-08-04T03:11:35+00:00
macosx: Notify when preparse starts in media source

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

- - - - -
3c5fb56b by Claudio Cambra at 2026-08-04T03:11:35+00:00
macosx: Fix loading overlay being shown forever for input nodes with no children

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

- - - - -


3 changed files:

- modules/gui/macosx/library/media-source/VLCMediaSource.h
- modules/gui/macosx/library/media-source/VLCMediaSource.m
- modules/gui/macosx/library/media-source/VLCMediaSourceDataSource.m


Changes:

=====================================
modules/gui/macosx/library/media-source/VLCMediaSource.h
=====================================
@@ -33,6 +33,7 @@ NS_ASSUME_NONNULL_BEGIN
 extern NSString *VLCMediaSourceChildrenReset;
 extern NSString *VLCMediaSourceChildrenAdded;
 extern NSString *VLCMediaSourceChildrenRemoved;
+extern NSString *VLCMediaSourcePreparsingStarted;
 extern NSString *VLCMediaSourcePreparsingEnded;
 
 @interface VLCMediaSource : NSObject


=====================================
modules/gui/macosx/library/media-source/VLCMediaSource.m
=====================================
@@ -21,6 +21,7 @@
  *****************************************************************************/
 
 #import "VLCMediaSource.h"
+#include <Foundation/Foundation.h>
 
 #import "extensions/NSString+Helpers.h"
 #import "library/VLCInputItem.h"
@@ -37,6 +38,7 @@
 NSString *VLCMediaSourceChildrenReset = @"VLCMediaSourceChildrenReset";
 NSString *VLCMediaSourceChildrenAdded = @"VLCMediaSourceChildrenAdded";
 NSString *VLCMediaSourceChildrenRemoved = @"VLCMediaSourceChildrenRemoved";
+NSString *VLCMediaSourcePreparsingStarted = @"VLCMediaSourcePreparsingStarted";
 NSString *VLCMediaSourcePreparsingEnded = @"VLCMediaSourcePreparsingEnded";
 
 static void cb_children_reset(vlc_media_tree_t * __unused p_tree,
@@ -323,6 +325,9 @@ static const char *const remoteBrowseDescription = "Remote Browse";
         return nil;
     }
 
+    [NSNotificationCenter.defaultCenter postNotificationName:VLCMediaSourcePreparsingStarted
+                                                      object:self];
+
     if (inputNode.inputItem.inputType == ITEM_TYPE_DIRECTORY &&
         [inputNode.inputItem.MRL hasPrefix:@"file://"]) {
         NSURL *dirUrl = [NSURL URLWithString:inputNode.inputItem.MRL];
@@ -459,6 +464,8 @@ static const char *const remoteBrowseDescription = "Remote Browse";
             if (self.didFinishGeneratingChildNodesForNodeHandler) {
                 self.didFinishGeneratingChildNodesForNodeHandler(directoryNode);
             }
+            [NSNotificationCenter.defaultCenter postNotificationName:VLCMediaSourcePreparsingEnded
+                                                              object:self];
             return error;
         }
 
@@ -511,6 +518,8 @@ static const char *const remoteBrowseDescription = "Remote Browse";
         if (self.didFinishGeneratingChildNodesForNodeHandler) {
             self.didFinishGeneratingChildNodesForNodeHandler(directoryNode);
         }
+        [NSNotificationCenter.defaultCenter postNotificationName:VLCMediaSourcePreparsingEnded
+                                                          object:self];
     }
 
     return nil;


=====================================
modules/gui/macosx/library/media-source/VLCMediaSourceDataSource.m
=====================================
@@ -60,6 +60,7 @@ NSString * const VLCMediaSourceDataSourceLoadingEnded = @"VLCMediaSourceDataSour
 }
 
 @property (readwrite) dispatch_source_t observedPathDispatchSource;
+ at property (readwrite) BOOL preparseOngoing;
 
 @end
 
@@ -84,7 +85,11 @@ NSString * const VLCMediaSourceDataSourceLoadingEnded = @"VLCMediaSourceDataSour
                                    name:VLCMediaSourceChildrenRemoved
                                  object:nil];
         [notificationCenter addObserver:self
-                               selector:@selector(mediaSourceChildrenChanged:)
+                               selector:@selector(preparseStateChanged:)
+                                   name:VLCMediaSourcePreparsingStarted
+                                 object:nil];
+        [notificationCenter addObserver:self
+                               selector:@selector(preparseStateChanged:)
                                    name:VLCMediaSourcePreparsingEnded
                                  object:nil];
     }
@@ -96,6 +101,11 @@ NSString * const VLCMediaSourceDataSourceLoadingEnded = @"VLCMediaSourceDataSour
     [NSNotificationCenter.defaultCenter removeObserver:self];
 }
 
+- (void)preparseStateChanged:(NSNotification *)notification
+{
+    self.preparseOngoing = notification.name != VLCMediaSourcePreparsingEnded;
+}
+
 - (void)mediaSourceChildrenChanged:(NSNotification *)notification
 {
     if (notification.object != self.displayedMediaSource)
@@ -177,7 +187,7 @@ NSString * const VLCMediaSourceDataSourceLoadingEnded = @"VLCMediaSourceDataSour
     }
 
     [self reloadData];
-    if (!self.hasDisplayedItems) {
+    if (self.preparseOngoing) {
         [NSNotificationCenter.defaultCenter postNotificationName:VLCMediaSourceDataSourceLoadingStarted
                                                           object:self];
     } else {



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/27e087d9b90f83fe0d92a97bf3ef25df241d0c1a...3c5fb56b93c52ef74d76a76d1d484a21396e4ece

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/27e087d9b90f83fe0d92a97bf3ef25df241d0c1a...3c5fb56b93c52ef74d76a76d1d484a21396e4ece
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