Agora RTC Objective-C API Reference Refactor

Instance Methods
<AgoraVideoFilterDelegate> Protocol Reference

Inherits <NSObject>.

## Instance Methods
(void) | - startExtensionControl:
(int) | - stopVideoFilter
(void) | - getProcessMode:
(void) | - getVideoFormatWanted:pixelBufferFormat:
(void) | - setEnabled:
(BOOL) | - isEnabled
(NSInteger) | - setPropertyWithKey:value:
(NSInteger) | - getPropertyWithKey:value:
(AgoraVideoFilterProcessResult) | - pendVideoFrame:
(AgoraVideoFilterProcessResult) | - adaptVideoFrame:dstFrame:

## Detailed Description

The AgoraVideoFilterDelegate protocol. This protocol is the intermediate node for video, which contains both the video source and the video sink. It reads video frames from the underlying video pipeline and writes video frames back after adaptation.

## Method Documentation

## ◆ startExtensionControl:

- (void) startExtensionControl: |  | (id< AgoraVideoFilterControlDelegate > _Nullable) | control |

This function is invoked right before data stream starts. Custom filter can override this function for initialization.

## ◆ stopVideoFilter

- (int) stopVideoFilter |  |  |

This function is invoked right before data stream stops. Custom filter can override this function for deinitialization.

## ◆ getProcessMode:

- (void) getProcessMode: |  | (AgoraVideoFilterProcessMode *_Nullable) | mode |

Get Process Mode If getProcessMode:(AgoraVideoFilterProcessMode *)mode, mode is AgoraVideoFilterProcessModeSync you MUST implement adaptVideoFrame:dstFrame: else getProcessMode:(AgoraVideoFilterProcessMode *)mode mode is AgoraVideoFilterProcessModeAsync you MUST implement pendVideoFrame

Parameters

  mode | AgoraVideoFilterProcessMode, inout param

## ◆ getVideoFormatWanted:pixelBufferFormat:

- (void) getVideoFormatWanted: |  | (AgoraVideoFilterFrameType *_Nullable) | type
pixelBufferFormat: |  | (AgoraMemPixelBufferFormatType *_Nullable) | format

Get Video Format

Parameters

  type | AgoraVideoFilterFrameType, inout param
  format | AgoraMemPixelBufferFormatType, inout param

## ◆ setEnabled:

- (void) setEnabled: |  | (BOOL) | enabled |

Enables or disables the video filter.

Parameters

  enable | Whether to enable the video filter: `YES`: (Default) Enable the video filter. `NO`: Do not enable the video filter. If the filter is disabled, frames will be passed without adaption.

## ◆ isEnabled

- (BOOL) isEnabled |  |  |

Checks whether the video filter is enabled.

Returns
  - `YES`: The video filter is enabled.
  - `NO`: The video filter is not enabled.

## ◆ setPropertyWithKey:value:

- (NSInteger) setPropertyWithKey: |  | (NSString *_Nonnull) | key
value: |  | (NSData *_Nonnull) | value

Sets a private property in the `IVideoFilter` class.

Parameters

  key | The pointer to the property name.
  value | The pointer to the buffer of this private property.

Returns
  - The actual size of the private property, if the method call succeeds.
  - -1, if the method call fails.

## ◆ getPropertyWithKey:value:

- (NSInteger) getPropertyWithKey: |  | (NSString *_Nonnull) | key
value: |  | (NSData *_Nullable *_Nullable) | value

Gets a private property in the IVideoFilter class.

Parameters

  key | The pointer to the property name.
  (in/out) | value The pointer to the buffer of this private property.

Returns
  - The actual size of the private property, if the method call succeeds.
  - -1, if the method call fails.

## ◆ pendVideoFrame:

- (AgoraVideoFilterProcessResult) pendVideoFrame: |  | (AgoraVideoFilterFrame *_Nonnull) | cFrame |
| optional

Adapts the video frame.

Parameters

  srcFrame | The pointer to the captured video frame that you want to adapt.

Returns
  AgoraVideoFilterProcessResult

## ◆ adaptVideoFrame:dstFrame:

- (AgoraVideoFilterProcessResult) adaptVideoFrame: |  | (AgoraVideoFilterFrame *_Nonnull) | srcFrame
dstFrame: |  | (AgoraVideoFilterFrame *_Nullable *_Nullable) | dstFrame
| optional

Adapts the video frame.

Parameters

  srcFrame | The pointer to the captured video frame that you want to adapt.
  dstFrame | The in/out pointer to the adapted video frame.

Returns
  AgoraVideoFilterProcessResult