NSString+SupportedMedia.m 1.84 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
/*****************************************************************************
 * NSString+SupportedMedia.m
 * VLC for iOS
 *****************************************************************************
 * Copyright (c) 2013 VideoLAN. All rights reserved.
 * $Id$
 *
 * Authors: Gleb Pinigin <gpinigin # gmail.com>
 *          Felix Paul Kühne <fkuehne # videolan.org>
 *
 * Refer to the COPYING file of the official project for license.
 *****************************************************************************/
13 14 15 16 17 18 19 20 21 22 23

#import "NSString+SupportedMedia.h"

@implementation NSString (SupportedMedia)

- (BOOL)isSupportedMediaFormat
{
    NSUInteger options = NSRegularExpressionSearch | NSCaseInsensitiveSearch;
    return ([self rangeOfString:kSupportedFileExtensions options:options].location != NSNotFound);
}

24 25 26 27 28 29
- (BOOL)isSupportedAudioMediaFormat
{
    NSUInteger options = NSRegularExpressionSearch | NSCaseInsensitiveSearch;
    return ([self rangeOfString:kSupportedAudioFileExtensions options:options].location != NSNotFound);
}

30 31 32 33 34 35
- (BOOL)isSupportedSubtitleFormat
{
    NSUInteger options = NSRegularExpressionSearch | NSCaseInsensitiveSearch;
    return ([self rangeOfString:kSupportedSubtitleFileExtensions options:options].location != NSNotFound);
}

36 37 38 39 40 41
- (BOOL)isSupportedPlaylistFormat
{
    NSUInteger options = NSRegularExpressionSearch | NSCaseInsensitiveSearch;
    return ([self rangeOfString:kSupportedPlaylistFileExtensions options:options].location != NSNotFound);
}

42 43 44 45 46 47
- (BOOL)isSupportedFormat
{
    NSUInteger options = NSRegularExpressionSearch | NSCaseInsensitiveSearch;
    return ([self rangeOfString:kSupportedSubtitleFileExtensions options:options].location != NSNotFound) || ([self rangeOfString:kSupportedAudioFileExtensions options:options].location != NSNotFound) || ([self rangeOfString:kSupportedFileExtensions options:options].location != NSNotFound);
}

48
@end