Commit 7777fcf2 authored by Soomin Lee's avatar Soomin Lee Committed by Carola Nitz

VLCNetworkServerBrowserUPnP: Add multi-protocol handling (closes #55)

If a media have multiple URI with an image, the image was choosed as the
default URI. Hence, this blocked the streaming of some media and could
even lead to a crash with a big media folders.
This patch fixes temporarily this issue waiting for the integration of the
libvlc's services discovery and the de-integration of upnpx.
Additionally, adds constants of protocols.

(cherry picked from commit 221e2d9a)
parent 08ba05b3
Pipeline #140 failed with stage
in 0 seconds
......@@ -12,6 +12,9 @@
#import "VLCNetworkServerBrowser-Protocol.h"
#define kVLCUPnPVideoProtocolKey @"http-get:*:video/"
#define kVLCUPnPAudioProtocolKey @"http-get:*:audio/"
NS_ASSUME_NONNULL_BEGIN
@class MediaServer1Device;
@interface VLCNetworkServerBrowserUPnP : NSObject <VLCNetworkServerBrowser>
......@@ -45,4 +48,4 @@ NS_ASSUME_NONNULL_BEGIN
@end
NS_ASSUME_NONNULL_END
\ No newline at end of file
NS_ASSUME_NONNULL_END
......@@ -113,7 +113,7 @@
// Provide users with a descriptive action sheet for them to choose based on the multiple resources advertised by DLNA devices (HDHomeRun for example)
NSRange position = [key rangeOfString:@"http-get:*:video/"];
NSRange position = [key rangeOfString:kVLCUPnPVideoProtocolKey];
if (position.location == NSNotFound)
return nil;
......@@ -245,23 +245,29 @@
return NO;
if ([evaluatedObject respondsToSelector:@selector(containsString:)]) {
if ([evaluatedObject containsString:@"http-get:*:video/"])
if ([evaluatedObject containsString:kVLCUPnPVideoProtocolKey])
return YES;
if ([evaluatedObject containsString:@"http-get:*:audio/"])
if ([evaluatedObject containsString:kVLCUPnPAudioProtocolKey])
return YES;
} else {
NSRange foundRange = [evaluatedObject rangeOfString:@"http-get:*:video/"];
NSRange foundRange = [evaluatedObject rangeOfString:kVLCUPnPVideoProtocolKey];
if (foundRange.location != NSNotFound)
return YES;
foundRange = [evaluatedObject rangeOfString:@"http-get:*:audio/"];
foundRange = [evaluatedObject rangeOfString:kVLCUPnPAudioProtocolKey];
if (foundRange.location != NSNotFound)
return YES;
}
return NO;
}]];
/* FIXME: on some servers, we can have more than 1 protocol string as different transcoding schemes are offered
* in previous versions, we offered a selector - maybe re-add? */
// Check for multiple URIs.
if ([mediaItem.uriCollection count] > 1) {
for (NSString *key in mediaItem.uriCollection) {
if ([key containsString:kVLCUPnPVideoProtocolKey] || [key containsString:kVLCUPnPAudioProtocolKey]) {
mediaItem.uri = [mediaItem.uriCollection objectForKey:key];
}
}
}
_URL = [NSURL URLWithString:[mediaItem uri]];
}
}
......
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