Skip to content

Commit

Permalink
gst-libs: gl: Fix documentation typo and clarify gl_memory_texsubimage
Browse files Browse the repository at this point in the history
`gst_gl_memory_read_pixels` reads pixels from `GLMemory` into the
pointer, effectively writing to it. This is opposite from
`gst_gl_memory_texsubimage` which reads texture data from `read_pointer`
into `GLMemory`.

Both cases are clarified by changing `read_pointer` to `write_pointer`,
and explaining what `gst_gl_memory_texsubimage` does in addition to
referring back to `gst_gl_memory_read_pixels`.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/847>
  • Loading branch information
MarijnS95 authored and tp-m committed Oct 2, 2020
1 parent 0c1c69b commit 83047de
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
14 changes: 8 additions & 6 deletions gst-libs/gst/gl/gstglmemory.c
Expand Up @@ -360,10 +360,10 @@ gst_gl_memory_init (GstGLMemory * mem, GstAllocator * allocator,
/**
* gst_gl_memory_read_pixels:
* @gl_mem: a #GstGLMemory
* @read_pointer: the data pointer to pass to glReadPixels
* @write_pointer: the data pointer to pass to glReadPixels
*
* Reads the texture in #GstGLMemory into @read_pointer if no buffer is bound
* to `GL_PIXEL_PACK_BUFFER`. Otherwise @read_pointer is the byte offset into
* Reads the texture in #GstGLMemory into @write_pointer if no buffer is bound
* to `GL_PIXEL_PACK_BUFFER`. Otherwise @write_pointer is the byte offset into
* the currently bound `GL_PIXEL_PACK_BUFFER` buffer to store the result of
* glReadPixels. See the OpenGL specification for glReadPixels for more
* details.
Expand All @@ -373,7 +373,7 @@ gst_gl_memory_init (GstGLMemory * mem, GstAllocator * allocator,
* Since: 1.8
*/
gboolean
gst_gl_memory_read_pixels (GstGLMemory * gl_mem, gpointer read_pointer)
gst_gl_memory_read_pixels (GstGLMemory * gl_mem, gpointer write_pointer)
{
GstGLContext *context = gl_mem->mem.context;
const GstGLFuncs *gl = context->gl_vtable;
Expand Down Expand Up @@ -419,7 +419,7 @@ gst_gl_memory_read_pixels (GstGLMemory * gl_mem, gpointer read_pointer)

_gst_gl_memory_start_log (gl_mem, "glReadPixels");
gl->ReadPixels (0, 0, gl_mem->tex_width, GL_MEM_HEIGHT (gl_mem), format,
type, read_pointer);
type, write_pointer);
_gst_gl_memory_end_log (gl_mem);

gl->BindFramebuffer (GL_FRAMEBUFFER, 0);
Expand Down Expand Up @@ -518,6 +518,8 @@ _upload_cpu_write (GstGLMemory * gl_mem, GstMapInfo * info, gsize maxsize)
* @gl_mem: a #GstGLMemory
* @read_pointer: the data pointer to pass to glTexSubImage
*
* Reads the texture in @read_pointer into @gl_mem.
*
* See gst_gl_memory_read_pixels() for what @read_pointer signifies.
*
* Since: 1.8
Expand Down Expand Up @@ -982,7 +984,7 @@ gst_gl_memory_allocator_init (GstGLMemoryAllocator * allocator)
* @width: width of @tex_id
* @height: height of @tex_id
*
* Copies @gl_mem into the texture specfified by @tex_id. The format of @tex_id
* Copies @gl_mem into the texture specified by @tex_id. The format of @tex_id
* is specified by @tex_format, @width and @height.
*
* Returns: Whether the copy succeeded
Expand Down
2 changes: 1 addition & 1 deletion gst-libs/gst/gl/gstglmemory.h
Expand Up @@ -285,7 +285,7 @@ gboolean gst_gl_memory_copy_teximage (GstGLMemory * src,

GST_GL_API
gboolean gst_gl_memory_read_pixels (GstGLMemory * gl_mem,
gpointer read_pointer);
gpointer write_pointer);
GST_GL_API
void gst_gl_memory_texsubimage (GstGLMemory * gl_mem,
gpointer read_pointer);
Expand Down
2 changes: 1 addition & 1 deletion gst-libs/gst/gl/gstglmemorypbo.c
Expand Up @@ -701,7 +701,7 @@ gst_gl_memory_pbo_allocator_init (GstGLMemoryPBOAllocator * allocator)
* @stride: stride of the backing texture data
* @respecify: whether to copy the data or copy per texel
*
* Copies @gl_mem into the texture specfified by @tex_id. The format of @tex_id
* Copies @gl_mem into the texture specified by @tex_id. The format of @tex_id
* is specified by @tex_format, @width and @height.
*
* If @respecify is %TRUE, then the copy is performed in terms of the texture
Expand Down
4 changes: 2 additions & 2 deletions gst-libs/gst/video/video-color.c
Expand Up @@ -411,7 +411,7 @@ gst_video_color_matrix_get_Kr_Kb (GstVideoColorMatrix matrix, gdouble * Kr,
* Depending on @func, different formulas might be applied. Some formulas
* encode a linear segment in the lower range.
*
* Returns: the gamme encoded value of @val
* Returns: the gamma encoded value of @val
*
* Since: 1.6
*/
Expand Down Expand Up @@ -529,7 +529,7 @@ gst_video_color_transfer_encode (GstVideoTransferFunction func, gdouble val)
* Depending on @func, different formulas might be applied. Some formulas
* encode a linear segment in the lower range.
*
* Returns: the gamme decoded value of @val
* Returns: the gamma decoded value of @val
*
* Since: 1.6
*/
Expand Down

0 comments on commit 83047de

Please sign in to comment.