Skip to content

Commit

Permalink
gl: add EGLImage support
Browse files Browse the repository at this point in the history
* picked from old libgstegl:
  - GstEGLImageMemory
  - GstEGLImageAllocator
  - last_buffer management from removed GstEGLImageBufferPool

* add-ons:
  - GstEGLImageMemory now old a reference on GstGLContext
    so that it can delete the EGLImage and its gltexture source
    while having the associated gl context being current.
  - add EGLImage support for GstVideoGLTextureUploadMeta which
    mainly call EGLImageTargetTexture2D
  - GstGLBufferPool now supports GstEGLImageAllocator
  - glimagesink / glfilters / etc.. now propose GstEGLImageAllocator
    to upstream

https://bugzilla.gnome.org/show_bug.cgi?id=703343
  • Loading branch information
Julien Isorce authored and tp-m committed Dec 9, 2017
1 parent cb9521a commit c2471ae
Show file tree
Hide file tree
Showing 17 changed files with 978 additions and 63 deletions.
18 changes: 17 additions & 1 deletion ext/gl/gstglimagesink.c
Expand Up @@ -169,7 +169,9 @@ static GstStaticPadTemplate gst_glimage_sink_template =
GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE (GST_GL_UPLOAD_FORMATS) "; "
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE_WITH_FEATURES
(GST_CAPS_FEATURE_MEMORY_EGL_IMAGE,
"RGBA") "; " GST_VIDEO_CAPS_MAKE (GST_GL_UPLOAD_FORMATS) "; "
GST_VIDEO_CAPS_MAKE_WITH_FEATURES
(GST_CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META,
GST_GL_UPLOAD_FORMATS))
Expand Down Expand Up @@ -863,6 +865,8 @@ gst_glimage_sink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
GstStructure *gl_context;
gchar *platform, *gl_apis;
gpointer handle;
GstAllocator *allocator = NULL;
GstAllocationParams params;

if (!_ensure_gl_setup (glimage_sink))
return FALSE;
Expand Down Expand Up @@ -936,6 +940,18 @@ gst_glimage_sink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
g_free (platform);
gst_structure_free (gl_context);

gst_allocation_params_init (&params);

allocator = gst_allocator_find (GST_GL_MEMORY_ALLOCATOR);
gst_query_add_allocation_param (query, allocator, &params);
gst_object_unref (allocator);

#if GST_GL_HAVE_PLATFORM_EGL
allocator = gst_allocator_find (GST_EGL_IMAGE_MEMORY_TYPE);
gst_query_add_allocation_param (query, allocator, &params);
gst_object_unref (allocator);
#endif

return TRUE;

/* ERRORS */
Expand Down
8 changes: 4 additions & 4 deletions gst-libs/gst/gl/egl/Makefile.am
Expand Up @@ -4,16 +4,16 @@ noinst_LTLIBRARIES = libgstgl-egl.la

libgstgl_egl_la_SOURCES = \
gstgldisplay_egl.c \
gstglcontext_egl.c
gstglcontext_egl.c \
gsteglimagememory.c

noinst_HEADERS = \
gstglcontext_egl.h

libgstgl_eglincludedir = $(includedir)/gstreamer-@GST_API_VERSION@/gst/gl/egl
libgstgl_eglinclude_HEADERS = \
gstgldisplay_egl.h

libgstgl_egl_la_LIBADD = $(top_builddir)/gst-libs/gst/egl/libgstegl-$(GST_API_VERSION).la
gstgldisplay_egl.h \
gsteglimagememory.h

libgstgl_egl_la_CFLAGS = \
-I$(top_srcdir)/gst-libs \
Expand Down

0 comments on commit c2471ae

Please sign in to comment.