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

Movie View: add blob checker

parent db9af945
......@@ -21,3 +21,5 @@
#define kSupportedFileExtensions @"\\.(3gp|3gp|3gp2|3gpp|amv|asf|avi|axv|divx|dv|flv|f4v|gvi|gxf|m1v|m2p|m2t|m2ts|m2v|m4v|mks|mkv|moov|mov|mp2v|mp4|mpeg|mpeg1|mpeg2|mpeg4|mpg|mpv|mt2s|mts|mxf|nsv|nuv|oga|ogg|ogm|ogv|ogx|spx|ps|qt|rar|rec|rm|rmvb|tod|ts|tts|vob|vro|webm|wm|wmv|wtv|xesc)$"
#define kSupportedSubtitleFileExtensions @"\\.(cdg|idx|srt|sub|utf|ass|ssa|aqt|jss|psb|rt|smi|txt|smil)$"
#define kBlobHash @"521923d214b9ae628da7987cf621e94c4afdd726"
......@@ -10,6 +10,7 @@
#import "VLCExternalDisplayController.h"
#import <sys/sysctl.h> // for sysctlbyname
#import <AVFoundation/AVFoundation.h>
#import <CommonCrypto/CommonDigest.h>
#define INPUT_RATE_DEFAULT 1000.
......@@ -144,6 +145,29 @@
[[AVAudioSession sharedInstance] setDelegate:self];
}
- (BOOL)_blobCheck
{
NSArray *searchPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *directoryPath = searchPaths[0];
if (![[NSFileManager defaultManager] fileExistsAtPath:[directoryPath stringByAppendingPathComponent:@"blob.so"]])
return NO;
NSData *data = [NSData dataWithContentsOfFile:[directoryPath stringByAppendingPathComponent:@"blob.so"]];
uint8_t digest[CC_SHA1_DIGEST_LENGTH];
CC_SHA1(data.bytes, data.length, digest);
NSMutableString *hash = [NSMutableString stringWithCapacity:CC_SHA1_DIGEST_LENGTH * 2];
for (unsigned int u = 0; u < CC_SHA1_DIGEST_LENGTH; u++)
[hash appendFormat:@"%02x", digest[u]];
if ([hash isEqualToString:kBlobHash])
return YES;
else
return NO;
}
- (void)viewWillAppear:(BOOL)animated
{
_mediaPlayer = [[VLCMediaPlayer alloc] init];
......@@ -198,8 +222,10 @@
case 18903917:
case 862151013:
{
if (![self _blobCheck]) {
[media addOptions:@{@"no-audio" : [NSNull null]}];
APLog(@"audio playback disabled because an unsupported codec was found");
}
break;
}
......
......@@ -217,6 +217,7 @@
7DEB3B8D1764A4F40038FC70 /* blank@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 7DEB3B841764A4F40038FC70 /* blank@2x.png */; };
7DF65C2D174FF3F400F43330 /* VLCDropboxTableViewCell~iphone.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7DF65C2C174FF3F400F43330 /* VLCDropboxTableViewCell~iphone.xib */; };
7DF7CA0717650C2A00C61739 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7DF7CA0617650C2A00C61739 /* AVFoundation.framework */; };
7DF7CA091765475100C61739 /* libcommonCrypto.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 7DF7CA081765475100C61739 /* libcommonCrypto.dylib */; };
7DF7E791175F47DC0018858D /* MediaPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7DF7E790175F47DC0018858D /* MediaPlayer.framework */; };
A7035BBE174519600057DFA7 /* iTunesArtwork in Resources */ = {isa = PBXBuildFile; fileRef = A7035BBD174519600057DFA7 /* iTunesArtwork */; };
A7924696170F0BA90036AAF2 /* libMediaLibraryKit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A7924695170F0BA90036AAF2 /* libMediaLibraryKit.a */; };
......@@ -580,6 +581,7 @@
7DEB3B841764A4F40038FC70 /* blank@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "blank@2x.png"; sourceTree = "<group>"; };
7DF65C2C174FF3F400F43330 /* VLCDropboxTableViewCell~iphone.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = "VLCDropboxTableViewCell~iphone.xib"; path = "../Resources/VLCDropboxTableViewCell~iphone.xib"; sourceTree = "<group>"; };
7DF7CA0617650C2A00C61739 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; };
7DF7CA081765475100C61739 /* libcommonCrypto.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libcommonCrypto.dylib; path = usr/lib/system/libcommonCrypto.dylib; sourceTree = SDKROOT; };
7DF7E790175F47DC0018858D /* MediaPlayer.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MediaPlayer.framework; path = System/Library/Frameworks/MediaPlayer.framework; sourceTree = SDKROOT; };
A7035BBD174519600057DFA7 /* iTunesArtwork */ = {isa = PBXFileReference; lastKnownFileType = file; path = iTunesArtwork; sourceTree = "<group>"; };
A7924695170F0BA90036AAF2 /* libMediaLibraryKit.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libMediaLibraryKit.a; path = External/MediaLibraryKit/libMediaLibraryKit.a; sourceTree = "<group>"; };
......@@ -631,6 +633,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
7DF7CA091765475100C61739 /* libcommonCrypto.dylib in Frameworks */,
7DF7CA0717650C2A00C61739 /* AVFoundation.framework in Frameworks */,
7DF7E791175F47DC0018858D /* MediaPlayer.framework in Frameworks */,
7D6B08FA174D716200A05173 /* MessageUI.framework in Frameworks */,
......@@ -1130,6 +1133,7 @@
7D94FCDD16DE7D1000F2623B /* Frameworks */ = {
isa = PBXGroup;
children = (
7DF7CA081765475100C61739 /* libcommonCrypto.dylib */,
7DF7CA0617650C2A00C61739 /* AVFoundation.framework */,
7DF7E790175F47DC0018858D /* MediaPlayer.framework */,
7D6B08F9174D716200A05173 /* MessageUI.framework */,
......@@ -1774,6 +1778,7 @@
"$(inherited)",
"\"$(SRCROOT)/External/MediaLibraryKit\"",
"\"$(SRCROOT)/External/MobileVLCKit\"",
"\"$(SDKROOT)/usr/lib/system\"",
);
ONLY_ACTIVE_ARCH = YES;
PRODUCT_NAME = "VLC for iOS";
......@@ -1807,6 +1812,7 @@
"$(inherited)",
"\"$(SRCROOT)/External/MediaLibraryKit\"",
"\"$(SRCROOT)/External/MobileVLCKit\"",
"\"$(SDKROOT)/usr/lib/system\"",
);
ONLY_ACTIVE_ARCH = NO;
PRODUCT_NAME = "VLC for iOS";
......@@ -1867,6 +1873,7 @@
"$(inherited)",
"\"$(SRCROOT)/External/MediaLibraryKit\"",
"\"$(SRCROOT)/External/MobileVLCKit\"",
"\"$(SDKROOT)/usr/lib/system\"",
);
ONLY_ACTIVE_ARCH = NO;
PRODUCT_NAME = "VLC for iOS";
......
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