summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaihua Hu <jared.hu@nxp.com>2017-05-25 11:05:47 +0800
committerSebastian Dröge <sebastian@centricular.com>2017-05-25 12:34:12 +0300
commitc2b2c68beaddbea0ec4fe7b099507cc492f6dd7c (patch)
tree1faea7f37503de6d415acf0fe2278d620df8e281
parent405d059a224b14c58c5ba0eada8aec849455c262 (diff)
glformat: fix the usage of GST_GL_RGB565
GL_RGB565 is sized internal glformat, the corresponding glformat should be GL_RGB and type is GL_UNSIGNED_SHORT_565. Otherwise will return GL_INVALID_ENUM when creating texture. https://bugzilla.gnome.org/show_bug.cgi?id=783066
-rw-r--r--gst-libs/gst/gl/gstglformat.c2
-rw-r--r--gst-libs/gst/gl/gstglmemory.c8
-rw-r--r--gst-libs/gst/gl/gstglmemorypbo.c4
-rw-r--r--gst-libs/gst/gl/gstglrenderbuffer.c4
4 files changed, 13 insertions, 5 deletions
diff --git a/gst-libs/gst/gl/gstglformat.c b/gst-libs/gst/gl/gstglformat.c
index e44968846..1aeb09db3 100644
--- a/gst-libs/gst/gl/gstglformat.c
+++ b/gst-libs/gst/gl/gstglformat.c
@@ -234,7 +234,7 @@ gst_gl_sized_gl_format_from_gl_format_type (GstGLContext * context,
&& !USING_GLES3 (context) ? GST_GL_RGB : GST_GL_RGB8;
break;
case GL_UNSIGNED_SHORT_5_6_5:
- return GST_GL_RGB;
+ return GST_GL_RGB565;
break;
}
break;
diff --git a/gst-libs/gst/gl/gstglmemory.c b/gst-libs/gst/gl/gstglmemory.c
index 0a06086c6..c762a9fb3 100644
--- a/gst-libs/gst/gl/gstglmemory.c
+++ b/gst-libs/gst/gl/gstglmemory.c
@@ -245,8 +245,10 @@ _gl_tex_create (GstGLMemory * gl_mem, GError ** error)
tex_format = gl_mem->tex_format;
tex_type = GL_UNSIGNED_BYTE;
- if (gl_mem->tex_format == GST_GL_RGB565)
+ if (gl_mem->tex_format == GST_GL_RGB565) {
+ tex_format = GST_GL_RGB;
tex_type = GL_UNSIGNED_SHORT_5_6_5;
+ }
internal_format =
gst_gl_sized_gl_format_from_gl_format_type (context, tex_format,
@@ -779,8 +781,10 @@ _gl_tex_copy_thread (GstGLContext * context, gpointer data)
out_tex_target = gst_gl_texture_target_to_gl (copy_params->tex_target);
out_gl_format = copy_params->src->tex_format;
out_gl_type = GL_UNSIGNED_BYTE;
- if (copy_params->out_format == GST_GL_RGB565)
+ if (copy_params->out_format == GST_GL_RGB565) {
+ out_gl_format = GST_GL_RGB;
out_gl_type = GL_UNSIGNED_SHORT_5_6_5;
+ }
internal_format =
gst_gl_sized_gl_format_from_gl_format_type (context, out_gl_format,
diff --git a/gst-libs/gst/gl/gstglmemorypbo.c b/gst-libs/gst/gl/gstglmemorypbo.c
index a7cf042f2..89091c80b 100644
--- a/gst-libs/gst/gl/gstglmemorypbo.c
+++ b/gst-libs/gst/gl/gstglmemorypbo.c
@@ -419,8 +419,10 @@ _gl_mem_copy_thread (GstGLContext * context, gpointer data)
gl = context->gl_vtable;
out_gl_format = copy_params->out_format;
out_gl_type = GL_UNSIGNED_BYTE;
- if (copy_params->out_format == GST_GL_RGB565)
+ if (copy_params->out_format == GST_GL_RGB565) {
+ out_gl_format = GST_GL_RGB;
out_gl_type = GL_UNSIGNED_SHORT_5_6_5;
+ }
in_gl_format = src->mem.tex_format;
in_gl_type = GL_UNSIGNED_BYTE;
if (src->mem.tex_format == GST_GL_RGB565)
diff --git a/gst-libs/gst/gl/gstglrenderbuffer.c b/gst-libs/gst/gl/gstglrenderbuffer.c
index c3e36f6b5..9a3c0c69e 100644
--- a/gst-libs/gst/gl/gstglrenderbuffer.c
+++ b/gst-libs/gst/gl/gstglrenderbuffer.c
@@ -86,8 +86,10 @@ _gl_rbo_create (GstGLRenderbuffer * gl_mem, GError ** error)
tex_format = gl_mem->renderbuffer_format;
renderbuffer_type = GL_UNSIGNED_BYTE;
- if (gl_mem->renderbuffer_format == GST_GL_RGB565)
+ if (gl_mem->renderbuffer_format == GST_GL_RGB565) {
+ tex_format = GST_GL_RGB;
renderbuffer_type = GL_UNSIGNED_SHORT_5_6_5;
+ }
internal_format =
gst_gl_sized_gl_format_from_gl_format_type (context, tex_format,