[vlc-devel] [PATCH] fixing some compiler warnings (VLCKit)
Stefan Schmidt-Bilkenroth
ssb at mac.com
Fri Apr 29 09:40:03 CEST 2016
From 530a96d8a9a3987fa425af00507120dccc079cd2 Mon Sep 17 00:00:00 2001
From: ssb <ssb at mac.com>
Date: Fri, 29 Apr 2016 09:30:19 +0200
Subject: [PATCH] fixing some compiler warnings (VLCKit)
---
Sources/VLCMedia.m | 17 +++++++++++------
Sources/VLCMediaDiscoverer.m | 2 +-
Sources/VLCMediaThumbnailer.m | 6 ++++--
3 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/Sources/VLCMedia.m b/Sources/VLCMedia.m
index 4add492..916296e 100644
--- a/Sources/VLCMedia.m
+++ b/Sources/VLCMedia.m
@@ -321,8 +321,11 @@ static void HandleMediaParsedChanged(const libvlc_event_t * event, void * self)
[self parseIfNeeded];
// wait until we are preparsed
- while (!_length && !libvlc_media_is_parsed(p_md) && [aDate timeIntervalSinceNow] > 0)
- usleep( thread_sleep );
+ libvlc_media_parsed_status_t status = libvlc_media_get_parsed_status(p_md);
+ while (!_length && !(status == VLCMediaParseStatusFailed || status == VLCMediaParseStatusDone) && [aDate timeIntervalSinceNow] > 0) {
+ usleep( thread_sleep );
+ status = libvlc_media_get_parsed_status(p_md);
+ }
// So we're done waiting, but sometimes we trap the fact that the parsing
// was done before the length gets assigned, so lets go ahead and assign
@@ -336,14 +339,16 @@ static void HandleMediaParsedChanged(const libvlc_event_t * event, void * self)
- (BOOL)isParsed
{
- VLCMediaParseStatus status = [self parseStatus];
- return VLCMediaParseStatusFailed || VLCMediaParseStatusDone;
+ VLCMediaParseStatus status = [self parseStatus];
+ return (status == VLCMediaParseStatusFailed || status == VLCMediaParseStatusDone) ? YES:NO;
}
- (VLCMediaParseStatus)parseStatus
{
- libvlc_media_parsed_status_t status = libvlc_media_get_parsed_status(p_md);
- return status;
+ if ( !p_md )
+ return VLCMediaParseStatusFailed;
+ libvlc_media_parsed_status_t status = libvlc_media_get_parsed_status(p_md);
+ return (VLCMediaParseStatus)status;
}
- (void)parse
diff --git a/Sources/VLCMediaDiscoverer.m b/Sources/VLCMediaDiscoverer.m
index d4cbfb9..407cd62 100644
--- a/Sources/VLCMediaDiscoverer.m
+++ b/Sources/VLCMediaDiscoverer.m
@@ -57,7 +57,7 @@ NSString *const VLCMediaDiscovererCategory = @"VLCMediaDiscovererCategory";
+ (NSArray *)availableMediaDiscovererForCategoryType:(VLCMediaDiscovererCategoryType)categoryType
{
libvlc_media_discoverer_description **discoverers;
- unsigned numberOfDiscoverers = libvlc_media_discoverer_list_get([VLCLibrary sharedInstance], categoryType, &discoverers);
+ unsigned numberOfDiscoverers = libvlc_media_discoverer_list_get([VLCLibrary sharedInstance], (libvlc_media_discoverer_category)categoryType, &discoverers);
if (numberOfDiscoverers == 0) {
libvlc_media_discoverer_list_release(discoverers, numberOfDiscoverers);
diff --git a/Sources/VLCMediaThumbnailer.m b/Sources/VLCMediaThumbnailer.m
index ac237a0..631b66f 100644
--- a/Sources/VLCMediaThumbnailer.m
+++ b/Sources/VLCMediaThumbnailer.m
@@ -143,7 +143,8 @@ static void display(void *opaque, void *picture)
{
NSAssert(!_data, @"We are already fetching a thumbnail");
- if (![_media isParsed]) {
+ VLCMediaParseStatus parseStatus = [_media parseStatus];
+ if (!(parseStatus == VLCMediaParseStatusFailed || parseStatus == VLCMediaParseStatusDone)) {
[_media addObserver:self forKeyPath:@"parsed" options:0 context:NULL];
[_media parseWithOptions:VLCMediaParseLocal];
NSAssert(!_parsingTimeoutTimer, @"We already have a timer around");
@@ -242,7 +243,8 @@ static void display(void *opaque, void *picture)
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
if (object == _media && [keyPath isEqualToString:@"parsed"]) {
- if ([_media isParsed]) {
+ VLCMediaParseStatus parseStatus = [_media parseStatus];
+ if (parseStatus == VLCMediaParseStatusFailed || parseStatus == VLCMediaParseStatusDone) {
[_parsingTimeoutTimer invalidate];
_parsingTimeoutTimer = nil;
[_media removeObserver:self forKeyPath:@"parsed"];
--
2.6.4 (Apple Git-63)
More information about the vlc-devel
mailing list