Hap is a video codec for fast decompression on modern graphics hardware. This is the home of the HapInAVFoundation framework. For general information about Hap, see the Hap project.
The HapInAVFoundation framework supports encoding and decoding Hap video. Unlike the QuickTime codec, the HapInAVFoundation framework will only decode to S3TC/DXT frames suitable for upload to graphics hardware at this time. If requested, decoding to RGB(A) pixel formats can be added. Encoding RGB(A) frames is supported. For the most part, this is a port of the hap quicktime codec.
Sample code for a test application ("HapInAVF Test App") that demonstrates the use of this framework for accelerated playback is included.
A compiled version of the framework can be downloaded from the Releases page.
Requires at minimum MacOS 10.10 Yosemite.
The general idea is to either download or compile the framework, add the framework to your XCode project so you may link against it, and then set up a build phase to copy the framework into your application bundle. This is fairly important: most of the time when you link against a framework, the framework is expected to be installed on your OS. HapInAVFoundation is different: your application will include a compiled copy of the framework. Here's the exact procedure:
- Unzip the framework, add it to your source tree, and then drag the framework into your xcode project file's workspace.
- Locate the "Build Phases" section for your project/application's target.
- Add the HapInAVFoundation framework to the "Link Binary with Libraries" section.
- Create a new "Copy Files" build phase, set its destination to the "Frameworks" folder, and add the HapInAVFoundation framework to this build phase- the goal is to copy the framework you need into the "Frameworks" folder inside your app package.
- Switch to the "Build Settings" section of your project's target, locate the "Runpath Search Paths" settings, and make sure that the following paths exist: "@loader_path/../Frameworks" and "@executable_path/../Frameworks".
- In XCode, close the HapInAVFoundation project (if it is open), and then open your project.
- In the Finder, drag "HapInAVFoundation.xcodeproj" into your project's workspace.
- Switch back to XCode, and locate the "Build Phases" section for your project/application's target.
- Add a dependency for the "HapInAVFoundation" framework. This will ensure that the framework gets compiled before your project, so there won't be any missing dependencies.
- Add the HapInAVFoundation framework to the "Link Binary with Libraries" section.
- Create a new "Copy Files" build phase, set its destination to the "Frameworks" folder, and add the HapInAVFoundation framework to this build phase- the goal is to copy the framework you need into the "Frameworks" folder inside your app package.
- Switch to the "Build Settings" section of your project's target, locate the "Runpath Search Paths" settings, and make sure that the following paths exist: "@loader_path/../Frameworks" and "@executable_path/../Frameworks".
- That's it- you're done now. You can import/include objects from the framework in your source just as you normally would.
Documentation for this framework can be found here. The header files are also commented extensively, and the included sample application demonstrates the use of the framework to play back Hap video to GL textures.
The Hap codec project is open-source, licensed under a FreeBSD License, meaning you can use it in your commercial or non-commercial applications free of charge. The hap project was originally written by Tom Butterworth and commissioned by VIDVOX, 2012.