【发布时间】:2011-11-19 04:39:44
【问题描述】:
我正在将我的电影播放器迁移到 64 位。
目前它可以同时使用 QuickTime API 和 FFmpeg 解码电影。
为了使用 QuickTime API 进行解码,我创建了一个 QTOpenGLTextureContext,提供了一个 QTVisualContextRef,然后我使用 QTVisualContextCopyImageForTime 获得了一个 CVOpenGLTextureRef 类型的解码帧。
现在我想让我的应用程序为 64 位,因此我不能再使用 QuickTime API,因为这些函数不是 64 位的。
所以我传递给 QTKit 并开始使用方法 frameImageAtTime:withAttributes:error: 解码帧,该方法提供各种图像格式的解码帧。目前我让它返回一个CVOpenGLTextureRef,以便使用我的显示例程的所有实际结构。
该方法确实有效,我可以摆脱32位QTVisualContextRef。
问题是这种方法非常慢!!它无法实时播放 Apple h264 电影预告片。输出CVOpenGLTextureRef需要的时间是旧方法的4倍!
我尝试了frameImageAtTime:withAttributes:error: 可以在输出中处理的所有其他图像类型,但没有成功..有时甚至更慢..
给定的属性是:
[_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];
QuickTime API 的真正替代品是 64 位?有吗?
我无法更改媒体播放器的主要结构,所以我必须获得CVOpenGLTextureRef或CVPixelBufferRef或CIImage*
希望你能帮帮我!
【问题讨论】:
-
我知道我可以使用 AVFoundation,但该框架仅在 Lion 中可用,我希望我的应用即使与 Snow Leopard 也兼容
标签: 64-bit quicktime playback qtkit core-video