diff --git a/src/flutter/shell/platform/embedder/embedder.h b/src/flutter/shell/platform/embedder/embedder.h index 6489edcf..6d1d95ee 100644 --- a/src/flutter/shell/platform/embedder/embedder.h +++ b/src/flutter/shell/platform/embedder/embedder.h @@ -447,6 +447,43 @@ typedef const void* FlutterMetalCommandQueueHandle; /// Alias for id. typedef const void* FlutterMetalTextureHandle; +/// Pixel format for the external texture. +typedef enum { + kYUVA, + kRGBA, +} FlutterMetalExternalTexturePixelFormat; + +typedef struct { + /// The size of this struct. Must be sizeof(FlutterMetalExternalTexture). + size_t struct_size; + /// Height of the texture. + size_t width; + /// Height of the texture. + size_t height; + /// The pixel format type of the external. + FlutterMetalExternalTexturePixelFormat pixel_format; + /// Represents the size of the `textures` array. + size_t num_textures; + /// Supported textures are YUVA and RGBA, in case of YUVA we expect 2 texture + /// handles to be provided by the embedder, Y first and UV next. In case of + /// RGBA only one should be passed. + /// These are individually aliases for id. These textures are + /// retained by the engine for the period of the composition. Once these + /// textures have been unregistered via the + /// `FlutterEngineUnregisterExternalTexture`, the embedder has to release + /// these textures. + FlutterMetalTextureHandle* textures; +} FlutterMetalExternalTexture; + +/// Callback to provide an external texture for a given texture_id. +/// See: external_texture_frame_callback. +typedef bool (*FlutterMetalTextureFrameCallback)( + void* /* user data */, + int64_t /* texture identifier */, + size_t /* width */, + size_t /* height */, + FlutterMetalExternalTexture* /* texture out */); + typedef struct { /// The size of this struct. Must be sizeof(FlutterMetalTexture). size_t struct_size; @@ -485,6 +522,11 @@ typedef struct { /// The callback presented to the embedder to present a fully populated metal /// texture to the user. FlutterMetalPresentCallback present_drawable_callback; + /// When the embedder specifies that a texture has a frame available, the + /// engine will call this method (on an internal engine managed thread) so + /// that external texture details can be supplied to the engine for subsequent + /// composition. + FlutterMetalTextureFrameCallback external_texture_frame_callback; } FlutterMetalRendererConfig; typedef struct {