[vlc-commits] MSW/DirectX: keep only picture_sys_t * instead of picture_resource_t
Rémi Denis-Courmont
git at videolan.org
Sun Jul 14 19:26:56 CEST 2013
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Jul 14 20:04:05 2013 +0300| [e7190f764a10963556b36794000dbf25a6dbdeff] | committer: Rémi Denis-Courmont
MSW/DirectX: keep only picture_sys_t * instead of picture_resource_t
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e7190f764a10963556b36794000dbf25a6dbdeff
---
modules/video_output/msw/common.h | 2 +-
modules/video_output/msw/directx.c | 53 ++++++++++++++++--------------------
2 files changed, 25 insertions(+), 30 deletions(-)
diff --git a/modules/video_output/msw/common.h b/modules/video_output/msw/common.h
index 4e0c476..0d4ce4b 100644
--- a/modules/video_output/msw/common.h
+++ b/modules/video_output/msw/common.h
@@ -100,7 +100,7 @@ struct vout_display_sys_t
LPDIRECTDRAWCLIPPER clipper; /* clipper used for blitting */
HINSTANCE hddraw_dll; /* handle of the opened ddraw dll */
- picture_resource_t resource;
+ picture_sys_t *picsys;
/* It protects the following variables */
vlc_mutex_t lock;
diff --git a/modules/video_output/msw/directx.c b/modules/video_output/msw/directx.c
index bcc5c85..1945795 100644
--- a/modules/video_output/msw/directx.c
+++ b/modules/video_output/msw/directx.c
@@ -1039,10 +1039,10 @@ static int DirectXCreatePictureResourceYuvOverlay(vout_display_t *vd,
}
/* */
- picture_resource_t *rsc = &sys->resource;
- rsc->p_sys->front_surface = front_surface;
- rsc->p_sys->surface = surface;
- rsc->p_sys->fallback = NULL;
+ picture_sys_t *picsys = sys->picsys;
+ picsys->front_surface = front_surface;
+ picsys->surface = surface;
+ picsys->fallback = NULL;
return VLC_SUCCESS;
}
static int DirectXCreatePictureResourceYuv(vout_display_t *vd,
@@ -1095,10 +1095,10 @@ static int DirectXCreatePictureResourceYuv(vout_display_t *vd,
}
/* */
- picture_resource_t *rsc = &sys->resource;
- rsc->p_sys->front_surface = surface;
- rsc->p_sys->surface = surface;
- rsc->p_sys->fallback = NULL;
+ picture_sys_t *picsys = sys->picsys;
+ picsys->front_surface = surface;
+ picsys->surface = surface;
+ picsys->fallback = NULL;
return VLC_SUCCESS;
}
static int DirectXCreatePictureResourceRgb(vout_display_t *vd,
@@ -1155,10 +1155,10 @@ static int DirectXCreatePictureResourceRgb(vout_display_t *vd,
}
/* */
- picture_resource_t *rsc = &sys->resource;
- rsc->p_sys->front_surface = surface;
- rsc->p_sys->surface = surface;
- rsc->p_sys->fallback = NULL;
+ picture_sys_t *picsys = sys->picsys;
+ picsys->front_surface = surface;
+ picsys->surface = surface;
+ picsys->fallback = NULL;
return VLC_SUCCESS;
}
@@ -1169,10 +1169,10 @@ static int DirectXCreatePictureResource(vout_display_t *vd,
vout_display_sys_t *sys = vd->sys;
/* */
- picture_resource_t *rsc = &sys->resource;
- rsc->p_sys = calloc(1, sizeof(*rsc->p_sys));
- if (!rsc->p_sys)
+ picture_sys_t *picsys = calloc(1, sizeof(*picsys));
+ if (unlikely(picsys == NULL))
return VLC_ENOMEM;
+ sys->picsys = picsys;
/* */
bool allow_hw_yuv = sys->can_blit_fourcc &&
@@ -1212,11 +1212,11 @@ static void DirectXDestroyPictureResource(vout_display_t *vd)
{
vout_display_sys_t *sys = vd->sys;
- if (sys->resource.p_sys->front_surface != sys->resource.p_sys->surface)
- DirectXDestroySurface(sys->resource.p_sys->surface);
- DirectXDestroySurface(sys->resource.p_sys->front_surface);
- if (sys->resource.p_sys->fallback)
- picture_Release(sys->resource.p_sys->fallback);
+ if (sys->picsys->front_surface != sys->picsys->surface)
+ DirectXDestroySurface(sys->picsys->surface);
+ DirectXDestroySurface(sys->picsys->front_surface);
+ if (sys->picsys->fallback)
+ picture_Release(sys->picsys->fallback);
}
static int DirectXLock(picture_t *picture)
@@ -1247,16 +1247,11 @@ static int DirectXCreatePool(vout_display_t *vd,
return VLC_EGENERIC;
/* Create the associated picture */
- picture_resource_t *rsc = &sys->resource;
- for (int i = 0; i < PICTURE_PLANE_MAX; i++) {
- rsc->p[i].p_pixels = NULL;
- rsc->p[i].i_pitch = 0;
- rsc->p[i].i_lines = 0;
- }
- picture_t *picture = picture_NewFromResource(fmt, rsc);
+ picture_resource_t resource = { .p_sys = sys->picsys };
+ picture_t *picture = picture_NewFromResource(fmt, &resource);
if (!picture) {
DirectXDestroyPictureResource(vd);
- free(rsc->p_sys);
+ free(sys->picsys);
return VLC_ENOMEM;
}
@@ -1325,7 +1320,7 @@ static int DirectXUpdateOverlay(vout_display_t *vd, LPDIRECTDRAWSURFACE2 surface
if (!surface) {
if (!sys->pool)
return VLC_EGENERIC;
- surface = sys->resource.p_sys->front_surface;
+ surface = sys->picsys->front_surface;
}
/* The new window dimensions should already have been computed by the
More information about the vlc-commits
mailing list