[vlc-commits] [Git][videolan/vlc][master] 37 commits: macosx: Fix playback rate change menu item being disabled when launching with a video
Steve Lhomme (@robUx4)
gitlab at videolan.org
Sat Jan 18 09:27:37 UTC 2025
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
f5c28be9 by Claudio Cambra at 2025-01-18T09:10:31+00:00
macosx: Fix playback rate change menu item being disabled when launching with a video
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
28813441 by Claudio Cambra at 2025-01-18T09:10:31+00:00
macosx: Implement enable state handling on capabilities change for all relevant items in VLCMainMenu
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
08c3cb84 by Claudio Cambra at 2025-01-18T09:10:31+00:00
macosx: Port NSMenuValidation implementation within VLCMainMenu to formal NSUserInterfaceValidations protocol
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
4cf3e72e by Claudio Cambra at 2025-01-18T09:10:31+00:00
macosx: Do not enable play/pause button if there is no current valid media item when capabilities change
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
3cc02f6c by Claudio Cambra at 2025-01-18T09:10:31+00:00
macosx: Access via properties in capabilitiesChanged
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
ed1b1536 by Claudio Cambra at 2025-01-18T09:10:31+00:00
macosx: Run capabilitiesChanged on init of main menu
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
69da6073 by Claudio Cambra at 2025-01-18T09:10:31+00:00
macosx: Set info enablement state in one place in main menu
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
93652be5 by Claudio Cambra at 2025-01-18T09:10:31+00:00
macosx: Allow play button to be enabled if there are any items in the play queue
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
0788bcda by Claudio Cambra at 2025-01-18T09:10:31+00:00
macosx: Clean up, modernise menu item validation
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
01fd411c by Claudio Cambra at 2025-01-18T09:10:31+00:00
macosx: Do not enable video sizing menu items if there is no current vout
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
ecf86ef9 by Claudio Cambra at 2025-01-18T09:10:31+00:00
macosx: Do early return in validation if target item is nil
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
0f72a77f by Claudio Cambra at 2025-01-18T09:10:31+00:00
macosx: Clean up playbackStateChanged
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
f36d9a6e by Claudio Cambra at 2025-01-18T09:10:31+00:00
macosx: Account for current valid media in capabilities change handling
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
72cac1a4 by Claudio Cambra at 2025-01-18T09:10:31+00:00
macosx: Update enablement of stop item when playback state has changed
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
86ef64d3 by Claudio Cambra at 2025-01-18T09:10:31+00:00
macosx: Account for nil current media in seekable/recordable items when validating
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
0bb07772 by Claudio Cambra at 2025-01-18T09:10:31+00:00
macosx: Correctly handle enablement of play and stop items in validate step
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
347dda10 by Claudio Cambra at 2025-01-18T09:10:31+00:00
macosx: Nilify current media input item in player controller when playback has (truly) stopped
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
2bc6e6fa by Claudio Cambra at 2025-01-18T09:10:31+00:00
macosx: Run playbackStateChanged on main menu init
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
e653a517 by Claudio Cambra at 2025-01-18T09:10:31+00:00
macosx: Update playback playqueue related items enablement when play queue changes
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
e78fda39 by Claudio Cambra at 2025-01-18T09:10:31+00:00
macosx: Perform validation of rate menu item within validation
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
ce559376 by Claudio Cambra at 2025-01-18T09:10:31+00:00
macosx: Add handling of info menu item in validation
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
f4ee3888 by Claudio Cambra at 2025-01-18T09:10:31+00:00
macosx: Declare conformance to NSUserInterfaceValidations in header of VLCMainMenu
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
ee255851 by Claudio Cambra at 2025-01-18T09:10:31+00:00
macosx: Remove setRateControlsEnabled in favour of just checking with validation method
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
0ae8e132 by Claudio Cambra at 2025-01-18T09:10:31+00:00
macosx: Defer to validate method to set info menu item enablement
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
b2903e65 by Claudio Cambra at 2025-01-18T09:10:31+00:00
macosx: Handle subtitle size menu item validation in validation method
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
735cb130 by Claudio Cambra at 2025-01-18T09:10:31+00:00
macosx: Defer to validation for subtitle size menu item enablement
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
03e19384 by Claudio Cambra at 2025-01-18T09:10:31+00:00
macosx: Set play enablement via validate method
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
ce40079d by Claudio Cambra at 2025-01-18T09:10:31+00:00
macosx: Handle visual and channels menu items in validation
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
8b24f132 by Claudio Cambra at 2025-01-18T09:10:31+00:00
macosx: Handle video related item enablement in validate method
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
0e249f6e by Claudio Cambra at 2025-01-18T09:10:31+00:00
macosx: Defer further playback and video and audio menu items enablement to validation
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
3e0ca04a by Claudio Cambra at 2025-01-18T09:10:31+00:00
macosx: Handle vout audio, video, and subtitle tracks enablement in validation
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
1ebfe5d1 by Claudio Cambra at 2025-01-18T09:10:31+00:00
macosx: Clean up track handling in main menu
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
ceb4ce96 by Claudio Cambra at 2025-01-18T09:10:31+00:00
macosx: Manually update custom subtitle menu item elements
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
caa677c9 by Claudio Cambra at 2025-01-18T09:10:31+00:00
macosx: Remove listening to certain notifications with non-existent selector handlers in mainmenu
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
9dd5c33d by Claudio Cambra at 2025-01-18T09:10:31+00:00
macosx: Update rate controls on capabilities change
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
e8d7961d by Claudio Cambra at 2025-01-18T09:10:31+00:00
macosx: Move subtitle entries update handling into track handling menus
Relevant since subtitle tracks will tell whether the subtitle-related
entries have any effect
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
be336c08 by Claudio Cambra at 2025-01-18T09:10:31+00:00
macosx: Handle video-related entries together in validation
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
3 changed files:
- modules/gui/macosx/menus/VLCMainMenu.h
- modules/gui/macosx/menus/VLCMainMenu.m
- modules/gui/macosx/playqueue/VLCPlayerController.m
Changes:
=====================================
modules/gui/macosx/menus/VLCMainMenu.h
=====================================
@@ -27,7 +27,7 @@
@class VLCRendererMenuController;
- at interface VLCMainMenu : NSObject
+ at interface VLCMainMenu : NSObject<NSUserInterfaceValidations>
/* main menu */
@property (readwrite, weak) IBOutlet NSMenuItem *about;
=====================================
modules/gui/macosx/menus/VLCMainMenu.m
=====================================
@@ -45,6 +45,7 @@
#import "panels/VLCTimeSelectionPanelController.h"
#import "playqueue/VLCPlayQueueController.h"
+#import "playqueue/VLCPlayQueueModel.h"
#import "playqueue/VLCPlayerController.h"
#import "playqueue/VLCPlayQueueSortingMenuController.h"
#import "preferences/VLCSimplePrefsController.h"
@@ -138,9 +139,6 @@ typedef NS_ENUM(NSInteger, VLCObjectType) {
[_rateTextField setAlignment:NSLeftTextAlignment];
}
- [self setRateControlsEnabled:NO];
- [self setSubtitleSizeControlsEnabled:NO];
-
#ifdef HAVE_SPARKLE
[_checkForUpdate setAction:@selector(checkForUpdates:)];
[_checkForUpdate setTarget:[SUUpdater sharedUpdater]];
@@ -162,6 +160,7 @@ typedef NS_ENUM(NSInteger, VLCObjectType) {
_sortPlayQueue.submenu = _playQueueSortingController.playQueueSortingMenu;
[self mediaItemChanged:nil];
+ [self playbackStateChanged:nil];
[self updateTitleAndChapterMenus:nil];
[self updateProgramMenu:nil];
[self updateLibraryPlayQueueMode];
@@ -225,7 +224,12 @@ typedef NS_ENUM(NSInteger, VLCObjectType) {
object:nil];
[notificationCenter addObserver:self
selector:@selector(voutListChanged:)
- name:VLCPlayerListOfVideoOutputThreadsChanged object:nil];
+ name:VLCPlayerListOfVideoOutputThreadsChanged
+ object:nil];
+ [notificationCenter addObserver:self
+ selector:@selector(updateRateControls:)
+ name:VLCPlayerCapabilitiesChanged
+ object:nil];
[self setupVarMenuItem:_add_intf
target:VLC_OBJECT(getIntf())
@@ -616,27 +620,16 @@ typedef NS_ENUM(NSInteger, VLCObjectType) {
#pragma mark - Interface update
-- (void)mediaItemChanged:(NSNotification *)aNotification
+- (void)mediaItemChanged:(NSNotification *)notification
{
- [self updateTrackHandlingMenus:aNotification];
-
- VLCInputItem * const inputItem = _playerController.currentMedia;
+ [self updateTrackHandlingMenus:notification];
+ [self updateRateControls:notification];
- if (inputItem != nil) {
+ if (_playerController.currentMedia != nil) {
[self rebuildAoutMenu];
[self rebuildVoutMenu];
- [self setRateControlsEnabled:_playerController.rateChangable];
- [self setSubtitleSizeControlsEnabled:YES];
- self.info.enabled = YES;
} else {
- [_postprocessing setEnabled:NO];
- [self setAudioSubMenusEnabled:NO];
- [self setVideoMenuActiveVideo:NO];
- [self setRateControlsEnabled:NO];
- [self setSubtitleSizeControlsEnabled:NO];
-
self.windowMenu.autoenablesItems = NO;
- self.info.enabled = NO;
}
}
@@ -658,7 +651,6 @@ typedef NS_ENUM(NSInteger, VLCObjectType) {
var:"visual"
selector:@selector(toggleVar:)];
aout_Release(p_aout);
- [self setAudioSubMenusEnabled:YES];
}
- (void)voutListChanged:(NSNotification *)aNotification
@@ -702,9 +694,6 @@ typedef NS_ENUM(NSInteger, VLCObjectType) {
vout_Release(p_vout);
[self refreshVoutDeviceMenu:nil];
-
- const BOOL activeVideoPlayback = _playerController.activeVideoPlayback;
- [self setVideoMenuActiveVideo:activeVideoPlayback];
}
- (void)refreshVoutDeviceMenu:(NSNotification *)notification
@@ -735,73 +724,43 @@ typedef NS_ENUM(NSInteger, VLCObjectType) {
[[submenu itemWithTag: var_InheritInteger(getIntf(), "macosx-vdev")] setState: NSOnState];
}
-- (void)setAudioSubMenusEnabled:(BOOL)enabled
+- (void)updateSubtitlesMenu:(NSNotification *)notification
{
- [_visual setEnabled: enabled];
- [_channels setEnabled: enabled];
-}
+ const BOOL enabled = [self validateUserInterfaceItem:self.openSubtitleFile];
+ self.subtitleSizeSlider.enabled = enabled;
-- (void)setVideoMenuActiveVideo:(BOOL)activeVideo
-{
- if (_videoMenu.autoenablesItems) {
- _videoMenu.autoenablesItems = NO;
- }
-
- _snapshot.enabled = activeVideo;
- [self setVideoSubmenusEnabled:activeVideo];
-}
+ const unsigned int scaleFactor = _playerController.subtitleTextScalingFactor;
+ self.subtitleSizeSlider.intValue = scaleFactor;
+ self.subtitleSizeTextField.stringValue =
+ [NSString stringWithFormat:@"%.2fx", scaleFactor / 100.];
-- (void)setVideoSubmenusEnabled:(BOOL)enabled
-{
- [_deinterlace setEnabled: enabled];
- [_deinterlace_mode setEnabled: enabled];
- [_screen setEnabled: enabled];
- [_aspect_ratio setEnabled: enabled];
- [_crop setEnabled: enabled];
- [_postprocessing setEnabled: enabled];
- [self setSubtitleMenuEnabled: enabled];
-}
+ NSColor * const color = enabled
+ ? NSColor.controlTextColor
+ : NSColor.disabledControlTextColor;
+ self.subtitleSizeLabel.textColor = color;
+ self.subtitleSizeSmallerLabel.textColor = color;
+ self.subtitleSizeLargerLabel.textColor = color;
+ self.subtitleSizeTextField.textColor = color;
-- (void)setSubtitleMenuEnabled:(BOOL)b_enabled
-{
- [_openSubtitleFile setEnabled: b_enabled];
- [_voutMenuOpenSubtitleFile setEnabled: b_enabled];
- if (b_enabled) {
- [_subtitle_bgopacityLabel_gray setHidden: YES];
- [_subtitle_bgopacityLabel setHidden: NO];
- } else {
- [_subtitle_bgopacityLabel_gray setHidden: NO];
- [_subtitle_bgopacityLabel setHidden: YES];
- }
- [_subtitle_bgopacity_sld setEnabled: b_enabled];
- [_teletext setEnabled:_playerController.teletextMenuAvailable];
+ self.subtitle_bgopacityLabel_gray.hidden = enabled;
+ self.subtitle_bgopacityLabel.hidden = !enabled;
+ self.subtitle_bgopacity_sld.enabled = enabled;
}
-- (void)setRateControlsEnabled:(BOOL)b_enabled
+- (void)updateRateControls:(NSNotification *)notification
{
- [_rate_sld setEnabled: b_enabled];
- [self updatePlaybackRate];
+ const BOOL enabled = [self validateUserInterfaceItem:self.rate];
+ self.rate_sld.enabled = enabled;
- NSColor *color = b_enabled ? [NSColor controlTextColor] : [NSColor disabledControlTextColor];
- [_rateLabel setTextColor:color];
- [_rate_slowerLabel setTextColor:color];
- [_rate_normalLabel setTextColor:color];
- [_rate_fasterLabel setTextColor:color];
- [_rateTextField setTextColor:color];
-}
+ NSColor * const color = enabled
+ ? NSColor.controlTextColor
+ : NSColor.disabledControlTextColor;
-- (void)setSubtitleSizeControlsEnabled:(BOOL)b_enabled
-{
- [_subtitleSizeSlider setEnabled: b_enabled];
- unsigned int scaleFactor = _playerController.subtitleTextScalingFactor;
- [_subtitleSizeSlider setIntValue:scaleFactor];
- [_subtitleSizeTextField setStringValue: [NSString stringWithFormat:@"%.2fx", scaleFactor / 100.]];
-
- NSColor *color = b_enabled ? [NSColor controlTextColor] : [NSColor disabledControlTextColor];
- [_subtitleSizeLabel setTextColor:color];
- [_subtitleSizeSmallerLabel setTextColor:color];
- [_subtitleSizeLargerLabel setTextColor:color];
- [_subtitleSizeTextField setTextColor:color];
+ self.rateLabel.textColor = color;
+ self.rate_slowerLabel.textColor = color;
+ self.rate_normalLabel.textColor = color;
+ self.rate_fasterLabel.textColor = color;
+ self.rateTextField.textColor = color;
}
#pragma mark - View
@@ -962,25 +921,42 @@ typedef NS_ENUM(NSInteger, VLCObjectType) {
}
#pragma mark - track handling
-- (void)updateTrackHandlingMenus:(NSNotification *)aNotification
-{
- NSArray *tracks = _playerController.audioTracks;
- NSUInteger numberOfTracks = tracks.count;
- [self rebuildTracksMenu:_audiotrackMenu withMetadata:tracks count:numberOfTracks category:AUDIO_ES];
- [self rebuildTracksMenu:_voutMenuAudiotrackMenu withMetadata:tracks count:numberOfTracks category:AUDIO_ES];
- _voutMenuAudiotrack.enabled = _audiotrack.enabled = numberOfTracks > 0 ? YES : NO;
-
- tracks = _playerController.videoTracks;
- numberOfTracks = tracks.count;
- [self rebuildTracksMenu:_videotrackMenu withMetadata:tracks count:numberOfTracks category:VIDEO_ES];
- [self rebuildTracksMenu:_voutMenuVideotrackMenu withMetadata:tracks count:numberOfTracks category:VIDEO_ES];
- _voutMenuVideotrack.enabled = _videotrack.enabled = numberOfTracks > 0 ? YES : NO;
-
- tracks = _playerController.subtitleTracks;
- numberOfTracks = tracks.count;
- [self rebuildTracksMenu:_subtitle_tracksMenu withMetadata:tracks count:numberOfTracks category:SPU_ES];
- [self rebuildTracksMenu:_voutMenuSubtitlestrackMenu withMetadata:tracks count:numberOfTracks category:SPU_ES];
- _voutMenuSubtitlestrack.enabled = _subtitle_track.enabled = numberOfTracks > 0 ? YES : NO;
+- (void)updateTrackHandlingMenus:(NSNotification *)notification
+{
+ NSArray * const audioTracks = _playerController.audioTracks;
+ const NSUInteger numberOfAudioTracks = audioTracks.count;
+ [self rebuildTracksMenu:self.audiotrackMenu
+ withMetadata:audioTracks
+ count:numberOfAudioTracks
+ category:AUDIO_ES];
+ [self rebuildTracksMenu:self.voutMenuAudiotrackMenu
+ withMetadata:audioTracks
+ count:numberOfAudioTracks
+ category:AUDIO_ES];
+
+ NSArray * const videoTracks = _playerController.videoTracks;
+ const NSUInteger numberOfVideoTracks = videoTracks.count;
+ [self rebuildTracksMenu:self.videotrackMenu
+ withMetadata:videoTracks
+ count:numberOfVideoTracks
+ category:VIDEO_ES];
+ [self rebuildTracksMenu:self.voutMenuVideotrackMenu
+ withMetadata:videoTracks
+ count:numberOfVideoTracks
+ category:VIDEO_ES];
+
+ NSArray * const subtitleTracks = _playerController.subtitleTracks;
+ const NSUInteger numberOfSubtitleTracks = subtitleTracks.count;
+ [self rebuildTracksMenu:self.subtitle_tracksMenu
+ withMetadata:subtitleTracks
+ count:numberOfSubtitleTracks
+ category:SPU_ES];
+ [self rebuildTracksMenu:self.voutMenuSubtitlestrackMenu
+ withMetadata:subtitleTracks
+ count:numberOfSubtitleTracks
+ category:SPU_ES];
+
+ [self updateSubtitlesMenu:notification];
}
- (void)rebuildTracksMenu:(NSMenu *)menu
@@ -1542,17 +1518,10 @@ typedef NS_ENUM(NSInteger, VLCObjectType) {
- (void)playbackStateChanged:(NSNotification *)aNotification
{
- enum vlc_player_state playerState = [_playQueueController playerController].playerState;
-
- switch (playerState) {
+ switch (_playerController.playerState) {
case VLC_PLAYER_STATE_PLAYING:
[self setPause];
break;
-
- case VLC_PLAYER_STATE_STOPPED:
- [self setVideoMenuActiveVideo:NO];
- [self setAudioSubMenusEnabled:NO];
-
default:
[self setPlay];
break;
@@ -1919,81 +1888,97 @@ typedef NS_ENUM(NSInteger, VLCObjectType) {
}
}
- at end
-
- at implementation VLCMainMenu (NSMenuValidation)
-
-- (BOOL)validateMenuItem:(NSMenuItem *)mi
-{
- BOOL enabled = YES;
- VLCInputItem *inputItem = _playQueueController.currentlyPlayingInputItem;
-
- if (mi == _stop || mi == _voutMenustop || mi == _dockMenustop) {
- if (!inputItem)
- enabled = NO;
- } else if (mi == _previous ||
- mi == _voutMenuprev ||
- mi == _dockMenuprevious) {
- enabled = _playQueueController.hasPreviousPlayQueueItem;
- } else if (
- mi == _next ||
- mi == _voutMenunext ||
- mi == _dockMenunext) {
- enabled = _playQueueController.hasNextPlayQueueItem;
- } else if (mi == _record || mi == _voutMenuRecord) {
- enabled = _playerController.recordable;
- } else if (mi == _random) {
- enum vlc_playlist_playback_order playbackOrder = [_playQueueController playbackOrder];
- [mi setState: playbackOrder == VLC_PLAYLIST_PLAYBACK_ORDER_RANDOM ? NSOnState : NSOffState];
- } else if (mi == _quitAfterPB) {
- BOOL state = _playQueueController.actionAfterStop == VLC_PLAYLIST_MEDIA_STOPPED_EXIT;
- [mi setState: state ? NSOnState : NSOffState];
- } else if (mi == _fwd || mi == _bwd || mi == _jumpToTime) {
- enabled = _playerController.seekable;
- } else if (mi == _mute || mi == _dockMenumute || mi == _voutMenumute) {
- [mi setState: _playerController.mute ? NSOnState : NSOffState];
+- (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item
+{
+ NSMenuItem * const mi = (NSMenuItem *)item;
+
+ if (mi == nil) {
+ return YES;
+ } else if (mi == self.play) {
+ return _playerController.playerState == VLC_PLAYER_STATE_PLAYING
+ ? _playerController.currentMedia != nil && _playerController.pausable
+ : _playQueueController.playQueueModel.numberOfPlayQueueItems > 0;
+ } else if (mi == self.stop ||
+ mi == self.voutMenustop ||
+ mi == self.dockMenustop ||
+ mi == self.visual ||
+ mi == self.channels) {
+ return _playerController.currentMedia &&
+ _playerController.playerState != VLC_PLAYER_STATE_STOPPED;
+ } else if (mi == self.previous || mi == self.voutMenuprev || mi == self.dockMenuprevious) {
+ return _playQueueController.hasPreviousPlayQueueItem;
+ } else if (mi == self.next || mi == self.voutMenunext || mi == self.dockMenunext) {
+ return _playQueueController.hasNextPlayQueueItem;
+ } else if (mi == self.record || mi == self.voutMenuRecord) {
+ return _playerController.currentMedia != nil && _playerController.recordable;
+ } else if (mi == self.random) {
+ const enum vlc_playlist_playback_order playbackOrder = _playQueueController.playbackOrder;
+ mi.state = playbackOrder == VLC_PLAYLIST_PLAYBACK_ORDER_RANDOM ? NSOnState : NSOffState;
+ } else if (mi == self.quitAfterPB) {
+ const BOOL state = _playQueueController.actionAfterStop == VLC_PLAYLIST_MEDIA_STOPPED_EXIT;
+ mi.state = state ? NSOnState : NSOffState;
+ } else if (mi == self.fwd || mi == self.bwd || mi == self.jumpToTime) {
+ return _playerController.currentMedia != nil && _playerController.seekable;
+ } else if (mi == self.mute || mi == self.dockMenumute || mi == self.voutMenumute) {
+ mi.state = _playerController.mute ? NSOnState : NSOffState;
[self refreshAudioDeviceList];
- } else if (mi == _half_window ||
- mi == _normal_window ||
- mi == _double_window ||
- mi == _fittoscreen ||
- mi == _snapshot ||
- mi == _voutMenusnapshot ||
- mi == _fullscreenItem ||
- mi == _voutMenufullscreen ||
- mi == _floatontop
- ) {
-
- vout_thread_t *p_vout = [_playerController videoOutputThreadForKeyWindow];
+ } else if (mi == self.half_window ||
+ mi == self.normal_window ||
+ mi == self.double_window ||
+ mi == self.fittoscreen ||
+ mi == self.snapshot ||
+ mi == self.voutMenusnapshot ||
+ mi == self.deinterlace ||
+ mi == self.deinterlace_mode ||
+ mi == self.screen ||
+ mi == self.aspect_ratio ||
+ mi == self.crop ||
+ mi == self.postprocessing ||
+ mi == self.fullscreenItem ||
+ mi == self.voutMenufullscreen ||
+ mi == self.floatontop) {
+ vout_thread_t * const p_vout = _playerController.videoOutputThreadForKeyWindow;
if (p_vout != NULL) {
- if (mi == _floatontop)
- [mi setState: var_GetBool(p_vout, "video-on-top")];
-
- if (mi == _fullscreenItem || mi == _voutMenufullscreen)
- [mi setState: _playerController.fullscreen];
-
- enabled = YES;
+ if (mi == self.floatontop) {
+ mi.state = var_GetBool(p_vout, "video-on-top") ? NSOnState : NSOffState;
+ } else if (mi == self.fullscreenItem || mi == self.voutMenufullscreen) {
+ mi.state = _playerController.fullscreen ? NSOnState : NSOffState;
+ }
vout_Release(p_vout);
}
-
- } else if (mi == _openSubtitleFile || mi == _voutMenuOpenSubtitleFile) {
- enabled = YES;
+ return p_vout != NULL &&
+ _playerController.currentMedia != nil &&
+ _playerController.activeVideoPlayback;
+ } else if (mi == self.rate) {
+ return _playerController.currentMedia && _playerController.rateChangable;
+ } else if (mi == self.info) {
+ return _playerController.currentMedia != nil;
+ } else if (mi == self.openSubtitleFile ||
+ mi == self.voutMenuOpenSubtitleFile ||
+ mi == self.subtitleSize) {
+ return _playerController.currentMedia != nil && _playerController.activeVideoPlayback;
+ } else if (mi == self.teletext) {
+ return _playerController.currentMedia != nil && _playerController.teletextMenuAvailable;
+ } else if (mi == self.voutMenuAudiotrack) {
+ return _playerController.audioTracks.count > 0;
+ } else if (mi == self.voutMenuVideotrack) {
+ return _playerController.videoTracks.count > 0;
+ } else if (mi == self.voutMenuSubtitlestrack) {
+ return _playerController.subtitleTracks.count > 0;
} else {
- NSMenuItem *_parent = [mi parentItem];
- if (_parent == _subtitle_textcolor || mi == _subtitle_textcolor ||
- _parent == _subtitle_bgcolor || mi == _subtitle_bgcolor ||
- _parent == _subtitle_bgopacity || mi == _subtitle_bgopacity ||
- _parent == _subtitle_outlinethickness || mi == _subtitle_outlinethickness
- ) {
- enabled = _openSubtitleFile.isEnabled;
- } else if (_parent == _teletext || mi == _teletext) {
- enabled = _playerController.teletextMenuAvailable;
+ NSMenuItem * const parent = mi.parentItem;
+ if (parent == self.subtitle_textcolor || mi == self.subtitle_textcolor ||
+ parent == self.subtitle_bgcolor || mi == self.subtitle_bgcolor ||
+ parent == self.subtitle_bgopacity || mi == self.subtitle_bgopacity ||
+ parent == self.subtitle_outlinethickness || mi == self.subtitle_outlinethickness) {
+
+ return [self validateUserInterfaceItem:self.openSubtitleFile];
+ } else if (parent == self.teletext || mi == self.teletext) {
+ return _playerController.teletextMenuAvailable;
}
}
- inputItem = nil;
-
- return enabled;
+ return YES;
}
@end
=====================================
modules/gui/macosx/playqueue/VLCPlayerController.m
=====================================
@@ -835,6 +835,7 @@ static int BossCallback(vlc_object_t *p_this,
[self resumeOtherAudioPlaybackApps];
_playbackHasTruelyEndedTimer = nil;
+ _currentMedia = nil;
}
- (void)stopOtherAudioPlaybackApps
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/3221c89f246cfe42fdceaa3c97e56b568f63b3b6...be336c08fe6f16bf3dd949cd9922a07039c7199a
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/3221c89f246cfe42fdceaa3c97e56b568f63b3b6...be336c08fe6f16bf3dd949cd9922a07039c7199a
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list