Hermes 0.7.0
Linux game streaming host
Loading...
Searching...
No Matches
x11grab.cpp File Reference

Definitions for x11 capture. More...

#include <fstream>
#include <thread>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <X11/extensions/Xfixes.h>
#include <X11/extensions/Xrandr.h>
#include <X11/X.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <xcb/shm.h>
#include <xcb/xfixes.h>
#include "cuda.h"
#include "graphics.h"
#include "misc.h"
#include "pyrowave.h"
#include "src/config.h"
#include "src/globals.h"
#include "src/logging.h"
#include "src/platform/common.h"
#include "src/task_pool.h"
#include "src/video.h"
#include "vaapi.h"
#include "x11grab.h"
Include dependency graph for x11grab.cpp:

Go to the source code of this file.

Classes

class  platf::shm_id_t
class  platf::shm_data_t
struct  platf::x11_img_t
struct  platf::shm_img_t
struct  platf::x11_attr_t
struct  platf::shm_attr_t

Macros

#define _FN(x, ret, args)

Typedefs

typedef XImage *(*) platf::x11::GetImage_fn(Display *display, Drawable d, int x, int y, unsigned int width, unsigned int height, unsigned long plane_mask, int format)
typedef Display *(*) platf::x11::OpenDisplay_fn(_Xconst char *display_name)
typedef Status(*) platf::x11::GetWindowAttributes_fn(Display *display, Window w, XWindowAttributes *window_attributes_return)
typedef int(*) platf::x11::CloseDisplay_fn(Display *display)
typedef int(*) platf::x11::Free_fn(void *data)
typedef Status(*) platf::x11::InitThreads_fn(void)
typedef XRRScreenResources *(*) platf::x11::rr::GetScreenResources_fn(Display *dpy, Window window)
typedef XRROutputInfo *(*) platf::x11::rr::GetOutputInfo_fn(Display *dpy, XRRScreenResources *resources, RROutput output)
typedef XRRCrtcInfo *(*) platf::x11::rr::GetCrtcInfo_fn(Display *dpy, XRRScreenResources *resources, RRCrtc crtc)
typedef void(*) platf::x11::rr::FreeScreenResources_fn(XRRScreenResources *resources)
typedef void(*) platf::x11::rr::FreeOutputInfo_fn(XRROutputInfo *outputInfo)
typedef void(*) platf::x11::rr::FreeCrtcInfo_fn(XRRCrtcInfo *crtcInfo)
typedef XFixesCursorImage *(*) platf::x11::fix::GetCursorImage_fn(Display *dpy)
typedef xcb_shm_get_image_reply_t *(*) platf::xcb::shm_get_image_reply_fn(xcb_connection_t *c, xcb_shm_get_image_cookie_t cookie, xcb_generic_error_t **e)
typedef xcb_shm_get_image_cookie_t(*) platf::xcb::shm_get_image_unchecked_fn(xcb_connection_t *c, xcb_drawable_t drawable, int16_t x, int16_t y, uint16_t width, uint16_t height, uint32_t plane_mask, uint8_t format, xcb_shm_seg_t shmseg, uint32_t offset)
typedef xcb_void_cookie_t(*) platf::xcb::shm_attach_fn(xcb_connection_t *c, xcb_shm_seg_t shmseg, uint32_t shmid, uint8_t read_only)
typedef xcb_query_extension_reply_t *(*) platf::xcb::get_extension_data_fn(xcb_connection_t *c, xcb_extension_t *ext)
typedef xcb_setup_t *(*) platf::xcb::get_setup_fn(xcb_connection_t *c)
typedef void(*) platf::xcb::disconnect_fn(xcb_connection_t *c)
typedef int(*) platf::xcb::connection_has_error_fn(xcb_connection_t *c)
typedef xcb_connection_t *(*) platf::xcb::connect_fn(const char *displayname, int *screenp)
typedef xcb_screen_iterator_t(*) platf::xcb::setup_roots_iterator_fn(const xcb_setup_t *R)
typedef std::uint32_t(*) platf::xcb::generate_id_fn(xcb_connection_t *c)
using platf::xcb_connect_t = util::dyn_safe_ptr<xcb_connection_t, &xcb::disconnect>
using platf::xcb_img_t = util::c_ptr<xcb_shm_get_image_reply_t>
using platf::ximg_t = util::safe_ptr<XImage, freeImage>
using platf::xcursor_t = util::safe_ptr<XFixesCursorImage, freeX>
using platf::crtc_info_t = util::dyn_safe_ptr<_XRRCrtcInfo, &x11::rr::FreeCrtcInfo>
using platf::output_info_t = util::dyn_safe_ptr<_XRROutputInfo, &x11::rr::FreeOutputInfo>
using platf::screen_res_t = util::dyn_safe_ptr<_XRRScreenResources, &x11::rr::FreeScreenResources>

