[vlc-commits] core: replace picture_sys_t* by void*

Romain Vimont git at videolan.org
Thu Apr 26 01:42:54 CEST 2018


vlc | branch: master | Romain Vimont <rom1v at videolabs.io> | Mon Apr 23 18:10:15 2018 +0200| [3de64989180176eb10dc6ea1a012ede660afd7f5] | committer: Jean-Baptiste Kempf

core: replace picture_sys_t* by void*

See #17078

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 include/vlc_picture.h                         |  2 +-
 modules/codec/avcodec/d3d11va.c               | 19 ++++++++--------
 modules/hw/d3d11/d3d11_deinterlace.c          | 31 +++++++++++++++------------
 modules/hw/d3d11/d3d11_filters.c              | 15 +++++++------
 modules/hw/d3d11/d3d11_surface.c              | 15 +++++++------
 modules/hw/d3d9/d3d9_filters.c                |  8 +++++--
 modules/hw/d3d9/dxa9.c                        | 11 +++++-----
 modules/hw/d3d9/dxva2_deinterlace.c           | 19 +++++++++-------
 modules/hw/vaapi/vlc_vaapi.c                  |  8 ++++---
 modules/hw/vdpau/chroma.c                     |  7 +++---
 modules/hw/vdpau/display.c                    |  3 ++-
 modules/video_output/opengl/converter_sw.c    | 13 ++++++-----
 modules/video_output/opengl/converter_vdpau.c | 13 ++++++-----
 modules/video_output/win32/direct3d11.c       |  7 +++---
 modules/video_output/win32/direct3d9.c        |  9 +++++---
 modules/video_output/win32/directdraw.c       | 19 +++++++++-------
 16 files changed, 116 insertions(+), 83 deletions(-)

diff --git a/include/vlc_picture.h b/include/vlc_picture.h
index 7c0d869821..7364ea94b2 100644
--- a/include/vlc_picture.h
+++ b/include/vlc_picture.h
@@ -97,7 +97,7 @@ struct picture_t
 
     /** Private data - the video output plugin might want to put stuff here to
      * keep track of the picture */
-    picture_sys_t * p_sys;
+    void           *p_sys;
 
     /** Next picture in a FIFO a pictures */
     struct picture_t *p_next;
diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index 45e954b203..7201b599bf 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -250,36 +250,37 @@ static struct va_pic_context* NewSurfacePicContext(vlc_va_t *va, int surface_ind
 
 static int Get(vlc_va_t *va, picture_t *pic, uint8_t **data)
 {
+    picture_sys_t *p_sys = pic->p_sys;
 #if D3D11_DIRECT_DECODE
     if (va->sys->dx_sys.can_extern_pool)
     {
         /* copy the original picture_sys_t in the va_pic_context */
         if (!pic->context)
         {
-            assert(pic->p_sys!=NULL);
-            if (!pic->p_sys->decoder)
+            assert(p_sys!=NULL);
+            if (!p_sys->decoder)
             {
                 HRESULT hr;
                 D3D11_VIDEO_DECODER_OUTPUT_VIEW_DESC viewDesc;
                 ZeroMemory(&viewDesc, sizeof(viewDesc));
                 viewDesc.DecodeProfile = va->sys->dx_sys.input;
                 viewDesc.ViewDimension = D3D11_VDOV_DIMENSION_TEXTURE2D;
-                viewDesc.Texture2D.ArraySlice = pic->p_sys->slice_index;
+                viewDesc.Texture2D.ArraySlice = p_sys->slice_index;
 
                 hr = ID3D11VideoDevice_CreateVideoDecoderOutputView( va->sys->dx_sys.d3ddec,
-                                                                     pic->p_sys->resource[KNOWN_DXGI_INDEX],
+                                                                     p_sys->resource[KNOWN_DXGI_INDEX],
                                                                      &viewDesc,
-                                                                     &pic->p_sys->decoder );
+                                                                     &p_sys->decoder );
                 if (FAILED(hr))
                     return VLC_EGENERIC;
             }
 
             pic->context = (picture_context_t*)CreatePicContext(
-                                             pic->p_sys->decoder,
-                                             pic->p_sys->resource[KNOWN_DXGI_INDEX],
+                                             p_sys->decoder,
+                                             p_sys->resource[KNOWN_DXGI_INDEX],
                                              va->sys->d3d_dev.d3dcontext,
-                                             pic->p_sys->slice_index,
-                                             pic->p_sys->resourceView );
+                                             p_sys->slice_index,
+                                             p_sys->resourceView );
             if (pic->context == NULL)
                 return VLC_EGENERIC;
         }
diff --git a/modules/hw/d3d11/d3d11_deinterlace.c b/modules/hw/d3d11/d3d11_deinterlace.c
index 8c87ad5261..d26a144d7a 100644
--- a/modules/hw/d3d11/d3d11_deinterlace.c
+++ b/modules/hw/d3d11/d3d11_deinterlace.c
@@ -128,6 +128,7 @@ static int RenderPic( filter_t *p_filter, picture_t *p_outpic, picture_t *p_pic,
     VLC_UNUSED(order);
     HRESULT hr;
     filter_sys_t *p_sys = p_filter->p_sys;
+    picture_sys_t *p_out_sys = p_outpic->p_sys;
 
     picture_t *p_prev = p_sys->context.pp_history[0];
     picture_t *p_cur  = p_sys->context.pp_history[1];
@@ -209,9 +210,9 @@ static int RenderPic( filter_t *p_filter, picture_t *p_outpic, picture_t *p_pic,
         .back = 1,
     };
 
-    ID3D11DeviceContext_CopySubresourceRegion(p_outpic->p_sys->context,
-                                              p_outpic->p_sys->resource[KNOWN_DXGI_INDEX],
-                                              p_outpic->p_sys->slice_index,
+    ID3D11DeviceContext_CopySubresourceRegion(p_out_sys->context,
+                                              p_out_sys->resource[KNOWN_DXGI_INDEX],
+                                              p_out_sys->slice_index,
                                               0, 0, 0,
                                               p_sys->outResource,
                                               0, &box);
@@ -274,15 +275,17 @@ static struct picture_context_t *d3d11_pic_context_copy(struct picture_context_t
 static picture_t *NewOutputPicture( filter_t *p_filter )
 {
     picture_t *pic = p_filter->p_sys->buffer_new( p_filter );
+    picture_sys_t *pic_sys = pic->p_sys;
     if ( !pic->context )
     {
         bool b_local_texture = false;
 
-        if ( !pic->p_sys )
+        if ( !pic_sys )
         {
-            pic->p_sys = calloc(1, sizeof(*pic->p_sys));
-            if (unlikely(pic->p_sys == NULL))
+            pic_sys = calloc(1, sizeof(*pic_sys));
+            if (unlikely(pic_sys == NULL))
                 return NULL;
+            pic->p_sys = pic_sys;
 
             D3D11_TEXTURE2D_DESC dstDesc;
             ID3D11Texture2D_GetDesc(p_filter->p_sys->outTexture, &dstDesc);
@@ -300,7 +303,7 @@ static picture_t *NewOutputPicture( filter_t *p_filter )
             }
             if (unlikely(cfg == NULL))
             {
-                free(pic->p_sys);
+                free(pic_sys);
                 return NULL;
             }
 
@@ -309,15 +312,15 @@ static picture_t *NewOutputPicture( filter_t *p_filter )
             fmt.i_width  = dstDesc.Width;
             fmt.i_height = dstDesc.Height;
             if (AllocateTextures(VLC_OBJECT(p_filter), &p_filter->p_sys->d3d_dev, cfg,
-                                 &fmt, 1, pic->p_sys->texture) != VLC_SUCCESS)
+                                 &fmt, 1, pic_sys->texture) != VLC_SUCCESS)
             {
-                free(pic->p_sys);
+                free(pic_sys);
                 return NULL;
             }
             b_local_texture = true;
 
-            pic->p_sys->context = p_filter->p_sys->d3d_dev.d3dcontext;
-            pic->p_sys->formatTexture = dstDesc.Format;
+            pic_sys->context = p_filter->p_sys->d3d_dev.d3dcontext;
+            pic_sys->formatTexture = dstDesc.Format;
 
         }
         /* the picture might be duplicated for snapshots so it needs a context */
@@ -326,14 +329,14 @@ static picture_t *NewOutputPicture( filter_t *p_filter )
         {
             pic_ctx->s.destroy = d3d11_pic_context_destroy;
             pic_ctx->s.copy    = d3d11_pic_context_copy;
-            pic_ctx->picsys = *pic->p_sys;
+            pic_ctx->picsys = *pic_sys;
             AcquirePictureSys( &pic_ctx->picsys );
             pic->context = &pic_ctx->s;
         }
         if (b_local_texture) {
             for (int i=0; i<D3D11_MAX_SHADER_VIEW; i++) {
-                if (pic->p_sys->texture[i])
-                    ID3D11Texture2D_Release(pic->p_sys->texture[i]);
+                if (pic_sys->texture[i])
+                    ID3D11Texture2D_Release(pic_sys->texture[i]);
             }
         }
     }
diff --git a/modules/hw/d3d11/d3d11_filters.c b/modules/hw/d3d11/d3d11_filters.c
index f3e25c47c4..daeb1b4e7d 100644
--- a/modules/hw/d3d11/d3d11_filters.c
+++ b/modules/hw/d3d11/d3d11_filters.c
@@ -236,7 +236,8 @@ static picture_t *Filter(filter_t *p_filter, picture_t *p_pic)
         picture_Release( p_pic );
         return NULL;
     }
-    if (unlikely(!p_outpic->p_sys))
+    picture_sys_t *p_out_sys = p_outpic->p_sys;
+    if (unlikely(!p_out_sys))
     {
         /* the output filter configuration may have changed since the filter
          * was opened */
@@ -299,9 +300,9 @@ static picture_t *Filter(filter_t *p_filter, picture_t *p_pic)
 
     if (count == 0)
     {
-        ID3D11DeviceContext_CopySubresourceRegion(p_outpic->p_sys->context,
-                                                  p_outpic->p_sys->resource[KNOWN_DXGI_INDEX],
-                                                  p_outpic->p_sys->slice_index,
+        ID3D11DeviceContext_CopySubresourceRegion(p_out_sys->context,
+                                                  p_out_sys->resource[KNOWN_DXGI_INDEX],
+                                                  p_out_sys->slice_index,
                                                   0, 0, 0,
                                                   p_src_sys->resource[KNOWN_DXGI_INDEX],
                                                   p_src_sys->slice_index,
@@ -309,9 +310,9 @@ static picture_t *Filter(filter_t *p_filter, picture_t *p_pic)
     }
     else
     {
-        ID3D11DeviceContext_CopySubresourceRegion(p_outpic->p_sys->context,
-                                                  p_outpic->p_sys->resource[KNOWN_DXGI_INDEX],
-                                                  p_outpic->p_sys->slice_index,
+        ID3D11DeviceContext_CopySubresourceRegion(p_out_sys->context,
+                                                  p_out_sys->resource[KNOWN_DXGI_INDEX],
+                                                  p_out_sys->slice_index,
                                                   0, 0, 0,
                                                   p_sys->out[outputs[idx] == p_sys->procOutput[0] ? 1 : 0].resource,
                                                   0,
diff --git a/modules/hw/d3d11/d3d11_surface.c b/modules/hw/d3d11/d3d11_surface.c
index 35997ef4b9..31aa663a77 100644
--- a/modules/hw/d3d11/d3d11_surface.c
+++ b/modules/hw/d3d11/d3d11_surface.c
@@ -645,11 +645,13 @@ static void NV12_D3D11(filter_t *p_filter, picture_t *src, picture_t *dst)
         return;
     }
 
+    picture_sys_t *p_staging_sys = sys->staging_pic->p_sys;
+
     D3D11_TEXTURE2D_DESC texDesc;
-    ID3D11Texture2D_GetDesc( sys->staging_pic->p_sys->texture[KNOWN_DXGI_INDEX], &texDesc);
+    ID3D11Texture2D_GetDesc( p_staging_sys->texture[KNOWN_DXGI_INDEX], &texDesc);
 
     D3D11_MAPPED_SUBRESOURCE lock;
-    HRESULT hr = ID3D11DeviceContext_Map(p_sys->context, sys->staging_pic->p_sys->resource[KNOWN_DXGI_INDEX],
+    HRESULT hr = ID3D11DeviceContext_Map(p_sys->context, p_staging_sys->resource[KNOWN_DXGI_INDEX],
                                          0, D3D11_MAP_WRITE, 0, &lock);
     if (FAILED(hr)) {
         msg_Err(p_filter, "Failed to map source surface. (hr=0x%0lx)", hr);
@@ -661,7 +663,7 @@ static void NV12_D3D11(filter_t *p_filter, picture_t *src, picture_t *dst)
     picture_Hold( src );
     sys->filter->pf_video_filter(sys->filter, src);
 
-    ID3D11DeviceContext_Unmap(p_sys->context, sys->staging_pic->p_sys->resource[KNOWN_DXGI_INDEX], 0);
+    ID3D11DeviceContext_Unmap(p_sys->context, p_staging_sys->resource[KNOWN_DXGI_INDEX], 0);
 
     D3D11_BOX copyBox = {
         .right = dst->format.i_width, .bottom = dst->format.i_height, .back = 1,
@@ -670,7 +672,7 @@ static void NV12_D3D11(filter_t *p_filter, picture_t *src, picture_t *dst)
                                               p_sys->resource[KNOWN_DXGI_INDEX],
                                               p_sys->slice_index,
                                               0, 0, 0,
-                                              sys->staging_pic->p_sys->resource[KNOWN_DXGI_INDEX], 0,
+                                              p_staging_sys->resource[KNOWN_DXGI_INDEX], 0,
                                               &copyBox);
     if (dst->context == NULL)
     {
@@ -679,7 +681,7 @@ static void NV12_D3D11(filter_t *p_filter, picture_t *src, picture_t *dst)
         {
             pic_ctx->s.destroy = d3d11_pic_context_destroy;
             pic_ctx->s.copy    = d3d11_pic_context_copy;
-            pic_ctx->picsys = *dst->p_sys;
+            pic_ctx->picsys = *p_sys;
             AcquirePictureSys(&pic_ctx->picsys);
             dst->context = &pic_ctx->s;
         }
@@ -827,6 +829,7 @@ int D3D11OpenCPUConverter( vlc_object_t *obj )
         msg_Err(p_filter, "Failed to map create the temporary picture.");
         goto done;
     }
+    picture_sys_t *p_dst_sys = p_dst->p_sys;
     picture_Setup(p_dst, &p_dst->format);
 
     texDesc.MipLevels = 1;
@@ -845,7 +848,7 @@ int D3D11OpenCPUConverter( vlc_object_t *obj )
     }
 
     res.p_sys->texture[KNOWN_DXGI_INDEX] = texture;
-    ID3D11DeviceContext_AddRef(p_dst->p_sys->context);
+    ID3D11DeviceContext_AddRef(p_dst_sys->context);
 
     if ( p_filter->fmt_in.video.i_chroma != d3d_fourcc )
     {
diff --git a/modules/hw/d3d9/d3d9_filters.c b/modules/hw/d3d9/d3d9_filters.c
index c8f445d9ac..680f120b33 100644
--- a/modules/hw/d3d9/d3d9_filters.c
+++ b/modules/hw/d3d9/d3d9_filters.c
@@ -107,7 +107,11 @@ static picture_t *Filter(filter_t *p_filter, picture_t *p_pic)
     picture_sys_t *p_src_sys = ActivePictureSys(p_pic);
 
     picture_t *p_outpic = filter_NewPicture( p_filter );
-    if( !p_outpic || !p_outpic->p_sys || !p_outpic->p_sys->surface )
+    if( !p_outpic )
+        goto failed;
+
+    picture_sys_t *p_out_sys = p_outpic->p_sys;
+    if( !p_out_sys || !p_out_sys->surface )
         goto failed;
 
     picture_CopyProperties( p_outpic, p_pic );
@@ -149,7 +153,7 @@ static picture_t *Filter(filter_t *p_filter, picture_t *p_pic)
                                                  1, NULL );
     hr = IDirect3DDevice9_StretchRect( p_sys->d3d_dev.dev,
                                        p_sys->hw_surface, NULL,
-                                       p_outpic->p_sys->surface, NULL,
+                                       p_out_sys->surface, NULL,
                                        D3DTEXF_NONE);
     if (FAILED(hr))
         goto failed;
diff --git a/modules/hw/d3d9/dxa9.c b/modules/hw/d3d9/dxa9.c
index 259e0153c4..7235709686 100644
--- a/modules/hw/d3d9/dxa9.c
+++ b/modules/hw/d3d9/dxa9.c
@@ -251,12 +251,13 @@ static void YV12_D3D9(filter_t *p_filter, picture_t *src, picture_t *dst)
 {
     filter_sys_t *sys = p_filter->p_sys;
     picture_sys_t *p_sys = dst->p_sys;
+    picture_sys_t *p_staging_sys = sys->staging->p_sys;
 
     D3DSURFACE_DESC texDesc;
     IDirect3DSurface9_GetDesc( p_sys->surface, &texDesc);
 
     D3DLOCKED_RECT d3drect;
-    HRESULT hr = IDirect3DSurface9_LockRect(sys->staging->p_sys->surface, &d3drect, NULL, 0);
+    HRESULT hr = IDirect3DSurface9_LockRect(p_staging_sys->surface, &d3drect, NULL, 0);
     if (FAILED(hr))
         return;
 
@@ -266,14 +267,14 @@ static void YV12_D3D9(filter_t *p_filter, picture_t *src, picture_t *dst)
 
     sys->filter->pf_video_filter(sys->filter, src);
 
-    IDirect3DSurface9_UnlockRect(sys->staging->p_sys->surface);
+    IDirect3DSurface9_UnlockRect(p_staging_sys->surface);
 
     RECT visibleSource = {
         .right = dst->format.i_width, .bottom = dst->format.i_height,
     };
     IDirect3DDevice9_StretchRect( sys->d3d_dev.dev,
-                                  sys->staging->p_sys->surface, &visibleSource,
-                                  dst->p_sys->surface, &visibleSource,
+                                  p_staging_sys->surface, &visibleSource,
+                                  p_sys->surface, &visibleSource,
                                   D3DTEXF_NONE );
 
     if (dst->context == NULL)
@@ -283,7 +284,7 @@ static void YV12_D3D9(filter_t *p_filter, picture_t *src, picture_t *dst)
         {
             pic_ctx->s.destroy = d3d9_pic_context_destroy;
             pic_ctx->s.copy    = d3d9_pic_context_copy;
-            pic_ctx->picsys = *dst->p_sys;
+            pic_ctx->picsys = *p_sys;
             AcquirePictureSys(&pic_ctx->picsys);
             dst->context = &pic_ctx->s;
         }
diff --git a/modules/hw/d3d9/dxva2_deinterlace.c b/modules/hw/d3d9/dxva2_deinterlace.c
index 3326fa0318..a2f0a54e23 100644
--- a/modules/hw/d3d9/dxva2_deinterlace.c
+++ b/modules/hw/d3d9/dxva2_deinterlace.c
@@ -132,6 +132,7 @@ static int RenderPic( filter_t *filter, picture_t *p_outpic, picture_t *src,
                       int order, int i_field )
 {
     filter_sys_t *sys = filter->p_sys;
+    picture_sys_t *p_out_sys = p_outpic->p_sys;
     const int i_samples = sys->decoder_caps.NumBackwardRefSamples + 1 +
                           sys->decoder_caps.NumForwardRefSamples;
     HRESULT hr;
@@ -195,7 +196,7 @@ static int RenderPic( filter_t *filter, picture_t *p_outpic, picture_t *src,
 
     hr = IDirect3DDevice9_StretchRect( sys->d3d_dev.dev,
                                        sys->hw_surface, NULL,
-                                       p_outpic->p_sys->surface, NULL,
+                                       p_out_sys->surface, NULL,
                                        D3DTEXF_NONE);
     if (FAILED(hr))
         return VLC_EGENERIC;
@@ -251,32 +252,34 @@ static picture_t *NewOutputPicture( filter_t *p_filter )
 {
     filter_sys_t *p_sys = p_filter->p_sys;
     picture_t *pic = p_sys->buffer_new( p_filter );
+    picture_sys_t *pic_sys = pic->p_sys;
     if ( !pic->context )
     {
         bool b_local_texture = false;
 
-        if (!pic->p_sys )
+        if ( !pic_sys )
         {
             D3DSURFACE_DESC dstDesc;
             if ( !p_sys->hw_surface ||
                  FAILED(IDirect3DSurface9_GetDesc( p_sys->hw_surface, &dstDesc )) )
                 return NULL;
 
-            pic->p_sys = calloc(1, sizeof(*pic->p_sys));
-            if (unlikely(pic->p_sys == NULL))
+            pic_sys = calloc(1, sizeof(*pic_sys));
+            if (unlikely(pic_sys == NULL))
                 return NULL;
+            pic->p_sys = pic_sys;
 
             HRESULT hr = IDirect3DDevice9_CreateOffscreenPlainSurface(p_sys->d3d_dev.dev,
                                                               p_filter->fmt_out.video.i_width,
                                                               p_filter->fmt_out.video.i_height,
                                                               dstDesc.Format,
                                                               D3DPOOL_DEFAULT,
-                                                              &pic->p_sys->surface,
+                                                              &pic_sys->surface,
                                                               NULL);
 
             if (FAILED(hr))
             {
-                free(pic->p_sys);
+                free(p_sys);
                 pic->p_sys = NULL;
                 return NULL;
             }
@@ -288,12 +291,12 @@ static picture_t *NewOutputPicture( filter_t *p_filter )
         {
             pic_ctx->s.destroy = d3d9_pic_context_destroy;
             pic_ctx->s.copy    = d3d9_pic_context_copy;
-            pic_ctx->picsys = *pic->p_sys;
+            pic_ctx->picsys = *pic_sys;
             AcquirePictureSys( &pic_ctx->picsys );
             pic->context = &pic_ctx->s;
         }
         if (b_local_texture)
-            IDirect3DSurface9_Release(pic->p_sys->surface);
+            IDirect3DSurface9_Release(pic_sys->surface);
     }
     return pic;
 }
diff --git a/modules/hw/vaapi/vlc_vaapi.c b/modules/hw/vaapi/vlc_vaapi.c
index 1f1f384c99..a44d828852 100644
--- a/modules/hw/vaapi/vlc_vaapi.c
+++ b/modules/hw/vaapi/vlc_vaapi.c
@@ -712,8 +712,9 @@ vlc_vaapi_PicAttachContext(picture_t *pic)
     assert(pic->p_sys != NULL);
     assert(pic->context == NULL);
 
-    pic->p_sys->ctx.picref = pic;
-    pic->context = &pic->p_sys->ctx.s;
+    picture_sys_t *p_sys = pic->p_sys;
+    p_sys->ctx.picref = pic;
+    pic->context = &p_sys->ctx.s;
 }
 
 VASurfaceID
@@ -731,5 +732,6 @@ vlc_vaapi_PicGetDisplay(picture_t *pic)
     ASSERT_VAAPI_CHROMA(pic);
     assert(pic->context);
 
-    return ((struct vaapi_pic_ctx *)pic->context)->picref->p_sys->instance->va_dpy;
+    picture_sys_t *p_sys = ((struct vaapi_pic_ctx *)pic->context)->picref->p_sys;
+    return p_sys->instance->va_dpy;
 }
diff --git a/modules/hw/vdpau/chroma.c b/modules/hw/vdpau/chroma.c
index d839285d8b..028f3d808c 100644
--- a/modules/hw/vdpau/chroma.c
+++ b/modules/hw/vdpau/chroma.c
@@ -516,7 +516,8 @@ static picture_t *Render(filter_t *filter, picture_t *src, bool import)
     if (dst == NULL)
         goto skip;
 
-    assert(dst->p_sys != NULL && dst->p_sys->vdp ==sys->vdp);
+    picture_sys_t *p_sys = dst->p_sys;
+    assert(p_sys != NULL && p_sys->vdp == sys->vdp);
     dst->date = sys->history[MAX_PAST].date;
     dst->b_force = sys->history[MAX_PAST].force;
 
@@ -589,7 +590,7 @@ static picture_t *Render(filter_t *filter, picture_t *src, bool import)
         }
     }
 
-    VdpOutputSurface output = dst->p_sys->surface;
+    VdpOutputSurface output = p_sys->surface;
 
     if (swap)
     {
@@ -670,7 +671,7 @@ static picture_t *Render(filter_t *filter, picture_t *src, bool import)
     if (swap)
     {
         err = vdp_output_surface_render_output_surface(sys->vdp,
-            dst->p_sys->surface, NULL, output, NULL, NULL, NULL,
+            p_sys->surface, NULL, output, NULL, NULL, NULL,
             VDP_OUTPUT_SURFACE_RENDER_ROTATE_90);
         vdp_output_surface_destroy(sys->vdp, output);
         if (err != VDP_STATUS_OK)
diff --git a/modules/hw/vdpau/display.c b/modules/hw/vdpau/display.c
index edd6096729..87b1378c6e 100644
--- a/modules/hw/vdpau/display.c
+++ b/modules/hw/vdpau/display.c
@@ -243,7 +243,8 @@ out:/* Destroy GPU surface */
 static void Queue(vout_display_t *vd, picture_t *pic, subpicture_t *subpic)
 {
     vout_display_sys_t *sys = vd->sys;
-    VdpOutputSurface surface = pic->p_sys->surface;
+    picture_sys_t *p_sys = pic->p_sys;
+    VdpOutputSurface surface = p_sys->surface;
     VdpStatus err;
 
     VdpPresentationQueueStatus status;
diff --git a/modules/video_output/opengl/converter_sw.c b/modules/video_output/opengl/converter_sw.c
index 981e0d4e37..2a01ba4215 100644
--- a/modules/video_output/opengl/converter_sw.c
+++ b/modules/video_output/opengl/converter_sw.c
@@ -216,6 +216,7 @@ tc_pbo_update(const opengl_tex_converter_t *tc, GLuint *textures,
     struct priv *priv = tc->priv;
 
     picture_t *display_pic = priv->pbo.display_pics[priv->pbo.display_idx];
+    picture_sys_t *p_sys = display_pic->p_sys;
     priv->pbo.display_idx = (priv->pbo.display_idx + 1) % PBO_DISPLAY_COUNT;
 
     for (int i = 0; i < pic->i_planes; i++)
@@ -223,7 +224,7 @@ tc_pbo_update(const opengl_tex_converter_t *tc, GLuint *textures,
         GLsizeiptr size = pic->p[i].i_lines * pic->p[i].i_pitch;
         const GLvoid *data = pic->p[i].p_pixels;
         tc->vt->BindBuffer(GL_PIXEL_UNPACK_BUFFER,
-                            display_pic->p_sys->buffers[i]);
+                           p_sys->buffers[i]);
         tc->vt->BufferSubData(GL_PIXEL_UNPACK_BUFFER, 0, size, data);
 
         tc->vt->ActiveTexture(GL_TEXTURE0 + i);
@@ -344,7 +345,7 @@ tc_persistent_update(const opengl_tex_converter_t *tc, GLuint *textures,
     }
 
     picsys->fence = tc->vt->FenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
-    if (pic->p_sys->fence == NULL)
+    if (picsys->fence == NULL)
     {
         /* Error (corner case): don't hold the picture */
         hold = false;
@@ -355,7 +356,7 @@ tc_persistent_update(const opengl_tex_converter_t *tc, GLuint *textures,
     if (hold)
     {
         /* Hold the picture while it's used by the GPU */
-        unsigned index = pic->p_sys->index;
+        unsigned index = picsys->index;
 
         priv->persistent.list |= 1ULL << index;
         assert(priv->persistent.pics[index] == NULL);
@@ -384,11 +385,13 @@ tc_persistent_get_pool(const opengl_tex_converter_t *tc, unsigned requested_coun
         picture_t *pic = pictures[count] = pbo_picture_create(tc, true);
         if (pic == NULL)
             break;
+
+        picture_sys_t *p_sys = pic->p_sys;
 #ifndef NDEBUG
         for (int i = 0; i < pic->i_planes; ++i)
-            assert(pic->p_sys->bytes[i] == pictures[0]->p_sys->bytes[i]);
+            assert(p_sys->bytes[i] == ((picture_sys_t *) pictures[0]->p_sys)->bytes[i]);
 #endif
-        pic->p_sys->index = count;
+        p_sys->index = count;
 
         if (persistent_map(tc, pic) != VLC_SUCCESS)
         {
diff --git a/modules/video_output/opengl/converter_vdpau.c b/modules/video_output/opengl/converter_vdpau.c
index f3d807a49b..bb77ae8d26 100644
--- a/modules/video_output/opengl/converter_vdpau.c
+++ b/modules/video_output/opengl/converter_vdpau.c
@@ -66,9 +66,10 @@ static PFNGLVDPAUUNMAPSURFACESNVPROC            _glVDPAUUnmapSurfacesNV;
 static void
 pool_pic_destroy_cb(picture_t *pic)
 {
-    vdp_output_surface_destroy(pic->p_sys->vdp, pic->p_sys->surface);
-    vdp_release_x11(pic->p_sys->vdp);
-    free(pic->p_sys);
+    picture_sys_t *p_sys = pic->p_sys;
+    vdp_output_surface_destroy(p_sys->vdp, p_sys->surface);
+    vdp_release_x11(p_sys->vdp);
+    free(p_sys);
     free(pic);
 }
 
@@ -129,8 +130,10 @@ tc_vdpau_gl_update(opengl_tex_converter_t const *tc, GLuint textures[],
     VLC_UNUSED(tex_heights);
     VLC_UNUSED(plane_offsets);
 
+    picture_sys_t *p_sys = pic->p_sys;
+
     GLvdpauSurfaceNV *p_gl_nv_surface =
-        (GLvdpauSurfaceNV *)&pic->p_sys->gl_nv_surface;
+        (GLvdpauSurfaceNV *)&p_sys->gl_nv_surface;
 
     if (*p_gl_nv_surface)
     {
@@ -148,7 +151,7 @@ tc_vdpau_gl_update(opengl_tex_converter_t const *tc, GLuint textures[],
 
     *p_gl_nv_surface =
         INTEROP_CALL(glVDPAURegisterOutputSurfaceNV,
-                     (void *)(size_t)pic->p_sys->surface,
+                     (void *)(size_t)p_sys->surface,
                      GL_TEXTURE_2D, tc->tex_count, textures);
     INTEROP_CALL(glVDPAUSurfaceAccessNV, *p_gl_nv_surface, GL_READ_ONLY);
     INTEROP_CALL(glVDPAUMapSurfacesNV, 1, p_gl_nv_surface);
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index aa4c4ec7ff..d4fc38be56 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -662,11 +662,12 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned pool_size)
         {
             sys->picQuad.resourceCount = DxgiResourceCount(sys->picQuadConfig);
             for (picture_count = 0; picture_count < pool_size; picture_count++) {
-                if (!pictures[picture_count]->p_sys->texture[0])
+                picture_sys_t *p_sys = pictures[picture_count]->p_sys;
+                if (!p_sys->texture[0])
                     continue;
                 if (AllocateShaderView(VLC_OBJECT(vd), sys->d3d_dev.d3ddevice, sys->picQuadConfig,
-                                       pictures[picture_count]->p_sys->texture, picture_count,
-                                       pictures[picture_count]->p_sys->resourceView))
+                                       p_sys->texture, picture_count,
+                                       p_sys->resourceView))
                     goto error;
             }
         }
diff --git a/modules/video_output/win32/direct3d9.c b/modules/video_output/win32/direct3d9.c
index 31dc070edd..18406428af 100644
--- a/modules/video_output/win32/direct3d9.c
+++ b/modules/video_output/win32/direct3d9.c
@@ -379,9 +379,10 @@ static void DestroyPicture(picture_t *picture)
  */
 static int Direct3D9LockSurface(picture_t *picture)
 {
+    picture_sys_t *p_sys = picture->p_sys;
     /* Lock the surface to get a valid pointer to the picture buffer */
     D3DLOCKED_RECT d3drect;
-    HRESULT hr = IDirect3DSurface9_LockRect(picture->p_sys->surface, &d3drect, NULL, 0);
+    HRESULT hr = IDirect3DSurface9_LockRect(p_sys->surface, &d3drect, NULL, 0);
     if (FAILED(hr)) {
         return VLC_EGENERIC;
     }
@@ -394,8 +395,9 @@ static int Direct3D9LockSurface(picture_t *picture)
  */
 static void Direct3D9UnlockSurface(picture_t *picture)
 {
+    picture_sys_t *p_sys = picture->p_sys;
     /* Unlock the Surface */
-    HRESULT hr = IDirect3DSurface9_UnlockRect(picture->p_sys->surface);
+    HRESULT hr = IDirect3DSurface9_UnlockRect(p_sys->surface);
     if (FAILED(hr)) {
         //msg_Dbg(vd, "Failed IDirect3DSurface9_UnlockRect: 0x%0lx", hr);
     }
@@ -496,7 +498,8 @@ static picture_pool_t *DisplayPool(vout_display_t *vd, unsigned count)
 static void Prepare(vout_display_t *vd, picture_t *picture, subpicture_t *subpicture)
 {
     vout_display_sys_t *sys = vd->sys;
-    LPDIRECT3DSURFACE9 surface = picture->p_sys->surface;
+    picture_sys_t *p_sys = picture->p_sys;
+    LPDIRECT3DSURFACE9 surface = p_sys->surface;
     d3d9_device_t *p_d3d9_dev = &sys->d3d_dev;
 
     /* FIXME it is a bit ugly, we need the surface to be unlocked for
diff --git a/modules/video_output/win32/directdraw.c b/modules/video_output/win32/directdraw.c
index 142ee0588b..ac3b290ea1 100644
--- a/modules/video_output/win32/directdraw.c
+++ b/modules/video_output/win32/directdraw.c
@@ -297,6 +297,7 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned count)
 static void Display(vout_display_t *vd, picture_t *picture, subpicture_t *subpicture)
 {
     vout_display_sys_t *sys = vd->sys;
+    picture_sys_t *p_sys = picture->p_sys;
 
     assert(sys->display);
 
@@ -316,8 +317,8 @@ static void Display(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
 
     if (sys->sys.use_overlay) {
         /* Flip the overlay buffers if we are using back buffers */
-        if (picture->p_sys->surface != picture->p_sys->front_surface) {
-            HRESULT hr = IDirectDrawSurface2_Flip(picture->p_sys->front_surface,
+        if (p_sys->surface != p_sys->front_surface) {
+            HRESULT hr = IDirectDrawSurface2_Flip(p_sys->front_surface,
                                                   NULL, DDFLIP_WAIT);
             if (hr != DD_OK)
                 msg_Warn(vd, "could not flip overlay (error %li)", hr);
@@ -331,7 +332,7 @@ static void Display(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
 
         HRESULT hr = IDirectDrawSurface2_Blt(sys->display,
                                              &sys->sys.rect_dest_clipped,
-                                             picture->p_sys->surface,
+                                             p_sys->surface,
                                              &sys->sys.rect_src_clipped,
                                              DDBLT_ASYNC, &ddbltfx);
         if (hr != DD_OK)
@@ -1270,18 +1271,20 @@ static void DirectXDestroyPictureResource(vout_display_t *vd)
 
 static int DirectXLock(picture_t *picture)
 {
+    picture_sys_t *p_sys = picture->p_sys;
     DDSURFACEDESC ddsd;
-    if (DirectXLockSurface(picture->p_sys->front_surface,
-                           picture->p_sys->surface, &ddsd))
-        return CommonUpdatePicture(picture, &picture->p_sys->fallback, NULL, 0);
+    if (DirectXLockSurface(p_sys->front_surface,
+                           p_sys->surface, &ddsd))
+        return CommonUpdatePicture(picture, &p_sys->fallback, NULL, 0);
 
     CommonUpdatePicture(picture, NULL, ddsd.lpSurface, ddsd.lPitch);
     return VLC_SUCCESS;
 }
 static void DirectXUnlock(picture_t *picture)
 {
-    DirectXUnlockSurface(picture->p_sys->front_surface,
-                         picture->p_sys->surface);
+    picture_sys_t *p_sys = picture->p_sys;
+    DirectXUnlockSurface(p_sys->front_surface,
+                         p_sys->surface);
 }
 
 static int DirectXCreatePool(vout_display_t *vd,



More information about the vlc-commits mailing list