I'm migrating my movie player to 64-bit.
At present it is capable of decoding movies with both QuickTime API and FFmpeg.
To decode with QuickTime API I create a QTOpenGLTextureContext
providing a QTVisualContextRef
and then I obtain a decoded frame of type CVOpenGLTextureRef
using QTVisualContextCopyImageForTime
.
Now I want to make my app 64-bit and therefore I can't use QuickTime API anymore because this functions aren't 64-bit.
So I passed to QTKit and I started to decode frames using the method frameImageAtTime:withAttributes:error:
which gives a decoded frame in various image format. At present I made it to return a CVOpenGLTextureRef
in order to use all the actual structure of my display routine.
The method actually works and I can get rid of the 32-bit QTVisualContextRef
.
The problem is that this method is tremendously SLOW!! It's not able to make a realtime playback of an Apple h264 movie trailer. It requires 4 times the time required by the old method to output the CVOpenGLTextureRef
!
I tried all of the other image type that frameImageAtTime:withAttributes:error:
can handle in output, without success..it's even slower sometimes..
The given attributes are:
[_imageAttr setObject:QTMovieFrameImageTypeCVOpenGLTextureRef forKey:QTMovieFrameImageType];
[_imageAttr setObject:[NSValue valueWithPointer:[openGLContext CGLContextObj]] forKey:QTMovieFrameImageOpenGLContext];
[_imageAttr setObject:[NSValue valueWithPointer:[openGLPixelFormat CGLPixelFormatObj]] forKey:QTMovieFrameImagePixelFormat];
[_imageAttr setObject:[NSNumber numberWithBool:YES] forKey:QTMovieFrameImageSessionMode];
[_imageAttr setObject:[NSNumber numberWithBool:YES] forKey:QTMovieFrameImageHighQuality];
[_imageAttr setObject:[NSNumber numberWithBool:YES] forKey:QTMovieFrameImageDeinterlaceFields];
Which is the real replacement for the QuickTime API is 64-bit? Is there any?
I can't change the main structure of the media player so I must obtain a CVOpenGLTextureRef
or CVPixelBufferRef
or CIImage*
I hope you can help me!
The replacement of QuickTime is AVFoundation. It may not contain all you need at the moment, but this is the future.