QCRenderer method createSnapshotImageOfType: returning nil
QCRenderer method createSnapshotImageOfType: returning nil
- Subject: QCRenderer method createSnapshotImageOfType: returning nil
- From: Anshul jain <email@hidden>
- Date: Mon, 2 Feb 2009 11:26:09 +0530
I am trying to Play a composition in a OPenGL layer. I have read in
Documentation that we can do that using QCRenderer. Here is my
initialization code
- (CGLContextObj)copyCGLContextForPixelFormat:
(CGLPixelFormatObj)pixelFormat
{
CGLContextObj object = [super
copyCGLContextForPixelFormat:pixelFormat];
NSString *path = [[NSBundle mainBundle] pathForResource:@"Blob"
ofType:@"qtz"];
QCComposition *aComposition = [QCComposition compositionWithFile:path];
CGColorSpaceRef colorRef =
CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB);
qcRenderer = [[QCRenderer alloc] initWithCGLContext:object
pixelFormat:pixelFormat colorSpace:colorRef composition:aComposition];
_startTime = -1.0;
return object;
}
i render it using this code
- (BOOL)canDrawInCGLContext:(CGLContextObj)glContext pixelFormat:
(CGLPixelFormatObj)pixelFormat forLayerTime:
(CFTimeInterval)timeInterval displayTime:(const CVTimeStamp *)timeStamp
{
BOOL success = [self renderAtTime:timeStamp];
if (texture)
CVOpenGLBufferRelease(texture);
texture = [qcRenderer createSnapshotImageOfType:@"CVOpenGLBuffer"];
if (success) {
if (texture)
return YES;
}
return NO;
}
- (BOOL) renderAtTime:(const CVTimeStamp*)time
{
NSTimeInterval videoTime,
localTime;
id image;
if (time) {
if(time->flags & kCVTimeStampVideoTimeValid)
videoTime = (NSTimeInterval)time->videoTime / (NSTimeInterval)time-
>videoTimeScale;
else
videoTime = 0; //Not sure what the best thing to do is
if(_startTime < 0) {
_startTime = videoTime;
localTime = 0;
}
else
localTime = videoTime - _startTime;
return [qcRenderer renderAtTime:localTime arguments:nil];
}
return NO;
}
Can any one tell what can be the reason for the QCRenderer to reurn NIL.
Thanks!
Anshul
_______________________________________________
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