Created
November 4, 2012 22:52
-
-
Save thinkdevcode/4014184 to your computer and use it in GitHub Desktop.
rubymotion broken
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
class MainController < UIViewController | |
def viewDidLoad | |
setupVideo() | |
end | |
def setupVideo | |
@session = AVCaptureSession.alloc.init | |
@session.sessionPreset = AVCaptureSessionPresetLow | |
@device = AVCaptureDevice.defaultDeviceWithMediaType AVMediaTypeVideo | |
@input = AVCaptureDeviceInput.deviceInputWithDevice @device, error:nil | |
@output = AVCaptureVideoDataOutput.alloc.init | |
@output.alwaysDiscardsLateVideoFrames = true | |
queue = Dispatch::Queue.new('cameraQueue') | |
@output.setSampleBufferDelegate self, queue:queue.dispatch_object | |
@output.setVideoSettings KCVPixelBufferPixelFormatTypeKey => KCVPixelFormatType_32BGRA | |
session.addInput @input | |
session.addOutput @output | |
@session.startRunning | |
end | |
def captureOutput(captureOutput, didOutputSampleBuffer:sampleBuffer, fromConnection:connection) | |
#imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer) | |
#image = CIImage.imageWithCVImageBuffer(imageBuffer) | |
#Dispatch::Queue.main.sync do | |
#end | |
nil | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Experiencing the same... lost a day trying to figure out if it was just me.