Skip to content

Instantly share code, notes, and snippets.

@vibrazy
Created August 6, 2015 16:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vibrazy/008903e5c493637edb84 to your computer and use it in GitHub Desktop.
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
- (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