Commit 4edcc9f0 authored by Tobias's avatar Tobias

bugfixes

parent b6f07df2
......@@ -14,15 +14,7 @@
#import "VLCLocalNetworkServiceBrowser-Protocol.h"
@interface VLCLocalNetworkServiceBrowserMediaDiscoverer : NSObject <VLCLocalNetworkServiceBrowser>
- (instancetype)initWithName:(NSString *)name serviceServiceName:(NSString *)serviceName; NS_DESIGNATED_INITIALIZER;
@property (nonatomic, weak) id<VLCLocalNetworkServiceBrowserDelegate> delegate;
@end
@interface VLCLocalNetworkServiceBrowserMediaDiscoverer ()
@property (nonatomic, readonly) NSString *serviceName;
@property (nonatomic, readonly) VLCMediaDiscoverer* mediaDiscoverer;
- (instancetype)initWithName:(NSString *)name serviceServiceName:(NSString *)serviceName NS_DESIGNATED_INITIALIZER;
@end
@interface VLCLocalNetworkServiceBrowserSAP : VLCLocalNetworkServiceBrowserMediaDiscoverer
......
......@@ -14,10 +14,13 @@
#import "VLCLocalNetworkServiceBrowserMediaDiscoverer.h"
@interface VLCLocalNetworkServiceBrowserMediaDiscoverer () <VLCMediaListDelegate>
@property (nonatomic, readonly) NSString *serviceName;
@property (nonatomic, readwrite) VLCMediaDiscoverer* mediaDiscoverer;
@end
@implementation VLCLocalNetworkServiceBrowserMediaDiscoverer
@synthesize name = _name;
@synthesize name = _name, delegate = _delegate;
- (instancetype)initWithName:(NSString *)name serviceServiceName:(NSString *)serviceName
{
......@@ -25,20 +28,32 @@
if (self) {
_name = name;
_serviceName = serviceName;
_mediaDiscoverer = [[VLCMediaDiscoverer alloc] initWithName:serviceName];
_mediaDiscoverer.discoveredMedia.delegate = self;
}
return self;
}
- (instancetype)init {
return [self initWithName:@"" serviceServiceName:@""];
}
- (void)startDiscovery
{
[self.mediaDiscoverer startDiscoverer];
// don't start discovery twice
if (self.mediaDiscoverer) {
return;
}
VLCMediaDiscoverer *discoverer = [[VLCMediaDiscoverer alloc] initWithName:self.serviceName];
self.mediaDiscoverer = discoverer;
[discoverer startDiscoverer];
discoverer.discoveredMedia.delegate = self;
}
- (void)stopDiscovery
{
[self.mediaDiscoverer stopDiscoverer];
VLCMediaDiscoverer *discoverer = self.mediaDiscoverer;
discoverer.discoveredMedia.delegate = nil;
[discoverer stopDiscoverer];
self.mediaDiscoverer = nil;
}
- (NSUInteger)numberOfItems {
......
......@@ -64,8 +64,6 @@ typedef NS_ENUM(NSUInteger, VLCLocalServerSections) {
Reachability *_reachability;
NSString *_myHostName;
BOOL _udnpDiscoveryRunning;
NSTimer *_searchTimer;
BOOL _setup;
......@@ -146,14 +144,15 @@ typedef NS_ENUM(NSUInteger, VLCLocalServerSections) {
_sapBrowser = [[VLCLocalNetworkServiceBrowserSAP alloc] init];
_sapBrowser.delegate = self;
_dsmBrowser = [[VLCLocalNetworkServiceBrowserDSM alloc] init];
_dsmBrowser.delegate = self;
_reachability = [Reachability reachabilityForLocalWiFi];
[_reachability startNotifier];
[self netReachabilityChanged];
_myHostName = [[VLCHTTPUploaderController sharedInstance] hostname];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(netReachabilityChanged) name:kReachabilityChangedNotification object:nil];
return self;
......
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