-
Notifications
You must be signed in to change notification settings - Fork 610
Support Texture widget #107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I can help with that.
I assume c++ based for all desktops ?
…On Fri, 13 Jul 2018, 09:12 湖北捷智云技术有限公司, ***@***.***> wrote:
We have ported the WebRTC plugin
<https://github.com/cloudwebrtc/flutter-webrtc> for iOS/Android, but
there is no Texture widget in flutter-desktop-embedding, Texture is needed
to support video rendering and video player development.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#107>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ATuCwhiMbSeeT4752YrP7Alxv3E60xkUks5uGEhAgaJpZM4VOaKo>
.
|
Yes, use C++ to write the plugins for all desktops. |
From a quick skim of the existing implementations it looks like Texture implementation requires access to engine APIs that aren't currently exposed via the embedding API. @chinmaygarde Is that accurate? |
Not having the Texture implementation is a bit of s show stopper for me too. I want to use the Texture to push 2D and 3D graphics to the GUI. Polite hint to @chinmaygarde. If you can comment on this ? |
Apologies for the late reply. Support for external textures to embedders is definitely something on the roadmap. Currently, external textures are handled very differently on iOS (CoreVideo) and Android (GL_OES_EGL_image_external) and so exposing the same to embedders is not straightforward. It would be great if we could collaborate on figuring out a few things first. For example, should the embedder API try to create an abstraction over textures on the various platforms or support platform specific APIs? In the specific case of the WebRTC plugin linked, I suspect the easiest way for the platform to express its textures would be in the form of CoreVideo pixel buffers. OTOH, on Linux, I suspect EGL images would be better. Should the embedder API support both platform specific APIs? Or, should the engine only deal with plain old GL_TEXTURE_2D objects and have the embedder render into the same. That would require sharing of the OpenGL context used by Flutter with the embedder or creating another context within the same sharegroup. @cloudwebrtc: I think exposing the current support for CoreVideo and EGL_Image_External as-is would be the easiest way to support your use case. @gedw99: How are you going to generate and update the textures with the graphics you mentioned? Are you going to push new textures (from a pool) to Flutter each frame or do you want to update the same texture? Are there threading restrictions to the way you are going to be generating your textures? Can you provide a reduced test case for how you want to generate your textures? That would be extremely helpful to try to pin down an API that works for the broadest audience. Thanks! |
Hey @chinmaygarde Answers to the questions How are you going to generate and update the textures with the graphics you mentioned?
Are you going to push new textures (from a pool) to Flutter each frame or do you want to update the same texture?
Are there threading restrictions to the way you are going to be generating your textures?
Can you provide a reduced test case for how you want to generate your textures?
Some Background: |
Engine patch with example embedder implementation has been posted flutter/engine#7087. |
@chinmaygarde I used your branch to create a webrtc plugin example that seems to work fine, thank you. /**
* An event sink callback.
*
* @param event The event.
*/
typedef void (^FlutterEventSink)(id _Nullable event);
extern NSObject const* FlutterEndOfEventStream;
@protocol FlutterStreamHandler
- (FLEMethodError* _Nullable)onListenWithArguments:(id _Nullable)arguments
eventSink:(FlutterEventSink)events;
- (FLEMethodError* _Nullable)onCancelWithArguments:(id _Nullable)arguments;
@end
@interface FlutterEventChannel : NSObject
+ (instancetype)eventChannelWithName:(NSString*)name
binaryMessenger:(NSObject<FLEBinaryMessenger>*)messenger;
- (void)setStreamHandler:(NSObject<FlutterStreamHandler>* _Nullable)handler;
@end
@protocol FlutterTexture<NSObject>
- (CVPixelBufferRef _Nullable)copyPixelBuffer;
@end
@protocol FlutterTextureRegistry<NSObject>
- (int64_t)registerTexture:(NSObject<FlutterTexture> *)texture;
- (void)textureFrameAvailable:(int64_t)textureId;
- (void)unregisterTexture:(int64_t)textureId;
@end
NS_ASSUME_NONNULL_BEGIN
@interface FLETextureRegister : NSObject<FlutterTextureRegistry, FLETextureDelegate>
@property(nullable, weak) FLEViewController *controller;
-(instancetype) initWithController:(FLEViewController *)controller;
@end
NS_ASSUME_NONNULL_END Should I add FlutterEventChannel and FlutterTextureRegistry to FlutterEmbedderMac.framework? Thanks again, the Linux/Win plugin should be easier to port, just copy the FlutterOpenGLTexture object and provide the GL_RGBA8 buffer. For testing please refer to:flutter-webrtc/flutter-webrtc#37 (comment) screenshots |
I'd be happy to accept a patch that adds FLEEventChannel (the naming convention I've been using for the macOS code in this project is to use FLE as a prefix, replacing Flutter when the iOS class starts with Flutter) and related classes to the framework! It'll need to wait to land until the engine change lands though, and then the texture APIs will need to be added to the macOS framework (which will likely have some changes from what's in that branch), but feel free to start the PR whenever you like and it go through review in the meantime. |
Okay, I created a PR for FELEventChannel. #174 |
Engine support landed in flutter/engine#7087 |
New PR for FLETexture on [macOS] #263. |
Moved to flutter/flutter#30717 and flutter/flutter#30718 @cloudwebrtc If you are still interested in moving forward with #263, 30717 would be the bug to associate a flutter/engine PR with. |
How I understand for start work with flutter Texture widget, I must get |
See my last comment; this bug is closed because the relevant code is in Flutter now, and the open bugs tracking the work are there now. The right place for your question is flutter/flutter#30718 (where there's a link to a patch with an implementation, which should answer your question). |
Is texture widget supported on Windows at all? |
No, see flutter/flutter#38601 |
We have ported the WebRTC plugin for iOS/Android, but there is no Texture widget in flutter-desktop-embedding, Texture is needed to support video rendering and video player development.
The text was updated successfully, but these errors were encountered: