Commit faa7b44a authored by Felix Paul Kühne's avatar Felix Paul Kühne

discoverer: add delegation protocol

parent 72079fed
...@@ -26,12 +26,25 @@ ...@@ -26,12 +26,25 @@
#import "VLCMediaList.h" #import "VLCMediaList.h"
@class VLCMediaList; @class VLCMediaList;
@class VLCMediaDiscoverer;
/** /**
* TODO: Documentation VLCMediaDiscoverer * TODO: Documentation VLCMediaDiscoverer
*/ */
@protocol VLCMediaDiscovererDelegate <NSObject>
@optional
- (void)discovererStarted:(VLCMediaDiscoverer *)theDiscoverer;
- (void)discovererStopped:(VLCMediaDiscoverer *)theDiscoverer;
@end
@interface VLCMediaDiscoverer : NSObject @interface VLCMediaDiscoverer : NSObject
@property (weak, readwrite) id<VLCMediaDiscovererDelegate> delegate;
/** /**
* Maintains a list of available media discoverers. This list is populated as new media * Maintains a list of available media discoverers. This list is populated as new media
* discoverers are created. * discoverers are created.
......
...@@ -172,6 +172,11 @@ static void HandleMediaDiscovererEnded( const libvlc_event_t *event, void *user_ ...@@ -172,6 +172,11 @@ static void HandleMediaDiscovererEnded( const libvlc_event_t *event, void *user_
[self willChangeValueForKey:@"running"]; [self willChangeValueForKey:@"running"];
_running = YES; _running = YES;
[self didChangeValueForKey:@"running"]; [self didChangeValueForKey:@"running"];
if (self.delegate) {
if ([self.delegate respondsToSelector:@selector(discovererStarted:)])
[self.delegate discovererStarted:self];
}
} }
- (void)_mediaDiscovererEnded - (void)_mediaDiscovererEnded
...@@ -179,5 +184,10 @@ static void HandleMediaDiscovererEnded( const libvlc_event_t *event, void *user_ ...@@ -179,5 +184,10 @@ static void HandleMediaDiscovererEnded( const libvlc_event_t *event, void *user_
[self willChangeValueForKey:@"running"]; [self willChangeValueForKey:@"running"];
_running = NO; _running = NO;
[self didChangeValueForKey:@"running"]; [self didChangeValueForKey:@"running"];
if (self.delegate) {
if ([self.delegate respondsToSelector:@selector(discovererStopped:)])
[self.delegate discovererStopped:self];
}
} }
@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