Hap QuickTime Playback Demo
A demonstration of GPU-accelerated playback of Hap movies using the QuickTime codec.
Hap is a video codec for fast decompression on modern graphics hardware. For general information about Hap, see the Hap project.
Accelerated playback of Hap involves passing S3TC frames to graphics hardware using OpenGL. The Hap codec will emit S3TC frames when an application indicates it can handle them. This is done using the usual QuickTime playback mechanisms and if you are already using QuickTime the code overhead to support Hap is fairly low.
The Hap QuickTime codec must be installed.
The steps are
- Open a movie and examine its video track to confirm it is Hap
- Create a QTPixelBufferContext for playback using a list of custom pixel-format type constants
- Play the movie
- When you receive a frame, perform compressed texture upload using OpenGL
- If the movie is encoded with Hap Q, use a shader when you draw the texture
This example includes reusable code to aid the process. Steps 1. and 2. utilise
Steps 4. and 5. utilise
HapPixelBufferTexture.h HapPixelBufferTexture.m ScaledCoCgYToRGBA.vert ScaledCoCgYToRGBA.frag
This code is open-source, licensed under a Free BSD License, meaning you can use it in your commercial or non-commercial applications free of charge.