[vlc-commits] macosx/media source: handle preparse-ended event
Felix Paul Kühne
git at videolan.org
Mon Jan 6 14:15:59 CET 2020
vlc | branch: master | Felix Paul Kühne <felix at feepk.net> | Sun Dec 29 16:23:49 2019 +0100| [897bec4e30c59b0032a1f6e5360e72d4310d078e] | committer: Felix Paul Kühne
macosx/media source: handle preparse-ended event
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=897bec4e30c59b0032a1f6e5360e72d4310d078e
---
modules/gui/macosx/media-source/VLCMediaSource.h | 1 +
modules/gui/macosx/media-source/VLCMediaSource.m | 14 ++++++++++++++
.../gui/macosx/media-source/VLCMediaSourceBaseDataSource.m | 10 ++++++++++
3 files changed, 25 insertions(+)
diff --git a/modules/gui/macosx/media-source/VLCMediaSource.h b/modules/gui/macosx/media-source/VLCMediaSource.h
index f40368959b..c39da12cb7 100644
--- a/modules/gui/macosx/media-source/VLCMediaSource.h
+++ b/modules/gui/macosx/media-source/VLCMediaSource.h
@@ -32,6 +32,7 @@ NS_ASSUME_NONNULL_BEGIN
extern NSString *VLCMediaSourceChildrenReset;
extern NSString *VLCMediaSourceChildrenAdded;
extern NSString *VLCMediaSourceChildrenRemoved;
+extern NSString *VLCMediaSourcePreparsingEnded;
@interface VLCMediaSource : NSObject
diff --git a/modules/gui/macosx/media-source/VLCMediaSource.m b/modules/gui/macosx/media-source/VLCMediaSource.m
index d02bee24f7..eb187fd1ea 100644
--- a/modules/gui/macosx/media-source/VLCMediaSource.m
+++ b/modules/gui/macosx/media-source/VLCMediaSource.m
@@ -37,6 +37,7 @@
NSString *VLCMediaSourceChildrenReset = @"VLCMediaSourceChildrenReset";
NSString *VLCMediaSourceChildrenAdded = @"VLCMediaSourceChildrenAdded";
NSString *VLCMediaSourceChildrenRemoved = @"VLCMediaSourceChildrenRemoved";
+NSString *VLCMediaSourcePreparsingEnded = @"VLCMediaSourcePreparsingEnded";
static void cb_children_reset(vlc_media_tree_t *p_tree,
input_item_node_t *p_node,
@@ -75,10 +76,23 @@ static void cb_children_removed(vlc_media_tree_t *p_tree,
});
}
+static void cb_preparse_ended(vlc_media_tree_t *p_tree,
+ input_item_node_t *p_node,
+ enum input_item_preparse_status status,
+ void *p_data)
+{
+ dispatch_async(dispatch_get_main_queue(), ^{
+ VLCMediaSource *mediaSource = (__bridge VLCMediaSource *)p_data;
+ [[NSNotificationCenter defaultCenter] postNotificationName:VLCMediaSourcePreparsingEnded
+ object:mediaSource];
+ });
+}
+
static const struct vlc_media_tree_callbacks treeCallbacks = {
cb_children_reset,
cb_children_added,
cb_children_removed,
+ cb_preparse_ended,
};
@implementation VLCMediaSource
diff --git a/modules/gui/macosx/media-source/VLCMediaSourceBaseDataSource.m b/modules/gui/macosx/media-source/VLCMediaSourceBaseDataSource.m
index 3994cde2a8..34fcc7b1e6 100644
--- a/modules/gui/macosx/media-source/VLCMediaSourceBaseDataSource.m
+++ b/modules/gui/macosx/media-source/VLCMediaSourceBaseDataSource.m
@@ -65,6 +65,10 @@ NSString *VLCMediaSourceTableViewCellIdentifier = @"VLCMediaSourceTableViewCellI
selector:@selector(mediaSourceChildrenRemoved:)
name:VLCMediaSourceChildrenRemoved
object:nil];
+ [notificationCenter addObserver:self
+ selector:@selector(mediaSourcePreparingEnded:)
+ name:VLCMediaSourcePreparsingEnded
+ object:nil];
}
return self;
}
@@ -375,6 +379,12 @@ NSString *VLCMediaSourceTableViewCellIdentifier = @"VLCMediaSourceTableViewCellI
[self reloadDataForNotification:aNotification];
}
+- (void)mediaSourcePreparingEnded:(NSNotification *)aNotification
+{
+ msg_Dbg(getIntf(), "Preparsing ended: %s", [[aNotification.object description] UTF8String]);
+ [self reloadDataForNotification:aNotification];
+}
+
- (void)reloadDataForNotification:(NSNotification *)aNotification
{
if (_gridViewMode) {
More information about the vlc-commits
mailing list