@@ -447,6 +447,43 @@ typedef const void* FlutterMetalCommandQueueHandle;
447447/// Alias for id<MTLTexture>.
448448typedef const void * FlutterMetalTextureHandle ;
449449
450+ /// Pixel format for the external texture.
451+ typedef enum {
452+ kYUVA ,
453+ kRGBA ,
454+ } FlutterMetalExternalTexturePixelFormat ;
455+
456+ typedef struct {
457+ /// The size of this struct. Must be sizeof(FlutterMetalExternalTexture).
458+ size_t struct_size ;
459+ /// Height of the texture.
460+ size_t width ;
461+ /// Height of the texture.
462+ size_t height ;
463+ /// The pixel format type of the external.
464+ FlutterMetalExternalTexturePixelFormat pixel_format ;
465+ /// Represents the size of the `textures` array.
466+ size_t num_textures ;
467+ /// Supported textures are YUVA and RGBA, in case of YUVA we expect 2 texture
468+ /// handles to be provided by the embedder, Y first and UV next. In case of
469+ /// RGBA only one should be passed.
470+ /// These are individually aliases for id<MTLTexture>. These textures are
471+ /// retained by the engine for the period of the composition. Once these
472+ /// textures have been unregistered via the
473+ /// `FlutterEngineUnregisterExternalTexture`, the embedder has to release
474+ /// these textures.
475+ FlutterMetalTextureHandle * textures ;
476+ } FlutterMetalExternalTexture ;
477+
478+ /// Callback to provide an external texture for a given texture_id.
479+ /// See: external_texture_frame_callback.
480+ typedef bool (* FlutterMetalTextureFrameCallback )(
481+ void * /* user data */ ,
482+ int64_t /* texture identifier */ ,
483+ size_t /* width */ ,
484+ size_t /* height */ ,
485+ FlutterMetalExternalTexture * /* texture out */ );
486+
450487typedef struct {
451488 /// The size of this struct. Must be sizeof(FlutterMetalTexture).
452489 size_t struct_size ;
@@ -485,6 +522,11 @@ typedef struct {
485522 /// The callback presented to the embedder to present a fully populated metal
486523 /// texture to the user.
487524 FlutterMetalPresentCallback present_drawable_callback ;
525+ /// When the embedder specifies that a texture has a frame available, the
526+ /// engine will call this method (on an internal engine managed thread) so
527+ /// that external texture details can be supplied to the engine for subsequent
528+ /// composition.
529+ FlutterMetalTextureFrameCallback external_texture_frame_callback ;
488530} FlutterMetalRendererConfig ;
489531
490532typedef struct {
0 commit comments