3

这是 Flutter 插件代码的一部分,该插件使用 Flutter 纹理通过 OpenGL 渲染某些东西

private FlutterVideoPlugin(Registrar registrar, MethodChannel channel) {
    this.registrar = registrar;
    this.channel = channel;
    this.textures = registrar.textures();
}

@Override
public void onMethodCall(MethodCall call, Result notSafeResult) {
    final AnyThreadResult result = new AnyThreadResult(notSafeResult);
    if (call.method.equals("createVideoRenderer")) {
        TextureRegistry.SurfaceTextureEntry entry = textures.createSurfaceTexture();
        //do anything with the texture

如您所见,它使用了 Flutter 方法调用。

是否可以在 C++ 中使用 FFI 做同样的事情?我不想依赖onMethodCall,它必须是 FFI 或 Flutter 方法调用,因为我认为 FFI 以不同的方式做所有事情,就像那样。

但是,由于 Flutter 引擎,特别是 Texture 部分是用 Java 编写的,看起来我需要一些 Java 代码。问题是 FFI 和 java 不能混用。看起来我要么必须使用onMethodCall我的应用程序中的所有内容,要么使用 FFI,但 FFI 似乎不支持获取纹理

4

0 回答 0