[vlc-commits] XCB: develop picture free function
Rémi Denis-Courmont
git at videolan.org
Sun Jul 14 17:47:02 CEST 2013
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Jul 14 18:36:54 2013 +0300| [77193c7badc6fbc70b583920fe0074203907edeb] | committer: Rémi Denis-Courmont
XCB: develop picture free function
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=77193c7badc6fbc70b583920fe0074203907edeb
---
modules/video_output/xcb/pictures.c | 11 ++++-------
modules/video_output/xcb/pictures.h | 2 +-
modules/video_output/xcb/x11.c | 8 ++++++--
modules/video_output/xcb/xvideo.c | 6 ++++--
4 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/modules/video_output/xcb/pictures.c b/modules/video_output/xcb/pictures.c
index d748b86..cb45363 100644
--- a/modules/video_output/xcb/pictures.c
+++ b/modules/video_output/xcb/pictures.c
@@ -147,16 +147,13 @@ int XCB_pictures_Alloc (vout_display_t *vd, picture_resource_t *res,
/**
* Release picture private data: detach the shared memory segment.
*/
-void XCB_pictures_Free (picture_resource_t *res, xcb_connection_t *conn)
+void XCB_pictures_Free (void *mem)
{
#ifdef HAVE_SYS_SHM_H
- xcb_shm_seg_t segment = res->p_sys->segment;
-
- if (conn != NULL && segment != 0)
- xcb_shm_detach (conn, segment);
- shmdt (res->p->p_pixels);
+ if (mem != NULL)
+ shmdt (mem);
#else
- free (res->p->p_pixels);
+ free (mem);
#endif
}
diff --git a/modules/video_output/xcb/pictures.h b/modules/video_output/xcb/pictures.h
index ffd4970..7256d0c 100644
--- a/modules/video_output/xcb/pictures.h
+++ b/modules/video_output/xcb/pictures.h
@@ -38,4 +38,4 @@ struct picture_sys_t
};
int XCB_pictures_Alloc (vout_display_t *, picture_resource_t *, size_t size,
xcb_connection_t *, xcb_shm_seg_t);
-void XCB_pictures_Free (picture_resource_t *, xcb_connection_t *);
+void XCB_pictures_Free (void *);
diff --git a/modules/video_output/xcb/x11.c b/modules/video_output/xcb/x11.c
index ff50e4a..54bfb51 100644
--- a/modules/video_output/xcb/x11.c
+++ b/modules/video_output/xcb/x11.c
@@ -396,7 +396,9 @@ static picture_pool_t *Pool (vout_display_t *vd, unsigned requested_count)
pic_array[count] = picture_NewFromResource (&vd->fmt, res);
if (!pic_array[count])
{
- XCB_pictures_Free (res, sys->conn);
+ XCB_pictures_Free (res->p->p_pixels);
+ if (res->p_sys->segment)
+ xcb_shm_detach (sys->conn, res->p_sys->segment);
memset (res, 0, sizeof(*res));
break;
}
@@ -576,7 +578,9 @@ static void ResetPictures (vout_display_t *vd)
if (!res->p->p_pixels)
break;
- XCB_pictures_Free (res, sys->conn);
+ XCB_pictures_Free (res->p->p_pixels);
+ if (res->p_sys->segment)
+ xcb_shm_detach (sys->conn, res->p_sys->segment);
}
picture_pool_Delete (sys->pool);
sys->pool = NULL;
diff --git a/modules/video_output/xcb/xvideo.c b/modules/video_output/xcb/xvideo.c
index 77f96a6..ca6f95d 100644
--- a/modules/video_output/xcb/xvideo.c
+++ b/modules/video_output/xcb/xvideo.c
@@ -606,7 +606,7 @@ static void Close (vlc_object_t *obj)
if (!res->p->p_pixels)
break;
- XCB_pictures_Free (res, NULL);
+ XCB_pictures_Free (res->p->p_pixels);
}
picture_pool_Delete (p_sys->pool);
}
@@ -670,7 +670,9 @@ static void PoolAlloc (vout_display_t *vd, unsigned requested_count)
pic_array[count] = picture_NewFromResource (&vd->fmt, res);
if (!pic_array[count])
{
- XCB_pictures_Free (res, p_sys->conn);
+ XCB_pictures_Free (res->p->p_pixels);
+ if (res->p_sys->segment)
+ xcb_shm_detach (p_sys->conn, res->p_sys->segment);
memset (res, 0, sizeof(*res));
break;
}
More information about the vlc-commits
mailing list