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

media discoverer: expose list of available discoverers

parent 0ee5a92c
......@@ -31,6 +31,20 @@
@class VLCMediaList;
@class VLCMediaDiscoverer;
typedef NS_ENUM(unsigned, VLCMediaDiscovererCategoryType)
{
VLCMediaDiscovererCategoryTypeDevices = 0,
VLCMediaDiscovererCategoryTypeLAN,
VLCMediaDiscovererCategoryTypePodcasts,
VLCMediaDiscovererCategoryTypeLocalDirectories
};
/* discoverer keys */
extern NSString *const VLCMediaDiscovererName;
extern NSString *const VLCMediaDiscovererLongName;
extern NSString *const VLCMediaDiscovererCategory;
/**
* VLCMediaDiscoverer
*/
......@@ -44,6 +58,12 @@
*/
+ (NSArray *)availableMediaDiscoverer __attribute__((deprecated));
/**
* \param The VLCMediaDiscovererCategory you are looking for
* \return returns an array of dictionaries describing the available discoverers for the requested type
*/
+ (NSArray *)availableMediaDiscovererForCategoryType:(VLCMediaDiscovererCategoryType)categoryType;
/* Initializers */
/**
* Initializes new object with specified name.
......
......@@ -43,11 +43,16 @@ New APIs:
- VLCDialogProvider
- new class to handle user interaction with VLC events
- VLCMediaDiscoverer
- added selector: availableMediaDiscovererForCategoryType:
Deprecated APIs:
- VLCMediaPlayer
- titles, chaptersForTitleIndex:, countOfTitles, framesPerSecond
- VLCAudio
- setMute:
- VLCMediaDiscoverer
- availableMediaDiscoverer
Removed APIs:
- VLCMedia:
......
......@@ -32,6 +32,10 @@
#include <vlc/libvlc.h>
#include <vlc/libvlc_media_discoverer.h>
NSString *const VLCMediaDiscovererName = @"VLCMediaDiscovererName";
NSString *const VLCMediaDiscovererLongName = @"VLCMediaDiscovererLongName";
NSString *const VLCMediaDiscovererCategory = @"VLCMediaDiscovererCategory";
@interface VLCMediaDiscoverer ()
{
NSString *_localizedName;
......@@ -50,6 +54,33 @@
return @[];
}
+ (NSArray *)availableMediaDiscovererForCategoryType:(VLCMediaDiscovererCategoryType)categoryType
{
libvlc_media_discoverer_description **discoverers;
unsigned numberOfDiscoverers = libvlc_media_discoverer_list_get([VLCLibrary sharedInstance], categoryType, &discoverers);
if (numberOfDiscoverers == 0) {
libvlc_media_discoverer_list_release(discoverers, numberOfDiscoverers);
return @[];
}
NSMutableArray *mutArray = [NSMutableArray arrayWithCapacity:numberOfDiscoverers];
for (unsigned u = 0; u < numberOfDiscoverers; u++) {
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
discoverers[u]->psz_name ? [NSString stringWithUTF8String:discoverers[u]->psz_name] : @"",
VLCMediaDiscovererName,
discoverers[u]->psz_longname ? [NSString stringWithUTF8String:discoverers[u]->psz_longname] : @"",
VLCMediaDiscovererLongName,
@(discoverers[u]->i_cat),
VLCMediaDiscovererCategory,
nil];
[mutArray addObject:dict];
}
libvlc_media_discoverer_list_release(discoverers, numberOfDiscoverers);
return [mutArray copy];
}
- (instancetype)initWithName:(NSString *)aServiceName
{
return [self initWithName:aServiceName libraryInstance:nil];
......
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