mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-22 09:41:07 +00:00
gl/format: add helper for returning the number of components in a GL format
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5109>
This commit is contained in:
parent
5bf85e7588
commit
a90f6d5d67
3 changed files with 69 additions and 0 deletions
|
@ -3914,6 +3914,19 @@ See also: gst_gl_filter_render_to_target()</doc>
|
|||
</parameter>
|
||||
</parameters>
|
||||
</function>
|
||||
<function name="n_components" c:identifier="gst_gl_format_n_components" version="1.24">
|
||||
<source-position filename="../subprojects/gst-plugins-base/gst-libs/gst/gl/gstglformat.h"/>
|
||||
<return-value transfer-ownership="none">
|
||||
<doc xml:space="preserve" filename="../subprojects/gst-plugins-base/gst-libs/gst/gl/gstglformat.c">the number of components in a #GstGLFormat</doc>
|
||||
<type name="guint" c:type="guint"/>
|
||||
</return-value>
|
||||
<parameters>
|
||||
<parameter name="gl_format" transfer-ownership="none">
|
||||
<doc xml:space="preserve" filename="../subprojects/gst-plugins-base/gst-libs/gst/gl/gstglformat.c">the #GstGLFormat</doc>
|
||||
<type name="GLFormat" c:type="GstGLFormat"/>
|
||||
</parameter>
|
||||
</parameters>
|
||||
</function>
|
||||
<function name="type_from_sized_gl_format" c:identifier="gst_gl_format_type_from_sized_gl_format" version="1.16">
|
||||
<doc xml:space="preserve" filename="../subprojects/gst-plugins-base/gst-libs/gst/gl/gstglformat.c">Get the unsized format and type from @format for usage in glReadPixels,
|
||||
glTex{Sub}Image*, glTexImage* and similar functions.</doc>
|
||||
|
@ -10757,6 +10770,19 @@ The returned #GstGLContext will be shared with a GStreamer created OpenGL contex
|
|||
</parameter>
|
||||
</parameters>
|
||||
</function>
|
||||
<function name="gl_format_n_components" c:identifier="gst_gl_format_n_components" moved-to="GLFormat.n_components" version="1.24">
|
||||
<source-position filename="../subprojects/gst-plugins-base/gst-libs/gst/gl/gstglformat.h"/>
|
||||
<return-value transfer-ownership="none">
|
||||
<doc xml:space="preserve" filename="../subprojects/gst-plugins-base/gst-libs/gst/gl/gstglformat.c">the number of components in a #GstGLFormat</doc>
|
||||
<type name="guint" c:type="guint"/>
|
||||
</return-value>
|
||||
<parameters>
|
||||
<parameter name="gl_format" transfer-ownership="none">
|
||||
<doc xml:space="preserve" filename="../subprojects/gst-plugins-base/gst-libs/gst/gl/gstglformat.c">the #GstGLFormat</doc>
|
||||
<type name="GLFormat" c:type="GstGLFormat"/>
|
||||
</parameter>
|
||||
</parameters>
|
||||
</function>
|
||||
<function name="gl_format_type_from_sized_gl_format" c:identifier="gst_gl_format_type_from_sized_gl_format" moved-to="GLFormat.type_from_sized_gl_format" version="1.16">
|
||||
<doc xml:space="preserve" filename="../subprojects/gst-plugins-base/gst-libs/gst/gl/gstglformat.c">Get the unsized format and type from @format for usage in glReadPixels,
|
||||
glTex{Sub}Image*, glTexImage* and similar functions.</doc>
|
||||
|
|
|
@ -415,6 +415,47 @@ gst_gl_format_type_from_sized_gl_format (GstGLFormat format,
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_gl_format_n_components:
|
||||
* @gl_format: the #GstGLFormat
|
||||
*
|
||||
* Returns: the number of components in a #GstGLFormat
|
||||
*
|
||||
* Since: 1.24
|
||||
*/
|
||||
guint
|
||||
gst_gl_format_n_components (GstGLFormat gl_format)
|
||||
{
|
||||
switch (gl_format) {
|
||||
case GST_GL_LUMINANCE:
|
||||
case GST_GL_ALPHA:
|
||||
case GST_GL_RED:
|
||||
case GST_GL_R8:
|
||||
case GST_GL_DEPTH_COMPONENT16:
|
||||
case GST_GL_R16:
|
||||
return 1;
|
||||
case GST_GL_LUMINANCE_ALPHA:
|
||||
case GST_GL_RG:
|
||||
case GST_GL_RG8:
|
||||
case GST_GL_DEPTH24_STENCIL8:
|
||||
case GST_GL_RG16:
|
||||
return 2;
|
||||
case GST_GL_RGB:
|
||||
case GST_GL_RGB8:
|
||||
case GST_GL_RGB565:
|
||||
case GST_GL_RGB16:
|
||||
return 3;
|
||||
case GST_GL_RGBA:
|
||||
case GST_GL_RGBA8:
|
||||
case GST_GL_RGBA16:
|
||||
case GST_GL_RGB10_A2:
|
||||
return 4;
|
||||
default:
|
||||
g_warn_if_reached ();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_gl_format_is_supported:
|
||||
* @context: a #GstGLContext
|
||||
|
|
|
@ -154,6 +154,8 @@ void gst_gl_format_type_from_sized_gl_format (GstGLFormat
|
|||
GST_GL_API
|
||||
gboolean gst_gl_format_is_supported (GstGLContext * context,
|
||||
GstGLFormat format);
|
||||
GST_GL_API
|
||||
guint gst_gl_format_n_components (GstGLFormat gl_format);
|
||||
|
||||
GST_GL_API
|
||||
GstGLTextureTarget gst_gl_texture_target_from_string (const gchar * str);
|
||||
|
|
Loading…
Reference in a new issue