Sunshine latest
Self-hosted game stream host for Moonlight.
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 "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:

Classes

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

Macros

#define _FN(x, ret, args)
 

Typedefs

typedef int(* platf::x11::CloseDisplay_fn) (Display *display)
 
typedef xcb_connection_t *(* platf::xcb::connect_fn) (const char *displayname, int *screenp)
 
typedef int(* platf::xcb::connection_has_error_fn) (xcb_connection_t *c)
 
using platf::crtc_info_t = util::dyn_safe_ptr<_XRRCrtcInfo, &x11::rr::FreeCrtcInfo>
 
typedef void(* platf::xcb::disconnect_fn) (xcb_connection_t *c)
 
typedef int(* platf::x11::Free_fn) (void *data)
 
typedef void(* platf::x11::rr::FreeCrtcInfo_fn) (XRRCrtcInfo *crtcInfo)
 
typedef void(* platf::x11::rr::FreeOutputInfo_fn) (XRROutputInfo *outputInfo)
 
typedef void(* platf::x11::rr::FreeScreenResources_fn) (XRRScreenResources *resources)
 
typedef std::uint32_t(* platf::xcb::generate_id_fn) (xcb_connection_t *c)
 
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 XRRCrtcInfo *(* platf::x11::rr::GetCrtcInfo_fn) (Display *dpy, XRRScreenResources *resources, RRCrtc crtc)
 
typedef XFixesCursorImage *(* platf::x11::fix::GetCursorImage_fn) (Display *dpy)
 
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 XRROutputInfo *(* platf::x11::rr::GetOutputInfo_fn) (Display *dpy, XRRScreenResources *resources, RROutput output)
 
typedef XRRScreenResources *(* platf::x11::rr::GetScreenResources_fn) (Display *dpy, Window window)
 
typedef Status(* platf::x11::GetWindowAttributes_fn) (Display *display, Window w, XWindowAttributes *window_attributes_return)
 
typedef Status(* platf::x11::InitThreads_fn) (void)
 
typedef Display *(* platf::x11::OpenDisplay_fn) (_Xconst char *display_name)
 
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>
 
typedef xcb_screen_iterator_t(* platf::xcb::setup_roots_iterator_fn) (const xcb_setup_t *R)
 
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_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)
 
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::xcursor_t = util::safe_ptr<XFixesCursorImage, freeX>
 
using platf::ximg_t = util::safe_ptr<XImage, freeImage>
 

Functions

void platf::x11::freeCursorCtx (cursor_ctx_t::pointer ctx)
 
void platf::x11::freeDisplay (_XDisplay *xdisplay)
 
void platf::freeImage (XImage *)
 
void platf::freeX (XFixesCursorImage *)
 
int platf::xcb::init ()
 
int platf::xcb::init_shm ()
 
int platf::load_x11 ()
 
int platf::load_xcb ()
 
xdisplay_t platf::x11::make_display ()
 
std::shared_ptr< display_tplatf::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 ()
 

Detailed Description

Definitions for x11 capture.

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 entry_handler.cpp:39