Compare commits
6 Commits
amolenaar/
...
wip/otte/t
Author | SHA1 | Date | |
---|---|---|---|
|
b1450adf75 | ||
|
448cf774b6 | ||
|
109efee393 | ||
|
0fc6203541 | ||
|
b0b71c6df7 | ||
|
5b995b5de3 |
@@ -10,6 +10,10 @@
|
||||
((__u32)(c) << 16) | ((__u32)(d) << 24))
|
||||
#endif
|
||||
|
||||
#ifndef DRM_FORMAT_INVALID
|
||||
#define DRM_FORMAT_INVALID 0
|
||||
#endif
|
||||
|
||||
#ifndef DRM_FORMAT_C1
|
||||
#define DRM_FORMAT_C1 fourcc_code('C', '1', ' ', ' ')
|
||||
#endif
|
||||
|
@@ -5867,6 +5867,31 @@ gsk_text_node_new (PangoFont *font,
|
||||
pango_units_to_float (ink_rect.width),
|
||||
pango_units_to_float (ink_rect.height));
|
||||
|
||||
static gboolean recursion_check = FALSE;
|
||||
if (!recursion_check)
|
||||
{
|
||||
recursion_check = TRUE;
|
||||
GBytes *bytes = gsk_render_node_serialize (node);
|
||||
GskRenderNode *compare = gsk_render_node_deserialize (bytes, NULL, NULL);
|
||||
|
||||
g_assert (compare);
|
||||
|
||||
if (!gsk_rect_equal (&node->bounds, &compare->bounds))
|
||||
{
|
||||
GskRenderNode *old = node;
|
||||
g_warning ("Wrong bounds %g %g %g %g instead of %g %g %g %g for this text node: \n%s",
|
||||
node->bounds.origin.x, node->bounds.origin.y, node->bounds.size.width, node->bounds.size.height,
|
||||
compare->bounds.origin.x, compare->bounds.origin.y, compare->bounds.size.width, compare->bounds.size.height,
|
||||
(char *) g_bytes_get_data (bytes, NULL));
|
||||
node = compare;
|
||||
gsk_render_node_unref (old);
|
||||
}
|
||||
else
|
||||
gsk_render_node_unref (compare);
|
||||
g_bytes_unref (bytes);
|
||||
recursion_check = FALSE;
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
|
35
meson.build
35
meson.build
@@ -26,6 +26,7 @@ cloudproviders_req = '>= 0.3.1'
|
||||
xkbcommon_req = '>= 0.2.0'
|
||||
sysprof_req = '>= 3.38.0'
|
||||
vulkan_req = '>= 1.3'
|
||||
gstreamer_req = '>= 1.23.1'
|
||||
|
||||
fs = import('fs')
|
||||
gnome = import('gnome')
|
||||
@@ -404,21 +405,27 @@ if win32_enabled
|
||||
pangowin32_dep = dependency('pangowin32')
|
||||
endif
|
||||
|
||||
pangocairo_dep = dependency('pangocairo', version: pango_req)
|
||||
pixbuf_dep = dependency('gdk-pixbuf-2.0', version: gdk_pixbuf_req,
|
||||
default_options: ['png=enabled', 'jpeg=enabled', 'builtin_loaders=png,jpeg', 'man=false'])
|
||||
png_dep = dependency('libpng', 'png')
|
||||
tiff_dep = dependency('libtiff-4', 'tiff')
|
||||
jpeg_dep = dependency('libjpeg', 'jpeg')
|
||||
pangocairo_dep = dependency('pangocairo', version: pango_req)
|
||||
pixbuf_dep = dependency('gdk-pixbuf-2.0', version: gdk_pixbuf_req,
|
||||
default_options: ['png=enabled', 'jpeg=enabled', 'builtin_loaders=png,jpeg', 'man=false'])
|
||||
png_dep = dependency('libpng', 'png')
|
||||
tiff_dep = dependency('libtiff-4', 'tiff')
|
||||
jpeg_dep = dependency('libjpeg', 'jpeg')
|
||||
|
||||
epoxy_dep = dependency('epoxy', version: epoxy_req)
|
||||
xkbdep = dependency('xkbcommon', version: xkbcommon_req, required: wayland_enabled)
|
||||
graphene_dep = dependency('graphene-gobject-1.0', version: graphene_req,
|
||||
default_options: ['tests=false', 'gobject_types=true'])
|
||||
iso_codes_dep = dependency('iso-codes', required: false)
|
||||
gi_dep = dependency('gobject-introspection-1.0', version: introspection_req,
|
||||
required: get_option('introspection').enabled() and
|
||||
get_option('build-tests'))
|
||||
epoxy_dep = dependency('epoxy', version: epoxy_req)
|
||||
xkbdep = dependency('xkbcommon', version: xkbcommon_req, required: wayland_enabled)
|
||||
graphene_dep = dependency('graphene-gobject-1.0', version: graphene_req,
|
||||
default_options: ['tests=false', 'gobject_types=true'])
|
||||
iso_codes_dep = dependency('iso-codes', required: false)
|
||||
gi_dep = dependency('gobject-introspection-1.0', version: introspection_req,
|
||||
required: get_option('introspection').enabled() and
|
||||
get_option('build-tests'))
|
||||
gstplayer_dep = dependency('gstreamer-player-1.0', version: gstreamer_req,
|
||||
required: get_option('media-gstreamer'))
|
||||
gstgl_dep = dependency('gstreamer-gl-1.0', version: gstreamer_req,
|
||||
required: get_option('media-gstreamer'))
|
||||
gstallocators_dep = dependency('gstreamer-allocators-1.0', version: gstreamer_req,
|
||||
required: get_option('media-gstreamer'))
|
||||
|
||||
fontconfig_dep = [] # only used in x11 backend
|
||||
|
||||
|
@@ -52,10 +52,8 @@
|
||||
|
||||
#include <gst/gl/gstglfuncs.h>
|
||||
|
||||
#ifdef HAVE_GSTREAMER_DRM
|
||||
#include <gdk/gdkdmabuffourccprivate.h>
|
||||
#include <gst/allocators/gstdmabuf.h>
|
||||
#endif
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
@@ -72,17 +70,11 @@ GST_DEBUG_CATEGORY (gtk_debug_gst_sink);
|
||||
|
||||
#define NOGL_CAPS GST_VIDEO_CAPS_MAKE (FORMATS)
|
||||
|
||||
#ifdef HAVE_GSTREAMER_DRM
|
||||
# define GST_VIDEO_DMA_DRM_CAPS_MAKE_STR GST_VIDEO_DMA_DRM_CAPS_MAKE "; "
|
||||
#else
|
||||
# define GST_VIDEO_DMA_DRM_CAPS_MAKE_STR
|
||||
#endif
|
||||
|
||||
static GstStaticPadTemplate gtk_gst_sink_template =
|
||||
GST_STATIC_PAD_TEMPLATE ("sink",
|
||||
GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS (GST_VIDEO_DMA_DRM_CAPS_MAKE_STR
|
||||
GST_STATIC_CAPS (GST_VIDEO_DMA_DRM_CAPS_MAKE "; "
|
||||
"video/x-raw(" GST_CAPS_FEATURE_MEMORY_GL_MEMORY "), "
|
||||
"format = (string) RGBA, "
|
||||
"width = " GST_VIDEO_SIZE_RANGE ", "
|
||||
@@ -130,7 +122,6 @@ gtk_gst_sink_get_times (GstBaseSink *bsink,
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_GSTREAMER_DRM
|
||||
static void
|
||||
add_drm_formats_and_modifiers (GstCaps *caps,
|
||||
GdkDmabufFormats *dmabuf_formats)
|
||||
@@ -164,7 +155,6 @@ add_drm_formats_and_modifiers (GstCaps *caps,
|
||||
gst_structure_take_value (gst_caps_get_structure (caps, 0), "drm-format",
|
||||
&dmabuf_list);
|
||||
}
|
||||
#endif
|
||||
|
||||
static GstCaps *
|
||||
gtk_gst_sink_get_caps (GstBaseSink *bsink,
|
||||
@@ -176,16 +166,12 @@ gtk_gst_sink_get_caps (GstBaseSink *bsink,
|
||||
|
||||
if (self->gst_context)
|
||||
{
|
||||
tmp = gst_pad_get_pad_template_caps (GST_BASE_SINK_PAD (bsink));
|
||||
#ifdef HAVE_GSTREAMER_DRM
|
||||
{
|
||||
GdkDisplay *display = gdk_gl_context_get_display (self->gdk_context);
|
||||
GdkDmabufFormats *formats = gdk_display_get_dmabuf_formats (display);
|
||||
GdkDisplay *display = gdk_gl_context_get_display (self->gdk_context);
|
||||
GdkDmabufFormats *formats = gdk_display_get_dmabuf_formats (display);
|
||||
|
||||
tmp = gst_caps_make_writable (tmp);
|
||||
add_drm_formats_and_modifiers (tmp, formats);
|
||||
}
|
||||
#endif
|
||||
tmp = gst_pad_get_pad_template_caps (GST_BASE_SINK_PAD (bsink));
|
||||
tmp = gst_caps_make_writable (tmp);
|
||||
add_drm_formats_and_modifiers (tmp, formats);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -218,24 +204,23 @@ gtk_gst_sink_set_caps (GstBaseSink *bsink,
|
||||
|
||||
GST_DEBUG_OBJECT (self, "set caps with %" GST_PTR_FORMAT, caps);
|
||||
|
||||
#ifdef HAVE_GSTREAMER_DRM
|
||||
if (gst_video_is_dma_drm_caps (caps)) {
|
||||
if (!gst_video_info_dma_drm_from_caps (&self->drm_info, caps))
|
||||
return FALSE;
|
||||
if (gst_video_is_dma_drm_caps (caps))
|
||||
{
|
||||
if (!gst_video_info_dma_drm_from_caps (&self->drm_info, caps))
|
||||
return FALSE;
|
||||
|
||||
if (!gst_video_info_dma_drm_to_video_info (&self->drm_info, &self->v_info))
|
||||
return FALSE;
|
||||
if (!gst_video_info_dma_drm_to_video_info (&self->drm_info, &self->v_info))
|
||||
return FALSE;
|
||||
|
||||
GST_INFO_OBJECT (self, "using DMABuf, passthrough possible");
|
||||
} else {
|
||||
gst_video_info_dma_drm_init (&self->drm_info);
|
||||
#endif
|
||||
GST_INFO_OBJECT (self, "using DMABuf, passthrough possible");
|
||||
}
|
||||
else
|
||||
{
|
||||
gst_video_info_dma_drm_init (&self->drm_info);
|
||||
|
||||
if (!gst_video_info_from_caps (&self->v_info, caps))
|
||||
return FALSE;
|
||||
#ifdef HAVE_GSTREAMER_DRM
|
||||
}
|
||||
#endif
|
||||
if (!gst_video_info_from_caps (&self->v_info, caps))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -277,13 +262,11 @@ gtk_gst_sink_propose_allocation (GstBaseSink *bsink,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#ifdef HAVE_GSTREAMER_DRM
|
||||
if (gst_caps_features_contains (gst_caps_get_features (caps, 0), GST_CAPS_FEATURE_MEMORY_DMABUF))
|
||||
{
|
||||
gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE, 0);
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!gst_caps_features_contains (gst_caps_get_features (caps, 0), GST_CAPS_FEATURE_MEMORY_GL_MEMORY))
|
||||
return FALSE;
|
||||
@@ -376,7 +359,6 @@ gtk_gst_sink_texture_from_buffer (GtkGstSink *self,
|
||||
viewport->size.width = GST_VIDEO_INFO_WIDTH (&self->v_info);
|
||||
viewport->size.height = GST_VIDEO_INFO_HEIGHT (&self->v_info);
|
||||
|
||||
#ifdef HAVE_GSTREAMER_DRM
|
||||
if (gst_is_dmabuf_memory (gst_buffer_peek_memory (buffer, 0)))
|
||||
{
|
||||
g_autoptr (GdkDmabufTextureBuilder) builder = NULL;
|
||||
@@ -433,10 +415,8 @@ gtk_gst_sink_texture_from_buffer (GtkGstSink *self,
|
||||
*pixel_aspect_ratio = ((double) GST_VIDEO_INFO_PAR_N (&self->v_info) /
|
||||
(double) GST_VIDEO_INFO_PAR_D (&self->v_info));
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (self->gdk_context &&
|
||||
gst_video_frame_map (frame, &self->v_info, buffer, GST_MAP_READ | GST_MAP_GL))
|
||||
else if (self->gdk_context &&
|
||||
gst_video_frame_map (frame, &self->v_info, buffer, GST_MAP_READ | GST_MAP_GL))
|
||||
{
|
||||
GstGLSyncMeta *sync_meta;
|
||||
GdkGLTextureBuilder *builder;
|
||||
@@ -649,20 +629,8 @@ gtk_gst_sink_initialize_gl (GtkGstSink *self)
|
||||
|
||||
if (gl_api & (GST_GL_API_OPENGL3 | GST_GL_API_OPENGL))
|
||||
{
|
||||
#ifdef HAVE_GST_GL_DISPLAY_NEW_WITH_TYPE
|
||||
self->gst_display = gst_gl_display_new_with_type (GST_GL_DISPLAY_TYPE_WIN32);
|
||||
#else
|
||||
#if GST_GL_HAVE_PLATFORM_EGL
|
||||
g_message ("If media fails to play, set the envvar `GST_DEBUG=1`, and if GstGL context creation fails");
|
||||
g_message ("due to \"Couldn't create GL context: Cannot share context with non-EGL context\",");
|
||||
g_message ("set in the environment `GST_GL_PLATFORM=wgl` and `GST_GL_WINDOW=win32`,");
|
||||
g_message ("and restart the GTK application");
|
||||
#endif
|
||||
|
||||
self->gst_display = gst_gl_display_new ();
|
||||
#endif
|
||||
}
|
||||
|
||||
#if GST_GL_HAVE_PLATFORM_EGL
|
||||
else
|
||||
{
|
||||
|
@@ -47,9 +47,7 @@ struct _GtkGstSink
|
||||
GstVideoSink parent;
|
||||
|
||||
GstVideoInfo v_info;
|
||||
#ifdef HAVE_GSTREAMER_DRM
|
||||
GstVideoInfoDmaDrm drm_info;
|
||||
#endif
|
||||
|
||||
GtkGstPaintable * paintable;
|
||||
GdkGLContext * gdk_context;
|
||||
|
@@ -5,29 +5,10 @@ media_backends = []
|
||||
extra_c_args = ['-DGTK_COMPILATION']
|
||||
extra_c_args += common_cflags
|
||||
|
||||
gstplayer_dep = dependency('gstreamer-player-1.0', version: '>= 1.12.3',
|
||||
required: get_option('media-gstreamer'))
|
||||
gstgl_dep = dependency('gstreamer-gl-1.0', version: '>= 1.12.3',
|
||||
required: get_option('media-gstreamer'))
|
||||
gstdrm_dep = dependency('gstreamer-allocators-1.0', version: '>= 1.23.1',
|
||||
required: false)
|
||||
|
||||
if gstplayer_dep.found() and gstgl_dep.found()
|
||||
extra_win_cflags = []
|
||||
|
||||
if host_machine.system() == 'windows' and gstgl_dep.version().version_compare('>=1.19.1')
|
||||
message('libgstgl has gst_gl_display_new_with_type()')
|
||||
extra_win_cflags += '-DHAVE_GST_GL_DISPLAY_NEW_WITH_TYPE'
|
||||
endif
|
||||
|
||||
if gstplayer_dep.found() and gstgl_dep.found() and gstallocators_dep.found()
|
||||
media_backends += 'gstreamer'
|
||||
cdata.set('HAVE_GSTREAMER', 1)
|
||||
media_gst_deps = [ libm, libgtk_dep, gstplayer_dep, gstgl_dep ]
|
||||
|
||||
if libdrm_dep.found() and gstdrm_dep.found()
|
||||
cdata.set('HAVE_GSTREAMER_DRM', 1)
|
||||
media_gst_deps += [ gstdrm_dep ]
|
||||
endif
|
||||
media_gst_deps = [ libm, libgtk_dep, gstplayer_dep, gstgl_dep, gstallocators_dep ]
|
||||
|
||||
shared_module('media-gstreamer',
|
||||
sources: [
|
||||
@@ -35,7 +16,7 @@ if gstplayer_dep.found() and gstgl_dep.found()
|
||||
'gtkgstpaintable.c',
|
||||
'gtkgstsink.c',
|
||||
],
|
||||
c_args: extra_c_args + extra_win_cflags,
|
||||
c_args: extra_c_args,
|
||||
dependencies: media_gst_deps,
|
||||
name_suffix: module_suffix,
|
||||
install_dir: media_install_dir,
|
||||
|
Reference in New Issue
Block a user