From 5eb538f9e2eb22867d30a67215ad6007012e8ebf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wang=20Xin-yu=20=28=E7=8E=8B=E6=98=95=E5=AE=87=29?= Date: Mon, 20 Oct 2014 15:02:28 +0800 Subject: [PATCH] glcolorconvert: support RGB16/BGR16 video format upload https://bugzilla.gnome.org/show_bug.cgi?id=738842 --- gst-libs/gst/gl/gstglcolorconvert.c | 6 ++++++ gst-libs/gst/gl/gstglcolorconvert.h | 2 +- gst-libs/gst/gl/gstglmemory.c | 3 +++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/gst-libs/gst/gl/gstglcolorconvert.c b/gst-libs/gst/gl/gstglcolorconvert.c index 3dfbe7555c..fd89ceb0fc 100644 --- a/gst-libs/gst/gl/gstglcolorconvert.c +++ b/gst-libs/gst/gl/gstglcolorconvert.c @@ -650,6 +650,12 @@ _RGB_pixel_order (const gchar * expected, const gchar * wanted) expect = g_ascii_strdown (expected, -1); want = g_ascii_strdown (wanted, -1); + if (strcmp (expect, "rgb16") == 0 || strcmp (expect, "bgr16") == 0) { + gchar *temp = expect; + expect = g_strndup (temp, 3); + g_free (temp); + } + /* pad want with 'a's */ if ((len = strlen (want)) < 4) { gchar *new_want = g_strndup (want, 4); diff --git a/gst-libs/gst/gl/gstglcolorconvert.h b/gst-libs/gst/gl/gstglcolorconvert.h index 9b905c77b6..aa94eb1098 100644 --- a/gst-libs/gst/gl/gstglcolorconvert.h +++ b/gst-libs/gst/gl/gstglcolorconvert.h @@ -88,7 +88,7 @@ struct _GstGLColorConvertClass #define GST_GL_COLOR_CONVERT_FORMATS "{ RGB, RGBx, RGBA, BGR, BGRx, BGRA, xRGB, " \ "xBGR, ARGB, ABGR, Y444, I420, YV12, Y42B, " \ "Y41B, NV12, NV21, YUY2, UYVY, AYUV, " \ - "GRAY8, GRAY16_LE, GRAY16_BE }" + "GRAY8, GRAY16_LE, GRAY16_BE, RGB16, BGR16 }" /** * GST_GL_COLOR_CONVERT_VIDEO_CAPS: diff --git a/gst-libs/gst/gl/gstglmemory.c b/gst-libs/gst/gl/gstglmemory.c index e0b274f290..064af6e4b9 100644 --- a/gst-libs/gst/gl/gstglmemory.c +++ b/gst-libs/gst/gl/gstglmemory.c @@ -222,6 +222,9 @@ gst_gl_texture_type_from_format (GstGLContext * context, case GST_VIDEO_FORMAT_BGR: n_plane_components = 3; break; + case GST_VIDEO_FORMAT_RGB16: + case GST_VIDEO_FORMAT_BGR16: + return GST_VIDEO_GL_TEXTURE_TYPE_RGB16; case GST_VIDEO_FORMAT_GRAY16_BE: case GST_VIDEO_FORMAT_GRAY16_LE: case GST_VIDEO_FORMAT_YUY2: