Created
August 6, 2015 16:22
-
-
Save vibrazy/008903e5c493637edb84 to your computer and use it in GitHub Desktop.
Vuforia Fix for Crash - QCAR::CameraDevice::getInstance().init(camera) - [AVCaptureVideoDataOutput setVideoSettings:] - b32a (1647522401) is not a supported pixel format type
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)vuforiaBugFix | |
{ | |
[AVCaptureVideoDataOutput aspect_hookSelector:@selector(setVideoSettings:) withOptions:AspectPositionInstead usingBlock:^(id<AspectInfo> aspectInfo, NSMutableDictionary *settings) { | |
// lets check if the settings have a PixelFormatType as the key | |
NSString *key = (id)kCVPixelBufferPixelFormatTypeKey; | |
if([settings objectForKey:key]) | |
{ | |
// vuforia is trying to set the pixel format, so lets check if the format is available | |
NSArray *availableFormats = [aspectInfo.instance availableVideoCVPixelFormatTypes]; | |
if ([availableFormats containsObject:settings[key]]) | |
{ | |
// okay, it's a valid format, so lets let it go thru | |
NSInvocation *invocation = aspectInfo.originalInvocation; | |
[invocation invoke]; | |
} | |
else | |
{ | |
// nothing to do really, otherwise it will break and crash the app (burgh) | |
// lets log it for a laugh | |
NSLog(@"trying to set some dodgy format (Vuforia please fix it): %@", settings); | |
} | |
} | |
} error:NULL]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment