mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-22 05:56:31 +00:00
wpe: Bump wpebackend-fdo version requirement to 1.8
Debian bullseye has this version already, and this allows us to get rid of many ifdefs. The mouse scroll handling is actually functional now as well. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2278>
This commit is contained in:
parent
0151276d7f
commit
a0b37e9d1a
5 changed files with 4 additions and 83 deletions
|
@ -33,21 +33,11 @@
|
|||
#include <cstdio>
|
||||
#include <mutex>
|
||||
|
||||
#if ENABLE_SHM_BUFFER_SUPPORT
|
||||
#include <wpe/unstable/fdo-shm.h>
|
||||
#endif
|
||||
|
||||
GST_DEBUG_CATEGORY_EXTERN (wpe_view_debug);
|
||||
#define GST_CAT_DEFAULT wpe_view_debug
|
||||
|
||||
#if defined(WPE_FDO_CHECK_VERSION) && WPE_FDO_CHECK_VERSION(1, 3, 0)
|
||||
#define USE_DEPRECATED_FDO_EGL_IMAGE 0
|
||||
#define WPE_GLIB_SOURCE_PRIORITY G_PRIORITY_DEFAULT
|
||||
#else
|
||||
#define USE_DEPRECATED_FDO_EGL_IMAGE 1
|
||||
#define WPE_GLIB_SOURCE_PRIORITY -70
|
||||
#endif
|
||||
|
||||
class GMutexHolder {
|
||||
public:
|
||||
GMutexHolder(GMutex& mutex)
|
||||
|
@ -122,7 +112,7 @@ void WPEContextThread::dispatch(Function func)
|
|||
g_cond_signal(&view.threading.cond);
|
||||
return G_SOURCE_REMOVE;
|
||||
}, &payload, nullptr);
|
||||
g_source_set_priority(source, WPE_GLIB_SOURCE_PRIORITY);
|
||||
g_source_set_priority(source, G_PRIORITY_DEFAULT);
|
||||
|
||||
{
|
||||
GMutexHolder lock(threading.mutex);
|
||||
|
@ -309,9 +299,7 @@ WPEView* WPEContextThread::createWPEView(GstWpeVideoSrc* src, GstGLContext* cont
|
|||
static std::once_flag s_loaderFlag;
|
||||
std::call_once(s_loaderFlag,
|
||||
[] {
|
||||
#if defined(WPE_BACKEND_CHECK_VERSION) && WPE_BACKEND_CHECK_VERSION(1, 2, 0)
|
||||
wpe_loader_init("libWPEBackend-fdo-1.0.so");
|
||||
#endif
|
||||
});
|
||||
|
||||
WPEView* view = nullptr;
|
||||
|
@ -419,12 +407,8 @@ WPEView::WPEView(WebKitWebContext* web_context, GstWpeVideoSrc* src, GstGLContex
|
|||
m_isValid = wpe_fdo_initialize_for_egl_display(eglDisplay);
|
||||
GST_DEBUG("FDO EGL display initialisation result: %d", m_isValid);
|
||||
} else {
|
||||
#if ENABLE_SHM_BUFFER_SUPPORT
|
||||
m_isValid = wpe_fdo_initialize_shm();
|
||||
GST_DEBUG("FDO SHM initialisation result: %d", m_isValid);
|
||||
#else
|
||||
GST_WARNING("FDO SHM support is available only in WPEBackend-FDO 1.7.0");
|
||||
#endif
|
||||
}
|
||||
if (!m_isValid)
|
||||
return;
|
||||
|
@ -432,16 +416,12 @@ WPEView::WPEView(WebKitWebContext* web_context, GstWpeVideoSrc* src, GstGLContex
|
|||
if (gst.display_egl) {
|
||||
wpe.exportable = wpe_view_backend_exportable_fdo_egl_create(&s_exportableEGLClient, this, wpe.width, wpe.height);
|
||||
} else {
|
||||
#if ENABLE_SHM_BUFFER_SUPPORT
|
||||
wpe.exportable = wpe_view_backend_exportable_fdo_create(&s_exportableClient, this, wpe.width, wpe.height);
|
||||
#endif
|
||||
}
|
||||
|
||||
auto* wpeViewBackend = wpe_view_backend_exportable_fdo_get_view_backend(wpe.exportable);
|
||||
auto* viewBackend = webkit_web_view_backend_new(wpeViewBackend, (GDestroyNotify) wpe_view_backend_exportable_fdo_destroy, wpe.exportable);
|
||||
#if defined(WPE_BACKEND_CHECK_VERSION) && WPE_BACKEND_CHECK_VERSION(1, 1, 0)
|
||||
wpe_view_backend_add_activity_state(wpeViewBackend, wpe_view_activity_state_visible | wpe_view_activity_state_focused | wpe_view_activity_state_in_window);
|
||||
#endif
|
||||
|
||||
webkit.view = WEBKIT_WEB_VIEW(g_object_new(WEBKIT_TYPE_WEB_VIEW,
|
||||
"web-context", web_context,
|
||||
|
@ -693,13 +673,8 @@ void WPEView::releaseImage(gpointer imagePointer)
|
|||
{
|
||||
s_view->dispatch([&]() {
|
||||
GST_TRACE("Dispatch release exported image %p", imagePointer);
|
||||
#if USE_DEPRECATED_FDO_EGL_IMAGE
|
||||
wpe_view_backend_exportable_fdo_egl_dispatch_release_image(wpe.exportable,
|
||||
static_cast<EGLImageKHR>(imagePointer));
|
||||
#else
|
||||
wpe_view_backend_exportable_fdo_egl_dispatch_release_exported_image(wpe.exportable,
|
||||
static_cast<struct wpe_fdo_egl_exported_image*>(imagePointer));
|
||||
#endif
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -713,12 +688,7 @@ void WPEView::handleExportedImage(gpointer image)
|
|||
ImageContext* imageContext = g_slice_new(ImageContext);
|
||||
imageContext->view = this;
|
||||
imageContext->image = static_cast<gpointer>(image);
|
||||
EGLImageKHR eglImage;
|
||||
#if USE_DEPRECATED_FDO_EGL_IMAGE
|
||||
eglImage = static_cast<EGLImageKHR>(image);
|
||||
#else
|
||||
eglImage = wpe_fdo_egl_exported_image_get_egl_image(static_cast<struct wpe_fdo_egl_exported_image*>(image));
|
||||
#endif
|
||||
EGLImageKHR eglImage = wpe_fdo_egl_exported_image_get_egl_image(static_cast<struct wpe_fdo_egl_exported_image*>(image));
|
||||
|
||||
auto* gstImage = gst_egl_image_new_wrapped(gst.context, eglImage, GST_GL_RGBA, imageContext, s_releaseImage);
|
||||
{
|
||||
|
@ -732,7 +702,6 @@ void WPEView::handleExportedImage(gpointer image)
|
|||
}
|
||||
}
|
||||
|
||||
#if ENABLE_SHM_BUFFER_SUPPORT
|
||||
struct SHMBufferContext {
|
||||
WPEView* view;
|
||||
struct wpe_fdo_shm_exported_buffer* buffer;
|
||||
|
@ -789,17 +758,8 @@ void WPEView::handleExportedBuffer(struct wpe_fdo_shm_exported_buffer* buffer)
|
|||
notifyLoadFinished();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
struct wpe_view_backend_exportable_fdo_egl_client WPEView::s_exportableEGLClient = {
|
||||
#if USE_DEPRECATED_FDO_EGL_IMAGE
|
||||
// export_egl_image
|
||||
[](void* data, EGLImageKHR image) {
|
||||
auto& view = *static_cast<WPEView*>(data);
|
||||
view.handleExportedImage(static_cast<gpointer>(image));
|
||||
},
|
||||
nullptr, nullptr,
|
||||
#else
|
||||
// export_egl_image
|
||||
nullptr,
|
||||
[](void* data, struct wpe_fdo_egl_exported_image* image) {
|
||||
|
@ -807,12 +767,10 @@ struct wpe_view_backend_exportable_fdo_egl_client WPEView::s_exportableEGLClient
|
|||
view.handleExportedImage(static_cast<gpointer>(image));
|
||||
},
|
||||
nullptr,
|
||||
#endif // USE_DEPRECATED_FDO_EGL_IMAGE
|
||||
// padding
|
||||
nullptr, nullptr
|
||||
};
|
||||
|
||||
#if ENABLE_SHM_BUFFER_SUPPORT
|
||||
struct wpe_view_backend_exportable_fdo_client WPEView::s_exportableClient = {
|
||||
nullptr,
|
||||
nullptr,
|
||||
|
@ -824,7 +782,6 @@ struct wpe_view_backend_exportable_fdo_client WPEView::s_exportableClient = {
|
|||
nullptr,
|
||||
nullptr,
|
||||
};
|
||||
#endif
|
||||
|
||||
void WPEView::s_releaseImage(GstEGLImage* image, gpointer data)
|
||||
{
|
||||
|
|
|
@ -32,12 +32,6 @@ typedef struct _GstGLContext GstGLContext;
|
|||
typedef struct _GstGLDisplay GstGLDisplay;
|
||||
typedef struct _GstEGLImage GstEGLImage;
|
||||
|
||||
#if defined(WPE_FDO_CHECK_VERSION) && WPE_FDO_CHECK_VERSION(1, 7, 0)
|
||||
#define ENABLE_SHM_BUFFER_SUPPORT 1
|
||||
#else
|
||||
#define ENABLE_SHM_BUFFER_SUPPORT 0
|
||||
#endif
|
||||
|
||||
class WPEView {
|
||||
public:
|
||||
WPEView(WebKitWebContext*, GstWpeVideoSrc*, GstGLContext*, GstGLDisplay*, int width, int height);
|
||||
|
@ -65,9 +59,7 @@ public:
|
|||
|
||||
protected:
|
||||
void handleExportedImage(gpointer);
|
||||
#if ENABLE_SHM_BUFFER_SUPPORT
|
||||
void handleExportedBuffer(struct wpe_fdo_shm_exported_buffer*);
|
||||
#endif
|
||||
|
||||
private:
|
||||
struct wpe_view_backend* backend() const;
|
||||
|
@ -76,10 +68,8 @@ private:
|
|||
void notifyLoadFinished();
|
||||
|
||||
void releaseImage(gpointer);
|
||||
#if ENABLE_SHM_BUFFER_SUPPORT
|
||||
void releaseSHMBuffer(gpointer);
|
||||
static void s_releaseSHMBuffer(gpointer);
|
||||
#endif
|
||||
|
||||
struct {
|
||||
GstGLContext* context;
|
||||
|
@ -88,9 +78,7 @@ private:
|
|||
} gst { nullptr, nullptr, nullptr };
|
||||
|
||||
static struct wpe_view_backend_exportable_fdo_egl_client s_exportableEGLClient;
|
||||
#if ENABLE_SHM_BUFFER_SUPPORT
|
||||
static struct wpe_view_backend_exportable_fdo_client s_exportableClient;
|
||||
#endif
|
||||
|
||||
static void s_releaseImage(GstEGLImage*, gpointer);
|
||||
struct {
|
||||
|
|
|
@ -179,14 +179,12 @@ GST_STATIC_PAD_TEMPLATE ("video", GST_PAD_SRC, GST_PAD_SOMETIMES,
|
|||
"framerate = " GST_VIDEO_FPS_RANGE ", "
|
||||
"pixel-aspect-ratio = (fraction)1/1,"
|
||||
"texture-target = (string)2D"
|
||||
#if ENABLE_SHM_BUFFER_SUPPORT
|
||||
"; video/x-raw, "
|
||||
"format = (string) BGRA, "
|
||||
"width = " GST_VIDEO_SIZE_RANGE ", "
|
||||
"height = " GST_VIDEO_SIZE_RANGE ", "
|
||||
"framerate = " GST_VIDEO_FPS_RANGE ", "
|
||||
"pixel-aspect-ratio = (fraction)1/1"
|
||||
#endif
|
||||
));
|
||||
|
||||
/**
|
||||
|
|
|
@ -137,16 +137,12 @@ struct _GstWpeVideoSrc
|
|||
#define gst_wpe_video_src_parent_class parent_class
|
||||
G_DEFINE_TYPE(GstWpeVideoSrc, gst_wpe_video_src, GST_TYPE_GL_BASE_SRC);
|
||||
|
||||
#if ENABLE_SHM_BUFFER_SUPPORT
|
||||
#define WPE_RAW_CAPS "; video/x-raw, " \
|
||||
"format = (string) BGRA, " \
|
||||
"width = " GST_VIDEO_SIZE_RANGE ", " \
|
||||
"height = " GST_VIDEO_SIZE_RANGE ", " \
|
||||
"framerate = " GST_VIDEO_FPS_RANGE ", " \
|
||||
"pixel-aspect-ratio = (fraction)1/1"
|
||||
#else
|
||||
#define WPE_RAW_CAPS ""
|
||||
#endif
|
||||
|
||||
#define WPE_BASIC_CAPS "video/x-raw(memory:GLMemory), " \
|
||||
"format = (string) RGBA, " \
|
||||
|
@ -588,23 +584,6 @@ gst_wpe_video_src_event (GstPad * pad, GstObject * parent, GstEvent * event)
|
|||
case GST_NAVIGATION_EVENT_MOUSE_SCROLL:
|
||||
if (gst_navigation_event_parse_mouse_scroll_event (event, &x, &y,
|
||||
&delta_x, &delta_y)) {
|
||||
#if WPE_CHECK_VERSION(1, 6, 0)
|
||||
struct wpe_input_axis_2d_event wpe_event;
|
||||
if (delta_x) {
|
||||
wpe_event.x_axis = delta_x;
|
||||
} else {
|
||||
wpe_event.y_axis = delta_y;
|
||||
}
|
||||
wpe_event.base.time =
|
||||
GST_TIME_AS_MSECONDS (GST_EVENT_TIMESTAMP (event));
|
||||
wpe_event.base.type =
|
||||
static_cast < wpe_input_axis_event_type >
|
||||
(wpe_input_axis_event_type_mask_2d |
|
||||
wpe_input_axis_event_type_motion_smooth);
|
||||
wpe_event.base.x = (int) x;
|
||||
wpe_event.base.y = (int) y;
|
||||
src->view->dispatchAxisEvent (wpe_event.base);
|
||||
#else
|
||||
struct wpe_input_axis_event wpe_event;
|
||||
if (delta_x) {
|
||||
wpe_event.axis = 1;
|
||||
|
@ -618,7 +597,6 @@ gst_wpe_video_src_event (GstPad * pad, GstObject * parent, GstEvent * event)
|
|||
wpe_event.x = (int) x;
|
||||
wpe_event.y = (int) y;
|
||||
src->view->dispatchAxisEvent (wpe_event);
|
||||
#endif
|
||||
ret = TRUE;
|
||||
}
|
||||
break;
|
||||
|
@ -734,4 +712,4 @@ gst_wpe_video_src_class_init (GstWpeVideoSrcClass * klass)
|
|||
static_cast < GSignalFlags > (G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
|
||||
G_CALLBACK (gst_wpe_video_src_load_bytes), NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 1, G_TYPE_BYTES);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ if not gstgl_dep.found()
|
|||
endif
|
||||
|
||||
wpe_dep = dependency('wpe-webkit-1.0', version : '>= 2.28', required : get_option('wpe'))
|
||||
wpe_fdo_dep = dependency('wpebackend-fdo-1.0', required : get_option('wpe'))
|
||||
wpe_fdo_dep = dependency('wpebackend-fdo-1.0', version : '>= 1.8', required : get_option('wpe'))
|
||||
egl_dep = dependency('egl', required : get_option('wpe'))
|
||||
xkbcommon_dep = dependency('xkbcommon', version : '>= 0.8', required : get_option('wpe'))
|
||||
wl_server_dep = dependency('wayland-server', required : get_option('wpe'))
|
||||
|
|
Loading…
Reference in a new issue