[vlc-commits] [Git][videolan/vlc][master] 3 commits: opengl: remove const in sampler API

Hugo Beauzée-Luyssen (@chouquette) gitlab at videolan.org
Thu Sep 2 12:00:26 UTC 2021



Hugo Beauzée-Luyssen pushed to branch master at VideoLAN / VLC


Commits:
48262555 by Romain Vimont at 2021-09-02T10:08:23+00:00
opengl: remove const in sampler API

For consistency, always pass the sampler to callbacks as a non-const
pointer.

- - - - -
a2b25359 by Romain Vimont at 2021-09-02T10:08:23+00:00
opengl: fix filter PRIV()

The macro parameter name was the same as the member name ("filter"). To
avoid the problem, use a static inline function instead.

- - - - -
3d1d2a5d by Romain Vimont at 2021-09-02T10:08:23+00:00
opengl: fix sampler PRIV()

The macro parameter name was the same as the member name ("sampler"). To
avoid the problem, use a static inline function instead.

- - - - -


3 changed files:

- modules/video_output/opengl/filter_priv.h
- modules/video_output/opengl/sampler.c
- modules/video_output/opengl/sampler.h


Changes:

=====================================
modules/video_output/opengl/filter_priv.h
=====================================
@@ -68,8 +68,11 @@ struct vlc_gl_filter_priv {
     struct vlc_list blend_subfilters; /**< list of vlc_gl_filter_priv.node */
 };
 
-#define vlc_gl_filter_PRIV(filter) \
-    container_of(filter, struct vlc_gl_filter_priv, filter)
+static inline struct vlc_gl_filter_priv *
+vlc_gl_filter_PRIV(struct vlc_gl_filter *filter)
+{
+    return container_of(filter, struct vlc_gl_filter_priv, filter);
+}
 
 struct vlc_gl_filter *
 vlc_gl_filter_New(vlc_object_t *parent, const struct vlc_gl_api *api);


=====================================
modules/video_output/opengl/sampler.c
=====================================
@@ -103,7 +103,11 @@ struct vlc_gl_sampler_priv {
     unsigned plane;
 };
 
-#define PRIV(sampler) container_of(sampler, struct vlc_gl_sampler_priv, sampler)
+static inline struct vlc_gl_sampler_priv *
+PRIV(struct vlc_gl_sampler *sampler)
+{
+    return container_of(sampler, struct vlc_gl_sampler_priv, sampler);
+}
 
 static const float MATRIX_COLOR_RANGE_LIMITED[4*3] = {
     255.0/219,         0,         0, -255.0/219 *  16.0/255,
@@ -334,7 +338,7 @@ GetTransformMatrix(const struct vlc_gl_interop *interop)
 }
 
 static void
-sampler_base_load(const struct vlc_gl_sampler *sampler)
+sampler_base_load(struct vlc_gl_sampler *sampler)
 {
     struct vlc_gl_sampler_priv *priv = PRIV(sampler);
 
@@ -427,7 +431,7 @@ sampler_xyz12_fetch_locations(struct vlc_gl_sampler *sampler, GLuint program)
 }
 
 static void
-sampler_xyz12_load(const struct vlc_gl_sampler *sampler)
+sampler_xyz12_load(struct vlc_gl_sampler *sampler)
 {
     struct vlc_gl_sampler_priv *priv = PRIV(sampler);
     const opengl_vtable_t *vt = priv->vt;
@@ -786,7 +790,7 @@ sampler_planes_fetch_locations(struct vlc_gl_sampler *sampler, GLuint program)
 }
 
 static void
-sampler_planes_load(const struct vlc_gl_sampler *sampler)
+sampler_planes_load(struct vlc_gl_sampler *sampler)
 {
     struct vlc_gl_sampler_priv *priv = PRIV(sampler);
     unsigned plane = priv->plane;


=====================================
modules/video_output/opengl/sampler.h
=====================================
@@ -109,7 +109,7 @@ struct vlc_gl_sampler_ops {
      * \param sampler the sampler
      */
     void
-    (*load)(const struct vlc_gl_sampler *sampler);
+    (*load)(struct vlc_gl_sampler *sampler);
 };
 
 static inline void
@@ -119,7 +119,7 @@ vlc_gl_sampler_FetchLocations(struct vlc_gl_sampler *sampler, GLuint program)
 }
 
 static inline void
-vlc_gl_sampler_Load(const struct vlc_gl_sampler *sampler)
+vlc_gl_sampler_Load(struct vlc_gl_sampler *sampler)
 {
     sampler->ops->load(sampler);
 }



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/021c73cdb22aed34fd6d295dce388049f69a538f...3d1d2a5d550d8d0c6fd111e5e7ba0dddb4682d64

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/021c73cdb22aed34fd6d295dce388049f69a538f...3d1d2a5d550d8d0c6fd111e5e7ba0dddb4682d64
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list