[vlc-commits] macosx: Move input-related handlers to InputManager, simplify
vlc | branch: master | David Fuhrmann | Sat Jun 27 22:31:54 2015 +0200| [91751dbd6aaeacf12544f44d34c2b5594f66823a] | committer: David Fuhrmann macosx: Move input-related handlers to InputManager, simplify > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=91751dbd6aaeacf12544f44d34c2b5594f66823a --- modules/gui/macosx/InputManager.m| 56 +++--- modules/gui/macosx/MainWindow.m |2 + modules/gui/macosx/VLCVoutWindowController.m |4 +- modules/gui/macosx/fspanel.m |2 +- modules/gui/macosx/intf.h|6 --- modules/gui/macosx/intf.m| 33 --- 6 files changed, 46 insertions(+), 57 deletions(-) diff --git a/modules/gui/macosx/InputManager.m b/modules/gui/macosx/InputManager.m index 004d915..d34b22c 100644 --- a/modules/gui/macosx/InputManager.m +++ b/modules/gui/macosx/InputManager.m @@ -21,6 +21,7 @@ #import "InputManager.h" +#import "CoreInteraction.h" #import "CompatibilityFixes.h" #import "ExtensionsManager.h" #import "intf.h" @@ -28,6 +29,7 @@ #import "MainWindow.h" #import "playlist.h" #import "playlistinfo.h" +#import "TrackSynchronization.h" #import "iTunes.h" #import "Spotify.h" @@ -60,14 +62,14 @@ static int InputEvent(vlc_object_t *p_this, const char *psz_var, [[[VLCMain sharedInstance] mainMenu] performSelectorOnMainThread:@selector(updatePlaybackRate) withObject: nil waitUntilDone:NO]; break; case INPUT_EVENT_POSITION: -[[VLCMain sharedInstance] performSelectorOnMainThread:@selector(updatePlaybackPosition) withObject: nil waitUntilDone:NO]; +[[[VLCMain sharedInstance] mainWindow] performSelectorOnMainThread:@selector(updateTimeSlider) withObject: nil waitUntilDone:NO]; break; case INPUT_EVENT_TITLE: case INPUT_EVENT_CHAPTER: -[[VLCMain sharedInstance] performSelectorOnMainThread:@selector(updateMainMenu) withObject: nil waitUntilDone:NO]; +[inputManager performSelectorOnMainThread:@selector(updateMainMenu) withObject: nil waitUntilDone:NO]; break; case INPUT_EVENT_CACHE: -[[VLCMain sharedInstance] performSelectorOnMainThread:@selector(updateMainWindow) withObject: nil waitUntilDone: NO]; +[inputManager performSelectorOnMainThread:@selector(updateMainWindow) withObject:nil waitUntilDone:NO]; break; case INPUT_EVENT_STATISTICS: dispatch_async(dispatch_get_main_queue(), ^{ @@ -84,17 +86,19 @@ static int InputEvent(vlc_object_t *p_this, const char *psz_var, break; case INPUT_EVENT_ITEM_META: case INPUT_EVENT_ITEM_INFO: -[[VLCMain sharedInstance] performSelectorOnMainThread:@selector(updateMainMenu) withObject: nil waitUntilDone:NO]; -[[VLCMain sharedInstance] performSelectorOnMainThread:@selector(updateName) withObject: nil waitUntilDone:NO]; +[inputManager performSelectorOnMainThread:@selector(updateMainMenu) withObject: nil waitUntilDone:NO]; +[inputManager performSelectorOnMainThread:@selector(updateName) withObject: nil waitUntilDone:NO]; [inputManager performSelectorOnMainThread:@selector(updateMetaAndInfo) withObject: nil waitUntilDone:NO]; break; case INPUT_EVENT_BOOKMARK: break; case INPUT_EVENT_RECORD: -[[VLCMain sharedInstance] updateRecordState: var_GetBool(p_this, "record")]; +dispatch_async(dispatch_get_main_queue(), ^{ +[[[VLCMain sharedInstance] mainMenu] updateRecordState: var_InheritBool(p_this, "record")]; +}); break; case INPUT_EVENT_PROGRAM: -[[VLCMain sharedInstance] performSelectorOnMainThread:@selector(updateMainMenu) withObject: nil waitUntilDone:NO]; +[inputManager performSelectorOnMainThread:@selector(updateMainMenu) withObject: nil waitUntilDone:NO]; break; case INPUT_EVENT_ITEM_EPG: break; @@ -102,17 +106,17 @@ static int InputEvent(vlc_object_t *p_this, const char *psz_var, break; case INPUT_EVENT_ITEM_NAME: -[[VLCMain sharedInstance] performSelectorOnMainThread:@selector(updateName) withObject: nil waitUntilDone:NO]; +[inputManager performSelectorOnMainThread:@selector(updateName) withObject: nil waitUntilDone:NO]; break; case INPUT_EVENT_AUDIO_DELAY: case INPUT_EVENT_SUBTITLE_DELAY: -[[VLCMain sharedInstance] performSelectorOnMainThread:@selector(updateDelays) withObject:nil waitUntilDone:NO]; +[inputManager performSelectorOnMainThread:@selector(updateDelays) withObject:nil waitUntilDone:NO]; break; case INPUT_EVENT_DEAD: -[[VLCMain sharedInstance] performSelectorOnMainThread:@selector
[vlc-commits] macosx: simplify more updaters
vlc | branch: master | David Fuhrmann | Sat Jun 27 22:59:53 2015 +0200| [876dc9a6121155ed96a9a4e3640fd20fa81152ca] | committer: David Fuhrmann macosx: simplify more updaters > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=876dc9a6121155ed96a9a4e3640fd20fa81152ca --- modules/gui/macosx/intf.h |2 -- modules/gui/macosx/intf.m | 52 +++-- 2 files changed, 22 insertions(+), 32 deletions(-) diff --git a/modules/gui/macosx/intf.h b/modules/gui/macosx/intf.h index 04114d2..c343a12 100644 --- a/modules/gui/macosx/intf.h +++ b/modules/gui/macosx/intf.h @@ -145,8 +145,6 @@ static NSString * VLCInputChangedNotification = @"VLCInputChangedNotification"; - (void)plItemUpdated; - (void)playbackModeUpdated; -- (void)updateVolume; -- (void)showMainWindow; - (void)showFullscreenController; - (void)updateTogglePlaylistState; diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m index 3801c79..6518dc8 100644 --- a/modules/gui/macosx/intf.m +++ b/modules/gui/macosx/intf.m @@ -359,22 +359,21 @@ static int PlaybackModeUpdated(vlc_object_t *p_this, const char *psz_var, static int VolumeUpdated(vlc_object_t *p_this, const char *psz_var, vlc_value_t oldval, vlc_value_t new_val, void *param) { -NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init]; -[[VLCMain sharedInstance] performSelectorOnMainThread:@selector(updateVolume) withObject:nil waitUntilDone:NO]; +dispatch_async(dispatch_get_main_queue(), ^{ +[[[VLCMain sharedInstance] mainWindow] updateVolumeSlider]; +}); -[o_pool release]; return VLC_SUCCESS; } static int BossCallback(vlc_object_t *p_this, const char *psz_var, vlc_value_t oldval, vlc_value_t new_val, void *param) { -NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init]; - -[[VLCCoreInteraction sharedInstance] performSelectorOnMainThread:@selector(pause) withObject:nil waitUntilDone:NO]; -[[VLCApplication sharedApplication] hide:nil]; +dispatch_async(dispatch_get_main_queue(), ^{ +[[VLCCoreInteraction sharedInstance] pause]; +[[VLCApplication sharedApplication] hide:nil]; +}); -[o_pool release]; return VLC_SUCCESS; } @@ -386,15 +385,21 @@ static int BossCallback(vlc_object_t *p_this, const char *psz_var, static int ShowController(vlc_object_t *p_this, const char *psz_variable, vlc_value_t old_val, vlc_value_t new_val, void *param) { -intf_thread_t * p_intf = VLCIntf; -if (p_intf) { -playlist_t * p_playlist = pl_Get(p_intf); -BOOL b_fullscreen = var_GetBool(p_playlist, "fullscreen"); -if (b_fullscreen) -[[VLCMain sharedInstance] performSelectorOnMainThread:@selector(showFullscreenController) withObject:nil waitUntilDone:NO]; -else if (!strcmp(psz_variable, "intf-show")) -[[VLCMain sharedInstance] performSelectorOnMainThread:@selector(showMainWindow) withObject:nil waitUntilDone:NO]; -} + +dispatch_async(dispatch_get_main_queue(), ^{ + +intf_thread_t * p_intf = VLCIntf; +if (p_intf) { +playlist_t * p_playlist = pl_Get(p_intf); +BOOL b_fullscreen = var_GetBool(p_playlist, "fullscreen"); +if (b_fullscreen) +[[VLCMain sharedInstance] showFullscreenController]; + +else if (!strcmp(psz_variable, "intf-show")) +[[[VLCMain sharedInstance] mainWindow] makeKeyAndOrderFront:nil]; +} + +}); return VLC_SUCCESS; } @@ -1225,11 +1230,6 @@ static VLCMain *_o_sharedMainInstance = nil; [o_info updateMetadata]; } -- (void)showMainWindow -{ -[o_mainwindow performSelectorOnMainThread:@selector(makeKeyAndOrderFront:) withObject:nil waitUntilDone:NO]; -} - - (void)showFullscreenController { // defer selector here (possibly another time) to ensure that keyWindow is set properly @@ -1237,11 +1237,6 @@ static VLCMain *_o_sharedMainInstance = nil; [o_mainwindow performSelectorOnMainThread:@selector(showFullscreenController) withObject:nil waitUntilDone:NO]; } -- (void)updateVolume -{ -[o_mainwindow updateVolumeSlider]; -} - - (void)playbackModeUpdated { playlist_t * p_playlist = pl_Get(VLCIntf); @@ -1263,9 +1258,6 @@ static VLCMain *_o_sharedMainInstance = nil; [o_mainmenu setShuffle]; } -#pragma mark - -#pragma mark Window updater - - (void)setActiveVideoPlayback:(BOOL)b_value { assert([NSThread isMainThread]); ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] macosx: remove unneeded prototypes
vlc | branch: master | David Fuhrmann | Sat Jun 27 23:02:19 2015 +0200| [c77bd876c1c3a0cee141442fa1b6634ff208cb4b] | committer: David Fuhrmann macosx: remove unneeded prototypes > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c77bd876c1c3a0cee141442fa1b6634ff208cb4b --- modules/gui/macosx/intf.m |9 - 1 file changed, 9 deletions(-) diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m index 6518dc8..53618e6 100644 --- a/modules/gui/macosx/intf.m +++ b/modules/gui/macosx/intf.m @@ -82,15 +82,6 @@ static void updateProgressPanel (void *, const char *, float); static bool checkProgressPanel (void *); static void destroyProgressPanel (void *); -static int PLItemUpdated(vlc_object_t *, const char *, - vlc_value_t, vlc_value_t, void *); - -static int PlaybackModeUpdated(vlc_object_t *, const char *, - vlc_value_t, vlc_value_t, void *); -static int VolumeUpdated(vlc_object_t *, const char *, - vlc_value_t, vlc_value_t, void *); -static int BossCallback(vlc_object_t *, const char *, - vlc_value_t, vlc_value_t, void *); #pragma mark - #pragma mark VLC Interface Object Callbacks ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] macosx: always delete stored input thread on change (close #14850)
vlc | branch: master | David Fuhrmann | Sat Jun 27 14:51:02 2015 +0200| [ff4982c01902e66818c4e008660c86cd58722f30] | committer: David Fuhrmann macosx: always delete stored input thread on change (close #14850) > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ff4982c01902e66818c4e008660c86cd58722f30 --- modules/gui/macosx/intf.m | 39 +++ 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m index 3d901d8..3225a86 100644 --- a/modules/gui/macosx/intf.m +++ b/modules/gui/macosx/intf.m @@ -1320,9 +1320,7 @@ static VLCMain *_o_sharedMainInstance = nil; // This must be called on main thread - (void)PlaylistItemChanged { -input_thread_t *p_input_changed = NULL; - -if (p_current_input && p_current_input->b_dead) { +if (p_current_input) { var_DelCallback(p_current_input, "intf-event", InputEvent, [VLCMain sharedInstance]); vlc_object_release(p_current_input); p_current_input = NULL; @@ -1332,27 +1330,28 @@ static VLCMain *_o_sharedMainInstance = nil; [[NSNotificationCenter defaultCenter] postNotificationName:VLCInputChangedNotification object:nil]; } -else if (!p_current_input) { -// object is hold here and released then it is dead -p_current_input = playlist_CurrentInput(pl_Get(VLCIntf)); -if (p_current_input) { -var_AddCallback(p_current_input, "intf-event", InputEvent, [VLCMain sharedInstance]); -[self playbackStatusUpdated]; -[o_mainmenu setRateControlsEnabled: YES]; - -if ([self activeVideoPlayback] && [[o_mainwindow videoView] isHidden]) { -[o_mainwindow changePlaylistState: psPlaylistItemChangedEvent]; -} -p_input_changed = vlc_object_hold(p_current_input); - -[[self playlist] currentlyPlayingItemChanged]; +input_thread_t *p_input_changed = NULL; -[[self playlist] continuePlaybackWhereYouLeftOff:p_current_input]; +// object is hold here and released then it is dead +p_current_input = playlist_CurrentInput(pl_Get(VLCIntf)); +if (p_current_input) { +var_AddCallback(p_current_input, "intf-event", InputEvent, [VLCMain sharedInstance]); +[self playbackStatusUpdated]; +[o_mainmenu setRateControlsEnabled: YES]; -[[NSNotificationCenter defaultCenter] postNotificationName:VLCInputChangedNotification -object:nil]; +if ([self activeVideoPlayback] && [[o_mainwindow videoView] isHidden]) { +[o_mainwindow changePlaylistState: psPlaylistItemChangedEvent]; } + +p_input_changed = vlc_object_hold(p_current_input); + +[[self playlist] currentlyPlayingItemChanged]; + +[[self playlist] continuePlaybackWhereYouLeftOff:p_current_input]; + +[[NSNotificationCenter defaultCenter] postNotificationName:VLCInputChangedNotification +object:nil]; } [self updateMetaAndInfo]; ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] macosx: Move input-related code to own class
vlc | branch: master | David Fuhrmann | Sat Jun 27 19:35:15 2015 +0200| [0eaddd99fb3e55dc7a3ea252c8392b4fc5fe9581] | committer: David Fuhrmann macosx: Move input-related code to own class > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0eaddd99fb3e55dc7a3ea252c8392b4fc5fe9581 --- modules/gui/macosx/InputManager.h | 62 ++ modules/gui/macosx/InputManager.m | 399 + modules/gui/macosx/Makefile.am|3 +- modules/gui/macosx/intf.h | 31 +-- modules/gui/macosx/intf.m | 360 ++--- 5 files changed, 487 insertions(+), 368 deletions(-) Diff: http://git.videolan.org/gitweb.cgi/vlc.git/?a=commitdiff;h=0eaddd99fb3e55dc7a3ea252c8392b4fc5fe9581 ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] macosx: rename PLItemChanged to InputThreadChanged
vlc | branch: master | David Fuhrmann | Sat Jun 27 14:54:42 2015 +0200| [d3b385e2e8059bf5fb120d7ce0595c154829ced5] | committer: David Fuhrmann macosx: rename PLItemChanged to InputThreadChanged This path is about the current input thread, not about playlist items. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d3b385e2e8059bf5fb120d7ce0595c154829ced5 --- modules/gui/macosx/intf.h |2 +- modules/gui/macosx/intf.m | 14 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/gui/macosx/intf.h b/modules/gui/macosx/intf.h index f8e6517..27ed4f5 100644 --- a/modules/gui/macosx/intf.h +++ b/modules/gui/macosx/intf.h @@ -152,7 +152,7 @@ static NSString * VLCInputChangedNotification = @"VLCInputChangedNotification"; - (void)updateCurrentlyUsedHotkeys; - (BOOL)hasDefinedShortcutKey:(NSEvent *)o_event force:(BOOL)b_force; -- (void)PlaylistItemChanged; +- (void)inputThreadChanged; - (void)plItemUpdated; - (void)playbackStatusUpdated; - (void)sendDistributedNotificationWithUpdatedPlaybackStatus; diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m index 3225a86..c88e355 100644 --- a/modules/gui/macosx/intf.m +++ b/modules/gui/macosx/intf.m @@ -85,7 +85,7 @@ static void destroyProgressPanel (void *); static int InputEvent(vlc_object_t *, const char *, vlc_value_t, vlc_value_t, void *); -static int PLItemChanged(vlc_object_t *, const char *, +static int InputThreadChanged(vlc_object_t *, const char *, vlc_value_t, vlc_value_t, void *); static int PLItemUpdated(vlc_object_t *, const char *, vlc_value_t, vlc_value_t, void *); @@ -387,12 +387,12 @@ static int InputEvent(vlc_object_t *p_this, const char *psz_var, return VLC_SUCCESS; } -static int PLItemChanged(vlc_object_t *p_this, const char *psz_var, +static int InputThreadChanged(vlc_object_t *p_this, const char *psz_var, vlc_value_t oldval, vlc_value_t new_val, void *param) { NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init]; -[[VLCMain sharedInstance] performSelectorOnMainThread:@selector(PlaylistItemChanged) withObject:nil waitUntilDone:NO]; +[[VLCMain sharedInstance] performSelectorOnMainThread:@selector(inputThreadChanged) withObject:nil waitUntilDone:NO]; [o_pool release]; return VLC_SUCCESS; @@ -680,7 +680,7 @@ static VLCMain *_o_sharedMainInstance = nil; var_AddCallback(p_intf->p_libvlc, "intf-show", ShowController, self); var_AddCallback(p_intf->p_libvlc, "intf-boss", BossCallback, self); var_AddCallback(p_playlist, "item-change", PLItemUpdated, self); -var_AddCallback(p_playlist, "input-current", PLItemChanged, self); +var_AddCallback(p_playlist, "input-current", InputThreadChanged, self); var_AddCallback(p_playlist, "playlist-item-append", PLItemAppended, self); var_AddCallback(p_playlist, "playlist-item-deleted", PLItemRemoved, self); var_AddCallback(p_playlist, "random", PlaybackModeUpdated, self); @@ -796,7 +796,7 @@ static VLCMain *_o_sharedMainInstance = nil; * Thus, call additional updaters as we might miss these events if posted before * the callbacks are registered. */ -[self PlaylistItemChanged]; +[self inputThreadChanged]; [self playbackModeUpdated]; // respect playlist-autostart @@ -849,7 +849,7 @@ static VLCMain *_o_sharedMainInstance = nil; var_DelCallback(p_intf, "dialog-question", DialogCallback, self); var_DelCallback(p_intf, "dialog-progress-bar", DialogCallback, self); var_DelCallback(p_playlist, "item-change", PLItemUpdated, self); -var_DelCallback(p_playlist, "input-current", PLItemChanged, self); +var_DelCallback(p_playlist, "input-current", InputThreadChanged, self); var_DelCallback(p_playlist, "playlist-item-append", PLItemAppended, self); var_DelCallback(p_playlist, "playlist-item-deleted", PLItemRemoved, self); var_DelCallback(p_playlist, "random", PlaybackModeUpdated, self); @@ -1318,7 +1318,7 @@ static VLCMain *_o_sharedMainInstance = nil; } // This must be called on main thread -- (void)PlaylistItemChanged +- (void)inputThreadChanged { if (p_current_input) { var_DelCallback(p_current_input, "intf-event", InputEvent, [VLCMain sharedInstance]); ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits