gl,video: Make ptrs to VideoInfo and (GL)AllocationParams immutable
authorMarijn Suijten <marijns95@gmail.com>
Mon, 4 Jan 2021 22:25:10 +0000 (23:25 +0100)
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Thu, 14 Jan 2021 11:53:10 +0000 (11:53 +0000)
These parameters are incorrectly regarded as mutable in G-IR making them
"incompatible" with languages that are explicit about mutability like
Rust. In order to clean up the code and expected API there, update the
signatures here, right at the source (instead of overriding them in
Gir.toml and hoping for the best).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1005>

38 files changed:
ext/gl/gltestsrc.c
ext/gl/gltestsrc.h
ext/gl/gstglimagesink.c
gst-libs/gst/gl/egl/gsteglimage.c
gst-libs/gst/gl/egl/gsteglimage.h
gst-libs/gst/gl/egl/gsteglimage_private.h
gst-libs/gst/gl/gstglbasememory.c
gst-libs/gst/gl/gstglbasememory.h
gst-libs/gst/gl/gstglbuffer.c
gst-libs/gst/gl/gstglbuffer.h
gst-libs/gst/gl/gstglbufferpool.c
gst-libs/gst/gl/gstglbufferpool.h
gst-libs/gst/gl/gstglcolorconvert.c
gst-libs/gst/gl/gstglformat.c
gst-libs/gst/gl/gstglformat.h
gst-libs/gst/gl/gstglmemory.c
gst-libs/gst/gl/gstglmemory.h
gst-libs/gst/gl/gstglmemorypbo.c
gst-libs/gst/gl/gstglrenderbuffer.c
gst-libs/gst/gl/gstglrenderbuffer.h
gst-libs/gst/gl/gstglutils.c
gst-libs/gst/gl/gstglutils.h
gst-libs/gst/gl/gstglviewconvert.c
gst-libs/gst/pbutils/gstaudiovisualizer.c
gst-libs/gst/video/gstvideopool.c
gst-libs/gst/video/gstvideopool.h
gst-libs/gst/video/video-converter.c
gst-libs/gst/video/video-converter.h
gst-libs/gst/video/video-frame.c
gst-libs/gst/video/video-frame.h
gst-libs/gst/video/video-info.c
gst-libs/gst/video/video-info.h
gst-libs/gst/video/video-overlay-composition.c
gst/compositor/compositor.c
gst/videoscale/gstvideoscale.c
sys/xvimage/xvcontext.c
sys/xvimage/xvcontext.h
tests/check/libs/gstglmemory.c

index 04b2dfe..d353166 100644 (file)
@@ -166,7 +166,8 @@ _unbind_buffer (struct SrcShader *src)
 }
 
 static gboolean
-_src_shader_init (gpointer impl, GstGLContext * context, GstVideoInfo * v_info)
+_src_shader_init (gpointer impl, GstGLContext * context,
+    const GstVideoInfo * v_info)
 {
   struct SrcShader *src = impl;
   const GstGLFuncs *gl = context->gl_vtable;
@@ -280,7 +281,7 @@ static const gchar *snow_vertex_src =
     "   out_uv = position.xy;\n"
     "}";
 
-static const gchar *snow_fragment_src = 
+static const gchar *snow_fragment_src =
     "uniform float time;\n"
     "varying vec2 out_uv;\n"
     "\n"
@@ -314,7 +315,8 @@ _src_smpte_new (GstGLTestSrc * test)
 }
 
 static gboolean
-_src_smpte_init (gpointer impl, GstGLContext * context, GstVideoInfo * v_info)
+_src_smpte_init (gpointer impl, GstGLContext * context,
+    const GstVideoInfo * v_info)
 {
   struct SrcSMPTE *src = impl;
   struct XYZWRGB *coord;
@@ -595,7 +597,7 @@ _src_uni_color_new (GstGLTestSrc * test)
 
 static gboolean
 _src_uni_color_init (gpointer impl, GstGLContext * context,
-    GstVideoInfo * v_info)
+    const GstVideoInfo * v_info)
 {
   struct SrcUniColor *src = impl;
 
@@ -712,7 +714,7 @@ struct SrcCheckers
 
 static gboolean
 _src_checkers_init (gpointer impl, GstGLContext * context,
-    GstVideoInfo * v_info)
+    const GstVideoInfo * v_info)
 {
   struct SrcCheckers *src = impl;
   GError *error = NULL;
@@ -813,7 +815,8 @@ SRC_CHECKERS (4);
 SRC_CHECKERS (8);
 
 static gboolean
-_src_snow_init (gpointer impl, GstGLContext * context, GstVideoInfo * v_info)
+_src_snow_init (gpointer impl, GstGLContext * context,
+    const GstVideoInfo * v_info)
 {
   struct SrcShader *src = impl;
   GError *error = NULL;
@@ -918,7 +921,7 @@ static const gchar *mandelbrot_vertex_src = "attribute vec4 position;\n"
     "  fractal_position *= 2.5;\n"
     "}";
 
-static const gchar *mandelbrot_fragment_src = 
+static const gchar *mandelbrot_fragment_src =
     "uniform float time;\n"
     "varying vec2 fractal_position;\n"
     "const vec4 K = vec4(1.0, 0.66, 0.33, 3.0);\n"
@@ -952,7 +955,7 @@ static const gchar *mandelbrot_fragment_src =
 
 static gboolean
 _src_mandelbrot_init (gpointer impl, GstGLContext * context,
-    GstVideoInfo * v_info)
+    const GstVideoInfo * v_info)
 {
   struct SrcShader *src = impl;
   GError *error = NULL;
@@ -1080,7 +1083,7 @@ static const gchar *circular_fragment_src =
 
 static gboolean
 _src_circular_init (gpointer impl, GstGLContext * context,
-    GstVideoInfo * v_info)
+    const GstVideoInfo * v_info)
 {
   struct SrcShader *src = impl;
   GError *error = NULL;
index dbcab0c..29b42fd 100644 (file)
@@ -71,7 +71,7 @@ struct SrcFuncs
 {
   GstGLTestSrcPattern pattern;
   gpointer (*new) (GstGLTestSrc * src);
-  gboolean (*init) (gpointer impl, GstGLContext * context, GstVideoInfo * v_info);
+  gboolean (*init) (gpointer impl, GstGLContext * context, const GstVideoInfo * v_info);
   gboolean (*fill_bound_fbo) (gpointer impl);
   void (*free) (gpointer impl);
 };
index 2c023ce..72d8ac6 100644 (file)
@@ -1426,7 +1426,7 @@ gst_glimage_sink_get_caps (GstBaseSink * bsink, GstCaps * filter)
 
 static gboolean
 configure_display_from_info (GstGLImageSink * glimage_sink,
-    GstVideoInfo * vinfo)
+    const GstVideoInfo * vinfo)
 {
   gint width;
   gint height;
index 3185381..6622617 100644 (file)
@@ -460,7 +460,7 @@ gst_egl_image_from_texture (GstGLContext * context, GstGLMemory * gl_mem,
  * target.
  */
 static int
-_drm_rgba_fourcc_from_info (GstVideoInfo * info, int plane,
+_drm_rgba_fourcc_from_info (const GstVideoInfo * info, int plane,
     GstGLFormat * out_format)
 {
   GstVideoFormat format = GST_VIDEO_INFO_FORMAT (info);
@@ -571,7 +571,7 @@ _drm_rgba_fourcc_from_info (GstVideoInfo * info, int plane,
  */
 GstEGLImage *
 gst_egl_image_from_dmabuf (GstGLContext * context,
-    gint dmabuf, GstVideoInfo * in_info, gint plane, gsize offset)
+    gint dmabuf, const GstVideoInfo * in_info, gint plane, gsize offset)
 {
   GstGLFormat format = 0;
   guintptr attribs[13];
@@ -621,7 +621,7 @@ gst_egl_image_from_dmabuf (GstGLContext * context,
  * YUV->RGB conversion matrices etc.)
  */
 static int
-_drm_direct_fourcc_from_info (GstVideoInfo * info)
+_drm_direct_fourcc_from_info (const GstVideoInfo * info)
 {
   GstVideoFormat format = GST_VIDEO_INFO_FORMAT (info);
 
@@ -729,7 +729,7 @@ _drm_direct_fourcc_from_info (GstVideoInfo * info)
  */
 gboolean
 gst_egl_image_check_dmabuf_direct (GstGLContext * context,
-    GstVideoInfo * in_info, GstGLTextureTarget target)
+    const GstVideoInfo * in_info, GstGLTextureTarget target)
 {
   EGLDisplay egl_display = EGL_DEFAULT_DISPLAY;
   GstGLDisplayEGL *display_egl;
@@ -857,7 +857,7 @@ gst_egl_image_check_dmabuf_direct (GstGLContext * context,
  */
 GstEGLImage *
 gst_egl_image_from_dmabuf_direct_target (GstGLContext * context,
-    gint * fd, gsize * offset, GstVideoInfo * in_info,
+    gint * fd, const gsize * offset, const GstVideoInfo * in_info,
     GstGLTextureTarget target)
 {
 
@@ -1022,7 +1022,7 @@ gst_egl_image_from_dmabuf_direct_target (GstGLContext * context,
  */
 GstEGLImage *
 gst_egl_image_from_dmabuf_direct (GstGLContext * context,
-    gint * fd, gsize * offset, GstVideoInfo * in_info)
+    gint * fd, const gsize * offset, const GstVideoInfo * in_info)
 {
   return gst_egl_image_from_dmabuf_direct_target (context, fd, offset, in_info,
       GST_GL_TEXTURE_TARGET_2D);
index 6aa56a4..f90fa82 100644 (file)
@@ -85,19 +85,19 @@ GstEGLImage *           gst_egl_image_from_texture              (GstGLContext *
 GST_GL_API
 GstEGLImage *           gst_egl_image_from_dmabuf               (GstGLContext * context,
                                                                  gint dmabuf,
-                                                                 GstVideoInfo * in_info,
+                                                                 const GstVideoInfo * in_info,
                                                                  gint plane,
                                                                  gsize offset);
 GST_GL_API
 GstEGLImage *           gst_egl_image_from_dmabuf_direct        (GstGLContext * context,
                                                                  gint *fd,
-                                                                 gsize *offset,
-                                                                 GstVideoInfo * in_info);
+                                                                 const gsize *offset,
+                                                                 const GstVideoInfo * in_info);
 GST_GL_API
 GstEGLImage *           gst_egl_image_from_dmabuf_direct_target (GstGLContext * context,
                                                                  gint *fd,
-                                                                 gsize *offset,
-                                                                 GstVideoInfo * in_info,
+                                                                 const gsize *offset,
+                                                                 const GstVideoInfo * in_info,
                                                                  GstGLTextureTarget target);
 
 GST_GL_API
index f98287c..6544549 100644 (file)
@@ -28,7 +28,7 @@ G_BEGIN_DECLS
 
 G_GNUC_INTERNAL
 gboolean                gst_egl_image_check_dmabuf_direct       (GstGLContext * context,
-                                                                 GstVideoInfo * in_info,
+                                                                 const GstVideoInfo * in_info,
                                                                  GstGLTextureTarget target);
 
 
index 534b313..832a8b2 100644 (file)
@@ -128,8 +128,9 @@ _mem_create_gl (GstGLContext * context, struct create_data *transfer)
  */
 void
 gst_gl_base_memory_init (GstGLBaseMemory * mem, GstAllocator * allocator,
-    GstMemory * parent, GstGLContext * context, GstAllocationParams * params,
-    gsize size, gpointer user_data, GDestroyNotify notify)
+    GstMemory * parent, GstGLContext * context,
+    const GstAllocationParams * params, gsize size, gpointer user_data,
+    GDestroyNotify notify)
 {
   gsize align = gst_memory_alignment, offset = 0, maxsize;
   GstMemoryFlags flags = 0;
@@ -631,7 +632,7 @@ gboolean
 gst_gl_allocation_params_init (GstGLAllocationParams * params,
     gsize struct_size, guint alloc_flags, GstGLAllocationParamsCopyFunc copy,
     GstGLAllocationParamsFreeFunc free, GstGLContext * context,
-    gsize alloc_size, GstAllocationParams * alloc_params,
+    gsize alloc_size, const GstAllocationParams * alloc_params,
     gpointer wrapped_data, gpointer gl_handle, gpointer user_data,
     GDestroyNotify notify)
 {
index 8165839..7582cf9 100644 (file)
@@ -227,7 +227,7 @@ gboolean                gst_gl_allocation_params_init       (GstGLAllocationPara
                                                              GstGLAllocationParamsFreeFunc free,
                                                              GstGLContext * context,
                                                              gsize alloc_size,
-                                                             GstAllocationParams * alloc_params,
+                                                             const GstAllocationParams * alloc_params,
                                                              gpointer wrapped_data,
                                                              gpointer gl_handle,
                                                              gpointer user_data,
@@ -398,7 +398,7 @@ void          gst_gl_base_memory_init      (GstGLBaseMemory * mem,
                                             GstAllocator * allocator,
                                             GstMemory * parent,
                                             GstGLContext * context,
-                                            GstAllocationParams * params,
+                                            const GstAllocationParams * params,
                                             gsize size,
                                             gpointer user_data,
                                             GDestroyNotify notify);
index 52d1ece..a120e26 100644 (file)
@@ -97,7 +97,7 @@ struct create_data
 static void
 _gl_buffer_init (GstGLBuffer * mem, GstAllocator * allocator,
     GstMemory * parent, GstGLContext * context, guint gl_target, guint gl_usage,
-    GstAllocationParams * params, gsize size)
+    const GstAllocationParams * params, gsize size)
 {
   mem->target = gl_target;
   mem->usage_hints = gl_usage;
@@ -112,7 +112,7 @@ _gl_buffer_init (GstGLBuffer * mem, GstAllocator * allocator,
 static GstGLBuffer *
 _gl_buffer_new (GstAllocator * allocator, GstMemory * parent,
     GstGLContext * context, guint gl_target, guint gl_usage,
-    GstAllocationParams * params, gsize size)
+    const GstAllocationParams * params, gsize size)
 {
   GstGLBuffer *ret = g_new0 (GstGLBuffer, 1);
   _gl_buffer_init (ret, allocator, parent, context, gl_target, gl_usage,
@@ -371,7 +371,7 @@ G_DEFINE_BOXED_TYPE (GstGLBufferAllocationParams,
  */
 GstGLBufferAllocationParams *
 gst_gl_buffer_allocation_params_new (GstGLContext * context, gsize alloc_size,
-    GstAllocationParams * alloc_params, guint gl_target, guint gl_usage)
+    const GstAllocationParams * alloc_params, guint gl_target, guint gl_usage)
 {
   GstGLBufferAllocationParams *params;
 
index c14a585..8680e3f 100644 (file)
@@ -87,7 +87,7 @@ struct _GstGLBufferAllocationParams
 GST_GL_API
 GstGLBufferAllocationParams *   gst_gl_buffer_allocation_params_new     (GstGLContext * context,
                                                                          gsize alloc_size,
-                                                                         GstAllocationParams * alloc_params,
+                                                                         const GstAllocationParams * alloc_params,
                                                                          guint gl_target,
                                                                          guint gl_usage);
 
index 15adab4..ac5b593 100644 (file)
@@ -406,7 +406,7 @@ gst_buffer_pool_config_get_gl_allocation_params (GstStructure * config)
  */
 void
 gst_buffer_pool_config_set_gl_allocation_params (GstStructure * config,
-    GstGLAllocationParams * params)
+    const GstGLAllocationParams * params)
 {
   g_return_if_fail (config != NULL);
   g_return_if_fail (params != NULL);
index 60c24fe..06a705d 100644 (file)
@@ -73,7 +73,7 @@ GST_GL_API
 GstGLAllocationParams * gst_buffer_pool_config_get_gl_allocation_params    (GstStructure * config);
 GST_GL_API
 void                    gst_buffer_pool_config_set_gl_allocation_params    (GstStructure * config,
-                                                                            GstGLAllocationParams * params);
+                                                                            const GstGLAllocationParams * params);
 
 G_END_DECLS
 
index 663a50f..51a33fc 100644 (file)
@@ -658,8 +658,8 @@ gst_gl_color_convert_reset (GstGLColorConvert * convert)
 }
 
 static gboolean
-_gst_gl_color_convert_can_passthrough_info (GstVideoInfo * in,
-    GstVideoInfo * out)
+_gst_gl_color_convert_can_passthrough_info (const GstVideoInfo * in,
+    const GstVideoInfo * out)
 {
   gint i;
 
index e992cf3..66ffa80 100644 (file)
@@ -148,8 +148,8 @@ gst_gl_format_type_n_bytes (guint format, guint type)
  * Returns: the #GstGLFormat necessary for holding the data in @plane of @vinfo
  */
 GstGLFormat
-gst_gl_format_from_video_info (GstGLContext * context, GstVideoInfo * vinfo,
-    guint plane)
+gst_gl_format_from_video_info (GstGLContext * context,
+    const GstVideoInfo * vinfo, guint plane)
 {
   gboolean texture_rg =
       gst_gl_context_check_feature (context, "GL_EXT_texture_rg")
index 1e95ceb..0db5a14 100644 (file)
@@ -140,7 +140,7 @@ guint                   gst_gl_format_type_n_bytes                  (guint forma
                                                                      guint type);
 GST_GL_API
 GstGLFormat             gst_gl_format_from_video_info               (GstGLContext * context,
-                                                                     GstVideoInfo * vinfo,
+                                                                     const GstVideoInfo * vinfo,
                                                                      guint plane);
 GST_GL_API
 guint                   gst_gl_sized_gl_format_from_gl_format_type  (GstGLContext * context,
index fa0a1fb..0ac2919 100644 (file)
@@ -105,7 +105,7 @@ typedef struct
 } GstGLMemoryCopyParams;
 
 static inline guint
-_get_plane_width (GstVideoInfo * info, guint plane)
+_get_plane_width (const GstVideoInfo * info, guint plane)
 {
   if (GST_VIDEO_INFO_IS_YUV (info))
     /* For now component width and plane width are the same and the
@@ -117,7 +117,7 @@ _get_plane_width (GstVideoInfo * info, guint plane)
 }
 
 static inline guint
-_get_plane_height (GstVideoInfo * info, guint plane)
+_get_plane_height (const GstVideoInfo * info, guint plane)
 {
   if (GST_VIDEO_INFO_IS_YUV (info))
     /* For now component width and plane width are the same and the
@@ -316,8 +316,8 @@ _gst_gl_memory_end_log (GstGLMemory * gl_mem)
 void
 gst_gl_memory_init (GstGLMemory * mem, GstAllocator * allocator,
     GstMemory * parent, GstGLContext * context, GstGLTextureTarget target,
-    GstGLFormat tex_format, GstAllocationParams * params,
-    GstVideoInfo * info, guint plane, GstVideoAlignment * valign,
+    GstGLFormat tex_format, const GstAllocationParams * params,
+    const GstVideoInfo * info, guint plane, const GstVideoAlignment * valign,
     gpointer user_data, GDestroyNotify notify)
 {
   const gchar *target_str;
@@ -1148,7 +1148,7 @@ G_DEFINE_BOXED_TYPE (GstGLVideoAllocationParams, gst_gl_video_allocation_params,
 
 static void
 _gst_gl_video_allocation_params_set_video_alignment (GstGLVideoAllocationParams
-    * params, GstVideoAlignment * valign)
+    * params, const GstVideoAlignment * valign)
 {
   g_return_if_fail (params != NULL);
 
@@ -1191,8 +1191,8 @@ gboolean
 gst_gl_video_allocation_params_init_full (GstGLVideoAllocationParams * params,
     gsize struct_size, guint alloc_flags, GstGLAllocationParamsCopyFunc copy,
     GstGLAllocationParamsFreeFunc free, GstGLContext * context,
-    GstAllocationParams * alloc_params, GstVideoInfo * v_info,
-    guint plane, GstVideoAlignment * valign, GstGLTextureTarget target,
+    const GstAllocationParams * alloc_params, const GstVideoInfo * v_info,
+    guint plane, const GstVideoAlignment * valign, GstGLTextureTarget target,
     GstGLFormat tex_format, gpointer wrapped_data, gpointer gl_handle,
     gpointer user_data, GDestroyNotify notify)
 {
@@ -1241,8 +1241,8 @@ gst_gl_video_allocation_params_init_full (GstGLVideoAllocationParams * params,
  */
 GstGLVideoAllocationParams *
 gst_gl_video_allocation_params_new (GstGLContext * context,
-    GstAllocationParams * alloc_params, GstVideoInfo * v_info, guint plane,
-    GstVideoAlignment * valign, GstGLTextureTarget target,
+    const GstAllocationParams * alloc_params, const GstVideoInfo * v_info,
+    guint plane, const GstVideoAlignment * valign, GstGLTextureTarget target,
     GstGLFormat tex_format)
 {
   GstGLVideoAllocationParams *params = g_new0 (GstGLVideoAllocationParams, 1);
@@ -1282,8 +1282,8 @@ gst_gl_video_allocation_params_new (GstGLContext * context,
  */
 GstGLVideoAllocationParams *
 gst_gl_video_allocation_params_new_wrapped_data (GstGLContext * context,
-    GstAllocationParams * alloc_params, GstVideoInfo * v_info, guint plane,
-    GstVideoAlignment * valign, GstGLTextureTarget target,
+    const GstAllocationParams * alloc_params, const GstVideoInfo * v_info,
+    guint plane, const GstVideoAlignment * valign, GstGLTextureTarget target,
     GstGLFormat tex_format, gpointer wrapped_data, gpointer user_data,
     GDestroyNotify notify)
 {
@@ -1329,8 +1329,8 @@ gst_gl_video_allocation_params_new_wrapped_data (GstGLContext * context,
  */
 GstGLVideoAllocationParams *
 gst_gl_video_allocation_params_new_wrapped_gl_handle (GstGLContext * context,
-    GstAllocationParams * alloc_params, GstVideoInfo * v_info, guint plane,
-    GstVideoAlignment * valign, GstGLTextureTarget target,
+    const GstAllocationParams * alloc_params, const GstVideoInfo * v_info,
+    guint plane, const GstVideoAlignment * valign, GstGLTextureTarget target,
     GstGLFormat tex_format, gpointer gl_handle, gpointer user_data,
     GDestroyNotify notify)
 {
@@ -1372,8 +1372,8 @@ gst_gl_video_allocation_params_new_wrapped_gl_handle (GstGLContext * context,
  */
 GstGLVideoAllocationParams *
 gst_gl_video_allocation_params_new_wrapped_texture (GstGLContext * context,
-    GstAllocationParams * alloc_params, GstVideoInfo * v_info, guint plane,
-    GstVideoAlignment * valign, GstGLTextureTarget target,
+    const GstAllocationParams * alloc_params, const GstVideoInfo * v_info,
+    guint plane, const GstVideoAlignment * valign, GstGLTextureTarget target,
     GstGLFormat tex_format, guint tex_id, gpointer user_data,
     GDestroyNotify notify)
 {
index d51504c..ed23d02 100644 (file)
@@ -145,10 +145,10 @@ gboolean        gst_gl_video_allocation_params_init_full        (GstGLVideoAlloc
                                                                  GstGLAllocationParamsCopyFunc copy,
                                                                  GstGLAllocationParamsFreeFunc free,
                                                                  GstGLContext * context,
-                                                                 GstAllocationParams * alloc_params,
-                                                                 GstVideoInfo * v_info,
+                                                                 const GstAllocationParams * alloc_params,
+                                                                 const GstVideoInfo * v_info,
                                                                  guint plane,
-                                                                 GstVideoAlignment * valign,
+                                                                 const GstVideoAlignment * valign,
                                                                  GstGLTextureTarget target,
                                                                  GstGLFormat tex_format,
                                                                  gpointer wrapped_data,
@@ -157,18 +157,18 @@ gboolean        gst_gl_video_allocation_params_init_full        (GstGLVideoAlloc
                                                                  GDestroyNotify notify);
 GST_GL_API
 GstGLVideoAllocationParams * gst_gl_video_allocation_params_new (GstGLContext * context,
-                                                                 GstAllocationParams * alloc_params,
-                                                                 GstVideoInfo * v_info,
+                                                                 const GstAllocationParams * alloc_params,
+                                                                 const GstVideoInfo * v_info,
                                                                  guint plane,
-                                                                 GstVideoAlignment * valign,
+                                                                 const GstVideoAlignment * valign,
                                                                  GstGLTextureTarget target,
                                                                  GstGLFormat tex_format);
 GST_GL_API
 GstGLVideoAllocationParams * gst_gl_video_allocation_params_new_wrapped_data    (GstGLContext * context,
-                                                                                 GstAllocationParams * alloc_params,
-                                                                                 GstVideoInfo * v_info,
+                                                                                 const GstAllocationParams * alloc_params,
+                                                                                 const GstVideoInfo * v_info,
                                                                                  guint plane,
-                                                                                 GstVideoAlignment * valign,
+                                                                                 const GstVideoAlignment * valign,
                                                                                  GstGLTextureTarget target,
                                                                                  GstGLFormat tex_format,
                                                                                  gpointer wrapped_data,
@@ -177,10 +177,10 @@ GstGLVideoAllocationParams * gst_gl_video_allocation_params_new_wrapped_data
 
 GST_GL_API
 GstGLVideoAllocationParams * gst_gl_video_allocation_params_new_wrapped_texture (GstGLContext * context,
-                                                                                 GstAllocationParams * alloc_params,
-                                                                                 GstVideoInfo * v_info,
+                                                                                 const GstAllocationParams * alloc_params,
+                                                                                 const GstVideoInfo * v_info,
                                                                                  guint plane,
-                                                                                 GstVideoAlignment * valign,
+                                                                                 const GstVideoAlignment * valign,
                                                                                  GstGLTextureTarget target,
                                                                                  GstGLFormat tex_format,
                                                                                  guint tex_id,
@@ -189,10 +189,10 @@ GstGLVideoAllocationParams * gst_gl_video_allocation_params_new_wrapped_texture
 
 GST_GL_API
 GstGLVideoAllocationParams * gst_gl_video_allocation_params_new_wrapped_gl_handle (GstGLContext * context,
-                                                                                 GstAllocationParams * alloc_params,
-                                                                                 GstVideoInfo * v_info,
+                                                                                 const GstAllocationParams * alloc_params,
+                                                                                 const GstVideoInfo * v_info,
                                                                                  guint plane,
-                                                                                 GstVideoAlignment * valign,
+                                                                                 const GstVideoAlignment * valign,
                                                                                  GstGLTextureTarget target,
                                                                                  GstGLFormat tex_format,
                                                                                  gpointer gl_handle,
@@ -270,10 +270,10 @@ void            gst_gl_memory_init              (GstGLMemory * mem,
                                                  GstGLContext * context,
                                                  GstGLTextureTarget target,
                                                  GstGLFormat tex_format,
-                                                 GstAllocationParams *params,
-                                                 GstVideoInfo * info,
+                                                 const GstAllocationParams *params,
+                                                 const GstVideoInfo * info,
                                                  guint plane,
-                                                 GstVideoAlignment *valign,
+                                                 const GstVideoAlignment *valign,
                                                  gpointer user_data,
                                                  GDestroyNotify notify);
 
index 04c1237..a288544 100644 (file)
@@ -122,7 +122,7 @@ typedef struct
 } GstGLMemoryPBOCopyParams;
 
 static inline guint
-_get_plane_height (GstVideoInfo * info, guint plane)
+_get_plane_height (const GstVideoInfo * info, guint plane)
 {
   if (GST_VIDEO_INFO_IS_YUV (info))
     /* For now component width and plane width are the same and the
index ef5ce29..7fa6f62 100644 (file)
@@ -115,7 +115,7 @@ _gl_rbo_create (GstGLRenderbuffer * gl_mem, GError ** error)
 static void
 gst_gl_renderbuffer_init (GstGLRenderbuffer * mem, GstAllocator * allocator,
     GstMemory * parent, GstGLContext * context,
-    GstGLFormat renderbuffer_format, GstAllocationParams * params,
+    GstGLFormat renderbuffer_format, const GstAllocationParams * params,
     guint width, guint height, gpointer user_data, GDestroyNotify notify)
 {
   gsize size;
@@ -379,7 +379,7 @@ static gboolean
     (GstGLRenderbufferAllocationParams * params, gsize struct_size,
     guint alloc_flags, GstGLAllocationParamsCopyFunc copy,
     GstGLAllocationParamsFreeFunc free, GstGLContext * context,
-    GstAllocationParams * alloc_params, guint width, guint height,
+    const GstAllocationParams * alloc_params, guint width, guint height,
     GstGLFormat renderbuffer_format, gpointer wrapped_data,
     gpointer gl_handle, gpointer user_data, GDestroyNotify notify)
 {
@@ -416,7 +416,7 @@ static gboolean
  */
 GstGLRenderbufferAllocationParams *
 gst_gl_renderbuffer_allocation_params_new (GstGLContext * context,
-    GstAllocationParams * alloc_params, GstGLFormat renderbuffer_format,
+    const GstAllocationParams * alloc_params, GstGLFormat renderbuffer_format,
     guint width, guint height)
 {
   GstGLRenderbufferAllocationParams *params =
@@ -455,7 +455,7 @@ gst_gl_renderbuffer_allocation_params_new (GstGLContext * context,
  */
 GstGLRenderbufferAllocationParams *
 gst_gl_renderbuffer_allocation_params_new_wrapped (GstGLContext * context,
-    GstAllocationParams * alloc_params, GstGLFormat renderbuffer_format,
+    const GstAllocationParams * alloc_params, GstGLFormat renderbuffer_format,
     guint width, guint height, gpointer gl_handle, gpointer user_data,
     GDestroyNotify notify)
 {
index 84be319..516a104 100644 (file)
@@ -128,14 +128,14 @@ struct _GstGLRenderbufferAllocationParams
 
 GST_GL_API
 GstGLRenderbufferAllocationParams *     gst_gl_renderbuffer_allocation_params_new           (GstGLContext * context,
-                                                                                             GstAllocationParams * alloc_params,
+                                                                                             const GstAllocationParams * alloc_params,
                                                                                              GstGLFormat renderbuffer_format,
                                                                                              guint width,
                                                                                              guint height);
 
 GST_GL_API
 GstGLRenderbufferAllocationParams *     gst_gl_renderbuffer_allocation_params_new_wrapped   (GstGLContext * context,
-                                                                                             GstAllocationParams * alloc_params,
+                                                                                             const GstAllocationParams * alloc_params,
                                                                                              GstGLFormat renderbuffer_format,
                                                                                              guint width,
                                                                                              guint height,
index a60aa45..05b597e 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * GStreamer
  * Copyright (C) 2013 Matthew Waters <ystreet00@gmail.com>
  *
@@ -610,8 +610,8 @@ gst_gl_query_local_gl_context (GstElement * element, GstPadDirection direction,
  * Retrieve the size in bytes of a video plane of data with a certain alignment
  */
 gsize
-gst_gl_get_plane_data_size (GstVideoInfo * info, GstVideoAlignment * align,
-    guint plane)
+gst_gl_get_plane_data_size (const GstVideoInfo * info,
+    const GstVideoAlignment * align, guint plane)
 {
   gint padded_height;
   gsize plane_size;
@@ -639,8 +639,8 @@ gst_gl_get_plane_data_size (GstVideoInfo * info, GstVideoAlignment * align,
  *          and where the data from the previous plane ends.
  */
 gsize
-gst_gl_get_plane_start (GstVideoInfo * info, GstVideoAlignment * valign,
-    guint plane)
+gst_gl_get_plane_start (const GstVideoInfo * info,
+    const GstVideoAlignment * valign, guint plane)
 {
   gsize plane_start;
   gint i;
index 0064d29..bbae73e 100644 (file)
@@ -32,10 +32,10 @@ GST_GL_API
 gboolean gst_gl_ensure_element_data (gpointer element,
     GstGLDisplay **display_ptr, GstGLContext ** other_context_ptr);
 GST_GL_API
-gboolean gst_gl_handle_set_context (GstElement * element, GstContext * context, 
+gboolean gst_gl_handle_set_context (GstElement * element, GstContext * context,
     GstGLDisplay ** display, GstGLContext ** other_context);
 GST_GL_API
-gboolean gst_gl_handle_context_query (GstElement * element, GstQuery * query, 
+gboolean gst_gl_handle_context_query (GstElement * element, GstQuery * query,
     GstGLDisplay * display, GstGLContext * context, GstGLContext * other_context);
 GST_GL_API
 gboolean gst_gl_query_local_gl_context (GstElement * element, GstPadDirection direction,
@@ -45,10 +45,10 @@ GST_GL_API
 void gst_gl_element_propagate_display_context (GstElement * element, GstGLDisplay * display);
 
 GST_GL_API
-gsize gst_gl_get_plane_data_size (GstVideoInfo * info, GstVideoAlignment * align,
+gsize gst_gl_get_plane_data_size (const GstVideoInfo * info, const GstVideoAlignment * align,
     guint plane);
 GST_GL_API
-gsize gst_gl_get_plane_start (GstVideoInfo * info, GstVideoAlignment * valign,
+gsize gst_gl_get_plane_start (const GstVideoInfo * info, const GstVideoAlignment * valign,
     guint plane);
 
 GST_GL_API
index aab126f..6931f91 100644 (file)
@@ -376,8 +376,8 @@ gst_gl_view_convert_set_context (GstGLViewConvert * viewconvert,
 
 static gboolean
 _view_convert_set_format (GstGLViewConvert * viewconvert,
-    GstVideoInfo * in_info, GstGLTextureTarget from_target,
-    GstVideoInfo * out_info, GstGLTextureTarget to_target)
+    const GstVideoInfo * in_info, GstGLTextureTarget from_target,
+    const GstVideoInfo * out_info, GstGLTextureTarget to_target)
 {
   gboolean passthrough;
   g_return_val_if_fail (GST_IS_GL_VIEW_CONVERT (viewconvert), FALSE);
index 91a02fc..9482b10 100644 (file)
@@ -844,7 +844,7 @@ no_format:
 static gboolean
 gst_audio_visualizer_set_allocation (GstAudioVisualizer * scope,
     GstBufferPool * pool, GstAllocator * allocator,
-    GstAllocationParams * params, GstQuery * query)
+    const GstAllocationParams * params, GstQuery * query)
 {
   GstAllocator *oldalloc;
   GstBufferPool *oldpool;
index 7cfd367..fd4198d 100644 (file)
@@ -50,7 +50,7 @@ GST_DEBUG_CATEGORY_STATIC (gst_video_pool_debug);
  */
 void
 gst_buffer_pool_config_set_video_alignment (GstStructure * config,
-    GstVideoAlignment * align)
+    const GstVideoAlignment * align)
 {
   g_return_if_fail (config != NULL);
   g_return_if_fail (align != NULL);
index 01e9abd..6fd0db1 100644 (file)
@@ -48,7 +48,7 @@ G_BEGIN_DECLS
 /* setting a bufferpool config */
 
 GST_VIDEO_API
-void             gst_buffer_pool_config_set_video_alignment  (GstStructure *config, GstVideoAlignment *align);
+void             gst_buffer_pool_config_set_video_alignment  (GstStructure *config, const GstVideoAlignment *align);
 
 GST_VIDEO_API
 gboolean         gst_buffer_pool_config_get_video_alignment  (GstStructure *config, GstVideoAlignment *align);
index 7d921a7..a259113 100644 (file)
@@ -2249,8 +2249,8 @@ convert_get_alpha_mode (GstVideoConverter * convert)
  * Since: 1.20
  */
 GstVideoConverter *
-gst_video_converter_new_with_pool (GstVideoInfo * in_info,
-    GstVideoInfo * out_info, GstStructure * config, GstTaskPool * pool)
+gst_video_converter_new_with_pool (const GstVideoInfo * in_info,
+    const GstVideoInfo * out_info, GstStructure * config, GstTaskPool * pool)
 {
   GstVideoConverter *convert;
   GstLineCache *prev;
@@ -2490,8 +2490,8 @@ no_pack_func:
  * Since: 1.6
  */
 GstVideoConverter *
-gst_video_converter_new (GstVideoInfo * in_info, GstVideoInfo * out_info,
-    GstStructure * config)
+gst_video_converter_new (const GstVideoInfo * in_info,
+    const GstVideoInfo * out_info, GstStructure * config)
 {
   return gst_video_converter_new_with_pool (in_info, out_info, config, NULL);
 }
index 5c82d44..bda85fb 100644 (file)
@@ -276,13 +276,13 @@ typedef enum {
 typedef struct _GstVideoConverter GstVideoConverter;
 
 GST_VIDEO_API
-GstVideoConverter *  gst_video_converter_new            (GstVideoInfo *in_info,
-                                                         GstVideoInfo *out_info,
+GstVideoConverter *  gst_video_converter_new            (const GstVideoInfo *in_info,
+                                                         const GstVideoInfo *out_info,
                                                          GstStructure *config);
 
 GST_VIDEO_API
-GstVideoConverter * gst_video_converter_new_with_pool   (GstVideoInfo * in_info,
-                                                         GstVideoInfo * out_info,
+GstVideoConverter * gst_video_converter_new_with_pool   (const GstVideoInfo * in_info,
+                                                         const GstVideoInfo * out_info,
                                                          GstStructure * config,
                                                          GstTaskPool  * pool);
 
index 04500bd..c969bc7 100644 (file)
@@ -67,7 +67,7 @@ video_frame_get_perf_category (void)
  * Returns: %TRUE on success.
  */
 gboolean
-gst_video_frame_map_id (GstVideoFrame * frame, GstVideoInfo * info,
+gst_video_frame_map_id (GstVideoFrame * frame, const GstVideoInfo * info,
     GstBuffer * buffer, gint id, GstMapFlags flags)
 {
   GstVideoMeta *meta;
@@ -240,7 +240,7 @@ invalid_size:
  * Returns: %TRUE on success.
  */
 gboolean
-gst_video_frame_map (GstVideoFrame * frame, GstVideoInfo * info,
+gst_video_frame_map (GstVideoFrame * frame, const GstVideoInfo * info,
     GstBuffer * buffer, GstMapFlags flags)
 {
   return gst_video_frame_map_id (frame, info, buffer, -1, flags);
index 79c182b..f3925c4 100644 (file)
@@ -94,11 +94,11 @@ struct _GstVideoFrame {
 };
 
 GST_VIDEO_API
-gboolean    gst_video_frame_map           (GstVideoFrame *frame, GstVideoInfo *info,
+gboolean    gst_video_frame_map           (GstVideoFrame *frame, const GstVideoInfo *info,
                                            GstBuffer *buffer, GstMapFlags flags);
 
 GST_VIDEO_API
-gboolean    gst_video_frame_map_id        (GstVideoFrame *frame, GstVideoInfo *info,
+gboolean    gst_video_frame_map_id        (GstVideoFrame *frame, const GstVideoInfo *info,
                                            GstBuffer *buffer, gint id, GstMapFlags flags);
 
 GST_VIDEO_API
index 43f2435..faf6adb 100644 (file)
@@ -1208,7 +1208,7 @@ fill_planes (GstVideoInfo * info, gsize plane_size[GST_VIDEO_MAX_PLANES])
  * Returns: TRUE if the conversion was successful.
  */
 gboolean
-gst_video_info_convert (GstVideoInfo * info,
+gst_video_info_convert (const GstVideoInfo * info,
     GstFormat src_format, gint64 src_value,
     GstFormat dest_format, gint64 * dest_value)
 {
@@ -1324,6 +1324,9 @@ done:
  * @align: alignment parameters
  * @plane_size: (out) (allow-none): array used to store the plane sizes
  *
+ * Extra padding will be added to the right side when stride alignment padding
+ * is required and @align will be updated with the new padding values.
+ *
  * This variant of gst_video_info_align() provides the updated size, in bytes,
  * of each video plane after the alignment, including all horizontal and vertical
  * paddings.
index 6ec3b92..d3ff1ba 100644 (file)
@@ -455,7 +455,7 @@ GST_VIDEO_API
 GstCaps *      gst_video_info_to_caps     (const GstVideoInfo *info);
 
 GST_VIDEO_API
-gboolean       gst_video_info_convert     (GstVideoInfo *info,
+gboolean       gst_video_info_convert     (const GstVideoInfo *info,
                                            GstFormat     src_format,
                                            gint64        src_value,
                                            GstFormat     dest_format,
index 315e91f..a7cd415 100644 (file)
@@ -1078,8 +1078,9 @@ gst_video_overlay_rectangle_apply_global_alpha (GstVideoOverlayRectangle * rect,
 }
 
 static void
-gst_video_overlay_rectangle_convert (GstVideoInfo * src, GstBuffer * src_buffer,
-    GstVideoFormat dest_format, GstVideoInfo * dest, GstBuffer ** dest_buffer)
+gst_video_overlay_rectangle_convert (const GstVideoInfo * src,
+    GstBuffer * src_buffer, GstVideoFormat dest_format, GstVideoInfo * dest,
+    GstBuffer ** dest_buffer)
 {
   gint width, height, stride;
   GstVideoFrame src_frame, dest_frame;
index 12e24d1..f9d012a 100644 (file)
@@ -612,7 +612,7 @@ G_DEFINE_TYPE_WITH_CODE (GstCompositor, gst_compositor,
         gst_compositor_child_proxy_init));
 
 static gboolean
-set_functions (GstCompositor * self, GstVideoInfo * info)
+set_functions (GstCompositor * self, const GstVideoInfo * info)
 {
   gboolean ret = FALSE;
 
index f73950c..0483257 100644 (file)
@@ -47,7 +47,7 @@
  *
  */
 
-/* 
+/*
  * Formulas for PAR, DAR, width and height relations:
  *
  * dar_n   w   par_n
@@ -57,7 +57,7 @@
  * par_n    h   dar_n
  * ----- =  - * -----
  * par_d    w   dar_d
- * 
+ *
  *         dar_n   par_d
  * w = h * ----- * -----
  *         dar_d   par_n
index 152746e..69d6884 100644 (file)
@@ -886,7 +886,8 @@ gst_xvcontext_update_colorbalance (GstXvContext * context,
 /* This function tries to get a format matching with a given caps in the
    supported list of formats we generated in gst_xvimagesink_get_xv_support */
 gint
-gst_xvcontext_get_format_from_info (GstXvContext * context, GstVideoInfo * info)
+gst_xvcontext_get_format_from_info (GstXvContext * context,
+    const GstVideoInfo * info)
 {
   GList *list = NULL;
 
index 68cbdb7..701b527 100644 (file)
@@ -196,7 +196,7 @@ gst_xvcontext_unref (GstXvContext * xvcontext)
 }
 
 gint            gst_xvcontext_get_format_from_info      (GstXvContext * xvcontext,
-                                                         GstVideoInfo * info);
+                                                         const GstVideoInfo * info);
 
 
 void            gst_xvcontext_set_synchronous           (GstXvContext * xvcontext,
index 23489bf..16a8cd6 100644 (file)
@@ -100,7 +100,8 @@ GST_START_TEST (test_allocator_pbo_alloc)
 GST_END_TEST;
 
 static GstMemory *
-create_memory (const gchar * allocator_name, GstVideoInfo * v_info, guint plane)
+create_memory (const gchar * allocator_name, const GstVideoInfo * v_info,
+    guint plane)
 {
   GstAllocator *gl_allocator;
   GstGLBaseMemoryAllocator *base_mem_alloc;
@@ -194,7 +195,7 @@ GST_START_TEST (test_memory_copy)
 GST_END_TEST;
 
 static GstMemory *
-wrap_raw_data (const gchar * allocator_name, GstVideoInfo * v_info,
+wrap_raw_data (const gchar * allocator_name, const GstVideoInfo * v_info,
     guint plane, guint8 * data)
 {
   GstAllocator *gl_allocator;