summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGwang Yoon Hwang <yoon@igalia.com>2016-01-20 03:10:38 +0900
committerMatthew Waters <matthew@centricular.com>2016-05-04 13:42:23 +1000
commit27d2cdd45dcf0bbd58c753e4b33058607153c4c1 (patch)
tree7cfe8c1439db4fae64254f076fe17dd981a8c904
parent91dd92964d2171c6e43878f93cb0980101795cf2 (diff)
omxvideodec : Use gstglmemoryegl for the RPi
Modified to use gstglmemoryegl to avoid texture creation/copy operations at the glupload. [Matthew Waters]: gst-indent the sources and port testegl to GstGLMemoryEGL https://bugzilla.gnome.org/show_bug.cgi?id=760918
-rw-r--r--examples/egl/testegl.c12
-rw-r--r--omx/gstomxvideodec.c39
2 files changed, 21 insertions, 30 deletions
diff --git a/examples/egl/testegl.c b/examples/egl/testegl.c
index 29214d6..d4b46e4 100644
--- a/examples/egl/testegl.c
+++ b/examples/egl/testegl.c
@@ -719,13 +719,7 @@ init_textures (APP_STATE_T * state, GstBuffer * buffer)
{
GstCapsFeatures *feature = gst_caps_get_features (state->caps, 0);
- if (gst_caps_features_contains (feature, "memory:EGLImage")) {
- /* nothing special to do */
- g_print ("Prepare texture for EGLImage\n");
- state->can_avoid_upload = FALSE;
- glGenTextures (1, &state->tex);
- glBindTexture (GL_TEXTURE_2D, state->tex);
- } else if (gst_caps_features_contains (feature, "memory:GLMemory")) {
+ if (gst_caps_features_contains (feature, "memory:GLMemory")) {
g_print ("Prepare texture for GLMemory\n");
state->can_avoid_upload = TRUE;
state->tex = 0;
@@ -1144,10 +1138,6 @@ init_parse_launch_player (APP_STATE_T * state, const gchar * spipeline)
./testegl "filesrc location=big_buck_bunny_720p_h264.mov ! qtdemux ! \
h264parse ! omxh264dec ! glcolorscale ! \
- video/x-raw(memory:EGLImage) ! fakesink name=vsink"
-
- ./testegl "filesrc location=big_buck_bunny_720p_h264.mov ! qtdemux ! \
- h264parse ! omxh264dec ! glcolorscale ! \
video/x-raw(memory:GLMemory) ! fakesink name=vsink"
./testegl "filesrc location=big_buck_bunny_720p_h264.mov ! qtdemux ! \
diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c
index 2368f34..39903d3 100644
--- a/omx/gstomxvideodec.c
+++ b/omx/gstomxvideodec.c
@@ -38,7 +38,7 @@
#if defined (USE_OMX_TARGET_RPI) && defined (HAVE_GST_GL)
#include <gst/gl/gl.h>
-#include <gst/gl/egl/gsteglimagememory.h>
+#include <gst/gl/egl/gstglmemoryegl.h>
#endif
#if defined (USE_OMX_TARGET_RPI) && defined(__GNUC__)
@@ -125,7 +125,7 @@ gst_omx_video_dec_class_init (GstOMXVideoDecClass * klass)
klass->cdata.type = GST_OMX_COMPONENT_TYPE_FILTER;
klass->cdata.default_src_template_caps =
#if defined (USE_OMX_TARGET_RPI) && defined (HAVE_GST_GL)
- GST_VIDEO_CAPS_MAKE_WITH_FEATURES (GST_CAPS_FEATURE_MEMORY_EGL_IMAGE,
+ GST_VIDEO_CAPS_MAKE_WITH_FEATURES (GST_CAPS_FEATURE_MEMORY_GL_MEMORY,
"RGBA") "; "
#endif
"video/x-raw, "
@@ -596,8 +596,8 @@ gst_omx_video_dec_allocate_output_buffers (GstOMXVideoDec * self)
gst_structure_free (config);
#if defined (USE_OMX_TARGET_RPI) && defined (HAVE_GST_GL)
- eglimage = self->eglimage && (allocator
- && g_strcmp0 (allocator->mem_type, GST_EGL_IMAGE_MEMORY_TYPE) == 0);
+ eglimage = self->eglimage
+ && (allocator && GST_IS_GL_MEMORY_EGL_ALLOCATOR (allocator));
#else
/* TODO: Implement something that works for other targets too */
eglimage = FALSE;
@@ -640,12 +640,12 @@ gst_omx_video_dec_allocate_output_buffers (GstOMXVideoDec * self)
for (i = 0; i < min; i++) {
GstBuffer *buffer;
GstMemory *mem;
+ GstGLMemoryEGL *gl_mem;
if (gst_buffer_pool_acquire_buffer (pool, &buffer, &params) != GST_FLOW_OK
|| gst_buffer_n_memory (buffer) != 1
|| !(mem = gst_buffer_peek_memory (buffer, 0))
- || g_strcmp0 (mem->allocator->mem_type,
- GST_EGL_IMAGE_MEMORY_TYPE) != 0) {
+ || !GST_IS_GL_MEMORY_EGL_ALLOCATOR (mem->allocator)) {
GST_INFO_OBJECT (self, "Failed to allocated %d-th EGLImage", i);
g_list_free_full (buffers, (GDestroyNotify) gst_buffer_unref);
g_list_free (images);
@@ -656,13 +656,14 @@ gst_omx_video_dec_allocate_output_buffers (GstOMXVideoDec * self)
err = OMX_ErrorUndefined;
goto done;
}
-
+ gl_mem = (GstGLMemoryEGL *) mem;
buffers = g_list_append (buffers, buffer);
- gst_egl_image_memory_set_orientation (mem,
- GST_VIDEO_GL_TEXTURE_ORIENTATION_X_NORMAL_Y_FLIP);
- images = g_list_append (images, gst_egl_image_memory_get_image (mem));
+ /* FIXME: replace with the affine transformation meta */
+ gl_mem->image->orientation =
+ GST_VIDEO_GL_TEXTURE_ORIENTATION_X_NORMAL_Y_FLIP;
+ images = g_list_append (images, gst_gl_memory_egl_get_image (gl_mem));
if (egl_display == EGL_NO_DISPLAY)
- egl_display = gst_egl_image_memory_get_display (mem);
+ egl_display = gst_gl_memory_egl_get_display (gl_mem);
}
GST_DEBUG_OBJECT (self, "Allocated %d EGLImages successfully", min);
@@ -909,8 +910,8 @@ gst_omx_video_dec_deallocate_output_buffers (GstOMXVideoDec * self)
}
#if defined (USE_OMX_TARGET_RPI) && defined (HAVE_GST_GL)
err =
- gst_omx_port_deallocate_buffers (self->
- eglimage ? self->egl_out_port : self->dec_out_port);
+ gst_omx_port_deallocate_buffers (self->eglimage ? self->
+ egl_out_port : self->dec_out_port);
#else
err = gst_omx_port_deallocate_buffers (self->dec_out_port);
#endif
@@ -954,14 +955,14 @@ gst_omx_video_dec_reconfigure_output_port (GstOMXVideoDec * self)
gst_caps_unref (state->caps);
state->caps = gst_video_info_to_caps (&state->info);
gst_caps_set_features (state->caps, 0,
- gst_caps_features_new (GST_CAPS_FEATURE_MEMORY_EGL_IMAGE, NULL));
+ gst_caps_features_new (GST_CAPS_FEATURE_MEMORY_GL_MEMORY, NULL));
/* try to negotiate with caps feature */
if (!gst_video_decoder_negotiate (GST_VIDEO_DECODER (self))) {
GST_DEBUG_OBJECT (self,
"Failed to negotiate with feature %s",
- GST_CAPS_FEATURE_MEMORY_EGL_IMAGE);
+ GST_CAPS_FEATURE_MEMORY_GL_MEMORY);
if (state->caps)
gst_caps_replace (&state->caps, NULL);
@@ -1307,8 +1308,8 @@ gst_omx_video_dec_loop (GstOMXVideoDec * self)
OMX_VIDEO_CodingUnused);
format =
- gst_omx_video_get_format_from_omx (port_def.format.
- video.eColorFormat);
+ gst_omx_video_get_format_from_omx (port_def.format.video.
+ eColorFormat);
if (format == GST_VIDEO_FORMAT_UNKNOWN) {
GST_ERROR_OBJECT (self, "Unsupported color format: %d",
@@ -2546,7 +2547,7 @@ gst_omx_video_dec_decide_allocation (GstVideoDecoder * bdec, GstQuery * query)
gst_query_parse_nth_allocation_param (query, i, &allocator, &params);
if (allocator) {
- if (g_strcmp0 (allocator->mem_type, GST_EGL_IMAGE_MEMORY_TYPE) == 0) {
+ if (GST_IS_GL_MEMORY_EGL_ALLOCATOR (allocator)) {
found = TRUE;
gst_query_set_nth_allocation_param (query, 0, allocator, &params);
while (gst_query_get_n_allocation_params (query) > 1)
@@ -2564,7 +2565,7 @@ gst_omx_video_dec_decide_allocation (GstVideoDecoder * bdec, GstQuery * query)
* and if allocator is not of type memory EGLImage then fails */
if (feature
&& gst_caps_features_contains (feature,
- GST_CAPS_FEATURE_MEMORY_EGL_IMAGE) && !found) {
+ GST_CAPS_FEATURE_MEMORY_GL_MEMORY) && !found) {
return FALSE;
}
}