Mailing Lists: Apple Mailing Lists

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

Playback Bug in QTVisualContextCopyImageForTime



I'm having quite a strange problem with QTVisualContextCopyImageForTime. When I play most movies, it only plays the first couple of frames. Repeated calls to this function do not return the current frame that is actually playing. Because I can hear the audio from the movie, I'm quite sure the whole movie is playing.

To make this even weirder, I do have a couple of movies that play fine. But most (320x240 Photo JPEG codec) do not. Both movies that play fine were DV movies exported to the 320x240 Photo JPEG format.

It is interesting to note that if I comment out the call to QTVisualContextTask described below -- then all movies play OK. But the memory usage indicator in "Activity Monitor" just grows and grows. Obviously not calling QTVisualContextTask causes a memory leak.

I've struggled to find out why this isn't working, but to no avail. I've outlined the steps I'm using to play the movie below. If anyone has any ideas, I'd be very eager to hear them.

Also, if someone at Apple thinks this is worth a bug report, I've created a small application that recreates the problem that they can examine.

Many Thanks in Advance,
Mark

----

Steps to recreate the problem in my Carbon/MachO application

Carbon/MachO application

0) call NSApplicationLoad to make nice with Cocoa

1) Create a Window for the Movie and Show it (so it is visible)

2) Create a QTVisualContextRef with an CGLContext context in preparation for opening the movie with NewMovieFromProperties. The pixel format properties are


kCGLPFAFullScreen, kCGLPFADisplayMask, CGDisplayIDToOpenGLDisplayMask(kCGDirectMainDisplay), kCGLPFANoRecovery, kCGLPFAAccelerated, kCGLPFADepthSize, (CGLPixelFormatAttribute) 32, 0

3) Create the movie using NewMovieFromProperties and the aforementioned QTVisualContextRef

4) Create an AGL OpenGL context for the window (I'm trying to integrate this into legacy code that uses AGL -- hopefully this doesn't matter to QT in the end.)

5) Create a CIContext for the AGL context, using the contextWithCGLContext class method. I'm using aglGetCGLContext and aglGetCGLPixelFormat to get the CGL form of the AGL context and pixel format before making this call.

6) Then, in an idle procedure, call

6a) MoviesTask
6a) QTVisualContextTask
6c) QTVisualContextIsNewImageAvailable, and if an image is available call
6d) QTVisualContextCopyImageForTime to get a new CVImageBufferRef
6e) Use initWithCVImageBuffer to create a CIImage from the CVImageBufferRef
6f) Then use the following code to prepare the AGL world

aglSetCurrentContext(aglContext)
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
glOrtho(0, 320, 0, 240, -1, 1);
glMatrixMode (GL_MODELVIEW);
glLoadIdentity();
glDisable(GL_BLEND);

and

[inContext drawImage:inImage inRect:dstRect fromRect:srcRect];

to draw the image.

Result: only two or three frames ever play, even though the audio playing in the movie tells me that it is actually playing the whole thing.


-- ===================================================================== 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.