glimagesink: add support for Y410 format

Sample pipeline:
gst-launch-1.0 videotestsrc ! video/x-raw,format=Y410 ! glimagesink
This commit is contained in:
Haihao Xiang 2019-10-11 22:54:02 +08:00 committed by Matthew Waters
parent 56de495f0e
commit 7ef84fb757
4 changed files with 22 additions and 4 deletions

View file

@ -924,11 +924,14 @@ _init_supported_formats (GstGLContext * context, gboolean output,
if (!context || gst_gl_format_is_supported (context, GST_GL_RGB565))
_append_value_string_list (supported_formats, "RGB16", "BGR16", NULL);
if (!context || gst_gl_format_is_supported (context, GST_GL_RGB10_A2)) {
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
if (!context || gst_gl_format_is_supported (context, GST_GL_RGB10_A2))
_append_value_string_list (supported_formats, "BGR10A2_LE", "RGB10A2_LE",
NULL);
"Y410", NULL);
#else
_append_value_string_list (supported_formats, "Y410", NULL);
#endif
}
if (!context || (gst_gl_format_is_supported (context, GST_GL_R16) &&
gst_gl_format_is_supported (context, GST_GL_RG16)))
@ -1525,6 +1528,7 @@ _get_n_textures (GstVideoFormat v_format)
case GST_VIDEO_FORMAT_ARGB64:
case GST_VIDEO_FORMAT_BGR10A2_LE:
case GST_VIDEO_FORMAT_RGB10A2_LE:
case GST_VIDEO_FORMAT_Y410:
return 1;
case GST_VIDEO_FORMAT_NV12:
case GST_VIDEO_FORMAT_NV21:
@ -1625,6 +1629,12 @@ _YUV_to_RGB (GstGLColorConvert * convert)
pixel_order[0], pixel_order[1], pixel_order[2], pixel_order[3]);
info->shader_tex_names[0] = "tex";
break;
case GST_VIDEO_FORMAT_Y410:
info->templ = &templ_AYUV_to_RGB;
info->frag_body = g_strdup_printf (templ_AYUV_to_RGB_BODY, "yxz", 'w',
pixel_order[0], pixel_order[1], pixel_order[2], pixel_order[3]);
info->shader_tex_names[0] = "tex";
break;
case GST_VIDEO_FORMAT_I420:
case GST_VIDEO_FORMAT_Y444:
case GST_VIDEO_FORMAT_Y42B:
@ -1754,6 +1764,13 @@ _RGB_to_YUV (GstGLColorConvert * convert)
pixel_order[1], pixel_order[2], pixel_order[3], "zyx", 'w', alpha);
info->out_n_textures = 1;
break;
case GST_VIDEO_FORMAT_Y410:
alpha = _is_RGBx (in_format) ? "1.0" : "texel.a";
info->templ = &templ_RGB_to_AYUV;
info->frag_body = g_strdup_printf (templ_RGB_to_AYUV_BODY, pixel_order[0],
pixel_order[1], pixel_order[2], pixel_order[3], "yxz", 'w', alpha);
info->out_n_textures = 1;
break;
case GST_VIDEO_FORMAT_I420:
case GST_VIDEO_FORMAT_YV12:
case GST_VIDEO_FORMAT_Y444:

View file

@ -95,7 +95,7 @@ struct _GstGLColorConvertClass
#define GST_GL_COLOR_CONVERT_FORMATS "{ RGBA, RGB, RGBx, BGR, BGRx, BGRA, xRGB, " \
"xBGR, ARGB, ABGR, Y444, I420, YV12, Y42B, " \
"Y41B, NV12, NV21, YUY2, UYVY, AYUV, VUYA, " \
"Y41B, NV12, NV21, YUY2, UYVY, AYUV, VUYA, Y410, " \
"GRAY8, GRAY16_LE, GRAY16_BE, RGB16, BGR16, ARGB64 " \
COLOR_CONVERT_EXT_FORMATS "}"

View file

@ -202,6 +202,7 @@ gst_gl_format_from_video_info (GstGLContext * context, GstVideoInfo * vinfo,
break;
case GST_VIDEO_FORMAT_BGR10A2_LE:
case GST_VIDEO_FORMAT_RGB10A2_LE:
case GST_VIDEO_FORMAT_Y410:
return GST_GL_RGB10_A2;
case GST_VIDEO_FORMAT_P010_10LE:
case GST_VIDEO_FORMAT_P010_10BE:

View file

@ -58,7 +58,7 @@ GType gst_gl_memory_allocator_get_type(void);
#define GST_GL_MEMORY_VIDEO_FORMATS_STR \
"{ RGBA, BGRA, RGBx, BGRx, ARGB, ABGR, xRGB, xBGR, RGB, BGR, RGB16, BGR16, " \
"AYUV, VUYA, I420, YV12, NV12, NV21, YUY2, UYVY, Y41B, Y42B, Y444, " \
"AYUV, VUYA, Y410, I420, YV12, NV12, NV21, YUY2, UYVY, Y41B, Y42B, Y444, " \
"GRAY8, GRAY16_LE, GRAY16_BE, ARGB64" MEMORY_VIDEO_EXT_FORMATS "}"
/**