linux-capture: Remove XLib based shm helpers
Remove the old XLib based shm helper functions from xhelpers.master
parent
008f4467f0
commit
4d2e730bfa
|
@ -91,64 +91,6 @@ fail:
|
|||
return -1;
|
||||
}
|
||||
|
||||
xshm_t *xshm_attach(Display *dpy, Screen *screen,
|
||||
int_fast32_t w, int_fast32_t h)
|
||||
{
|
||||
if (!dpy || !screen)
|
||||
return NULL;
|
||||
|
||||
xshm_t *xshm = bzalloc(sizeof(xshm_t));
|
||||
|
||||
xshm->dpy = dpy;
|
||||
xshm->image = XShmCreateImage(xshm->dpy, DefaultVisualOfScreen(screen),
|
||||
DefaultDepthOfScreen(screen), ZPixmap, NULL, &xshm->info,
|
||||
w, h);
|
||||
if (!xshm->image)
|
||||
goto fail;
|
||||
|
||||
xshm->info.shmid = shmget(IPC_PRIVATE,
|
||||
xshm->image->bytes_per_line * xshm->image->height,
|
||||
IPC_CREAT | 0700);
|
||||
if (xshm->info.shmid < 0)
|
||||
goto fail;
|
||||
|
||||
xshm->info.shmaddr
|
||||
= xshm->image->data
|
||||
= (char *) shmat(xshm->info.shmid, 0, 0);
|
||||
if (xshm->info.shmaddr == (char *) -1)
|
||||
goto fail;
|
||||
xshm->info.readOnly = false;
|
||||
|
||||
if (!XShmAttach(xshm->dpy, &xshm->info))
|
||||
goto fail;
|
||||
|
||||
xshm->attached = true;
|
||||
return xshm;
|
||||
fail:
|
||||
xshm_detach(xshm);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void xshm_detach(xshm_t *xshm)
|
||||
{
|
||||
if (!xshm)
|
||||
return;
|
||||
|
||||
if (xshm->attached)
|
||||
XShmDetach(xshm->dpy, &xshm->info);
|
||||
|
||||
if (xshm->info.shmaddr != (char *) -1)
|
||||
shmdt(xshm->info.shmaddr);
|
||||
|
||||
if (xshm->info.shmid != -1)
|
||||
shmctl(xshm->info.shmid, IPC_RMID, NULL);
|
||||
|
||||
if (xshm->image)
|
||||
XDestroyImage(xshm->image);
|
||||
|
||||
bfree(xshm);
|
||||
}
|
||||
|
||||
xcb_shm_t* xshm_xcb_attach(xcb_connection_t *xcb, const int w, const int h)
|
||||
{
|
||||
if (!xcb)
|
||||
|
|
|
@ -22,18 +22,10 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/extensions/XShm.h>
|
||||
#include <xcb/shm.h>
|
||||
#include <xcb/xproto.h>
|
||||
#include <obs.h>
|
||||
|
||||
typedef struct {
|
||||
XShmSegmentInfo info;
|
||||
XImage *image;
|
||||
Display *dpy;
|
||||
bool attached;
|
||||
} xshm_t;
|
||||
|
||||
typedef struct {
|
||||
xcb_connection_t *xcb;
|
||||
xcb_shm_seg_t seg;
|
||||
|
@ -87,24 +79,6 @@ int_fast32_t xinerama_screen_geo(Display *dpy, const int_fast32_t screen,
|
|||
int_fast32_t x11_screen_geo(Display *dpy, const int_fast32_t screen,
|
||||
int_fast32_t *w, int_fast32_t *h);
|
||||
|
||||
/**
|
||||
* Attach a shared memory segment to the X-Server
|
||||
*
|
||||
* @param dpy X11 Display
|
||||
* @param screen X11 Screen
|
||||
* @param w width for the shared memory segment
|
||||
* @param h height for the shared memory segment
|
||||
*
|
||||
* @return NULL on error
|
||||
*/
|
||||
xshm_t *xshm_attach(Display *dpy, Screen *screen,
|
||||
int_fast32_t w, int_fast32_t h);
|
||||
|
||||
/**
|
||||
* Detach a shared memory segment
|
||||
*/
|
||||
void xshm_detach(xshm_t *xshm);
|
||||
|
||||
/**
|
||||
* Attach a shared memory segment to the X-Server
|
||||
*
|
||||
|
|
|
@ -18,8 +18,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <inttypes.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
//#include <X11/Xlib.h>
|
||||
//#include <X11/Xutil.h>
|
||||
#include <X11/Xlib-xcb.h>
|
||||
#include <xcb/shm.h>
|
||||
#include <xcb/xfixes.h>
|
||||
|
|
Loading…
Reference in New Issue