vlc | branch: master | Steve Lhomme <[email protected]> | Wed Nov 27 09:24:05 2019 +0100| [90a5c45045d4e0b523918793f62b384272b769a7] | committer: Steve Lhomme
kms: simplify the picture resource setting And reduce the scope of some variables > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=90a5c45045d4e0b523918793f62b384272b769a7 --- modules/video_output/kms.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/modules/video_output/kms.c b/modules/video_output/kms.c index 7626254b65..9352dc90f6 100644 --- a/modules/video_output/kms.c +++ b/modules/video_output/kms.c @@ -619,26 +619,24 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned count) { VLC_UNUSED(count); vout_display_sys_t *sys = vd->sys; - picture_sys_t *psys; - picture_resource_t rsc; - int i; if (!sys->pool && !sys->picture) { - memset(&rsc, 0, sizeof(rsc)); + picture_sys_t *psys = malloc(sizeof(*psys)); + if (psys == NULL) + return NULL; + + picture_resource_t rsc = { + .p_sys = psys, + .pf_destroy = CustomDestroyPicture, + }; - for (i = 0; i < PICTURE_PLANE_MAX; i++) { + for (size_t i = 0; i < PICTURE_PLANE_MAX; i++) { rsc.p[i].p_pixels = sys->map[0]+sys->offsets[i]; rsc.p[i].i_lines = sys->height; rsc.p[i].i_pitch = sys->stride; } - psys = calloc(1, sizeof(*psys)); - if (psys == NULL) - return NULL; - psys->p_voutsys = sys; - rsc.p_sys = psys; - rsc.pf_destroy = CustomDestroyPicture; sys->picture = picture_NewFromResource(&vd->fmt, &rsc); _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
