Initial commit
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
#ifndef FLUTTER_PLUGIN_FLUTTER_GSTREAMER_PLAYER_PLUGIN_H_
|
||||
#define FLUTTER_PLUGIN_FLUTTER_GSTREAMER_PLAYER_PLUGIN_H_
|
||||
|
||||
#include <flutter_linux/flutter_linux.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#ifdef FLUTTER_PLUGIN_IMPL
|
||||
#define FLUTTER_PLUGIN_EXPORT __attribute__((visibility("default")))
|
||||
#else
|
||||
#define FLUTTER_PLUGIN_EXPORT
|
||||
#endif
|
||||
|
||||
typedef struct _FlutterGstreamerPlayerPlugin FlutterGstreamerPlayerPlugin;
|
||||
typedef struct {
|
||||
GObjectClass parent_class;
|
||||
} FlutterGstreamerPlayerPluginClass;
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT GType flutter_gstreamer_player_plugin_get_type();
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void flutter_gstreamer_player_plugin_register_with_registrar(
|
||||
FlPluginRegistrar* registrar);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif // FLUTTER_PLUGIN_FLUTTER_GSTREAMER_PLAYER_PLUGIN_H_
|
||||
@@ -0,0 +1,43 @@
|
||||
#ifndef VIDEO_OUTLET_H_
|
||||
#define VIDEO_OUTLET_H_
|
||||
|
||||
#include <flutter_linux/flutter_linux.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
struct _VideoOutletClass {
|
||||
FlPixelBufferTextureClass parent_class;
|
||||
};
|
||||
|
||||
struct VideoOutletPrivate {
|
||||
int64_t texture_id = 0;
|
||||
uint8_t* buffer = nullptr;
|
||||
int32_t video_width = 0;
|
||||
int32_t video_height = 0;
|
||||
};
|
||||
|
||||
G_DECLARE_DERIVABLE_TYPE(VideoOutlet, video_outlet, MY_OPENGL, VIDEO_OUTLET,
|
||||
FlPixelBufferTexture)
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE(VideoOutlet, video_outlet, fl_pixel_buffer_texture_get_type(), G_ADD_PRIVATE(VideoOutlet))
|
||||
|
||||
static VideoOutlet* video_outlet_new() {
|
||||
return MY_OPENGL_VIDEO_OUTLET(g_object_new(video_outlet_get_type(), nullptr));
|
||||
}
|
||||
|
||||
static gboolean video_outlet_copy_pixels(
|
||||
FlPixelBufferTexture* texture, const uint8_t** out_buffer, uint32_t* width,
|
||||
uint32_t* height, GError** error) {
|
||||
auto video_outlet_private = (VideoOutletPrivate*) video_outlet_get_instance_private(MY_OPENGL_VIDEO_OUTLET(texture));
|
||||
*out_buffer = video_outlet_private->buffer;
|
||||
*width = video_outlet_private->video_width;
|
||||
*height = video_outlet_private->video_height;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void video_outlet_class_init(VideoOutletClass* klass) {
|
||||
FL_PIXEL_BUFFER_TEXTURE_CLASS(klass)->copy_pixels = video_outlet_copy_pixels;
|
||||
}
|
||||
|
||||
static void video_outlet_init(VideoOutlet* self) {}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user