Commit 18c789d2 authored by Stefan's avatar Stefan Committed by Felix Paul Kühne

Fix some compiler warnings

Signed-off-by: Felix Paul Kühne's avatarFelix Paul Kühne <fkuehne@videolan.org>
parent 9476ce01
......@@ -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
......
......@@ -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);
......
......@@ -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"];
......
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