[vlc-commits] macosx/fspanel: fix media title display
Felix Paul Kühne
git at videolan.org
Wed Mar 27 17:52:48 CET 2019
vlc | branch: master | Felix Paul Kühne <felix at feepk.net> | Wed Mar 27 15:40:05 2019 +0100| [713fc86ec6c5b79da99de99dcef7295f93bdee9b] | committer: Felix Paul Kühne
macosx/fspanel: fix media title display
This also fixes the include order in related files
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=713fc86ec6c5b79da99de99dcef7295f93bdee9b
---
.../gui/macosx/windows/mainwindow/VLCMainWindow.h | 2 +-
.../gui/macosx/windows/mainwindow/VLCMainWindow.m | 3 +-
.../macosx/windows/video/VLCFSPanelController.h | 2 --
.../macosx/windows/video/VLCFSPanelController.m | 37 ++++++++++++++++++++--
.../macosx/windows/video/VLCVideoWindowCommon.m | 2 +-
5 files changed, 38 insertions(+), 8 deletions(-)
diff --git a/modules/gui/macosx/windows/mainwindow/VLCMainWindow.h b/modules/gui/macosx/windows/mainwindow/VLCMainWindow.h
index d6480fed71..21facc96b5 100644
--- a/modules/gui/macosx/windows/mainwindow/VLCMainWindow.h
+++ b/modules/gui/macosx/windows/mainwindow/VLCMainWindow.h
@@ -30,12 +30,12 @@
#import <vlc_vout_window.h>
#import "extensions/misc.h"
-#import "windows/video/VLCFSPanelController.h"
#import "windows/video/VLCVideoWindowCommon.h"
@class VLCMainWindowControlsBar;
@class VLCVoutView;
@class PXSourceList;
+ at class VLCFSPanelController;
typedef enum {
psUserEvent,
diff --git a/modules/gui/macosx/windows/mainwindow/VLCMainWindow.m b/modules/gui/macosx/windows/mainwindow/VLCMainWindow.m
index 2b0c41d6cd..6085acf78c 100644
--- a/modules/gui/macosx/windows/mainwindow/VLCMainWindow.m
+++ b/modules/gui/macosx/windows/mainwindow/VLCMainWindow.m
@@ -48,6 +48,7 @@
#import "windows/video/VLCDetachedVideoWindow.h"
#import "windows/video/VLCVoutView.h"
#import "windows/video/VLCVideoOutputProvider.h"
+#import "windows/video/VLCFSPanelController.h"
@interface VLCMainWindow() <PXSourceListDataSource, PXSourceListDelegate, NSOutlineViewDataSource, NSOutlineViewDelegate, NSWindowDelegate, NSAnimationDelegate, NSSplitViewDelegate>
{
@@ -618,8 +619,6 @@ static const float f_min_window_height = 307.;
[[[VLCMain sharedInstance] voutProvider] updateWindowsUsingBlock:^(VLCVideoWindowCommon *o_window) {
[o_window setTitle:aString];
}];
-
- [self.fspanel setStreamTitle: aString];
} else {
[self setTitle: _NS("VLC media player")];
[self setRepresentedURL: nil];
diff --git a/modules/gui/macosx/windows/video/VLCFSPanelController.h b/modules/gui/macosx/windows/video/VLCFSPanelController.h
index c9fecf6e19..b705f2ef2f 100644
--- a/modules/gui/macosx/windows/video/VLCFSPanelController.h
+++ b/modules/gui/macosx/windows/video/VLCFSPanelController.h
@@ -64,8 +64,6 @@
- (void)setNonActive;
- (void)setVoutWasUpdated:(VLCWindow *)voutWindow;
-- (void)setStreamTitle:(NSString *)title;
-
// Constrain frame to window. Used by VLCFSPanelDraggableView.
- (NSRect)contrainFrameToAssociatedVoutWindow:(NSRect)frame;
diff --git a/modules/gui/macosx/windows/video/VLCFSPanelController.m b/modules/gui/macosx/windows/video/VLCFSPanelController.m
index 7084e03776..0581f1b479 100644
--- a/modules/gui/macosx/windows/video/VLCFSPanelController.m
+++ b/modules/gui/macosx/windows/video/VLCFSPanelController.m
@@ -106,6 +106,7 @@ static NSString *kAssociatedFullscreenRect = @"VLCFullscreenAssociatedWindowRect
[notificationCenter addObserver:self selector:@selector(hasPreviousChanged:) name:VLCPlaybackHasPreviousChanged object:nil];
[notificationCenter addObserver:self selector:@selector(hasNextChanged:) name:VLCPlaybackHasNextChanged object:nil];
[notificationCenter addObserver:self selector:@selector(volumeChanged:) name:VLCPlayerVolumeChanged object:nil];
+ [notificationCenter addObserver:self selector:@selector(inputItemChanged:) name:VLCPlayerCurrentMediaItemChanged object:nil];
}
#define setupButton(target, title, desc) \
@@ -256,9 +257,41 @@ static NSString *kAssociatedFullscreenRect = @"VLCFullscreenAssociatedWindowRect
[_playPauseButton setToolTip: _NS("Pause")];
}
-- (void)setStreamTitle:(NSString *)title
+- (void)inputItemChanged:(NSNotification *)aNotification
{
- [_mediaTitle setStringValue:title];
+ NSString *title;
+ NSString *nowPlaying;
+ input_item_t *mediaItem = _playerController.currentMedia;
+
+ if (mediaItem) {
+ /* Something is playing */
+ static char *tmp_cstr = NULL;
+
+ // Get Title
+ tmp_cstr = input_item_GetTitleFbName(mediaItem);
+ if (tmp_cstr) {
+ title = toNSStr(tmp_cstr);
+ FREENULL(tmp_cstr);
+ }
+
+ // Get Now Playing
+ tmp_cstr = input_item_GetNowPlaying(mediaItem);
+ if (tmp_cstr) {
+ nowPlaying = toNSStr(tmp_cstr);
+ FREENULL(tmp_cstr);
+ }
+
+ input_item_Release(mediaItem);
+ } else {
+ /* Nothing playing */
+ title = _NS("VLC media player");
+ }
+
+ if (nowPlaying) {
+ [_mediaTitle setStringValue:nowPlaying];
+ } else {
+ [_mediaTitle setStringValue:title];
+ }
}
- (void)updatePositionAndTime:(NSNotification *)aNotification
diff --git a/modules/gui/macosx/windows/video/VLCVideoWindowCommon.m b/modules/gui/macosx/windows/video/VLCVideoWindowCommon.m
index ab972fad68..94c371d90b 100644
--- a/modules/gui/macosx/windows/video/VLCVideoWindowCommon.m
+++ b/modules/gui/macosx/windows/video/VLCVideoWindowCommon.m
@@ -30,9 +30,9 @@
#import "windows/mainwindow/VLCControlsBarCommon.h"
#import "windows/mainwindow/VLCMainWindow.h"
#import "windows/video/VLCVoutView.h"
+#import "windows/video/VLCFSPanelController.h"
#import "playlist/VLCPlaylistController.h"
#import "playlist/VLCPlayerController.h"
-//#import <vlc_playlist_legacy.h>
/*****************************************************************************
* VLCVideoWindowCommon
More information about the vlc-commits
mailing list