Commit a406c082 authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

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

parent 3f4aec54
...@@ -15,8 +15,11 @@ ...@@ -15,8 +15,11 @@
void *instance; void *instance;
NSMutableArray *_extensions; NSMutableArray *_extensions;
VLCMediaPlayer *_player; VLCMediaPlayer *_player;
void *_previousInput;
} }
+ (VLCExtensionsManager *)sharedManager; + (VLCExtensionsManager *)sharedManager;
- (NSArray *)extensions; - (NSArray *)extensions;
- (void)runExtension:(VLCExtension *)extension; - (void)runExtension:(VLCExtension *)extension;
@property (readwrite, retain) VLCMediaPlayer *mediaPlayer;
@end @end
...@@ -88,6 +88,12 @@ static VLCExtensionsManager *sharedManager = nil; ...@@ -88,6 +88,12 @@ static VLCExtensionsManager *sharedManager = nil;
- (void)mediaPlayerLikelyChangedInput - (void)mediaPlayerLikelyChangedInput
{ {
input_thread_t *input = _player ? libvlc_media_player_get_input_thread([_player libVLCMediaPlayer]) : NULL; 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) for(VLCExtension *extension in _extensions)
extension_SetInput(_instance, [extension instance], input); extension_SetInput(_instance, [extension instance], input);
if (input) if (input)
...@@ -110,4 +116,9 @@ static VLCExtensionsManager *sharedManager = nil; ...@@ -110,4 +116,9 @@ static VLCExtensionsManager *sharedManager = nil;
if (player) if (player)
[center addObserver:self selector:@selector(mediaPlayerLikelyChangedInput) name:VLCMediaPlayerStateChanged object:_player]; [center addObserver:self selector:@selector(mediaPlayerLikelyChangedInput) name:VLCMediaPlayerStateChanged object:_player];
} }
- (VLCMediaPlayer *)mediaPlayer
{
return _player;
}
@end @end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment