Re: Display USB Video Camera output : AVFoundation?
It¹s a bug. I filed it a couple of days ago. 22666722 AVCaptureSession commitConfiguration calls deprecated code. On 9/13/15 2:00 PM, "cocoa-dev-requ...@lists.apple.com" wrote: > Well, AVCaptureView is not very malleable. I needed to use an > AVCaptureVideoPreviewLayer, which needed quite a few more lines of code than > the zero I reported yesterday :( For the record, I have pasted in the working > code below. The only problem is that this silly warning prints to the console > whenever my view loads: CoreAnimation: Warning! CAImageQueueSetOwner() is > deprecated and does nothing. Please stop calling this method. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Display USB Video Camera output : AVFoundation?
Well, AVCaptureView is not very malleable. I needed to use an AVCaptureVideoPreviewLayer, which needed quite a few more lines of code than the zero I reported yesterday :( For the record, I have pasted in the working code below. The only problem is that this silly warning prints to the console whenever my view loads: CoreAnimation: Warning! CAImageQueueSetOwner() is deprecated and does nothing. Please stop calling this method. I am doing no such thing. This is built with the 10.10 SDK, running in 10.11. Can anyone explain? Otherwise I’ll report as a bug in 10.11. Jerry *** Camera.h *** @interface Camera : NSObject + (Camera*)sharedCamera ; - (BOOL)startInView:(NSView*)view error_p:(NSError**)error_p ; @end *** Camera.m *** #import static Camera* sharedCamera = nil ; @interface Camera () @property AVCaptureSession* session ; @end @implementation Camera + (Camera*)sharedCamera { if (sharedCamera == nil) { sharedCamera = [[self alloc] init] ; } return sharedCamera ; } - (BOOL)startInView:(NSView*)view error_p:(NSError**)error_p { BOOL ok = NO ; NSError* error = nil ; AVCaptureDevice* device = nil ; for (device in [AVCaptureDevice devices]) { /* We want an external video camera. Grab the first device which will do video and is not vended by Apple Inc. This code could be improved if more properties of the intended camera were available. */ if ([device hasMediaType:AVMediaTypeVideo]) { NSString* modelID = [device modelID] ; if ([modelID rangeOfString:@"VendorID_0x106B"].location == NSNotFound) { ok = YES ; break ; } } } if (!ok) { NSDictionary* info = @{ NSLocalizedDescriptionKey : NSLocalizedString(@"No external camera found", nil), } ; error = [NSError errorWithDomain:kMyErrorDomain code:258740 userInfo:info] ; } AVCaptureDeviceInput* input = nil ; if (device) { input = [[AVCaptureDeviceInput alloc] initWithDevice:device error:&error] ; if (!input) { ok = NO ; } } if (ok) { self.session = [[AVCaptureSession alloc] init] ; [self.session addInput:input] ; AVCaptureVideoPreviewLayer* layer ; layer = [AVCaptureVideoPreviewLayer layerWithSession:self.session] ; layer.contentsGravity = kCAGravityResizeAspectFill ; view.layer = layer ; [view setWantsLayer:YES] ; layer.contentsGravity = kCAGravityResizeAspectFill ; view.layerContentsRedrawPolicy = NSViewLayerContentsRedrawDuringViewResize ; view.layerContentsPlacement = NSViewLayerContentsPlacementCenter ; layer.frame = view.bounds ; [self.session startRunning] ; } if (error && error_p) { *error_p = error ; } return ok ; } @end ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Display USB Video Camera output : AVFoundation?
> On 2015 Sep 10, at 07:50, Gordon Apple wrote: > > Second, you can use AVCaptureView or AVCaptureVideoPreviewLayer. Holy cow. I just instantiated an AVCaptureView in InterfaceBuilder, added AVKit.framework to the project, build, run and what to my wondering eyes did appear but my ugly face, live on my screen, via the FaceTime camera!! I still have to figure out how to get rid of the little control strip which appears at the bottom of the view when you mouse over it, and how to programatically select an external USB camera, but considering that I have read zero pages of documentation so far, I have high hopes that these tasks will be straightforward. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Display USB Video Camera output : AVFoundation?
First, yes, AVFoundation is the way to go. Second, you can use AVCaptureView or AVCaptureVideoPreviewLayer. II recommend that you don¹t subclass AVCaptureVideoPreviewLayer, but rather embed it in your own custom CALayer. That gives you more freedom of control, and if you want to do things like clipping and add shadows, you can do it. Otherwise the capture layer will clip the shadows. Our (still unreleased) application allows any number of cameras to be used simultaneously, with individual display parameters. You can even (installing their driver) use a $5 app, PocketCam, as a wireless remote video camera input. On 9/10/15 4:42 AM, "cocoa-dev-requ...@lists.apple.com" wrote: > In a Mac app, I need to display real-time video (as in ³movies²) from a USB > camera on the screen. Can someone please confirm that AVFoundation the way to > go? I¹ve read that QTKit is deprecated but, oddly, I cannot find any mention > of deprecation here in the QTKit Programming Guide: > https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/QTKitAp > plicationProgrammingGuide/ Thank you, Jerry ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Display USB Video Camera output : AVFoundation?
One of my projects (still on the back burner at the moment, but slowly progressing nonetheless) is a DIY pick-and-place machine for doing small-run electronics. It uses standard VGA-quality USB webcams (such as the type that you can get off of eBay for under $10 each… often under $4) to do the component-detection machine vision; and I do have the video input section of the project seeing the webcams with AVFoundation. So if that’s the kind of camera in question… yeah, it works. :-) > On Sep 9, 2015, at 9:22 PM, Jerry Krinock wrote: > > In a Mac app, I need to display real-time video (as in “movies”) from a USB > camera on the screen. Can someone please confirm that AVFoundation the way > to go? > > I’ve read that QTKit is deprecated but, oddly, I cannot find any mention of > deprecation here in the QTKit Programming Guide: > > https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/QTKitApplicationProgrammingGuide/ > > Thank you, > > Jerry > > > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > https://lists.apple.com/mailman/options/cocoa-dev/bdurbrow%40rattlesnakehillsoftworks.com > > This email sent to bdurb...@rattlesnakehillsoftworks.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Display USB Video Camera output : AVFoundation?
On Sep 9, 2015, at 21:22 , Jerry Krinock wrote: > > I’ve read that QTKit is deprecated but, oddly, I cannot find any mention of > deprecation here in the QTKit Programming Guide: The lack of a mention of deprecation isn’t so odd if you scroll to the bottom of the page and note that the last update was in 2009. It’s worth training yourself to check the update date before you believe anything you read in any of the programming guides. (And at the speed things change, I’d avoid believing any document that’s more than 2 or 3 years old. It’s getting to the point where the only trustworthy documents are those written in the future.) If you follow the links through to specific QTKit classes, you’ll see that absolutely everything was deprecated in 10.9, except for the QTMovieModernizer class, which was added in 10.9. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Display USB Video Camera output : AVFoundation?
On 10 Sep 2015, at 2:22 pm, Jerry Krinock wrote: > > In a Mac app, I need to display real-time video (as in “movies”) from a USB > camera on the screen. Have a look at the sample code AVRecorder. -- Shane Stanley ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Display USB Video Camera output : AVFoundation?
> On Sep 9, 2015, at 9:22 PM, Jerry Krinock wrote: > > In a Mac app, I need to display real-time video (as in “movies”) from a USB > camera on the screen. Can someone please confirm that AVFoundation the way > to go? I can confirm that it’s easy to use AVFoundation to display live video from the built-in webcam on a MacBook Pro. I would guess that it also works for other cameras recognized by the OS; the standard live-video view has a control to switch the input source. —Jens ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Display USB Video Camera output : AVFoundation?
In a Mac app, I need to display real-time video (as in “movies”) from a USB camera on the screen. Can someone please confirm that AVFoundation the way to go? I’ve read that QTKit is deprecated but, oddly, I cannot find any mention of deprecation here in the QTKit Programming Guide: https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/QTKitApplicationProgrammingGuide/ Thank you, Jerry ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com