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:
-
hapSampleBuffer
property -
codecSubType
property -
imgSize
property -
dxtData
property -
dxtMinDataSize
property -
dxtDataSize
property -
dxtPixelFormat
property -
dxtImgSize
property -
dxtTextureFormat
property -
userInfo
property
Properties
codecSubType
The codec subtype of the video data in this frame. Either kHapCodecSubType, kHapAlphaCodecSubType, or kHapYCoCgCodecSubType (defined in “HapCodecSubTypes.h”)
@property (readonly) OSType codecSubType
Declared In
HapDecoderFrame.h
dxtData
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 *dxtData
Declared In
HapDecoderFrame.h
dxtDataSize
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 dxtDataSize
Declared In
HapDecoderFrame.h
dxtImgSize
The size of the DXT frame, in pixels. This may be larger tha the “imgSize”.
@property (readonly) NSSize dxtImgSize
Declared In
HapDecoderFrame.h
dxtMinDataSize
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 dxtMinDataSize
Declared In
HapDecoderFrame.h
dxtPixelFormat
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 dxtPixelFormat
Declared In
HapDecoderFrame.h
dxtTextureFormat
The format of the GL texture, suitable for passing on to GL commands (
@property (assign, readwrite, setter=setDXTTextureFormat:) enum HapTextureFormat dxtTextureFormat
Declared In
HapDecoderFrame.h
hapSampleBuffer
The CMSampleBufferRef containing video data compressed using the Hap codec, returned from an AVSampleBufferGenerator
@property (readonly) CMSampleBufferRef hapSampleBuffer
Declared In
HapDecoderFrame.h
imgSize
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 imgSize
Declared In
HapDecoderFrame.h
userInfo
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 userInfo
Declared In
HapDecoderFrame.h
Instance 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)sb
Parameters
- sb
A CMSampleBufferRef containing video data compressed using the hap codec.
Declared In
HapDecoderFrame.h
initWithHapSampleBuffer:
Calls “initEmptyWithHapSampleBuffer:”, then allocates a CFDataRef and sets that as the empty frame’s “dxtData”.
- (id)initWithHapSampleBuffer:(CMSampleBufferRef)sb
Parameters
- sb
A CMSampleBufferRef containing video data compressed using the hap codec.
Declared In
HapDecoderFrame.h