From abb026ec6ab1617b44de69e9a251317592eee755 Mon Sep 17 00:00:00 2001 From: Marijn Suijten Date: Mon, 4 Jan 2021 23:25:10 +0100 Subject: [PATCH] gl,video: Make ptrs to VideoInfo and (GL)AllocationParams immutable 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: --- ext/gl/gltestsrc.c | 21 ++++++----- ext/gl/gltestsrc.h | 2 +- ext/gl/gstglimagesink.c | 2 +- gst-libs/gst/gl/egl/gsteglimage.c | 12 +++---- gst-libs/gst/gl/egl/gsteglimage.h | 10 +++--- gst-libs/gst/gl/egl/gsteglimage_private.h | 2 +- gst-libs/gst/gl/gstglbasememory.c | 7 ++-- gst-libs/gst/gl/gstglbasememory.h | 4 +-- gst-libs/gst/gl/gstglbuffer.c | 6 ++-- gst-libs/gst/gl/gstglbuffer.h | 2 +- gst-libs/gst/gl/gstglbufferpool.c | 2 +- gst-libs/gst/gl/gstglbufferpool.h | 2 +- gst-libs/gst/gl/gstglcolorconvert.c | 4 +-- gst-libs/gst/gl/gstglformat.c | 4 +-- gst-libs/gst/gl/gstglformat.h | 2 +- gst-libs/gst/gl/gstglmemory.c | 30 ++++++++-------- gst-libs/gst/gl/gstglmemory.h | 36 +++++++++---------- gst-libs/gst/gl/gstglmemorypbo.c | 2 +- gst-libs/gst/gl/gstglrenderbuffer.c | 8 ++--- gst-libs/gst/gl/gstglrenderbuffer.h | 4 +-- gst-libs/gst/gl/gstglutils.c | 10 +++--- gst-libs/gst/gl/gstglutils.h | 8 ++--- gst-libs/gst/gl/gstglviewconvert.c | 4 +-- gst-libs/gst/pbutils/gstaudiovisualizer.c | 2 +- gst-libs/gst/video/gstvideopool.c | 2 +- gst-libs/gst/video/gstvideopool.h | 2 +- gst-libs/gst/video/video-converter.c | 8 ++--- gst-libs/gst/video/video-converter.h | 8 ++--- gst-libs/gst/video/video-frame.c | 4 +-- gst-libs/gst/video/video-frame.h | 4 +-- gst-libs/gst/video/video-info.c | 5 ++- gst-libs/gst/video/video-info.h | 2 +- .../gst/video/video-overlay-composition.c | 5 +-- gst/compositor/compositor.c | 2 +- gst/videoscale/gstvideoscale.c | 4 +-- sys/xvimage/xvcontext.c | 3 +- sys/xvimage/xvcontext.h | 2 +- tests/check/libs/gstglmemory.c | 5 +-- 38 files changed, 126 insertions(+), 116 deletions(-) diff --git a/ext/gl/gltestsrc.c b/ext/gl/gltestsrc.c index 04b2dfe6f4..d353166a42 100644 --- a/ext/gl/gltestsrc.c +++ b/ext/gl/gltestsrc.c @@ -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; diff --git a/ext/gl/gltestsrc.h b/ext/gl/gltestsrc.h index dbcab0cab3..29b42fd956 100644 --- a/ext/gl/gltestsrc.h +++ b/ext/gl/gltestsrc.h @@ -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); }; diff --git a/ext/gl/gstglimagesink.c b/ext/gl/gstglimagesink.c index 2c023ce7c0..72d8ac643e 100644 --- a/ext/gl/gstglimagesink.c +++ b/ext/gl/gstglimagesink.c @@ -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; diff --git a/gst-libs/gst/gl/egl/gsteglimage.c b/gst-libs/gst/gl/egl/gsteglimage.c index 3185381050..662261736c 100644 --- a/gst-libs/gst/gl/egl/gsteglimage.c +++ b/gst-libs/gst/gl/egl/gsteglimage.c @@ -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); diff --git a/gst-libs/gst/gl/egl/gsteglimage.h b/gst-libs/gst/gl/egl/gsteglimage.h index 6aa56a4b11..f90fa82a39 100644 --- a/gst-libs/gst/gl/egl/gsteglimage.h +++ b/gst-libs/gst/gl/egl/gsteglimage.h @@ -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 diff --git a/gst-libs/gst/gl/egl/gsteglimage_private.h b/gst-libs/gst/gl/egl/gsteglimage_private.h index f98287cf30..654454968c 100644 --- a/gst-libs/gst/gl/egl/gsteglimage_private.h +++ b/gst-libs/gst/gl/egl/gsteglimage_private.h @@ -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); diff --git a/gst-libs/gst/gl/gstglbasememory.c b/gst-libs/gst/gl/gstglbasememory.c index 534b3133c4..832a8b24b1 100644 --- a/gst-libs/gst/gl/gstglbasememory.c +++ b/gst-libs/gst/gl/gstglbasememory.c @@ -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) { diff --git a/gst-libs/gst/gl/gstglbasememory.h b/gst-libs/gst/gl/gstglbasememory.h index 8165839d8e..7582cf9f66 100644 --- a/gst-libs/gst/gl/gstglbasememory.h +++ b/gst-libs/gst/gl/gstglbasememory.h @@ -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); diff --git a/gst-libs/gst/gl/gstglbuffer.c b/gst-libs/gst/gl/gstglbuffer.c index 52d1ece73d..a120e26368 100644 --- a/gst-libs/gst/gl/gstglbuffer.c +++ b/gst-libs/gst/gl/gstglbuffer.c @@ -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; diff --git a/gst-libs/gst/gl/gstglbuffer.h b/gst-libs/gst/gl/gstglbuffer.h index c14a5850bf..8680e3f627 100644 --- a/gst-libs/gst/gl/gstglbuffer.h +++ b/gst-libs/gst/gl/gstglbuffer.h @@ -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); diff --git a/gst-libs/gst/gl/gstglbufferpool.c b/gst-libs/gst/gl/gstglbufferpool.c index 15adab40cc..ac5b5939a6 100644 --- a/gst-libs/gst/gl/gstglbufferpool.c +++ b/gst-libs/gst/gl/gstglbufferpool.c @@ -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); diff --git a/gst-libs/gst/gl/gstglbufferpool.h b/gst-libs/gst/gl/gstglbufferpool.h index 60c24fef13..06a705da94 100644 --- a/gst-libs/gst/gl/gstglbufferpool.h +++ b/gst-libs/gst/gl/gstglbufferpool.h @@ -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 diff --git a/gst-libs/gst/gl/gstglcolorconvert.c b/gst-libs/gst/gl/gstglcolorconvert.c index 663a50fcc3..51a33fcdb0 100644 --- a/gst-libs/gst/gl/gstglcolorconvert.c +++ b/gst-libs/gst/gl/gstglcolorconvert.c @@ -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; diff --git a/gst-libs/gst/gl/gstglformat.c b/gst-libs/gst/gl/gstglformat.c index e992cf3d52..66ffa803e8 100644 --- a/gst-libs/gst/gl/gstglformat.c +++ b/gst-libs/gst/gl/gstglformat.c @@ -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") diff --git a/gst-libs/gst/gl/gstglformat.h b/gst-libs/gst/gl/gstglformat.h index 1e95cebdcf..0db5a1422a 100644 --- a/gst-libs/gst/gl/gstglformat.h +++ b/gst-libs/gst/gl/gstglformat.h @@ -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, diff --git a/gst-libs/gst/gl/gstglmemory.c b/gst-libs/gst/gl/gstglmemory.c index fa0a1fb7b8..0ac2919be7 100644 --- a/gst-libs/gst/gl/gstglmemory.c +++ b/gst-libs/gst/gl/gstglmemory.c @@ -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) { diff --git a/gst-libs/gst/gl/gstglmemory.h b/gst-libs/gst/gl/gstglmemory.h index d51504cf2f..ed23d021cc 100644 --- a/gst-libs/gst/gl/gstglmemory.h +++ b/gst-libs/gst/gl/gstglmemory.h @@ -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); diff --git a/gst-libs/gst/gl/gstglmemorypbo.c b/gst-libs/gst/gl/gstglmemorypbo.c index 04c1237650..a2885448d5 100644 --- a/gst-libs/gst/gl/gstglmemorypbo.c +++ b/gst-libs/gst/gl/gstglmemorypbo.c @@ -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 diff --git a/gst-libs/gst/gl/gstglrenderbuffer.c b/gst-libs/gst/gl/gstglrenderbuffer.c index ef5ce29a3e..7fa6f62eb4 100644 --- a/gst-libs/gst/gl/gstglrenderbuffer.c +++ b/gst-libs/gst/gl/gstglrenderbuffer.c @@ -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) { diff --git a/gst-libs/gst/gl/gstglrenderbuffer.h b/gst-libs/gst/gl/gstglrenderbuffer.h index 84be3195f7..516a104279 100644 --- a/gst-libs/gst/gl/gstglrenderbuffer.h +++ b/gst-libs/gst/gl/gstglrenderbuffer.h @@ -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, diff --git a/gst-libs/gst/gl/gstglutils.c b/gst-libs/gst/gl/gstglutils.c index a60aa45198..05b597ed6d 100644 --- a/gst-libs/gst/gl/gstglutils.c +++ b/gst-libs/gst/gl/gstglutils.c @@ -1,4 +1,4 @@ -/* +/* * GStreamer * Copyright (C) 2013 Matthew Waters * @@ -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; diff --git a/gst-libs/gst/gl/gstglutils.h b/gst-libs/gst/gl/gstglutils.h index 0064d2964f..bbae73e6db 100644 --- a/gst-libs/gst/gl/gstglutils.h +++ b/gst-libs/gst/gl/gstglutils.h @@ -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 diff --git a/gst-libs/gst/gl/gstglviewconvert.c b/gst-libs/gst/gl/gstglviewconvert.c index aab126f982..6931f916ac 100644 --- a/gst-libs/gst/gl/gstglviewconvert.c +++ b/gst-libs/gst/gl/gstglviewconvert.c @@ -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); diff --git a/gst-libs/gst/pbutils/gstaudiovisualizer.c b/gst-libs/gst/pbutils/gstaudiovisualizer.c index 91a02fc7dc..9482b1067c 100644 --- a/gst-libs/gst/pbutils/gstaudiovisualizer.c +++ b/gst-libs/gst/pbutils/gstaudiovisualizer.c @@ -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; diff --git a/gst-libs/gst/video/gstvideopool.c b/gst-libs/gst/video/gstvideopool.c index 7cfd367e35..fd4198d79f 100644 --- a/gst-libs/gst/video/gstvideopool.c +++ b/gst-libs/gst/video/gstvideopool.c @@ -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); diff --git a/gst-libs/gst/video/gstvideopool.h b/gst-libs/gst/video/gstvideopool.h index 01e9abd0f7..6fd0db1bcd 100644 --- a/gst-libs/gst/video/gstvideopool.h +++ b/gst-libs/gst/video/gstvideopool.h @@ -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); diff --git a/gst-libs/gst/video/video-converter.c b/gst-libs/gst/video/video-converter.c index 7d921a70db..a259113480 100644 --- a/gst-libs/gst/video/video-converter.c +++ b/gst-libs/gst/video/video-converter.c @@ -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); } diff --git a/gst-libs/gst/video/video-converter.h b/gst-libs/gst/video/video-converter.h index 5c82d4486e..bda85fbdfa 100644 --- a/gst-libs/gst/video/video-converter.h +++ b/gst-libs/gst/video/video-converter.h @@ -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); diff --git a/gst-libs/gst/video/video-frame.c b/gst-libs/gst/video/video-frame.c index 04500bd2de..c969bc75d4 100644 --- a/gst-libs/gst/video/video-frame.c +++ b/gst-libs/gst/video/video-frame.c @@ -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); diff --git a/gst-libs/gst/video/video-frame.h b/gst-libs/gst/video/video-frame.h index 79c182b2a7..f3925c47de 100644 --- a/gst-libs/gst/video/video-frame.h +++ b/gst-libs/gst/video/video-frame.h @@ -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 diff --git a/gst-libs/gst/video/video-info.c b/gst-libs/gst/video/video-info.c index 43f24350c9..faf6adbf3a 100644 --- a/gst-libs/gst/video/video-info.c +++ b/gst-libs/gst/video/video-info.c @@ -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. diff --git a/gst-libs/gst/video/video-info.h b/gst-libs/gst/video/video-info.h index 6ec3b92697..d3ff1ba965 100644 --- a/gst-libs/gst/video/video-info.h +++ b/gst-libs/gst/video/video-info.h @@ -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, diff --git a/gst-libs/gst/video/video-overlay-composition.c b/gst-libs/gst/video/video-overlay-composition.c index 315e91f7e1..a7cd415182 100644 --- a/gst-libs/gst/video/video-overlay-composition.c +++ b/gst-libs/gst/video/video-overlay-composition.c @@ -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; diff --git a/gst/compositor/compositor.c b/gst/compositor/compositor.c index 12e24d1896..f9d012a96b 100644 --- a/gst/compositor/compositor.c +++ b/gst/compositor/compositor.c @@ -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; diff --git a/gst/videoscale/gstvideoscale.c b/gst/videoscale/gstvideoscale.c index f73950c367..04832579d1 100644 --- a/gst/videoscale/gstvideoscale.c +++ b/gst/videoscale/gstvideoscale.c @@ -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 diff --git a/sys/xvimage/xvcontext.c b/sys/xvimage/xvcontext.c index 152746e538..69d6884ddc 100644 --- a/sys/xvimage/xvcontext.c +++ b/sys/xvimage/xvcontext.c @@ -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; diff --git a/sys/xvimage/xvcontext.h b/sys/xvimage/xvcontext.h index 68cbdb7477..701b527fa6 100644 --- a/sys/xvimage/xvcontext.h +++ b/sys/xvimage/xvcontext.h @@ -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, diff --git a/tests/check/libs/gstglmemory.c b/tests/check/libs/gstglmemory.c index 23489bf90b..16a8cd6d8c 100644 --- a/tests/check/libs/gstglmemory.c +++ b/tests/check/libs/gstglmemory.c @@ -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;