Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[REPOST] Sample Code for QTPixelBufferContextCreate



Posted this before but didn't get any help. If someone out there knows how to do this, I'd really appreciate hearing from you.

Best Wishes,
Mark

---

Is there any sample code available that illustrates the usage of QTPixelBufferContextCreate and NewMovieFromProperties? I couldn't find any on the Apple site, and the documentation is a bit sparse.

Specifically, I'm trying to create an ARGB bitmap. I'm using the following code to create the context:

---------->

OSType pixelType = k32ARGBPixelFormat;
cfNumPixelType = ::CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &pixelType);
ThrowIfNil_(cfNumPixelType);


pixBufDict = ::CFDictionaryCreateMutable(kCFAllocatorDefault, 1, NULL, NULL);
ThrowIfNil_(pixBufDict);

::CFDictionaryAddValue(pixBufDict, kCVPixelBufferPixelFormatTypeKey, cfNumPixelType );

err = ::QTPixelBufferContextCreate(kCFAllocatorDefault, pixBufDict, &context);
ThrowIfOSErr_(err);

<----------

And then the next snippet to create the movie:

---------->
Boolean active = false;

QTNewMoviePropertyElement params[] =
{
{ kQTPropertyClass_DataLocation, kQTDataLocationPropertyID_CFURL, sizeof(CFURLRef), &cfURLRef, noErr },
{ kQTPropertyClass_NewMovieProperty, kQTNewMoviePropertyID_Active, sizeof(Boolean), &active, noErr },
{ kQTPropertyClass_Context, kQTContextPropertyID_VisualContext, sizeof(QTVisualContextRef), &context, noErr }
};


SInt32 bytes = sizeof(params);
SInt32 divisor = sizeof(QTNewMoviePropertyElement);
SInt32 inPropCount = bytes / divisor;

err = ::NewMovieFromProperties(inPropCount, params, 0, NULL, outMovie);
ThrowIfOSErr_(err);

<----------

Does this look correct?

Thanks in advance,
Mark

--

--
=====================================================================
Mark Coniglio, Artistic Co-Director | email@hidden
Troika Ranch Dance Theater          | http://www.troikaranch.org
=====================================================================
_______________________________________________
Do not post admin requests to the list. They will be ignored.
QuickTime-API mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quicktime-api/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.