Flutter OpenGL 환경은 네이티브 환경과 격리되어 있으므로 Tencent Effect SDK를 Flutter에 직접 통합할 수 없습니다. 네이티브 측에서 이들 사이에 연결을 설정해야 합니다.
Tencent Effect 측에서 정의한 API:
public interface ITXCustomBeautyProcesserFactory {
/**
* 뷰티필터 인스턴스 생성
* @return
*/
ITXCustomBeautyProcesser createCustomBeautyProcesser();
/**
* 뷰티필터 인스턴스 종료(이 API는 OpenGL 스레드에서 호출되어야 함)
*/
void destroyCustomBeautyProcesser();
}
public interface ITXCustomBeautyProcesser {
//비디오 프레임에 지원되는 픽셀 형식을 가져옵니다. Tencent Effect는 OpenGL 2D 텍스처를 지원합니다.
TXCustomBeautyPixelFormat getSupportedPixelFormat();
//비디오 프레임에 지원되는 컨테이너 형식을 가져옵니다. Tencent Effect는 최고의 성능을 제공하고 비디오 품질에 미치는 영향이 가장 적은 V2TXLiveBufferTypeTexture를 지원합니다.
TXCustomBeautyBufferType getSupportedBufferType();
//OpenGL 스레드에서 이 API를 호출합니다(srcFrame은 RGBA 텍스처와 width 및 height를 포함해야 함). 처리 후 텍스처 객체는 dstFrame의 texture.textureId에 포함됩니다.
void onProcessVideoFrame(TXCustomBeautyVideoFrame srcFrame, TXCustomBeautyVideoFrame dstFrame);
}
Flutter
레이어에서 사용자 지정 효과를 활성화 또는 비활성화하는 데 사용되는 Future<v2txlivecode> enableCustomVideoProcess(bool enable)
를 제공합니다.Tencent Effect에서 제공하는 추상화 레이어 의존성
///
implementation 'com.tencent.liteav:custom-video-processor:latest.release'
문제 해결에 도움이 되었나요?