• 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
CoreVideo Display Link Callback function
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CoreVideo Display Link Callback function


  • Subject: CoreVideo Display Link Callback function
  • From: "San Saeteurn" <email@hidden>
  • Date: Fri, 19 Jan 2007 13:44:57 -0800

Hi,

I am trying to build an OpenGL Texture image using CoreVideo. I initialize the Display Link Thread as Follows:

   //Initializing the Display Link and Display Link Callback
   CVReturn            error = kCVReturnSuccess;
   CGDirectDisplayID   displayID = CGMainDisplayID();

   error = CVDisplayLinkCreateWithDisplay(displayID, &displayLink);
   if(error)
   {
       NSLog(@"DisplayLink created with error:%d", error);
       displayLink = NULL;
       return;
   }

error = CVDisplayLinkSetOutputCallback(displayLink, (CVDisplayLinkOutputCallback)myCVDisplayLinkDisplayCallback, self);
if(error)
{
NSLog(@"Setting Output Callback error:%d", error);
displayLink = NULL;
return;
}


   error = CVDisplayLinkStart(displayLink);
   if(error)
   {
       NSLog(@"Starting display link thread error: %d", error);
       return;
   }

This occurs in the wakeup function of one of my OpenGL Object Classes.
The callback in implemented as follows:

//Callback Funtions
//The Output Callback Funtion
CVReturn myCVDisplayLinkDisplayCallback(CVDisplayLinkRef displayLink,
const CVTimeStamp *syncTimeStamp, CVOptionFlags flagsIn,
void *displayLinkContext)
{
if(displayLinkContext == NULL)
NSLog(@"The Passed in Display Link Context is NULL: %@", displayLinkContext);
return [(GLObjectMovie *)displayLinkContext displayFrame:syncTimeStamp];
}


The function - (void)displayFrame:(const CVTimeStamp *)timeStamp.

The problem:
The parameter in the callback function "void *displayLinkContext" is NULL.
How do I set it to be the active instance of GLObject? In the initialization of the thread:


error = CVDisplayLinkSetOutputCallback(displayLink, (CVDisplayLinkOutputCallback)myCVDisplayLinkDisplayCallback, self);
if(error)
{
NSLog(@"Setting Output Callback error:%d", error);
displayLink = NULL;
return;
}


I set the last parameter (void *userData), I set self (meaning the current active GLObjectMovie instance). This is called from inside the class instance itself so it isn't NULL.

Any ideas?

-San Saeteurn

_________________________________________________________________
The MSN Entertainment Guide to Golden Globes is here. Get all the scoop. http://tv.msn.com/tv/globes2007/?icid=nctagline2


_______________________________________________

Cocoa-dev mailing list (email@hidden)

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


  • Prev by Date: Re: Getting image info without loading entire image
  • Next by Date: Relationship between -isEqual and -hash
  • Previous by thread: Re: notification on screensaver unlock ?
  • Next by thread: Relationship between -isEqual and -hash
  • Index(es):
    • Date
    • Thread