
public interface ITXCustomBeautyProcesserFactory {/*** Create an instance* @return*/ITXCustomBeautyProcesser createCustomBeautyProcesser();/*** Terminate an instance (this API must be called in the OpenGL thread)*/void destroyCustomBeautyProcesser();}public interface ITXCustomBeautyProcesser {// Get the pixel formats supported for video frames. Tencent Effect supports OpenGL 2D textures.TXCustomBeautyPixelFormat getSupportedPixelFormat();// Get the container formats supported for video frames. Tencent Effect supports V2TXLiveBufferTypeTexture, which delivers the best performance and has the smallest impact on video quality.TXCustomBeautyBufferType getSupportedBufferType();// Call this API in the OpenGL thread (`srcFrame` must include RGBA textures and the width and height). After processing, the texture object will be included in `texture.textureId` of `dstFrame`.void onProcessVideoFrame(TXCustomBeautyVideoFrame srcFrame, TXCustomBeautyVideoFrame dstFrame);}
com.tencent.effect.tencent_effect_flutter.XmagicProcesserFactory, the implementation class of ITXCustomBeautyProcesserFactory with TRTC (at the native side).
Flutter layer, provide Future<V2TXLiveCode> enableCustomVideoProcess(bool enable), which is used to enable or disable custom effects.

///implementation 'com.tencent.liteav:custom-video-processor:latest.release'
@objc public protocol ITXCustomBeautyProcesserFactory {/// Create a beauty effect instancefunc createCustomBeautyProcesser() -> ITXCustomBeautyProcesser/// Terminate a beauty effect instancefunc destroyCustomBeautyProcesser()}@objc public protocol ITXCustomBeautyProcesser {/// Get third-party beauty feature PixelFormatfunc getSupportedPixelFormat() -> ITXCustomBeautyPixelFormat/// Get third-party beauty feature BufferTypefunc getSupportedBufferType() -> ITXCustomBeautyBufferType/// Callback for NativeSDK video custom processing/// - Returns: Returns the video frame object processed by the third-party beauty feature SDKfunc onProcessVideoFrame(srcFrame: ITXCustomBeautyVideoFrame, dstFrame: ITXCustomBeautyVideoFrame) -> ITXCustomBeautyVideoFrame}
com.tencent.effect.tencent_effect_flutter.XmagicProcesserFactory of the beauty effect ITXCustomBeautyProcesserFactory API needs to be registered into TRTC (perform on the native end).
Flutter layer, the Future<V2TXLiveCode> enableCustomVideoProcess(bool enable) API is provided to enable or disable the custom beauty interface./// Enable/disable custom video processing.@objcfunc enableCustomVideoProcess(call: FlutterMethodCall, result: @escaping FlutterResult) {let key = "enable"guard let enable = MethodUtils.getMethodParams(call: call, key: key, resultType: NSNumber.self)?.boolValue else {FlutterResultUtils.handleMethod(code: .paramNotFound, methodName: call.method, paramKey: key, result: result)return}guard let customBeautyInstance = TXLivePluginManager.getBeautyInstance() else {FlutterResultUtils.handleMethod(code: .valueIsNull, methodName: call.method, paramKey: key, result: result)return}customBeautyQueue.async { [weak self] inguard let `self` = self else {FlutterResultUtils.handleMethod(code: .valueIsNull, methodName: call.method, paramKey: key, result: result)return}if (enable && self.beautyInstance == nil) {self.beautyInstance = customBeautyInstance.createCustomBeautyProcesser()}guard let beautyInstance = self.beautyInstance else {FlutterResultUtils.handleMethod(code: .valueIsNull, methodName: call.method, paramKey: key, result: result)return}let pixelFormat = beautyInstance.getSupportedPixelFormat()let bufferType = beautyInstance.getSupportedBufferType()let v2PixelFormat = ConvertBeautyFrame.convertToV2LivePixelFormat(beautyPixelFormat: pixelFormat)let v2BufferType = ConvertBeautyFrame.convertToV2LiveBufferType(beautyBufferType: bufferType)let code = self.pusher.enableCustomVideoProcess(enable,pixelFormat:v2PixelFormat,bufferType:v2BufferType)DispatchQueue.main.async {result(NSNumber(value: code.rawValue))}}}
public static func convertToV2LivePixelFormat(beautyPixelFormat: ITXCustomBeautyPixelFormat) -> V2TXLivePixelFormat {switch beautyPixelFormat {case .Unknown:return .unknowncase .I420:return .I420case .Texture2D:return .texture2Dcase .BGRA:return .BGRA32case .NV12:return .NV12}}public static func convertToV2LiveBufferType(beautyBufferType: ITXCustomBeautyBufferType) -> V2TXLiveBufferType {switch beautyBufferType {case .Unknown:return .unknowncase .PixelBuffer:return .pixelBuffercase .Data:return .nsDatacase .Texture:return .texture}}
///s.dependency 'TXCustomBeautyProcesserPlugin','1.0.2'
Feedback