gst-libs: gl: Fix documentation typo and clarify gl_memory_texsubimage
authorMarijn Suijten <marijns95@gmail.com>
Thu, 3 Sep 2020 19:19:29 +0000 (21:19 +0200)
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Wed, 9 Sep 2020 09:54:48 +0000 (09:54 +0000)
`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/806>

gst-libs/gst/gl/gstglmemory.c
gst-libs/gst/gl/gstglmemory.h
gst-libs/gst/gl/gstglmemorypbo.c
gst-libs/gst/video/video-color.c

index 900368d..566fc4a 100644 (file)
@@ -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.
@@ -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;
@@ -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);
@@ -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
@@ -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
index d3ac52f..df9cab6 100644 (file)
@@ -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);
index 0e46683..260f193 100644 (file)
@@ -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
index f376121..01f8d17 100644 (file)
@@ -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
  */
@@ -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
  */