[vlc-commits] [Git][videolan/vlc][master] 3 commits: macosx: Do not observe audio media changes in hero view
Steve Lhomme (@robUx4)
gitlab at videolan.org
Fri Jun 12 19:41:16 UTC 2026
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
1bc74f96 by Claudio Cambra at 2026-06-12T19:25:04+00:00
macosx: Do not observe audio media changes in hero view
We never present audio media items in the hero view
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
9362b9b8 by Claudio Cambra at 2026-06-12T19:25:04+00:00
macosx: Update the represented item in hero view when current item becomes inadequate
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
546e18e5 by Claudio Cambra at 2026-06-12T19:25:04+00:00
macosx: Always call change delegate on main dispatch queue
Prevent deadlocks
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
2 changed files:
- modules/gui/macosx/library/VLCLibraryHeroView.m
- modules/gui/macosx/library/VLCLibraryModel.m
Changes:
=====================================
modules/gui/macosx/library/VLCLibraryHeroView.m
=====================================
@@ -185,18 +185,10 @@
selector:@selector(itemUpdated:)
name:VLCLibraryModelVideoMediaItemUpdated
object:nil];
- [notificationCenter addObserver:self
- selector:@selector(itemUpdated:)
- name:VLCLibraryModelAudioMediaItemUpdated
- object:nil];
[notificationCenter addObserver:self
selector:@selector(itemDeleted:)
name:VLCLibraryModelVideoMediaItemDeleted
object:nil];
- [notificationCenter addObserver:self
- selector:@selector(itemDeleted:)
- name:VLCLibraryModelAudioMediaItemDeleted
- object:nil];
}
- (void)itemUpdated:(NSNotification *)notification
@@ -205,6 +197,10 @@
NSAssert(mediaItem != nil, @"Notification should contain a media item!");
if (mediaItem.libraryID != self.representedItem.item.libraryID) {
return;
+ } else if (mediaItem.progress == 0 || mediaItem.progress == 100 || mediaItem.playCount == 0) {
+ // If the item is now unplayed or fully played, it is not optimal anymore
+ [self setOptimalRepresentedItem];
+ return;
}
VLCLibraryRepresentedItem * const item =
=====================================
modules/gui/macosx/library/VLCLibraryModel.m
=====================================
@@ -1148,19 +1148,21 @@ static void libraryCallback(void *p_data, const vlc_ml_event_t *p_event)
if (recentMediaArray != nil && recentMediaIndex != NSNotFound) {
[recentMediaArray replaceObjectAtIndex:recentMediaIndex withObject:mediaItem];
- switch (mediaItem.mediaType) {
- case VLC_ML_MEDIA_TYPE_VIDEO:
- [self.changeDelegate notifyChange:VLCLibraryModelRecentsMediaItemUpdated
- withObject:mediaItem];
- break;
- case VLC_ML_MEDIA_TYPE_AUDIO:
- [self.changeDelegate notifyChange:VLCLibraryModelRecentAudioMediaItemUpdated
- withObject:mediaItem];
- break;
- case VLC_ML_MEDIA_TYPE_UNKNOWN:
- NSLog(@"Unknown type of media type encountered, don't know what to do in deletion");
- break;
- }
+ dispatch_async(dispatch_get_main_queue(), ^{
+ switch (mediaItem.mediaType) {
+ case VLC_ML_MEDIA_TYPE_VIDEO:
+ [self.changeDelegate notifyChange:VLCLibraryModelRecentsMediaItemUpdated
+ withObject:mediaItem];
+ break;
+ case VLC_ML_MEDIA_TYPE_AUDIO:
+ [self.changeDelegate notifyChange:VLCLibraryModelRecentAudioMediaItemUpdated
+ withObject:mediaItem];
+ break;
+ case VLC_ML_MEDIA_TYPE_UNKNOWN:
+ NSLog(@"Unknown type of media type encountered, don't know what to do in deletion");
+ break;
+ }
+ });
}
if (showsArray != nil && showIndex != NSNotFound) {
@@ -1168,22 +1170,26 @@ static void libraryCallback(void *p_data, const vlc_ml_event_t *p_event)
VLCMediaLibraryShow * const staleShow = showsArray[showIndex];
VLCMediaLibraryShow * const updatedShow = [VLCMediaLibraryShow showWithLibraryId:staleShow.libraryID];
[showsArray replaceObjectAtIndex:showIndex withObject:updatedShow];
- [self.changeDelegate notifyChange:VLCLibraryModelShowUpdated withObject:updatedShow];
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [self.changeDelegate notifyChange:VLCLibraryModelShowUpdated withObject:updatedShow];
+ });
}
- switch (mediaItem.mediaType) {
- case VLC_ML_MEDIA_TYPE_VIDEO:
- [self.changeDelegate notifyChange:VLCLibraryModelVideoMediaItemUpdated
- withObject:mediaItem];
- break;
- case VLC_ML_MEDIA_TYPE_AUDIO:
- [self.changeDelegate notifyChange:VLCLibraryModelAudioMediaItemUpdated
- withObject:mediaItem];
- break;
- case VLC_ML_MEDIA_TYPE_UNKNOWN:
- NSLog(@"Unknown type of media type encountered, don't know what to do in update");
- break;
- }
+ dispatch_async(dispatch_get_main_queue(), ^{
+ switch (mediaItem.mediaType) {
+ case VLC_ML_MEDIA_TYPE_VIDEO:
+ [self.changeDelegate notifyChange:VLCLibraryModelVideoMediaItemUpdated
+ withObject:mediaItem];
+ break;
+ case VLC_ML_MEDIA_TYPE_AUDIO:
+ [self.changeDelegate notifyChange:VLCLibraryModelAudioMediaItemUpdated
+ withObject:mediaItem];
+ break;
+ case VLC_ML_MEDIA_TYPE_UNKNOWN:
+ NSLog(@"Unknown type of media type encountered, don't know what to do in update");
+ break;
+ }
+ });
}];
}
@@ -1214,46 +1220,58 @@ static void libraryCallback(void *p_data, const vlc_ml_event_t *p_event)
if (recentMediaArray != nil && recentMediaIndex != NSNotFound) {
[recentMediaArray removeObjectAtIndex:recentMediaIndex];
- switch (mediaItem.mediaType) {
- case VLC_ML_MEDIA_TYPE_VIDEO:
- [self.changeDelegate notifyChange:VLCLibraryModelRecentsMediaItemDeleted
- withObject:mediaItem];
- break;
- case VLC_ML_MEDIA_TYPE_AUDIO:
- [self.changeDelegate notifyChange:VLCLibraryModelRecentAudioMediaItemDeleted
- withObject:mediaItem];
- break;
- case VLC_ML_MEDIA_TYPE_UNKNOWN:
- NSLog(@"Unknown type of media type encountered, don't know what to do in deletion");
- break;
- }
+ dispatch_async(dispatch_get_main_queue(), ^{
+ switch (mediaItem.mediaType) {
+ case VLC_ML_MEDIA_TYPE_VIDEO:
+ [self.changeDelegate notifyChange:VLCLibraryModelRecentsMediaItemDeleted
+ withObject:mediaItem];
+ break;
+ case VLC_ML_MEDIA_TYPE_AUDIO:
+ [self.changeDelegate notifyChange:VLCLibraryModelRecentAudioMediaItemDeleted
+ withObject:mediaItem];
+ break;
+ case VLC_ML_MEDIA_TYPE_UNKNOWN:
+ NSLog(@"Unknown type of media type encountered, don't know what to do in deletion");
+ break;
+ }
+ });
}
if (showsArray != nil && showIndex != NSNotFound) {
// An episode has changed. Refresh the whole show.
VLCMediaLibraryShow * const staleShow = showsArray[showIndex];
- VLCMediaLibraryShow * const updatedShow = [VLCMediaLibraryShow showWithLibraryId:staleShow.libraryID];
+ VLCMediaLibraryShow * const updatedShow =
+ [VLCMediaLibraryShow showWithLibraryId:staleShow.libraryID];
+
if (updatedShow == nil || updatedShow.episodeCount == 0) {
- [self.changeDelegate notifyChange:VLCLibraryModelShowDeleted withObject:@(staleShow.libraryID)];
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [self.changeDelegate notifyChange:VLCLibraryModelShowDeleted
+ withObject:@(staleShow.libraryID)];
+ });
} else {
[showsArray replaceObjectAtIndex:showIndex withObject:updatedShow];
- [self.changeDelegate notifyChange:VLCLibraryModelShowUpdated withObject:updatedShow];
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [self.changeDelegate notifyChange:VLCLibraryModelShowUpdated
+ withObject:updatedShow];
+ });
}
}
- switch (mediaItem.mediaType) {
- case VLC_ML_MEDIA_TYPE_VIDEO:
- [self.changeDelegate notifyChange:VLCLibraryModelVideoMediaItemDeleted
- withObject:mediaItem];
- break;
- case VLC_ML_MEDIA_TYPE_AUDIO:
- [self.changeDelegate notifyChange:VLCLibraryModelAudioMediaItemDeleted
- withObject:mediaItem];
- break;
- case VLC_ML_MEDIA_TYPE_UNKNOWN:
- NSLog(@"Unknown type of media type encountered, don't know what to do in deletion");
- break;
- }
+ dispatch_async(dispatch_get_main_queue(), ^{
+ switch (mediaItem.mediaType) {
+ case VLC_ML_MEDIA_TYPE_VIDEO:
+ [self.changeDelegate notifyChange:VLCLibraryModelVideoMediaItemDeleted
+ withObject:mediaItem];
+ break;
+ case VLC_ML_MEDIA_TYPE_AUDIO:
+ [self.changeDelegate notifyChange:VLCLibraryModelAudioMediaItemDeleted
+ withObject:mediaItem];
+ break;
+ case VLC_ML_MEDIA_TYPE_UNKNOWN:
+ NSLog(@"Unknown type of media type encountered, don't know what to do in deletion");
+ break;
+ }
+ });
}];
}
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/15956dde0234721719e30792ebcc2642911ede92...546e18e53e7edf82c8b7984c62d553c995c3e183
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/15956dde0234721719e30792ebcc2642911ede92...546e18e53e7edf82c8b7984c62d553c995c3e183
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