• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
-[CALayer setContents: cvPixelBufferRef ] ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

-[CALayer setContents: cvPixelBufferRef ] ?


  • Subject: -[CALayer setContents: cvPixelBufferRef ] ?
  • From: "Jonathan del Strother" <email@hidden>
  • Date: Thu, 3 Apr 2008 19:34:29 +0100

I have a CVPixelBufferRef, with a 2vuy pixel format.  I'd like to
display it in a CALayer.

CALayer says that 'contents' is "typically a CGImageRef, but may be
something else".  I (optimistically) tried assigning the
CVPixelBufferRef directly to the contents, but apparently that's not
included in the mysterious 'something else' list.

The only way I've found of going from CVPixelBufferRef to CGImageRef
is via CIImage, something like the following :

CVImageBufferRef cvImage = some_2vuy_CVPixelBufferRef_image_source;
CGContextRef cgContext = [[NSGraphicsContext currentContext] graphicsPort];
CIContext* drawingContext = [CIContext contextWithCGContext:cgContext
options:nil];
CIImage* ciImage = [CIImage imageWithCVImageBuffer:cvImage];
CGImageRef cgImage = [drawingContext createCGImage:ciImage
fromRect:CVImageBufferGetCleanRect(cvImage)];


- which kinda works, but seems slow (and somewhere along the line, I'm
leaking memory like crazy.  Memory that doesn't show up in
MallocDebug, which is odd...)


The fastest way I've got so far is to create a Quartz Composition with
an Image input port, create a QCCompositionLayer, and assign the
CVPixelBufferRef directly to the input port.  That seems somewhat
contorted - is there a more obvious way?

Cheers,
Jon
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: -[CALayer setContents: cvPixelBufferRef ] ?
      • From: David Duncan <email@hidden>
  • Prev by Date: Re: Objective-C Instance Variable Names
  • Next by Date: NSPopupButton Cell in NSTableView
  • Previous by thread: Re: Need Mac Developers
  • Next by thread: Re: -[CALayer setContents: cvPixelBufferRef ] ?
  • Index(es):
    • Date
    • Thread