Re: Problem creating CVPixelBufferPool using CVPixelBufferPoolCreate
Re: Problem creating CVPixelBufferPool using CVPixelBufferPoolCreate
- Subject: Re: Problem creating CVPixelBufferPool using CVPixelBufferPoolCreate
- From: MacDeveloper <email@hidden>
- Date: Fri, 3 Aug 2007 16:39:48 +0530
Sorry for disturbing.
Got solution. Actually key and value are swapped.
Thank you,
Mac
On 03-Aug-07, at 4:09 PM, MacDeveloper wrote:
Hi all,
I am facing problem in creating CVPixelBufferPool using
CVPixelBufferPoolCreate.
If I use CFDictionary for attributes it fails. And success on using
NSDictionary.
Why these 2 are not equal.
1. using CFDictionary
//Create buffer pool
int pixelFormat = k32ARGBPixelFormat;
CFNumberRef pixelFormatNumber = CFNumberCreate
(kCFAllocatorDefault, kCFNumberIntType, &pixelFormat);
int width = 320;
CFNumberRef widthNumber = CFNumberCreate(kCFAllocatorDefault,
kCFNumberIntType, &width);
int height = 240;
CFNumberRef heightNumber = CFNumberCreate(kCFAllocatorDefault,
kCFNumberIntType, &height);
CFDictionaryKeyCallBacks keyCallBack =
kCFTypeDictionaryKeyCallBacks;
CFDictionaryValueCallBacks valueCallBack =
kCFTypeDictionaryValueCallBacks;
CFMutableDictionaryRef dictionaryRef = CFDictionaryCreateMutable
(kCFAllocatorDefault, 3, &keyCallBack, &valueCallBack);
CFDictionarySetValue(dictionaryRef, pixelFormatNumber,
kCVPixelBufferPixelFormatTypeKey);
CFDictionarySetValue(dictionaryRef, widthNumber,
kCVPixelBufferWidthKey);
CFDictionarySetValue(dictionaryRef, heightNumber,
kCVPixelBufferHeightKey);
CVPixelBufferPoolRef bufferPool;
CVReturn theError = CVPixelBufferPoolCreate(kCFAllocatorDefault,
NULL, (CFDictionaryRef)dictionaryRef, &bufferPool);
this returns error !
2. using NSDictionary
//Create buffer pool
NSMutableDictionary* attributes;
attributes = [NSMutableDictionary dictionary];
int pixelFormat = k32ARGBPixelFormat;
int width = 320;
int height = 240;
[attributes setObject:[NSNumber numberWithInt:k32ARGBPixelFormat]
forKey:(NSString*)kCVPixelBufferPixelFormatTypeKey];
[attributes setObject:[NSNumber numberWithInt:width] forKey:
(NSString*)kCVPixelBufferWidthKey];
[attributes setObject:[NSNumber numberWithInt:height] forKey:
(NSString*)kCVPixelBufferHeightKey];
CVPixelBufferPoolRef bufferPool;
CVReturn theError = CVPixelBufferPoolCreate(kCFAllocatorDefault,
NULL, (CFDictionaryRef) attributes, &bufferPool);
This returns success
Regards,
Mac
_______________________________________________
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