Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions shell/platform/darwin/common/framework/Headers/FlutterTexture.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@
NS_ASSUME_NONNULL_BEGIN

FLUTTER_EXPORT
/**
* Represents a texture that can be shared with Flutter.
*
* See also: https://github.com/flutter/plugins/tree/master/packages/camera
*/
@protocol FlutterTexture <NSObject>
/** Copy the contents of the texture into a `CVPixelBuffer`. */
- (CVPixelBufferRef _Nullable)copyPixelBuffer;

/**
Expand All @@ -26,9 +32,26 @@ FLUTTER_EXPORT
@end

FLUTTER_EXPORT
/**
* A collection of registered `FlutterTexture`'s.
*/
@protocol FlutterTextureRegistry <NSObject>
/**
* Registers a `FlutterTexture` for usage in Flutter and returns an id that can be used to reference
* that texture when calling into Flutter with channels.
*/
- (int64_t)registerTexture:(NSObject<FlutterTexture>*)texture;
/**
* Notifies Flutter that the content of the previously registered texture has been updated.
*
* See also: `flutter::PlatformView::MarkTextureFrameAvailable`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an internal method that users of this header will not have access to.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe also mention that in response to this call, the engine will attempt to resolve the pixel buffer via the copyPixelBuffer call on the render thread.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Render thread? Gpu thread, right?
Also, this call is meant to happen on the platform thread, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This call should happen on the platform thread but the pixel buffer will be copied on the GPU thread. Sorry about the mixed terminology, still processing flutter/flutter#29443.

*/
- (void)textureFrameAvailable:(int64_t)textureId;
/**
* Unregisters a `FlutterTexture` that has previously regeistered with `registerTexture:`.
*
* @param textureId The result that was previously returned from `registerTexture:`.
*/
- (void)unregisterTexture:(int64_t)textureId;
@end

Expand Down