[vlc-commits] commit: XCB: support platforms without System V shared memory (untested) ( =?UTF-8?Q?R=C3=A9mi=20Denis=2DCourmont=20?=)
git at videolan.org
git at videolan.org
Sun Nov 28 15:09:45 CET 2010
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Nov 28 16:08:26 2010 +0200| [d3fbc3d267dfd2f255f89fc9069d2359a4a3ffce] | committer: Rémi Denis-Courmont
XCB: support platforms without System V shared memory (untested)
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d3fbc3d267dfd2f255f89fc9069d2359a4a3ffce
---
modules/video_output/xcb/common.c | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/modules/video_output/xcb/common.c b/modules/video_output/xcb/common.c
index 2b7588f..fc89cc6 100644
--- a/modules/video_output/xcb/common.c
+++ b/modules/video_output/xcb/common.c
@@ -28,7 +28,9 @@
#include <assert.h>
#include <sys/types.h>
+#ifdef HAVE_SYS_SHM_H
#include <sys/shm.h>
+#endif
#include <xcb/xcb.h>
#include <xcb/shm.h>
@@ -160,6 +162,7 @@ error:
/** Check MIT-SHM shared memory support */
void CheckSHM (vlc_object_t *obj, xcb_connection_t *conn, bool *restrict pshm)
{
+#ifdef HAVE_SYS_SHM_H
bool shm = var_InheritBool (obj, "x11-shm") > 0;
if (shm)
{
@@ -177,6 +180,11 @@ void CheckSHM (vlc_object_t *obj, xcb_connection_t *conn, bool *restrict pshm)
free (r);
}
*pshm = shm;
+#else
+ msg_Warn (obj, "shared memory (MIT-SHM) not implemented");
+ (void) conn;
+ *pshm = false;
+#endif
}
/**
@@ -191,6 +199,7 @@ int PictureResourceAlloc (vout_display_t *vd, picture_resource_t *res, size_t si
if (!res->p_sys)
return VLC_EGENERIC;
+#ifdef HAVE_SYS_SHM_H
/* Allocate shared memory segment */
int id = shmget (IPC_PRIVATE, size, IPC_CREAT | 0700);
if (id == -1)
@@ -231,6 +240,18 @@ int PictureResourceAlloc (vout_display_t *vd, picture_resource_t *res, size_t si
shmctl (id, IPC_RMID, 0);
res->p_sys->segment = segment;
res->p->p_pixels = shm;
+#else
+ assert (!attach);
+ res->p_sys->segment = 0;
+
+ /* XXX: align on 32 bytes for VLC chroma filters */
+ res->p->p_pixels = malloc (size);
+ if (unlikely(res->p->p_pixels == NULL))
+ {
+ free (res->p_sys);
+ return VLC_EGENERIC;
+ }
+#endif
return VLC_SUCCESS;
}
@@ -239,10 +260,14 @@ int PictureResourceAlloc (vout_display_t *vd, picture_resource_t *res, size_t si
*/
void PictureResourceFree (picture_resource_t *res, xcb_connection_t *conn)
{
+#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);
+#else
+ free (res->p->p_pixels);
+#endif
}
More information about the vlc-commits
mailing list