Commit 9c08c259 authored by Tobias's avatar Tobias
Browse files

forward mediaOptions to child media items

parent 13919577
......@@ -14,13 +14,13 @@
NS_ASSUME_NONNULL_BEGIN
@interface VLCNetworkServerBrowserVLCMedia : NSObject <VLCNetworkServerBrowser>
- (instancetype)initWithMedia:(VLCMedia *)media NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithMedia:(VLCMedia *)media options:(NSDictionary *)options NS_DESIGNATED_INITIALIZER;
- (instancetype)init NS_UNAVAILABLE;
@end
@interface VLCNetworkServerBrowserItemVLCMedia : NSObject <VLCNetworkServerBrowserItem>
- (instancetype)initWithMedia:(VLCMedia *)media;
- (instancetype)initWithMedia:(VLCMedia *)media options:(NSDictionary *)mediaOptions;
@end
@interface VLCNetworkServerBrowserVLCMedia (SMB)
......
......@@ -16,11 +16,13 @@
@property (nonatomic) VLCMedia *rootMedia;
@property (nonatomic) VLCMediaList *mediaList;
@property (nonatomic) NSMutableArray<id<VLCNetworkServerBrowserItem>> *mutableItems;
@property (nonatomic, readonly) NSDictionary *mediaOptions;
@end
@implementation VLCNetworkServerBrowserVLCMedia
@synthesize delegate = _delegate;
- (instancetype)initWithMedia:(VLCMedia *)media
- (instancetype)initWithMedia:(VLCMedia *)media options:(nonnull NSDictionary *)mediaOptions
{
self = [super init];
if (self) {
......@@ -29,6 +31,7 @@
[media parseWithOptions:VLCMediaParseNetwork];
_mediaList = [_rootMedia subitems];
_mediaList.delegate = self;
_mediaOptions = [mediaOptions copy];
}
return self;
}
......@@ -49,7 +52,8 @@
- (void)mediaList:(VLCMediaList *)aMediaList mediaAdded:(VLCMedia *)media atIndex:(NSInteger)index
{
[media parseWithOptions:VLCMediaParseNetwork];
[self.mutableItems addObject:[[VLCNetworkServerBrowserItemVLCMedia alloc] initWithMedia:media]];
[media addOptions:self.mediaOptions];
[self.mutableItems addObject:[[VLCNetworkServerBrowserItemVLCMedia alloc] initWithMedia:media options:self.mediaOptions]];
[self.delegate networkServerBrowserDidUpdate:self];
}
......@@ -63,11 +67,13 @@
@interface VLCNetworkServerBrowserItemVLCMedia ()
@property (nonatomic, readonly) VLCMedia *media;
@property (nonatomic, readonly) NSDictionary *mediaOptions;
@end
@implementation VLCNetworkServerBrowserItemVLCMedia
@synthesize name = _name, container = _container, fileSizeBytes = _fileSizeBytes, URL = _URL;
- (instancetype)initWithMedia:(VLCMedia *)media
- (instancetype)initWithMedia:(VLCMedia *)media options:(NSDictionary *)mediaOptions;
{
self = [super init];
if (self) {
......@@ -82,13 +88,14 @@
}
_name = title;
_URL = media.url;
_mediaOptions = [mediaOptions copy];
// _downloadable = NO; //TODO: add property for downloadable?
}
return self;
}
- (id<VLCNetworkServerBrowser>)containerBrowser {
return [[VLCNetworkServerBrowserVLCMedia alloc] initWithMedia:self.media];
return [[VLCNetworkServerBrowserVLCMedia alloc] initWithMedia:self.media options:self.mediaOptions];
}
@end
......@@ -102,7 +109,7 @@
@"smb-pwd" : password ?: @"",
@"smb-domain" : workgroup?: @"WORKGROUP"};
[media addOptions:mediaOptions];
return [[self alloc] initWithMedia:media];
return [[self alloc] initWithMedia:media options:mediaOptions];
}
@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