HapDecoderFrame Class Reference
| Inherits from | NSObject | 
| Declared in | HapDecoderFrame.h HapDecoderFrame.m | 
Overview
This object represents a frame, and holds all the values necessary to decode a hap frame from AVFoundation as a CMSampleBufferRef to DXT data. Instances of this class are not intended to be reusable: this is just a simple holder, the backend wants to release it as soon as possible.
Tasks
- 
	
		– initWithHapSampleBuffer:
- 
	
		– initEmptyWithHapSampleBuffer:
- 
	
		hapSampleBufferproperty
- 
	
		codecSubTypeproperty
- 
	
		imgSizeproperty
- 
	
		dxtDataproperty
- 
	
		dxtMinDataSizeproperty
- 
	
		dxtDataSizeproperty
- 
	
		dxtPixelFormatproperty
- 
	
		dxtImgSizeproperty
- 
	
		dxtTextureFormatproperty
- 
	
		userInfoproperty
Properties
codecSubType
The codec subtype of the video data in this frame. Either kHapCodecSubType, kHapAlphaCodecSubType, or kHapYCoCgCodecSubType (defined in “HapCodecSubTypes.h”)
@property (readonly) OSType codecSubTypeDeclared In
HapDecoderFrame.hdxtData
If you’re manually allocating HapDecoderFrame instances with a HapDecoderFrameAllocBlock, you must use this property to provide a pointer to the buffer of memory into which this framework can decode the hap frame into DXT data (this pointer must remain valid for the lifetime of the HapDecoderFrame instance). If you’re just retrieving HapDecoderFrame instances from an AVPlayerItemHapDXTOutput, you can use this property to get a ptr to the memory containing the DXT data, ready for upload to a GL texture.
@property (assign, readwrite, setter=setDXTData:) void *dxtDataDeclared In
HapDecoderFrame.hdxtDataSize
If you’re using a HapDecoderFrameAllocBlock, in addition to providing memory for the dxtData block, you must also tell the frame how much memory you’ve allocated.
@property (assign, readwrite, setter=setDXTDataSize:) size_t dxtDataSizeDeclared In
HapDecoderFrame.hdxtImgSize
The size of the DXT frame, in pixels. This may be larger tha the “imgSize”.
@property (readonly) NSSize dxtImgSizeDeclared In
HapDecoderFrame.hdxtMinDataSize
The minimum amount of memory required to contain a DXT-compressed image with dimensions of “imgSize”. If you’re using a HapDecoderFrameAllocBlock, the blocks of memory assigned to “dxtData” must be at least this large.
@property (readonly) size_t dxtMinDataSizeDeclared In
HapDecoderFrame.hdxtPixelFormat
The pixel format of the DXT frame, and is either ‘kHapCVPixelFormat_RGB_DXT1’ (if the video frame used the hap codec), ‘kHapCVPixelFormat_RGBA_DXT5’ (if it used the “hap alpha” codec), or ‘kHapCVPixelFormat_YCoCg_DXT5’ (if it used the “hap Q” codec). These values are defined in PixelFormats.h
@property (readonly) OSType dxtPixelFormatDeclared In
HapDecoderFrame.hdxtTextureFormat
The format of the GL texture, suitable for passing on to GL commands (
@property (assign, readwrite, setter=setDXTTextureFormat:) enum HapTextureFormat dxtTextureFormatDeclared In
HapDecoderFrame.hhapSampleBuffer
The CMSampleBufferRef containing video data compressed using the Hap codec, returned from an AVSampleBufferGenerator
@property (readonly) CMSampleBufferRef hapSampleBufferDeclared In
HapDecoderFrame.himgSize
The size of the image being returned. Note that the dimensions of the DXT buffer may be higher (multiple-of-4)- these are the dimensions of the final decoded image.
@property (readonly) NSSize imgSizeDeclared In
HapDecoderFrame.huserInfo
A nondescript, retained, (id) that you can use to retain an arbitrary object with this frame (it will be freed when the frame is deallocated). If you’re using a HapDecoderFrameAllocBlock to allocate memory for frames created by an AVPlayerItemHapDXTOutput and you want to retain a resource with the decoded frame, this is a good way to do it.
@property (retain, readwrite) id userInfoDeclared In
HapDecoderFrame.hInstance Methods
initEmptyWithHapSampleBuffer:
Returns an “empty” decoder frame- all the fields except “dxtData” and “dxtDataSize” are populated. You MUST populate the dxtData and dxtDataSize fields before you can return (or decode) the frame! “dxtMinDataSize” and the other fields are valid as soon as this returns, so you can query the properties of the frame and allocate memory of the appropriate length.
- (id)initEmptyWithHapSampleBuffer:(CMSampleBufferRef)sbParameters
- sb
- A CMSampleBufferRef containing video data compressed using the hap codec. 
Declared In
HapDecoderFrame.hinitWithHapSampleBuffer:
Calls “initEmptyWithHapSampleBuffer:”, then allocates a CFDataRef and sets that as the empty frame’s “dxtData”.
- (id)initWithHapSampleBuffer:(CMSampleBufferRef)sbParameters
- sb
- A CMSampleBufferRef containing video data compressed using the hap codec. 
Declared In
HapDecoderFrame.h