[vlc-commits] opengl/vdpau: remove struct priv

Rémi Denis-Courmont git at videolan.org
Mon Dec 24 18:23:18 CET 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Dec 24 16:28:22 2018 +0200| [ca42db67d60ba61a618fa5b315050d693ff1e6ee] | committer: Rémi Denis-Courmont

opengl/vdpau: remove struct priv

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ca42db67d60ba61a618fa5b315050d693ff1e6ee
---

 modules/video_output/opengl/converter_vdpau.c | 34 ++++++++-------------------
 1 file changed, 10 insertions(+), 24 deletions(-)

diff --git a/modules/video_output/opengl/converter_vdpau.c b/modules/video_output/opengl/converter_vdpau.c
index b5af7dc479..cdf0f0434d 100644
--- a/modules/video_output/opengl/converter_vdpau.c
+++ b/modules/video_output/opengl/converter_vdpau.c
@@ -47,11 +47,6 @@
         } \
     }
 
-struct  priv
-{
-    vdp_t *vdp;
-};
-
 static PFNGLVDPAUINITNVPROC                     _glVDPAUInitNV;
 static PFNGLVDPAUFININVPROC                     _glVDPAUFiniNV;
 static PFNGLVDPAUREGISTEROUTPUTSURFACENVPROC    _glVDPAURegisterOutputSurfaceNV;
@@ -66,14 +61,13 @@ static picture_pool_t *
 tc_vdpau_gl_get_pool(opengl_tex_converter_t const *tc,
                      unsigned int requested_count)
 {
-    struct priv *priv = tc->priv;
+    vdp_t *vdp = tc->priv;
     picture_t *pics[requested_count];
 
     unsigned int i;
     for (i = 0; i < requested_count; ++i)
     {
-        pics[i] = vlc_vdp_output_surface_create(priv->vdp,
-                                                VDP_RGBA_FORMAT_B8G8R8A8,
+        pics[i] = vlc_vdp_output_surface_create(vdp, VDP_RGBA_FORMAT_B8G8R8A8,
                                                 &tc->fmt);
         if (pics[i] == NULL)
             goto error;
@@ -140,8 +134,7 @@ Close(vlc_object_t *obj)
 {
     opengl_tex_converter_t *tc = (void *)obj;
     _glVDPAUFiniNV(); assert(tc->vt->GetError() == GL_NO_ERROR);
-    vdp_release_x11(((struct priv *)tc->priv)->vdp);
-    free(tc->priv);
+    vdp_release_x11(tc->priv);
 }
 
 static int
@@ -160,27 +153,21 @@ Open(vlc_object_t *obj)
     if (!vlc_xlib_init(VLC_OBJECT(tc->gl)))
         return VLC_EGENERIC;
 
-    struct priv *priv = calloc(1, sizeof(*priv));
-    if (!priv)
-        return VLC_EGENERIC;
-    tc->priv = priv;
-
+    vdp_t *vdp;
     VdpDevice device;
 
     if (vdp_get_x11(tc->gl->surface->display.x11, -1,
-                    &priv->vdp, &device) != VDP_STATUS_OK)
-    {
-        free(priv);
+                    &vdp, &device) != VDP_STATUS_OK)
         return VLC_EGENERIC;
-    }
+
+    tc->priv = vdp;
 
     void *vdp_gpa;
-    if (vdp_get_proc_address(priv->vdp, device,
+    if (vdp_get_proc_address(vdp, device,
                              VDP_FUNC_ID_GET_PROC_ADDRESS, &vdp_gpa)
         != VDP_STATUS_OK)
     {
-        vdp_release_x11(priv->vdp);
-        free(priv);
+        vdp_release_x11(vdp);
         return VLC_EGENERIC;
     }
 
@@ -188,8 +175,7 @@ Open(vlc_object_t *obj)
     _##fct = vlc_gl_GetProcAddress(tc->gl, #fct); \
     if (!_##fct) \
     { \
-        vdp_release_x11(priv->vdp); \
-        free(priv); \
+        vdp_release_x11(vdp); \
         return VLC_EGENERIC; \
     }
     SAFE_GPA(glVDPAUInitNV);



More information about the vlc-commits mailing list