summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMatthew Waters <matthew@centricular.com>2015-06-10 16:36:15 +1000
committerMatthew Waters <matthew@centricular.com>2015-06-12 16:59:20 +1000
commit7d8d1f8206cc5303309f8951e863b20e8fd905d0 (patch)
tree6c966dd7c0d5d7d26aceb6338a7457195d41086b /tests
parent6e88b07cc5c4ef2ad439815d0ca8b20f7a8a3c6a (diff)
downloadgstreamer-plugins-bad-7d8d1f8206cc5303309f8951e863b20e8fd905d0.tar.gz
glmemory: implement on top of glbasebuffer
Provides convenient access to PBO usage. Currently texture updates are coupled tightly to data transfers.
Diffstat (limited to 'tests')
-rw-r--r--tests/check/Makefile.am11
-rw-r--r--tests/check/libs/gstglmemory.c94
2 files changed, 58 insertions, 47 deletions
diff --git a/tests/check/Makefile.am b/tests/check/Makefile.am
index 295791b77..da8df716e 100644
--- a/tests/check/Makefile.am
+++ b/tests/check/Makefile.am
@@ -203,6 +203,7 @@ endif
if USE_GL
check_gl=libs/gstglcontext \
+ libs/gstglbuffer \
libs/gstglmemory \
libs/gstglupload \
libs/gstglcolorconvert \
@@ -489,6 +490,16 @@ libs_gstglmemory_CFLAGS = \
-DGST_USE_UNSTABLE_API \
$(GST_BASE_CFLAGS) $(GST_CFLAGS) $(AM_CFLAGS)
+libs_gstglbuffer_LDADD = \
+ $(top_builddir)/gst-libs/gst/gl/libgstgl-@GST_API_VERSION@.la \
+ $(GST_PLUGINS_BASE_LIBS) -lgstvideo-$(GST_API_VERSION) \
+ $(GST_BASE_LIBS) $(GST_LIBS) $(LDADD)
+
+libs_gstglbuffer_CFLAGS = \
+ $(GST_PLUGINS_BAD_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) \
+ -DGST_USE_UNSTABLE_API \
+ $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(AM_CFLAGS)
+
libs_gstglupload_CFLAGS = \
$(GST_PLUGINS_BAD_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) \
-DGST_USE_UNSTABLE_API \
diff --git a/tests/check/libs/gstglmemory.c b/tests/check/libs/gstglmemory.c
index 74ab15b83..bc9348dd4 100644
--- a/tests/check/libs/gstglmemory.c
+++ b/tests/check/libs/gstglmemory.c
@@ -79,7 +79,7 @@ GST_START_TEST (test_basic)
/* test init params */
fail_if (gst_video_info_is_equal (&v_info, &gl_mem->info) == FALSE);
- fail_if (gl_mem->context != context);
+ fail_if (gl_mem->mem.context != context);
fail_if (gl_mem->tex_id == 0);
/* copy the memory */
@@ -90,7 +90,7 @@ GST_START_TEST (test_basic)
/* test params */
fail_if (gst_video_info_is_equal (&gl_mem2->info,
&gl_mem->info) == FALSE);
- fail_if (gl_mem->context != gl_mem2->context);
+ fail_if (gl_mem->mem.context != gl_mem2->mem.context);
if (gst_gl_context_get_error ())
printf ("%s\n", gst_gl_context_get_error ());
@@ -125,10 +125,10 @@ GST_START_TEST (test_transfer)
/* texture creation */
mem = (GstMemory *) gst_gl_memory_alloc (context, NULL, &v_info, 0, NULL);
- fail_unless (!GST_GL_MEMORY_FLAG_IS_SET (mem,
- GST_GL_MEMORY_FLAG_NEED_UPLOAD));
- fail_unless (!GST_GL_MEMORY_FLAG_IS_SET (mem,
- GST_GL_MEMORY_FLAG_NEED_DOWNLOAD));
+ fail_unless (!GST_MEMORY_FLAG_IS_SET (mem,
+ GST_GL_BASE_BUFFER_FLAG_NEED_UPLOAD));
+ fail_unless (!GST_MEMORY_FLAG_IS_SET (mem,
+ GST_GL_BASE_BUFFER_FLAG_NEED_DOWNLOAD));
/* test wrapping raw data */
mem2 =
@@ -136,27 +136,27 @@ GST_START_TEST (test_transfer)
rgba_pixel, NULL, NULL);
fail_if (mem == NULL);
- fail_unless (GST_GL_MEMORY_FLAG_IS_SET (mem2,
- GST_GL_MEMORY_FLAG_NEED_UPLOAD));
- fail_unless (!GST_GL_MEMORY_FLAG_IS_SET (mem2,
- GST_GL_MEMORY_FLAG_NEED_DOWNLOAD));
+ fail_unless (GST_MEMORY_FLAG_IS_SET (mem2,
+ GST_GL_BASE_BUFFER_FLAG_NEED_UPLOAD));
+ fail_unless (!GST_MEMORY_FLAG_IS_SET (mem2,
+ GST_GL_BASE_BUFFER_FLAG_NEED_DOWNLOAD));
/* wrapped texture creation */
mem3 = (GstMemory *) gst_gl_memory_wrapped_texture (context,
((GstGLMemory *) mem)->tex_id, GL_TEXTURE_2D, &v_info, 0, NULL, NULL,
NULL);
- fail_unless (!GST_GL_MEMORY_FLAG_IS_SET (mem3,
- GST_GL_MEMORY_FLAG_NEED_UPLOAD));
- fail_unless (GST_GL_MEMORY_FLAG_IS_SET (mem3,
- GST_GL_MEMORY_FLAG_NEED_DOWNLOAD));
+ fail_unless (!GST_MEMORY_FLAG_IS_SET (mem3,
+ GST_GL_BASE_BUFFER_FLAG_NEED_UPLOAD));
+ fail_unless (GST_MEMORY_FLAG_IS_SET (mem3,
+ GST_GL_BASE_BUFFER_FLAG_NEED_DOWNLOAD));
/* check data/flags are correct */
fail_unless (gst_memory_map (mem2, &map_info, GST_MAP_READ));
- fail_unless (GST_GL_MEMORY_FLAG_IS_SET (mem2,
- GST_GL_MEMORY_FLAG_NEED_UPLOAD));
- fail_unless (!GST_GL_MEMORY_FLAG_IS_SET (mem2,
- GST_GL_MEMORY_FLAG_NEED_DOWNLOAD));
+ fail_unless (GST_MEMORY_FLAG_IS_SET (mem2,
+ GST_GL_BASE_BUFFER_FLAG_NEED_UPLOAD));
+ fail_unless (!GST_MEMORY_FLAG_IS_SET (mem2,
+ GST_GL_BASE_BUFFER_FLAG_NEED_DOWNLOAD));
fail_unless (((gchar *) map_info.data)[0] == rgba_pixel[0]);
fail_unless (((gchar *) map_info.data)[1] == rgba_pixel[1]);
@@ -165,32 +165,32 @@ GST_START_TEST (test_transfer)
gst_memory_unmap (mem2, &map_info);
- fail_unless (GST_GL_MEMORY_FLAG_IS_SET (mem2,
- GST_GL_MEMORY_FLAG_NEED_UPLOAD));
- fail_unless (!GST_GL_MEMORY_FLAG_IS_SET (mem2,
- GST_GL_MEMORY_FLAG_NEED_DOWNLOAD));
+ fail_unless (GST_MEMORY_FLAG_IS_SET (mem2,
+ GST_GL_BASE_BUFFER_FLAG_NEED_UPLOAD));
+ fail_unless (!GST_MEMORY_FLAG_IS_SET (mem2,
+ GST_GL_BASE_BUFFER_FLAG_NEED_DOWNLOAD));
fail_unless (gst_memory_map (mem2, &map_info, GST_MAP_READ | GST_MAP_GL));
- fail_unless (!GST_GL_MEMORY_FLAG_IS_SET (mem2,
- GST_GL_MEMORY_FLAG_NEED_UPLOAD));
- fail_unless (!GST_GL_MEMORY_FLAG_IS_SET (mem2,
- GST_GL_MEMORY_FLAG_NEED_DOWNLOAD));
+ fail_unless (!GST_MEMORY_FLAG_IS_SET (mem2,
+ GST_GL_BASE_BUFFER_FLAG_NEED_UPLOAD));
+ fail_unless (!GST_MEMORY_FLAG_IS_SET (mem2,
+ GST_GL_BASE_BUFFER_FLAG_NEED_DOWNLOAD));
/* test texture copy */
fail_unless (gst_gl_memory_copy_into_texture ((GstGLMemory *) mem2,
((GstGLMemory *) mem)->tex_id, GST_VIDEO_GL_TEXTURE_TYPE_RGBA, 1, 1,
4, FALSE));
- GST_GL_MEMORY_FLAG_SET (mem, GST_GL_MEMORY_FLAG_NEED_DOWNLOAD);
+ GST_MINI_OBJECT_FLAG_SET (mem, GST_GL_BASE_BUFFER_FLAG_NEED_DOWNLOAD);
- fail_unless (!GST_GL_MEMORY_FLAG_IS_SET (mem2,
- GST_GL_MEMORY_FLAG_NEED_UPLOAD));
- fail_unless (!GST_GL_MEMORY_FLAG_IS_SET (mem2,
- GST_GL_MEMORY_FLAG_NEED_DOWNLOAD));
- fail_unless (!GST_GL_MEMORY_FLAG_IS_SET (mem,
- GST_GL_MEMORY_FLAG_NEED_UPLOAD));
- fail_unless (GST_GL_MEMORY_FLAG_IS_SET (mem,
- GST_GL_MEMORY_FLAG_NEED_DOWNLOAD));
+ fail_unless (!GST_MEMORY_FLAG_IS_SET (mem2,
+ GST_GL_BASE_BUFFER_FLAG_NEED_UPLOAD));
+ fail_unless (!GST_MEMORY_FLAG_IS_SET (mem2,
+ GST_GL_BASE_BUFFER_FLAG_NEED_DOWNLOAD));
+ fail_unless (!GST_MEMORY_FLAG_IS_SET (mem,
+ GST_GL_BASE_BUFFER_FLAG_NEED_UPLOAD));
+ fail_unless (GST_MEMORY_FLAG_IS_SET (mem,
+ GST_GL_BASE_BUFFER_FLAG_NEED_DOWNLOAD));
gst_memory_unmap (mem2, &map_info);
@@ -207,10 +207,10 @@ GST_START_TEST (test_transfer)
/* test download of wrapped copied texture */
fail_unless (gst_memory_map (mem3, &map_info, GST_MAP_READ));
- fail_unless (!GST_GL_MEMORY_FLAG_IS_SET (mem,
- GST_GL_MEMORY_FLAG_NEED_UPLOAD));
- fail_unless (!GST_GL_MEMORY_FLAG_IS_SET (mem,
- GST_GL_MEMORY_FLAG_NEED_DOWNLOAD));
+ fail_unless (!GST_MEMORY_FLAG_IS_SET (mem,
+ GST_GL_BASE_BUFFER_FLAG_NEED_UPLOAD));
+ fail_unless (!GST_MEMORY_FLAG_IS_SET (mem,
+ GST_GL_BASE_BUFFER_FLAG_NEED_DOWNLOAD));
fail_unless (((gchar *) map_info.data)[0] == rgba_pixel[0]);
fail_unless (((gchar *) map_info.data)[1] == rgba_pixel[1]);
@@ -223,19 +223,19 @@ GST_START_TEST (test_transfer)
fail_unless (gst_memory_map (mem3, &map_info, GST_MAP_WRITE));
gst_memory_unmap (mem3, &map_info);
- fail_unless (GST_GL_MEMORY_FLAG_IS_SET (mem3,
- GST_GL_MEMORY_FLAG_NEED_UPLOAD));
- fail_unless (!GST_GL_MEMORY_FLAG_IS_SET (mem3,
- GST_GL_MEMORY_FLAG_NEED_DOWNLOAD));
+ fail_unless (GST_MEMORY_FLAG_IS_SET (mem3,
+ GST_GL_BASE_BUFFER_FLAG_NEED_UPLOAD));
+ fail_unless (!GST_MEMORY_FLAG_IS_SET (mem3,
+ GST_GL_BASE_BUFFER_FLAG_NEED_DOWNLOAD));
/* test download flag */
fail_unless (gst_memory_map (mem3, &map_info, GST_MAP_WRITE | GST_MAP_GL));
gst_memory_unmap (mem3, &map_info);
- fail_unless (!GST_GL_MEMORY_FLAG_IS_SET (mem3,
- GST_GL_MEMORY_FLAG_NEED_UPLOAD));
- fail_unless (GST_GL_MEMORY_FLAG_IS_SET (mem3,
- GST_GL_MEMORY_FLAG_NEED_DOWNLOAD));
+ fail_unless (!GST_MEMORY_FLAG_IS_SET (mem3,
+ GST_GL_BASE_BUFFER_FLAG_NEED_UPLOAD));
+ fail_unless (GST_MEMORY_FLAG_IS_SET (mem3,
+ GST_GL_BASE_BUFFER_FLAG_NEED_DOWNLOAD));
if (gst_gl_context_get_error ())
printf ("%s\n", gst_gl_context_get_error ());