1 /* Copyright (C) <2018> Philippe Normand <philn@igalia.com>
2 * Copyright (C) <2018> Žan Doberšek <zdobersek@igalia.com>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
21 * SECTION:element-wpesrc
24 * The wpesrc element is used to produce a video texture representing a web page
25 * rendered off-screen by WPE.
27 * Starting from WPEBackend-FDO 1.6.x, software rendering support is available. This
28 * features allows wpesrc to be used on machines without GPU, and/or for testing
29 * purpose. To enable it, set the `LIBGL_ALWAYS_SOFTWARE=true` environment
30 * variable and make sure `video/x-raw, format=BGRA` caps are negotiated by the
33 * As the webview loading is usually not instantaneous, the wpesrc element emits
34 * messages indicating the load progress, in percent. The value is an estimate
35 * based on the total number of bytes expected to be received for a document,
36 * including all its possible subresources and child documents. The application
37 * can handle these `element` messages synchronously for instance, in order to
38 * display a progress bar or other visual load indicator. The load percent value
39 * is stored in the message structure as a double value named
40 * `estimated-load-progress` and the structure name is `wpe-stats`.
42 * ## Example launch lines
45 * gst-launch-1.0 -v wpesrc location="https://gstreamer.freedesktop.org" ! queue ! glimagesink
47 * Shows the GStreamer website homepage
50 * LIBGL_ALWAYS_SOFTWARE=true gst-launch-1.0 -v wpesrc num-buffers=50 location="https://gstreamer.freedesktop.org" \
51 * videoconvert ! pngenc ! multifilesink location=/tmp/snapshot-%05d.png
53 * Saves the first 50 video frames generated for the GStreamer website as PNG files in /tmp.
56 * gst-play-1.0 --videosink gtkglsink wpe://https://gstreamer.freedesktop.org
58 * Shows the GStreamer website homepage as played with GstPlayer in a GTK+ window.
61 * gst-launch-1.0 glvideomixer name=m sink_1::zorder=0 ! glimagesink wpesrc location="file:///tmp/asset.html" draw-background=0 \
62 * ! m. videotestsrc ! queue ! glupload ! glcolorconvert ! m.
64 * Composite WPE with a video stream in a single OpenGL scene.
67 * gst-launch-1.0 glvideomixer name=m sink_1::zorder=0 sink_0::height=818 sink_0::width=1920 ! gtkglsink \
68 * wpesrc location="file:///tmp/asset.html" draw-background=0 ! m.
69 * uridecodebin uri="http://example.com/Sintel.2010.1080p.mkv" name=d d. ! queue ! glupload ! glcolorconvert ! m.
71 * Composite WPE with a video stream, sink_0 pad properties have to match the video dimensions.
78 * - Audio support (requires an AudioSession implementation in WebKit and a WPEBackend-fdo API for it)
79 * - DMABuf support (requires changes in WPEBackend-fdo to expose DMABuf planes and fds)
80 * - Custom EGLMemory allocator
81 * - Better navigation events handling (would require a new GstNavigation API)
88 #include "gstwpesrc.h"
89 #include <gst/gl/gl.h>
90 #include <gst/gl/egl/gstglmemoryegl.h>
91 #include <gst/gl/wayland/gstgldisplay_wayland.h>
92 #include <gst/video/video.h>
93 #include <xkbcommon/xkbcommon.h>
95 #include "WPEThreadedView.h"
97 GST_DEBUG_CATEGORY (wpe_src_debug);
98 #define GST_CAT_DEFAULT wpe_src_debug
100 #define DEFAULT_WIDTH 1920
101 #define DEFAULT_HEIGHT 1080
102 #define DEFAULT_FPS_N 30
103 #define DEFAULT_FPS_D 1
114 SIGNAL_CONFIGURE_WEB_VIEW,
118 static guint gst_wpe_src_signals[LAST_SIGNAL] = { 0 };
126 gboolean draw_background;
131 gint64 n_frames; /* total frames sent */
138 #define WPE_LOCK(o) g_mutex_lock(&(o)->lock)
139 #define WPE_UNLOCK(o) g_mutex_unlock(&(o)->lock)
141 static void gst_wpe_src_uri_handler_init (gpointer iface, gpointer data);
143 #define gst_wpe_src_parent_class parent_class
144 G_DEFINE_TYPE_WITH_CODE (GstWpeSrc, gst_wpe_src, GST_TYPE_GL_BASE_SRC,
145 G_IMPLEMENT_INTERFACE (GST_TYPE_URI_HANDLER, gst_wpe_src_uri_handler_init);
146 GST_DEBUG_CATEGORY_INIT (wpe_src_debug, "wpesrc", 0, "WPE Source"););
147 GST_ELEMENT_REGISTER_DEFINE (wpesrc, "wpesrc", GST_RANK_NONE,
150 #if ENABLE_SHM_BUFFER_SUPPORT
151 #define WPE_RAW_CAPS "; video/x-raw, " \
152 "format = (string) BGRA, " \
153 "width = " GST_VIDEO_SIZE_RANGE ", " \
154 "height = " GST_VIDEO_SIZE_RANGE ", " \
155 "framerate = " GST_VIDEO_FPS_RANGE ", " \
156 "pixel-aspect-ratio = (fraction)1/1"
158 #define WPE_RAW_CAPS ""
161 #define WPE_BASIC_CAPS "video/x-raw(memory:GLMemory), " \
162 "format = (string) RGBA, " \
163 "width = " GST_VIDEO_SIZE_RANGE ", " \
164 "height = " GST_VIDEO_SIZE_RANGE ", " \
165 "framerate = " GST_VIDEO_FPS_RANGE ", " \
166 "pixel-aspect-ratio = (fraction)1/1, texture-target = (string)2D"
168 #define WPE_SRC_CAPS WPE_BASIC_CAPS WPE_RAW_CAPS
169 #define WPE_SRC_DOC_CAPS WPE_BASIC_CAPS "; video/x-raw, format = (string) BGRA"
171 static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
174 GST_STATIC_CAPS (WPE_SRC_CAPS));
177 gst_wpe_src_create (GstBaseSrc * bsrc, guint64 offset, guint length, GstBuffer ** buf)
179 GstGLBaseSrc *gl_src = GST_GL_BASE_SRC (bsrc);
180 GstWpeSrc *src = GST_WPE_SRC (bsrc);
181 GstFlowReturn ret = GST_FLOW_ERROR;
182 GstBuffer *locked_buffer;
183 GstClockTime next_time;
184 gint64 ts_offset = 0;
187 if (src->gl_enabled) {
189 return GST_CALL_PARENT_WITH_DEFAULT (GST_BASE_SRC_CLASS, create, (bsrc, offset, length, buf), ret);
192 locked_buffer = src->view->buffer ();
193 if (locked_buffer == NULL) {
195 GST_ELEMENT_ERROR (src, RESOURCE, FAILED,
196 ("WPE View did not render a buffer"), (NULL));
199 *buf = gst_buffer_copy_deep (locked_buffer);
201 g_object_get(gl_src, "timestamp-offset", &ts_offset, NULL);
203 /* The following code mimics the behaviour of GLBaseSrc::fill */
204 GST_BUFFER_TIMESTAMP (*buf) = ts_offset + gl_src->running_time;
205 GST_BUFFER_OFFSET (*buf) = src->n_frames;
207 GST_BUFFER_OFFSET_END (*buf) = src->n_frames;
208 if (gl_src->out_info.fps_n) {
209 next_time = gst_util_uint64_scale_int (src->n_frames * GST_SECOND,
210 gl_src->out_info.fps_d, gl_src->out_info.fps_n);
211 GST_BUFFER_DURATION (*buf) = next_time - gl_src->running_time;
213 next_time = ts_offset;
214 GST_BUFFER_DURATION (*buf) = GST_CLOCK_TIME_NONE;
217 GST_LOG_OBJECT (src, "Created buffer from SHM %" GST_PTR_FORMAT, *buf);
219 gl_src->running_time = next_time;
227 gst_wpe_src_fill_memory (GstGLBaseSrc * bsrc, GstGLMemory * memory)
229 GstWpeSrc *src = GST_WPE_SRC (bsrc);
230 const GstGLFuncs *gl;
232 GstEGLImage *locked_image;
234 if (!gst_gl_context_check_feature (GST_GL_CONTEXT (bsrc->context),
235 "EGL_KHR_image_base")) {
236 GST_ERROR_OBJECT (src, "EGL_KHR_image_base is not supported");
242 gl = bsrc->context->gl_vtable;
243 tex_id = gst_gl_memory_get_texture_id (memory);
244 locked_image = src->view->image ();
251 gl->ActiveTexture (GL_TEXTURE0 + memory->plane);
252 gl->BindTexture (GL_TEXTURE_2D, tex_id);
253 gl->EGLImageTargetTexture2D (GL_TEXTURE_2D,
254 gst_egl_image_get_image (locked_image));
261 gst_wpe_src_start (GstWpeSrc * src)
263 GstGLContext *context = NULL;
264 GstGLDisplay *display = NULL;
265 GstGLBaseSrc *base_src = GST_GL_BASE_SRC (src);
266 gboolean created_view = FALSE;
269 GST_INFO_OBJECT (src, "Starting up");
272 if (src->gl_enabled) {
273 context = base_src->context;
274 display = base_src->display;
277 GST_DEBUG_OBJECT (src, "Will %sfill GLMemories", src->gl_enabled ? "" : "NOT ");
279 auto & thread = WPEContextThread::singleton ();
282 src->view = thread.createWPEView (src, context, display,
283 GST_VIDEO_INFO_WIDTH (&base_src->out_info),
284 GST_VIDEO_INFO_HEIGHT (&base_src->out_info));
286 GST_DEBUG_OBJECT (src, "created view %p", src->view);
291 GST_ELEMENT_ERROR (src, RESOURCE, FAILED,
292 ("WPEBackend-FDO EGL display initialisation failed"), (NULL));
296 GST_OBJECT_LOCK (src);
299 GST_OBJECT_UNLOCK (src);
302 src->view->loadData (bytes);
303 g_bytes_unref (bytes);
314 gst_wpe_src_decide_allocation (GstBaseSrc * base_src, GstQuery * query)
316 GstGLBaseSrc *gl_src = GST_GL_BASE_SRC (base_src);
317 GstWpeSrc *src = GST_WPE_SRC (base_src);
318 GstCapsFeatures *caps_features;
321 caps_features = gst_caps_get_features (gl_src->out_caps, 0);
322 if (caps_features != NULL && gst_caps_features_contains (caps_features, GST_CAPS_FEATURE_MEMORY_GL_MEMORY)) {
323 src->gl_enabled = TRUE;
325 src->gl_enabled = FALSE;
328 if (src->gl_enabled) {
330 return GST_CALL_PARENT_WITH_DEFAULT(GST_BASE_SRC_CLASS, decide_allocation, (base_src, query), FALSE);
333 return gst_wpe_src_start (src);
337 gst_wpe_src_gl_start (GstGLBaseSrc * base_src)
339 GstWpeSrc *src = GST_WPE_SRC (base_src);
340 return gst_wpe_src_start (src);
344 gst_wpe_src_stop_unlocked (GstWpeSrc * src)
347 GST_DEBUG_OBJECT (src, "deleting view %p", src->view);
354 gst_wpe_src_gl_stop (GstGLBaseSrc * base_src)
356 GstWpeSrc *src = GST_WPE_SRC (base_src);
359 gst_wpe_src_stop_unlocked (src);
364 gst_wpe_src_stop (GstBaseSrc * base_src)
366 GstWpeSrc *src = GST_WPE_SRC (base_src);
368 /* we can call this always, GstGLBaseSrc is smart enough to not crash if
369 * gst_gl_base_src_gl_start() has not been called from chaining up
370 * gst_wpe_src_decide_allocation() */
371 if (!GST_CALL_PARENT_WITH_DEFAULT(GST_BASE_SRC_CLASS, stop, (base_src), FALSE))
376 /* if gl-enabled, gst_wpe_src_stop_unlocked() would have already been called
377 * inside gst_wpe_src_gl_stop() from the base class stopping the OpenGL
379 if (!src->gl_enabled)
380 gst_wpe_src_stop_unlocked (src);
387 gst_wpe_src_fixate (GstBaseSrc * base_src, GstCaps * caps)
389 GstWpeSrc *src = GST_WPE_SRC (base_src);
390 GstStructure *structure;
393 caps = gst_caps_make_writable (caps);
394 structure = gst_caps_get_structure (caps, 0);
396 gst_structure_fixate_field_nearest_int (structure, "width", DEFAULT_WIDTH);
397 gst_structure_fixate_field_nearest_int (structure, "height", DEFAULT_HEIGHT);
399 if (gst_structure_has_field (structure, "framerate"))
400 gst_structure_fixate_field_nearest_fraction (structure, "framerate",
401 DEFAULT_FPS_N, DEFAULT_FPS_D);
403 gst_structure_set (structure, "framerate", GST_TYPE_FRACTION, DEFAULT_FPS_N,
404 DEFAULT_FPS_D, NULL);
406 caps = GST_BASE_SRC_CLASS (parent_class)->fixate (base_src, caps);
407 GST_INFO_OBJECT (base_src, "Fixated caps to %" GST_PTR_FORMAT, caps);
410 gst_structure_get (structure, "width", G_TYPE_INT, &width, "height", G_TYPE_INT, &height, NULL);
411 src->view->resize (width, height);
417 gst_wpe_src_configure_web_view (GstWpeSrc * src, WebKitWebView * webview)
419 GValue args[2] = { {0}, {0} };
421 g_value_init (&args[0], GST_TYPE_ELEMENT);
422 g_value_set_object (&args[0], src);
423 g_value_init (&args[1], G_TYPE_OBJECT);
424 g_value_set_object (&args[1], webview);
426 g_signal_emitv (args, gst_wpe_src_signals[SIGNAL_CONFIGURE_WEB_VIEW], 0,
429 g_value_unset (&args[0]);
430 g_value_unset (&args[1]);
434 gst_wpe_src_load_bytes (GstWpeSrc * src, GBytes * bytes)
436 if (src->view && GST_STATE (GST_ELEMENT_CAST (src)) > GST_STATE_NULL) {
437 src->view->loadData (bytes);
439 GST_OBJECT_LOCK (src);
441 g_bytes_unref (src->bytes);
442 src->bytes = g_bytes_ref (bytes);
443 GST_OBJECT_UNLOCK (src);
448 gst_wpe_src_set_location (GstWpeSrc * src, const gchar * location,
451 GST_OBJECT_LOCK (src);
452 g_free (src->location);
453 src->location = g_strdup (location);
454 GST_OBJECT_UNLOCK (src);
457 src->view->loadUri (location);
463 gst_wpe_src_set_draw_background (GstWpeSrc * src, gboolean draw_background)
465 GST_OBJECT_LOCK (src);
466 src->draw_background = draw_background;
467 GST_OBJECT_UNLOCK (src);
470 src->view->setDrawBackground (draw_background);
474 gst_wpe_src_set_property (GObject * object, guint prop_id, const GValue * value,
477 GstWpeSrc *src = GST_WPE_SRC (object);
482 const gchar *location;
484 location = g_value_get_string (value);
485 if (location == NULL) {
486 GST_WARNING_OBJECT (src, "location property cannot be NULL");
490 if (!gst_wpe_src_set_location (src, location, NULL)) {
491 GST_WARNING_OBJECT (src, "badly formatted location");
496 case PROP_DRAW_BACKGROUND:
497 gst_wpe_src_set_draw_background (src, g_value_get_boolean (value));
505 gst_wpe_src_get_property (GObject * object, guint prop_id, GValue * value,
508 GstWpeSrc *src = GST_WPE_SRC (object);
512 GST_OBJECT_LOCK (src);
513 g_value_set_string (value, src->location);
514 GST_OBJECT_UNLOCK (src);
516 case PROP_DRAW_BACKGROUND:
517 GST_OBJECT_LOCK (src);
518 g_value_set_boolean (value, src->draw_background);
519 GST_OBJECT_UNLOCK (src);
522 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
528 gst_wpe_src_event (GstPad * pad, GstObject * parent, GstEvent * event)
530 gboolean ret = FALSE;
531 GstWpeSrc *src = GST_WPE_SRC (parent);
533 if (GST_EVENT_TYPE (event) == GST_EVENT_NAVIGATION) {
536 gdouble x, y, delta_x, delta_y;
538 GST_DEBUG_OBJECT (src, "Processing event %" GST_PTR_FORMAT, event);
542 switch (gst_navigation_event_get_type (event)) {
543 case GST_NAVIGATION_EVENT_KEY_PRESS:
544 case GST_NAVIGATION_EVENT_KEY_RELEASE:
545 if (gst_navigation_event_parse_key_event (event, &key)) {
546 /* FIXME: This is wrong... The GstNavigation API should pass
547 hardware-level information, not high-level keysym strings */
549 (uint32_t) xkb_keysym_from_name (key, XKB_KEYSYM_NO_FLAGS);
550 struct wpe_input_keyboard_event wpe_event;
551 wpe_event.key_code = keysym;
553 gst_navigation_event_get_type (event) ==
554 GST_NAVIGATION_EVENT_KEY_PRESS;
555 src->view->dispatchKeyboardEvent (wpe_event);
559 case GST_NAVIGATION_EVENT_MOUSE_BUTTON_PRESS:
560 case GST_NAVIGATION_EVENT_MOUSE_BUTTON_RELEASE:
561 if (gst_navigation_event_parse_mouse_button_event (event, &button, &x,
563 struct wpe_input_pointer_event wpe_event;
564 wpe_event.time = GST_TIME_AS_MSECONDS (GST_EVENT_TIMESTAMP (event));
565 wpe_event.type = wpe_input_pointer_event_type_button;
566 wpe_event.x = (int) x;
567 wpe_event.y = (int) y;
569 wpe_event.modifiers = wpe_input_pointer_modifier_button1;
570 } else if (button == 2) {
571 wpe_event.modifiers = wpe_input_pointer_modifier_button2;
572 } else if (button == 3) {
573 wpe_event.modifiers = wpe_input_pointer_modifier_button3;
574 } else if (button == 4) {
575 wpe_event.modifiers = wpe_input_pointer_modifier_button4;
576 } else if (button == 5) {
577 wpe_event.modifiers = wpe_input_pointer_modifier_button5;
579 wpe_event.button = button;
581 gst_navigation_event_get_type (event) ==
582 GST_NAVIGATION_EVENT_MOUSE_BUTTON_PRESS;
583 src->view->dispatchPointerEvent (wpe_event);
587 case GST_NAVIGATION_EVENT_MOUSE_MOVE:
588 if (gst_navigation_event_parse_mouse_move_event (event, &x, &y)) {
589 struct wpe_input_pointer_event wpe_event;
590 wpe_event.time = GST_TIME_AS_MSECONDS (GST_EVENT_TIMESTAMP (event));
591 wpe_event.type = wpe_input_pointer_event_type_motion;
592 wpe_event.x = (int) x;
593 wpe_event.y = (int) y;
594 src->view->dispatchPointerEvent (wpe_event);
598 case GST_NAVIGATION_EVENT_MOUSE_SCROLL:
599 if (gst_navigation_event_parse_mouse_scroll_event (event, &x, &y,
600 &delta_x, &delta_y)) {
601 #if WPE_CHECK_VERSION(1, 6, 0)
602 struct wpe_input_axis_2d_event wpe_event;
604 wpe_event.x_axis = delta_x;
606 wpe_event.y_axis = delta_y;
608 wpe_event.base.time =
609 GST_TIME_AS_MSECONDS (GST_EVENT_TIMESTAMP (event));
610 wpe_event.base.type =
611 static_cast < wpe_input_axis_event_type >
612 (wpe_input_axis_event_type_mask_2d |
613 wpe_input_axis_event_type_motion_smooth);
614 wpe_event.base.x = (int) x;
615 wpe_event.base.y = (int) y;
616 src->view->dispatchAxisEvent (wpe_event.base);
618 struct wpe_input_axis_event wpe_event;
621 wpe_event.value = delta_x;
624 wpe_event.value = delta_y;
626 wpe_event.time = GST_TIME_AS_MSECONDS (GST_EVENT_TIMESTAMP (event));
627 wpe_event.type = wpe_input_axis_event_type_motion;
628 wpe_event.x = (int) x;
629 wpe_event.y = (int) y;
630 src->view->dispatchAxisEvent (wpe_event);
638 /* FIXME: No touch events handling support in GstNavigation */
642 ret = gst_pad_event_default (pad, parent, event);
644 gst_event_unref (event);
650 gst_wpe_src_init (GstWpeSrc * src)
652 GstPad *pad = gst_element_get_static_pad (GST_ELEMENT_CAST (src), "src");
654 gst_pad_set_event_function (pad, gst_wpe_src_event);
655 gst_object_unref (pad);
657 src->draw_background = TRUE;
659 gst_base_src_set_live (GST_BASE_SRC_CAST (src), TRUE);
661 g_mutex_init (&src->lock);
665 gst_wpe_src_finalize (GObject * object)
667 GstWpeSrc *src = GST_WPE_SRC (object);
669 g_free (src->location);
670 g_clear_pointer (&src->bytes, g_bytes_unref);
671 g_mutex_clear (&src->lock);
673 G_OBJECT_CLASS (parent_class)->finalize (object);
677 gst_wpe_src_uri_get_type (GType)
682 static const gchar *const *
683 gst_wpe_src_get_protocols (GType)
685 static const char *protocols[] = { "wpe", NULL };
690 gst_wpe_src_get_uri (GstURIHandler * handler)
692 GstWpeSrc *src = GST_WPE_SRC (handler);
695 GST_OBJECT_LOCK (src);
696 uri = g_strdup_printf ("wpe://%s", src->location);
697 GST_OBJECT_UNLOCK (src);
703 gst_wpe_src_set_uri (GstURIHandler * handler, const gchar * uri,
706 GstWpeSrc *src = GST_WPE_SRC (handler);
708 return gst_wpe_src_set_location (src, uri + 6, error);
712 gst_wpe_src_uri_handler_init (gpointer iface_ptr, gpointer data)
714 GstURIHandlerInterface *iface = (GstURIHandlerInterface *) iface_ptr;
716 iface->get_type = gst_wpe_src_uri_get_type;
717 iface->get_protocols = gst_wpe_src_get_protocols;
718 iface->get_uri = gst_wpe_src_get_uri;
719 iface->set_uri = gst_wpe_src_set_uri;
723 gst_wpe_src_class_init (GstWpeSrcClass * klass)
725 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
726 GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
727 GstGLBaseSrcClass *gl_base_src_class = GST_GL_BASE_SRC_CLASS (klass);
728 GstBaseSrcClass *base_src_class = GST_BASE_SRC_CLASS (klass);
729 GstPadTemplate *tmpl;
732 gobject_class->set_property = gst_wpe_src_set_property;
733 gobject_class->get_property = gst_wpe_src_get_property;
734 gobject_class->finalize = gst_wpe_src_finalize;
736 g_object_class_install_property (gobject_class, PROP_LOCATION,
737 g_param_spec_string ("location", "location",
738 "The URL to display",
739 "", (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
740 g_object_class_install_property (gobject_class, PROP_DRAW_BACKGROUND,
741 g_param_spec_boolean ("draw-background", "Draws the background",
742 "Whether to draw the WebView background", TRUE,
743 (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
745 gst_element_class_set_static_metadata (gstelement_class,
746 "WPE source", "Source/Video",
747 "Creates a video stream from a WPE browser",
748 "Philippe Normand <philn@igalia.com>, Žan Doberšek <zdobersek@igalia.com>");
750 tmpl = gst_static_pad_template_get (&src_factory);
751 gst_element_class_add_pad_template (gstelement_class, tmpl);
753 base_src_class->fixate = GST_DEBUG_FUNCPTR (gst_wpe_src_fixate);
754 base_src_class->create = GST_DEBUG_FUNCPTR (gst_wpe_src_create);
755 base_src_class->decide_allocation = GST_DEBUG_FUNCPTR (gst_wpe_src_decide_allocation);
756 base_src_class->stop = GST_DEBUG_FUNCPTR (gst_wpe_src_stop);
758 gl_base_src_class->supported_gl_api =
759 static_cast < GstGLAPI >
760 (GST_GL_API_OPENGL | GST_GL_API_OPENGL3 | GST_GL_API_GLES2);
761 gl_base_src_class->gl_start = GST_DEBUG_FUNCPTR (gst_wpe_src_gl_start);
762 gl_base_src_class->gl_stop = GST_DEBUG_FUNCPTR (gst_wpe_src_gl_stop);
763 gl_base_src_class->fill_gl_memory =
764 GST_DEBUG_FUNCPTR (gst_wpe_src_fill_memory);
766 doc_caps = gst_caps_from_string (WPE_SRC_DOC_CAPS);
767 gst_pad_template_set_documentation_caps (tmpl, doc_caps);
768 gst_clear_caps (&doc_caps);
771 * GstWpeSrc::configure-web-view:
772 * @src: the object which received the signal
773 * @webview: the webView
775 * Allow application to configure the webView settings.
777 gst_wpe_src_signals[SIGNAL_CONFIGURE_WEB_VIEW] =
778 g_signal_new ("configure-web-view", G_TYPE_FROM_CLASS (klass),
779 G_SIGNAL_RUN_LAST, 0, NULL, NULL, NULL, G_TYPE_NONE, 1, G_TYPE_OBJECT);
782 * GstWpeSrc::load-bytes:
783 * @src: the object which received the signal
784 * @bytes: the GBytes data to load
786 * Load the specified bytes into the internal webView.
788 gst_wpe_src_signals[SIGNAL_LOAD_BYTES] =
789 g_signal_new_class_handler ("load-bytes", G_TYPE_FROM_CLASS (klass),
790 static_cast < GSignalFlags > (G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
791 G_CALLBACK (gst_wpe_src_load_bytes), NULL, NULL, NULL,
792 G_TYPE_NONE, 1, G_TYPE_BYTES);
796 plugin_init (GstPlugin * plugin)
800 return GST_ELEMENT_REGISTER (wpesrc, plugin);
803 GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_VERSION_MINOR,
804 wpe, "WPE src plugin", plugin_init, VERSION, GST_LICENSE, PACKAGE,