Agora RTC Objective-C API Reference  Refactor
Instance Methods | Properties
AgoraVideoFrame Class Reference

Inherits <NSObject>.

Instance Methods

(void) - fillAlphaData
 

Properties

NSInteger format
 
CMTime time
 
int stride
 
int strideInPixels
 
int height
 
CVPixelBufferRef _Nullable textureBuf
 
IMAGE_CLASS *_Nullable image
 
NSData *_Nullable dataBuf
 
NSData *_Nullable metadataBuffer
 
int metadataSize
 
NSData *_Nullable alphaBuf
 
AgoraAlphaStitchMode alphaStitchMode
 
int cropLeft
 
int cropTop
 
int cropRight
 
int cropBottom
 
int rotation
 
AgoraColorSpace *_Nullable colorSpace
 

Method Documentation

◆ fillAlphaData

- (void) fillAlphaData

If data format is BGRA or RGBA and alphaBuf is nill, it is required to call fillAlphaData to fill alphaBuf.

Property Documentation

◆ format

- (NSInteger) format
readwritenonatomicassign

The format of the incoming video frame. This parameter must be specified as one of the following values:

  • 1: I420
  • 2: BGRA
  • 3: NV21
  • 4: RGBA
  • 5: IMC2
  • 7: ARGB
  • 8: NV12
  • 12: iOS texture (CVPixelBufferRef)
  • 16: I422

◆ time

- (CMTime) time
readwritenonatomicassign

Timestamp (ms) of the incoming video frame. An incorrect timestamp results in frame loss or unsynchronized audio and video.

◆ stride

- (int) stride
readwritenonatomicassign

The line span of the frame, that is, the number of pixels between two adjacent lines of video frames.

Note
  • The unit of this parameter is pixels, not bytes.
  • If the video is in Texture format, set this parameter to the width of Texture.
  • If the video frame format is set to 12, do not use this field.
  • When dealing with video data, it is necessary to process the offset between each line of pixel data based on this parameter, otherwise it may result in image distortion.
Deprecated:
Use strideInPixels instead.

◆ strideInPixels

- (int) strideInPixels
readwritenonatomicassign

Line spacing of the incoming video frame, which must be in pixels instead of bytes. For textures, it is the width of the texture.

◆ height

- (int) height
readwritenonatomicassign

Height of the incoming video frame.

◆ textureBuf

- (CVPixelBufferRef _Nullable) textureBuf
readwritenonatomicassign

Buffer of iOS texture.

◆ image

- (IMAGE_CLASS* _Nullable) image
readwritenonatomicstrong

Still Image (UIImage for iPhone, NSImage for Mac)

◆ dataBuf

- (NSData* _Nullable) dataBuf
readwritenonatomicstrong

Raw data buffer. This parameter does not apply to iOS textures.

◆ metadataBuffer

- (NSData* _Nullable) metadataBuffer
readwritenonatomicstrong

User specified metadata carried with the video frame. The default value is nil.

@technical preview

The SDK reads at most metadataSize bytes from this buffer. The default maximum metadata size is 1024 bytes. If the input size exceeds the current metadata limit, the SDK truncates the payload to the effective limit.

◆ metadataSize

- (int) metadataSize
readwritenonatomicassign

The metadata size in bytes. The default value is 0.

@technical preview

The default maximum metadata size is 1024 bytes.

◆ alphaBuf

- (NSData* _Nullable) alphaBuf
readwritenonatomicstrong

Indicates the alpha channel of current frame, which is consistent with the dimension of the video frame. The value range of each pixel is [0,255], where 0 represents the background; 255 represents the foreground. The default value is nill.

◆ alphaStitchMode

- (AgoraAlphaStitchMode) alphaStitchMode
readwritenonatomicassign

When the video frame contains alpha channel data, it represents the relative position of alphaBuffer and the video frame. See AgoraAlphaStitchMode.

◆ cropLeft

- (int) cropLeft
readwritenonatomicassign

Raw data related parameter. The number of pixels trimmed from the left. The default value is 0.

◆ cropTop

- (int) cropTop
readwritenonatomicassign

Raw data related parameter. The number of pixels trimmed from the top. The default value is 0.

◆ cropRight

- (int) cropRight
readwritenonatomicassign

Raw data related parameter. The number of pixels trimmed from the right. The default value is 0.

◆ cropBottom

- (int) cropBottom
readwritenonatomicassign

Raw data related parameter. The number of pixels trimmed from the bottom. The default value is 0.

◆ rotation

- (int) rotation
readwritenonatomicassign

Raw data related parameter. The clockwise rotation of the video frame. You can set the rotation angle as 0, 90, 180, or 270. The default value is 0.

◆ colorSpace

- (AgoraColorSpace* _Nullable) colorSpace
readwritenonatomicstrong

By default, the color space properties of video frames will apply the Full Range and BT.709 standard configurations.