Functions

int platf::load_xcb ()
int platf::load_x11 ()
int platf::xcb::init_shm ()
int platf::xcb::init ()
void platf::freeImage (XImage *)
void platf::freeX (XFixesCursorImage *)
std::shared_ptr< display_t > platf::x11_display (platf::mem_type_e hwdevice_type, const std::string &display_name, const ::video::config_t &config)
std::vector< std::string > platf::x11_display_names ()
xdisplay_t platf::x11::make_display ()
void platf::x11::freeDisplay (_XDisplay *xdisplay)
void platf::x11::freeCursorCtx (cursor_ctx_t::pointer ctx)

Detailed Description

Definitions for x11 capture.

Definition in file x11grab.cpp.

Macro Definition Documentation

◆ _FN

#define _FN ( x,
ret,
args )
Value:
typedef ret(*x##_fn) args; \
static x##_fn x
Functions for handling command line arguments.

Definition at line 41 of file x11grab.cpp.

Typedef Documentation

◆ CloseDisplay_fn

typedef int(*) platf::x11::CloseDisplay_fn(Display *display)

Definition at line 50 of file x11grab.cpp.

◆ connect_fn

typedef xcb_connection_t *(*) platf::xcb::connect_fn(const char *displayname, int *screenp)

Definition at line 174 of file x11grab.cpp.

◆ connection_has_error_fn

typedef int(*) platf::xcb::connection_has_error_fn(xcb_connection_t *c)

Definition at line 173 of file x11grab.cpp.

◆ crtc_info_t

using platf::crtc_info_t = util::dyn_safe_ptr<_XRRCrtcInfo, &x11::rr::FreeCrtcInfo>

Definition at line 253 of file x11grab.cpp.

◆ disconnect_fn

typedef void(*) platf::xcb::disconnect_fn(xcb_connection_t *c)

Definition at line 172 of file x11grab.cpp.

◆ Free_fn

typedef int(*) platf::x11::Free_fn(void *data)

Definition at line 51 of file x11grab.cpp.

◆ FreeCrtcInfo_fn

typedef void(*) platf::x11::rr::FreeCrtcInfo_fn(XRRCrtcInfo *crtcInfo)

Definition at line 60 of file x11grab.cpp.

◆ FreeOutputInfo_fn

typedef void(*) platf::x11::rr::FreeOutputInfo_fn(XRROutputInfo *outputInfo)

Definition at line 59 of file x11grab.cpp.

◆ FreeScreenResources_fn

typedef void(*) platf::x11::rr::FreeScreenResources_fn(XRRScreenResources *resources)

Definition at line 58 of file x11grab.cpp.

◆ generate_id_fn

typedef std::uint32_t(*) platf::xcb::generate_id_fn(xcb_connection_t *c)

Definition at line 176 of file x11grab.cpp.

◆ get_extension_data_fn

typedef xcb_query_extension_reply_t *(*) platf::xcb::get_extension_data_fn(xcb_connection_t *c, xcb_extension_t *ext)

Definition at line 169 of file x11grab.cpp.

◆ get_setup_fn

typedef xcb_setup_t *(*) platf::xcb::get_setup_fn(xcb_connection_t *c)

Definition at line 171 of file x11grab.cpp.

◆ GetCrtcInfo_fn

typedef XRRCrtcInfo *(*) platf::x11::rr::GetCrtcInfo_fn(Display *dpy, XRRScreenResources *resources, RRCrtc crtc)

Definition at line 57 of file x11grab.cpp.

◆ GetCursorImage_fn

typedef XFixesCursorImage *(*) platf::x11::fix::GetCursorImage_fn(Display *dpy)

Definition at line 97 of file x11grab.cpp.

◆ GetImage_fn

typedef XImage *(*) platf::x11::GetImage_fn(Display *display, Drawable d, int x, int y, unsigned int width, unsigned int height, unsigned long plane_mask, int format)

Definition at line 45 of file x11grab.cpp.

◆ GetOutputInfo_fn

typedef XRROutputInfo *(*) platf::x11::rr::GetOutputInfo_fn(Display *dpy, XRRScreenResources *resources, RROutput output)

Definition at line 56 of file x11grab.cpp.

◆ GetScreenResources_fn

typedef XRRScreenResources *(*) platf::x11::rr::GetScreenResources_fn(Display *dpy, Window window)

Definition at line 55 of file x11grab.cpp.

◆ GetWindowAttributes_fn

typedef Status(*) platf::x11::GetWindowAttributes_fn(Display *display, Window w, XWindowAttributes *window_attributes_return)

Definition at line 48 of file x11grab.cpp.

◆ InitThreads_fn

typedef Status(*) platf::x11::InitThreads_fn(void)

Definition at line 52 of file x11grab.cpp.

◆ OpenDisplay_fn

typedef Display *(*) platf::x11::OpenDisplay_fn(_Xconst char *display_name)

Definition at line 47 of file x11grab.cpp.

◆ output_info_t

using platf::output_info_t = util::dyn_safe_ptr<_XRROutputInfo, &x11::rr::FreeOutputInfo>

Definition at line 254 of file x11grab.cpp.

◆ screen_res_t

using platf::screen_res_t = util::dyn_safe_ptr<_XRRScreenResources, &x11::rr::FreeScreenResources>

Definition at line 255 of file x11grab.cpp.

◆ setup_roots_iterator_fn

typedef xcb_screen_iterator_t(*) platf::xcb::setup_roots_iterator_fn(const xcb_setup_t *R)

Definition at line 175 of file x11grab.cpp.

◆ shm_attach_fn

typedef xcb_void_cookie_t(*) platf::xcb::shm_attach_fn(xcb_connection_t *c, xcb_shm_seg_t shmseg, uint32_t shmid, uint8_t read_only)

Definition at line 167 of file x11grab.cpp.

◆ shm_get_image_reply_fn

typedef xcb_shm_get_image_reply_t *(*) platf::xcb::shm_get_image_reply_fn(xcb_connection_t *c, xcb_shm_get_image_cookie_t cookie, xcb_generic_error_t **e)

Definition at line 163 of file x11grab.cpp.

◆ shm_get_image_unchecked_fn

typedef xcb_shm_get_image_cookie_t(*) platf::xcb::shm_get_image_unchecked_fn(xcb_connection_t *c, xcb_drawable_t drawable, int16_t x, int16_t y, uint16_t width, uint16_t height, uint32_t plane_mask, uint8_t format, xcb_shm_seg_t shmseg, uint32_t offset)

Definition at line 165 of file x11grab.cpp.

◆ xcb_connect_t

using platf::xcb_connect_t = util::dyn_safe_ptr<xcb_connection_t, &xcb::disconnect>

Definition at line 247 of file x11grab.cpp.

◆ xcb_img_t

using platf::xcb_img_t = util::c_ptr<xcb_shm_get_image_reply_t>

Definition at line 248 of file x11grab.cpp.

◆ xcursor_t

using platf::xcursor_t = util::safe_ptr<XFixesCursorImage, freeX>

Definition at line 251 of file x11grab.cpp.

◆ ximg_t

using platf::ximg_t = util::safe_ptr<XImage, freeImage>

Definition at line 250 of file x11grab.cpp.

Function Documentation

◆ freeCursorCtx()

void platf::x11::freeCursorCtx ( cursor_ctx_t::pointer ctx)

Definition at line 889 of file x11grab.cpp.

◆ freeDisplay()

void platf::x11::freeDisplay ( _XDisplay * xdisplay)

Definition at line 885 of file x11grab.cpp.

◆ freeImage()

void platf::freeImage ( XImage * p)

Definition at line 813 of file x11grab.cpp.

◆ freeX()

void platf::freeX ( XFixesCursorImage * p)

Definition at line 817 of file x11grab.cpp.

◆ init()

int platf::xcb::init ( )

Definition at line 208 of file x11grab.cpp.

◆ init_shm()

int platf::xcb::init_shm ( )

Definition at line 178 of file x11grab.cpp.

◆ load_x11()

int platf::load_x11 ( )

Definition at line 828 of file x11grab.cpp.

◆ load_xcb()

int platf::load_xcb ( )

Definition at line 821 of file x11grab.cpp.

◆ make_display()

xdisplay_t platf::x11::make_display ( )

Definition at line 881 of file x11grab.cpp.

◆ x11_display()

std::shared_ptr< display_t > platf::x11_display ( platf::mem_type_e hwdevice_type,
const std::string & display_name,
const ::video::config_t & config )

Definition at line 742 of file x11grab.cpp.

◆ x11_display_names()

std::vector< std::string > platf::x11_display_names ( )

Definition at line 776 of file x11grab.cpp.