[vlc-devel] commit: macosx/framework: Make sure -[VLCExtensionManager mediaPlayer] is KVO. (Pierre d'Herbemont )

git version control git at videolan.org
Fri Jan 29 11:49:36 CET 2010


vlc | branch: master | Pierre d'Herbemont <pdherbemont at free.fr> | Fri Jan 29 11:48:56 2010 +0100| [a406c0827f3f1e5b08989582c410e37677ec8cf8] | committer: Pierre d'Herbemont 

macosx/framework: Make sure -[VLCExtensionManager mediaPlayer] is KVO.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a406c0827f3f1e5b08989582c410e37677ec8cf8
---

 .../Headers/Public/VLCExtensionsManager.h          |    3 +++
 .../framework/Sources/VLCExtensionsManager.m       |   11 +++++++++++
 2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/projects/macosx/framework/Headers/Public/VLCExtensionsManager.h b/projects/macosx/framework/Headers/Public/VLCExtensionsManager.h
index dee0fb9..6c34176 100644
--- a/projects/macosx/framework/Headers/Public/VLCExtensionsManager.h
+++ b/projects/macosx/framework/Headers/Public/VLCExtensionsManager.h
@@ -15,8 +15,11 @@
     void *instance;
     NSMutableArray *_extensions;
     VLCMediaPlayer *_player;
+    void *_previousInput;
 }
 + (VLCExtensionsManager *)sharedManager;
 - (NSArray *)extensions;
 - (void)runExtension:(VLCExtension *)extension;
+
+ at property (readwrite, retain) VLCMediaPlayer *mediaPlayer;
 @end
diff --git a/projects/macosx/framework/Sources/VLCExtensionsManager.m b/projects/macosx/framework/Sources/VLCExtensionsManager.m
index e202536..85f3896 100644
--- a/projects/macosx/framework/Sources/VLCExtensionsManager.m
+++ b/projects/macosx/framework/Sources/VLCExtensionsManager.m
@@ -88,6 +88,12 @@ static VLCExtensionsManager *sharedManager = nil;
 - (void)mediaPlayerLikelyChangedInput
 {
     input_thread_t *input = _player ? libvlc_media_player_get_input_thread([_player libVLCMediaPlayer]) : NULL;
+
+    // Don't send more than appropriate
+    if (_previousInput == input)
+        return;
+    _previousInput = input;
+
     for(VLCExtension *extension in _extensions)
         extension_SetInput(_instance, [extension instance], input);
     if (input)
@@ -110,4 +116,9 @@ static VLCExtensionsManager *sharedManager = nil;
     if (player)
         [center addObserver:self selector:@selector(mediaPlayerLikelyChangedInput) name:VLCMediaPlayerStateChanged object:_player];
 }
+
+- (VLCMediaPlayer *)mediaPlayer
+{
+    return _player;
+}
 @end




More information about the vlc-devel mailing list