Hermes 0.7.0
Linux game streaming host
Loading...
Searching...
No Matches
common.h File Reference

Declarations for common platform specific utilities. More...

#include <bitset>
#include <filesystem>
#include <functional>
#include <mutex>
#include <string>
#include <boost/core/noncopyable.hpp>
#include <boost/asio/ip/address.hpp>
#include <boost/process/v1/child.hpp>
#include <boost/process/v1/group.hpp>
#include <boost/process/v1/environment.hpp>
#include "src/config.h"
#include "src/logging.h"
#include "src/thread_safe.h"
#include "src/utility.h"
#include "src/video_colorspace.h"
#include <moonlight-common-c/src/Limelight.h>
Include dependency graph for common.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  platf::supported_gamepad_t
struct  platf::gamepad_feedback_msg_t
struct  platf::touch_port_t
struct  platf::gamepad_state_t
struct  platf::gamepad_id_t
struct  platf::gamepad_arrival_t
struct  platf::gamepad_touch_t
struct  platf::gamepad_motion_t
struct  platf::gamepad_battery_t
struct  platf::touch_input_t
struct  platf::pen_input_t
class  platf::deinit_t
struct  platf::img_t
struct  platf::sink_t
struct  platf::sink_t::null_t
struct  platf::encode_device_t
struct  platf::avcodec_encode_device_t
struct  platf::nvenc_encode_device_t
class  platf::display_t
class  platf::mic_t
class  platf::mic_writer_t
 Feeds a client's microphone into a session mic. More...
class  platf::audio_control_t
struct  platf::buffer_descriptor_t
struct  platf::batched_send_info_t
struct  platf::send_info_t
struct  platf::high_precision_timer
struct  platf::session_environment_t
struct  platf::appliance_readiness_t
 Read-only assessment of whether the host could run as a dedicated streaming appliance (boot straight into a headless/Gamescope session). More...

Namespaces

namespace  nvenc
 Standalone NVENC encoder.

Macros

#define _CONVERT(x)
#define SERVICE_TYPE   "_nvstream._tcp"

Typedefs

using platf::feedback_queue_t = safe::mail_raw_t::queue_t<gamepad_feedback_msg_t>
typedef uint32_t platf::platform_caps::caps_t
using platf::input_t = util::safe_ptr<void, freeInput>
typedef deinit_t platf::client_input_t

Enumerations

enum class  platf::gamepad_feedback_e {
  rumble , rumble_triggers , set_motion_event_state , set_rgb_led ,
  set_adaptive_triggers
}
enum  platf::speaker::speaker_e {
  platf::speaker::FRONT_LEFT , platf::speaker::FRONT_RIGHT , platf::speaker::FRONT_CENTER , platf::speaker::LOW_FREQUENCY ,
  platf::speaker::BACK_LEFT , platf::speaker::BACK_RIGHT , platf::speaker::SIDE_LEFT , platf::speaker::SIDE_RIGHT ,
  platf::speaker::MAX_SPEAKERS
}
enum class  platf::mem_type_e { system , vaapi , cuda , unknown }
enum class  platf::pix_fmt_e {
  yuv420p , yuv420p10 , nv12 , p010 ,
  ayuv , yuv444p16 , y410 , unknown
}
enum class  platf::capture_e : int {
  ok , reinit , timeout , interrupted ,
  error
}
enum class  platf::thread_priority_e : int { low , normal , high , critical }
enum class  platf::qos_data_type_e : int { audio , video }
enum class  platf::session_environment_e {
  unknown , headless , desktop_x11 , desktop_wayland ,
  gamescope_session
}
 The kind of session/compositor environment Hermes is running in. More...

Functions

std::string platf::session_mic_source (std::string_view sink)
 The microphone source of the session that plays into sink.
std::string_view platf::from_pix_fmt (pix_fmt_e pix_fmt)
void platf::freeInput (void *)
std::filesystem::path platf::appdata ()
 Performs migration if necessary, then returns the appdata directory.
std::string platf::get_mac_address (const std::string_view &address)
 The MAC address of the interface that holds address.
std::string platf::get_local_ip_for_gateway ()
std::string platf::from_sockaddr (const sockaddr *const)
std::pair< std::uint16_t, std::string > platf::from_sockaddr_ex (const sockaddr *const)
std::unique_ptr< audio_control_t > platf::audio_control ()
std::shared_ptr< display_t > platf::display (mem_type_e hwdevice_type, const std::string &display_name, const video::config_t &config)
 Get the display_t instance for the given hwdevice_type. If display_name is empty, use the first monitor that's compatible you can find If you require to use this parameter in a separate thread, make a copy of it.
std::shared_ptr< display_t > platf::encoder_probe_display (mem_type_e hwdevice_type, const video::config_t &config)
 A display with no screen behind it, for validating encoders.
std::vector< std::string > platf::display_names (mem_type_e hwdevice_type)
bool platf::needs_encoder_reenumeration ()
 Check if GPUs/drivers have changed since the last call to this function.
boost::process::v1::child platf::run_command (bool elevated, bool interactive, const std::string &cmd, boost::filesystem::path &working_dir, const boost::process::v1::environment &env, FILE *file, std::error_code &ec, boost::process::v1::group *group)
void platf::adjust_thread_priority (thread_priority_e priority)
void platf::streaming_will_start ()
void platf::streaming_will_stop ()
void platf::restart ()
int platf::set_env (const std::string &name, const std::string &value)
 Set an environment variable.
int platf::unset_env (const std::string &name)
 Unset an environment variable.
bool platf::send_batch (batched_send_info_t &send_info)
bool platf::send (send_info_t &send_info)
std::unique_ptr< deinit_t > platf::enable_socket_qos (uintptr_t native_socket, boost::asio::ip::address &address, uint16_t port, qos_data_type_e data_type, bool dscp_tagging)
 Enable QoS on the given socket for traffic to the specified destination.
void platf::open_url (const std::string &url)
 Open a url in the default web browser.
bool platf::request_process_group_exit (std::uintptr_t native_handle)
 Attempt to gracefully terminate a process group.
bool platf::process_group_running (std::uintptr_t native_handle)
 Check if a process group still has running children.
input_t platf::input (const std::string &session_tag={})
util::point_t platf::get_mouse_loc (input_t &input)
 Get the current mouse position on screen.
void platf::move_mouse (input_t &input, int deltaX, int deltaY)
void platf::abs_mouse (input_t &input, const touch_port_t &touch_port, float x, float y)
void platf::button_mouse (input_t &input, int button, bool release)
void platf::scroll (input_t &input, int distance)
void platf::hscroll (input_t &input, int distance)
void platf::keyboard_update (input_t &input, uint16_t modcode, bool release, uint8_t flags)
void platf::gamepad_update (input_t &input, int nr, const gamepad_state_t &gamepad_state)
void platf::unicode (input_t &input, char *utf8, int size)
std::unique_ptr< client_input_t > platf::allocate_client_input_context (input_t &input)
 Allocate a context to store per-client input data.
void platf::touch_update (client_input_t *input, const touch_port_t &touch_port, const touch_input_t &touch)
 Send a touch event to the OS.
bool platf::touch_binds_to_output ()
 Whether the session binds a touchscreen or a pen to one output.
void platf::pen_update (client_input_t *input, const touch_port_t &touch_port, const pen_input_t &pen)
 Send a pen event to the OS.
void platf::gamepad_touch (input_t &input, const gamepad_touch_t &touch)
 Send a gamepad touch event to the OS.
void platf::gamepad_motion (input_t &input, const gamepad_motion_t &motion)
 Send a gamepad motion event to the OS.
void platf::gamepad_battery (input_t &input, const gamepad_battery_t &battery)
 Send a gamepad battery event to the OS.
int platf::alloc_gamepad (input_t &input, const gamepad_id_t &id, const gamepad_arrival_t &metadata, feedback_queue_t feedback_queue)
 Create a new virtual gamepad.
void platf::free_gamepad (input_t &input, int nr)
void platf::release_gamepad (input_t &input, int nr)
 Release a gamepad because its stream ended, not because the client removed it. A detached desktop keeps it for the next stream to the same desktop, so the desktop's programs never see the controller leave.
void platf::forget_kept_gamepads (const std::string &session_tag)
 Remove the gamepads a session tag kept between streams.
platform_caps::caps_t platf::get_capabilities ()
 Get the supported platform capabilities to advertise to the client.
std::unique_ptr< deinit_t > platf::publish::start ()
std::unique_ptr< deinit_t > platf::init ()
std::string platf::get_host_name ()
 Returns the current computer name in UTF-8.
std::vector< supported_gamepad_t > & platf::supported_gamepads (input_t *input)
 Gets the supported gamepads for this platform backend.
std::unique_ptr< high_precision_timer > platf::create_high_precision_timer ()
 Create platform-specific timer capable of high-precision sleep.
std::string platf::get_clipboard ()
bool platf::set_clipboard (const std::string &content)
bool platf::clipboard_available ()
session_environment_t platf::detect_session_environment ()
 Detect the current session/compositor environment.
appliance_readiness_t platf::appliance_readiness ()
 Assess appliance-mode readiness without changing any state.

Variables

constexpr auto platf::MAX_GAMEPADS = 16
constexpr std::uint32_t platf::DPAD_UP = 0x0001
constexpr std::uint32_t platf::DPAD_DOWN = 0x0002
constexpr std::uint32_t platf::DPAD_LEFT = 0x0004
constexpr std::uint32_t platf::DPAD_RIGHT = 0x0008
constexpr std::uint32_t platf::START = 0x0010
constexpr std::uint32_t platf::BACK = 0x0020
constexpr std::uint32_t platf::LEFT_STICK = 0x0040
constexpr std::uint32_t platf::RIGHT_STICK = 0x0080
constexpr std::uint32_t platf::LEFT_BUTTON = 0x0100
constexpr std::uint32_t platf::RIGHT_BUTTON = 0x0200
constexpr std::uint32_t platf::HOME = 0x0400
constexpr std::uint32_t platf::A = 0x1000
constexpr std::uint32_t platf::B = 0x2000
constexpr std::uint32_t platf::X = 0x4000
constexpr std::uint32_t platf::Y = 0x8000
constexpr std::uint32_t platf::PADDLE1 = 0x010000
constexpr std::uint32_t platf::PADDLE2 = 0x020000
constexpr std::uint32_t platf::PADDLE3 = 0x040000
constexpr std::uint32_t platf::PADDLE4 = 0x080000
constexpr std::uint32_t platf::TOUCHPAD_BUTTON = 0x100000
constexpr std::uint32_t platf::MISC_BUTTON = 0x200000
constexpr std::uint8_t platf::speaker::map_stereo []
constexpr std::uint8_t platf::speaker::map_surround51 []
constexpr std::uint8_t platf::speaker::map_surround71 []
constexpr caps_t platf::platform_caps::pen_touch = 0x01
constexpr caps_t platf::platform_caps::controller_touch = 0x02

Detailed Description

Declarations for common platform specific utilities.

Definition in file common.h.

Macro Definition Documentation

◆ _CONVERT

#define _CONVERT ( x)
Value:
case pix_fmt_e::x: \
return #x##sv

◆ SERVICE_TYPE

#define SERVICE_TYPE   "_nvstream._tcp"

Definition at line 957 of file common.h.

Typedef Documentation

◆ caps_t

typedef uint32_t platf::platform_caps::caps_t

Definition at line 257 of file common.h.

◆ client_input_t

typedef deinit_t platf::client_input_t

Definition at line 871 of file common.h.

◆ feedback_queue_t

using platf::feedback_queue_t = safe::mail_raw_t::queue_t<gamepad_feedback_msg_t>

Definition at line 172 of file common.h.

◆ input_t

using platf::input_t = util::safe_ptr<void, freeInput>

Definition at line 645 of file common.h.

Enumeration Type Documentation

◆ capture_e

enum class platf::capture_e : int
strong
Enumerator
ok 

Success.

reinit 

Need to reinitialize.

timeout 

Timeout.

interrupted 

Capture was interrupted.

error 

Error.

Definition at line 435 of file common.h.

◆ gamepad_feedback_e

enum class platf::gamepad_feedback_e
strong
Enumerator
rumble 

Rumble.

rumble_triggers 

Rumble triggers.

set_motion_event_state 

Set motion event state.

set_rgb_led 

Set RGB LED.

set_adaptive_triggers 

Set adaptive triggers.

Definition at line 86 of file common.h.

◆ mem_type_e

enum class platf::mem_type_e
strong
Enumerator
system 

System memory.

vaapi 

VAAPI.

cuda 

CUDA.

unknown 

Unknown.

Definition at line 211 of file common.h.

◆ pix_fmt_e

enum class platf::pix_fmt_e
strong
Enumerator
yuv420p 

YUV 4:2:0.

yuv420p10 

YUV 4:2:0 10-bit.

nv12 

NV12.

p010 

P010.

ayuv 

AYUV.

yuv444p16 

Planar 10-bit (shifted to 16-bit) YUV 4:4:4.

y410 

Y410.

unknown 

Unknown.

Definition at line 218 of file common.h.

◆ qos_data_type_e

enum class platf::qos_data_type_e : int
strong
Enumerator
audio 

Audio.

video 

Video.

Definition at line 797 of file common.h.

◆ session_environment_e

enum class platf::session_environment_e
strong

The kind of session/compositor environment Hermes is running in.

This drives how Hermes handles virtual displays and Gamescope:

  • DESKTOP environments own a compositor (KWin/GNOME/wlroots) that can be asked to adopt a virtual display via output management.
  • GAMESCOPE_SESSION (e.g. SteamOS Game Mode) is itself the compositor on DRM/KMS; there is no desktop to host a virtual display, and the session output is captured directly.
Enumerator
unknown 

Could not be determined.

headless 

No window system / capture source available.

desktop_x11 

X11 desktop session.

desktop_wayland 

Wayland desktop session (KDE/GNOME/wlroots).

gamescope_session 

Standalone Gamescope compositor (SteamOS Game Mode).

Definition at line 1020 of file common.h.

◆ speaker_e

Enumerator
FRONT_LEFT 

Front left.

FRONT_RIGHT 

Front right.

FRONT_CENTER 

Front center.

LOW_FREQUENCY 

Low frequency.

BACK_LEFT 

Back left.

BACK_RIGHT 

Back right.

SIDE_LEFT 

Side left.

SIDE_RIGHT 

Side right.

MAX_SPEAKERS 

Maximum number of speakers.

Definition at line 175 of file common.h.

◆ thread_priority_e

enum class platf::thread_priority_e : int
strong
Enumerator
low 

Low priority.

normal 

Normal priority.

high 

High priority.

critical 

Critical priority.

Definition at line 693 of file common.h.

Function Documentation

◆ abs_mouse()

void platf::abs_mouse ( input_t & input,
const touch_port_t & touch_port,
float x,
float y )

Definition at line 118 of file virtualhid.cpp.

◆ adjust_thread_priority()

void platf::adjust_thread_priority ( thread_priority_e priority)

Definition at line 562 of file misc.cpp.

◆ alloc_gamepad()

int platf::alloc_gamepad ( input_t & input,
const gamepad_id_t & id,
const gamepad_arrival_t & metadata,
feedback_queue_t feedback_queue )

Create a new virtual gamepad.

Parameters
inputThe global input context.
idThe gamepad ID.
metadataController metadata from client (empty if none provided).
feedback_queueThe queue for posting messages back to the client.
Returns
0 on success.

Definition at line 183 of file virtualhid.cpp.

◆ allocate_client_input_context()

std::unique_ptr< client_input_t > platf::allocate_client_input_context ( input_t & input)

Allocate a context to store per-client input data.

Parameters
inputThe global input context.
Returns
A unique pointer to a per-client input data context.

Definition at line 103 of file virtualhid.cpp.

◆ appdata()

fs::path platf::appdata ( )

Performs migration if necessary, then returns the appdata directory.

This is used for the log directory, so it cannot invoke Boost logging!

Returns
The path of the appdata directory that should be used.

Definition at line 301 of file misc.cpp.

◆ appliance_readiness()

appliance_readiness_t platf::appliance_readiness ( )

Assess appliance-mode readiness without changing any state.

Returns
Readiness details. On non-Linux platforms all fields are false and the diagnostic is "unsupported".

Definition at line 1972 of file misc.cpp.

◆ audio_control()

std::unique_ptr< audio_control_t > platf::audio_control ( )

Definition at line 752 of file audio.cpp.

◆ button_mouse()

void platf::button_mouse ( input_t & input,
int button,
bool release )

Definition at line 125 of file virtualhid.cpp.

◆ clipboard_available()

bool platf::clipboard_available ( )

Definition at line 1871 of file misc.cpp.

◆ create_high_precision_timer()

std::unique_ptr< high_precision_timer > platf::create_high_precision_timer ( )

Create platform-specific timer capable of high-precision sleep.

Returns
A unique pointer to timer

Definition at line 1811 of file misc.cpp.

◆ detect_session_environment()

session_environment_t platf::detect_session_environment ( )

Detect the current session/compositor environment.

Returns
The detected environment. On non-Linux platforms this reports unknown.

Definition at line 1882 of file misc.cpp.

◆ display()

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

Get the display_t instance for the given hwdevice_type. If display_name is empty, use the first monitor that's compatible you can find If you require to use this parameter in a separate thread, make a copy of it.

Parameters
display_nameThe name of the monitor that SHOULD be displayed
configStream configuration
Returns
The display_t instance based on hwdevice_type.

Definition at line 1658 of file misc.cpp.

◆ display_names()

std::vector< std::string > platf::display_names ( mem_type_e hwdevice_type)

Definition at line 1613 of file misc.cpp.

◆ enable_socket_qos()

std::unique_ptr< deinit_t > platf::enable_socket_qos ( uintptr_t native_socket,
boost::asio::ip::address & address,
uint16_t port,
qos_data_type_e data_type,
bool dscp_tagging )

Enable QoS on the given socket for traffic to the specified destination.

Enables QoS on the given socket for traffic to the specified destination.

Parameters
native_socketThe native socket handle.
addressThe destination address for traffic sent on this socket.
portThe destination port for traffic sent on this socket.
data_typeThe type of traffic sent on this socket.
dscp_taggingSpecifies whether to enable DSCP tagging on outgoing traffic.

Definition at line 1470 of file misc.cpp.

◆ encoder_probe_display()

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

A display with no screen behind it, for validating encoders.

It captures nothing; validation encodes only the synthetic frames it fills in, so no monitor or virtual output is needed or touched.

Definition at line 92 of file encoder_probe_display.cpp.

◆ forget_kept_gamepads()

void platf::forget_kept_gamepads ( const std::string & session_tag)

Remove the gamepads a session tag kept between streams.

Parameters
session_tagThe tag of a session that has stopped.

Definition at line 201 of file virtualhid.cpp.

◆ free_gamepad()

void platf::free_gamepad ( input_t & input,
int nr )

Definition at line 193 of file virtualhid.cpp.

◆ freeInput()

void platf::freeInput ( void * pointer)

Definition at line 107 of file virtualhid.cpp.

◆ from_pix_fmt()

std::string_view platf::from_pix_fmt ( pix_fmt_e pix_fmt)
inline

Definition at line 229 of file common.h.

◆ from_sockaddr()

std::string platf::from_sockaddr ( const sockaddr * const ip_addr)

Definition at line 383 of file misc.cpp.

◆ from_sockaddr_ex()

std::pair< std::uint16_t, std::string > platf::from_sockaddr_ex ( const sockaddr * const ip_addr)

Definition at line 396 of file misc.cpp.

◆ gamepad_battery()

void platf::gamepad_battery ( input_t & input,
const gamepad_battery_t & battery )

Send a gamepad battery event to the OS.

Parameters
inputThe global input context.
batteryThe battery event.

Definition at line 217 of file virtualhid.cpp.

◆ gamepad_motion()

void platf::gamepad_motion ( input_t & input,
const gamepad_motion_t & motion )

Send a gamepad motion event to the OS.

Parameters
inputThe global input context.
motionThe motion event.

Definition at line 213 of file virtualhid.cpp.

◆ gamepad_touch()

void platf::gamepad_touch ( input_t & input,
const gamepad_touch_t & touch )

Send a gamepad touch event to the OS.

Parameters
inputThe global input context.
touchThe touch event.

Definition at line 209 of file virtualhid.cpp.

◆ gamepad_update()

void platf::gamepad_update ( input_t & input,
int nr,
const gamepad_state_t & gamepad_state )

Definition at line 205 of file virtualhid.cpp.

◆ get_capabilities()

platform_caps::caps_t platf::get_capabilities ( )

Get the supported platform capabilities to advertise to the client.

Returns
Capability flags.

Definition at line 221 of file virtualhid.cpp.

◆ get_clipboard()

std::string platf::get_clipboard ( )

Definition at line 1816 of file misc.cpp.

◆ get_host_name()

std::string platf::get_host_name ( )

Returns the current computer name in UTF-8.

Returns
Computer name or a placeholder upon failure.

Definition at line 1533 of file misc.cpp.

◆ get_local_ip_for_gateway()

std::string platf::get_local_ip_for_gateway ( )

Definition at line 441 of file misc.cpp.

◆ get_mac_address()

std::string platf::get_mac_address ( const std::string_view & address)

The MAC address of the interface that holds address.

Addresses are compared as addresses, not text, so a link-local address printed with its scope (fe80::1eth0) finds its interface.

Parameters
addressThe host address a client reached.
Returns
The MAC address, or 00:00:00:00:00:00 when no interface holds it.

Definition at line 412 of file misc.cpp.

◆ get_mouse_loc()

util::point_t platf::get_mouse_loc ( input_t & input)

Get the current mouse position on screen.

Parameters
inputThe input_t instance to use.
Returns
Screen coordinates of the mouse.

Examples

auto [x, y] = get_mouse_loc(input);

Definition at line 226 of file virtualhid.cpp.

◆ hscroll()

void platf::hscroll ( input_t & input,
int distance )

Definition at line 139 of file virtualhid.cpp.

◆ init()

std::unique_ptr< deinit_t > platf::init ( )
nodiscard

Definition at line 1722 of file misc.cpp.

◆ input()

input_t platf::input ( const std::string & session_tag = {})

Create a platform input device set. session_tag is stamped into Linux uinput phys/uniq metadata so a compositor seat can select only its client.

Definition at line 99 of file virtualhid.cpp.

◆ move_mouse()

void platf::move_mouse ( input_t & input,
int deltaX,
int deltaY )

Definition at line 111 of file virtualhid.cpp.

◆ needs_encoder_reenumeration()

bool platf::needs_encoder_reenumeration ( )

Check if GPUs/drivers have changed since the last call to this function.

Returns if GPUs/drivers have changed since the last call to this function.

Returns
true if a change has occurred or if it is unknown whether a change occurred.

Definition at line 1653 of file misc.cpp.

◆ open_url()

void platf::open_url ( const std::string & url)

Open a url in the default web browser.

Parameters
urlThe url to open.

Definition at line 546 of file misc.cpp.

◆ pen_update()

void platf::pen_update ( client_input_t * input,
const touch_port_t & touch_port,
const pen_input_t & pen )

Send a pen event to the OS.

Parameters
inputThe client-specific input context.
touch_portThe current viewport for translating to screen coordinates.
penThe pen event.

Definition at line 173 of file virtualhid.cpp.

◆ process_group_running()

bool platf::process_group_running ( std::uintptr_t native_handle)

Check if a process group still has running children.

Parameters
native_handleThe native handle of the process group.
Returns
true if processes are still running.

Definition at line 1064 of file misc.cpp.

◆ release_gamepad()

void platf::release_gamepad ( input_t & input,
int nr )

Release a gamepad because its stream ended, not because the client removed it. A detached desktop keeps it for the next stream to the same desktop, so the desktop's programs never see the controller leave.

Definition at line 197 of file virtualhid.cpp.

◆ request_process_group_exit()

bool platf::request_process_group_exit ( std::uintptr_t native_handle)

Attempt to gracefully terminate a process group.

Parameters
native_handleThe native handle of the process group.
Returns
true if termination was successfully requested.

Definition at line 1054 of file misc.cpp.

◆ restart()

void platf::restart ( )

Definition at line 1040 of file misc.cpp.

◆ scroll()

void platf::scroll ( input_t & input,
int distance )

Definition at line 132 of file virtualhid.cpp.

◆ send()

bool platf::send ( send_info_t & send_info)

Definition at line 1333 of file misc.cpp.

◆ send_batch()

bool platf::send_batch ( batched_send_info_t & send_info)

Definition at line 1126 of file misc.cpp.

◆ session_mic_source()

std::string platf::session_mic_source ( std::string_view sink)
inline

The microphone source of the session that plays into sink.

Definition at line 54 of file common.h.

◆ set_clipboard()

bool platf::set_clipboard ( const std::string & content)

Definition at line 1853 of file misc.cpp.

◆ set_env()

int platf::set_env ( const std::string & name,
const std::string & value )

Set an environment variable.

Parameters
nameThe name of the environment variable.
valueThe value to set the environment variable to.
Returns
0 on success, non-zero on failure.

Definition at line 1046 of file misc.cpp.

◆ start()

std::unique_ptr<::platf::deinit_t > platf::publish::start ( )
nodiscard

Definition at line 421 of file publish.cpp.

◆ streaming_will_start()

void platf::streaming_will_start ( )

Definition at line 994 of file misc.cpp.

◆ streaming_will_stop()

void platf::streaming_will_stop ( )

Definition at line 1000 of file misc.cpp.

◆ supported_gamepads()

std::vector< supported_gamepad_t > & platf::supported_gamepads ( input_t * input)

Gets the supported gamepads for this platform backend.

This may be called prior to platf::input()!

Parameters
inputPointer to the platform's input_t or nullptr.
Returns
Vector of gamepad options and status.

Definition at line 230 of file virtualhid.cpp.

◆ touch_binds_to_output()

bool platf::touch_binds_to_output ( )

Whether the session binds a touchscreen or a pen to one output.

Such a device reports where on its own surface it was touched, so the compositor has to decide which output that surface stands for. KWin and Mutter bind it to a single output, and the coordinates Hermes sends are then relative to the streamed output alone. Everywhere else the device spans the whole desktop and the streamed output's offset within it is part of the coordinate.

Definition at line 198 of file misc.cpp.

◆ touch_update()

void platf::touch_update ( client_input_t * input,
const touch_port_t & touch_port,
const touch_input_t & touch )

Send a touch event to the OS.

Parameters
inputThe client-specific input context.
touch_portThe current viewport for translating to screen coordinates.
touchThe touch event.

Definition at line 160 of file virtualhid.cpp.

◆ unicode()

void platf::unicode ( input_t & input,
char * utf8,
int size )

Definition at line 153 of file virtualhid.cpp.

◆ unset_env()

int platf::unset_env ( const std::string & name)

Unset an environment variable.

Parameters
nameThe name of the environment variable.
Returns
0 on success, non-zero on failure.

Definition at line 1050 of file misc.cpp.

Variable Documentation

◆ A

std::uint32_t platf::A = 0x1000
constexpr

Definition at line 69 of file common.h.

◆ B

std::uint32_t platf::B = 0x2000
constexpr

Definition at line 70 of file common.h.

◆ BACK

std::uint32_t platf::BACK = 0x0020
constexpr

Definition at line 63 of file common.h.

◆ controller_touch

caps_t platf::platform_caps::controller_touch = 0x02
constexpr

Definition at line 260 of file common.h.

◆ DPAD_DOWN

std::uint32_t platf::DPAD_DOWN = 0x0002
constexpr

Definition at line 59 of file common.h.

◆ DPAD_LEFT

std::uint32_t platf::DPAD_LEFT = 0x0004
constexpr

Definition at line 60 of file common.h.

◆ DPAD_RIGHT

std::uint32_t platf::DPAD_RIGHT = 0x0008
constexpr

Definition at line 61 of file common.h.

◆ DPAD_UP

std::uint32_t platf::DPAD_UP = 0x0001
constexpr

Definition at line 58 of file common.h.

◆ HOME

std::uint32_t platf::HOME = 0x0400
constexpr

Definition at line 68 of file common.h.

◆ LEFT_BUTTON

std::uint32_t platf::LEFT_BUTTON = 0x0100
constexpr

Definition at line 66 of file common.h.

◆ LEFT_STICK

std::uint32_t platf::LEFT_STICK = 0x0040
constexpr

Definition at line 64 of file common.h.

◆ map_stereo

std::uint8_t platf::speaker::map_stereo[]
constexpr
Initial value:
{
}
@ FRONT_LEFT
Front left.
Definition common.h:176
@ FRONT_RIGHT
Front right.
Definition common.h:177

Definition at line 187 of file common.h.

◆ map_surround51

std::uint8_t platf::speaker::map_surround51[]
constexpr
Initial value:
{
}
@ BACK_LEFT
Back left.
Definition common.h:180
@ LOW_FREQUENCY
Low frequency.
Definition common.h:179
@ FRONT_CENTER
Front center.
Definition common.h:178
@ BACK_RIGHT
Back right.
Definition common.h:181

Definition at line 191 of file common.h.

◆ map_surround71

std::uint8_t platf::speaker::map_surround71[]
constexpr
Initial value:

Definition at line 199 of file common.h.

◆ MAX_GAMEPADS

auto platf::MAX_GAMEPADS = 16
constexpr

Definition at line 51 of file common.h.

◆ MISC_BUTTON

std::uint32_t platf::MISC_BUTTON = 0x200000
constexpr

Definition at line 78 of file common.h.

◆ PADDLE1

std::uint32_t platf::PADDLE1 = 0x010000
constexpr

Definition at line 73 of file common.h.

◆ PADDLE2

std::uint32_t platf::PADDLE2 = 0x020000
constexpr

Definition at line 74 of file common.h.

◆ PADDLE3

std::uint32_t platf::PADDLE3 = 0x040000
constexpr

Definition at line 75 of file common.h.

◆ PADDLE4

std::uint32_t platf::PADDLE4 = 0x080000
constexpr

Definition at line 76 of file common.h.

◆ pen_touch

caps_t platf::platform_caps::pen_touch = 0x01
constexpr

Definition at line 259 of file common.h.

◆ RIGHT_BUTTON

std::uint32_t platf::RIGHT_BUTTON = 0x0200
constexpr

Definition at line 67 of file common.h.

◆ RIGHT_STICK

std::uint32_t platf::RIGHT_STICK = 0x0080
constexpr

Definition at line 65 of file common.h.

◆ START

std::uint32_t platf::START = 0x0010
constexpr

Definition at line 62 of file common.h.

◆ TOUCHPAD_BUTTON

std::uint32_t platf::TOUCHPAD_BUTTON = 0x100000
constexpr

Definition at line 77 of file common.h.

◆ X

std::uint32_t platf::X = 0x4000
constexpr

Definition at line 71 of file common.h.

◆ Y

std::uint32_t platf::Y = 0x8000
constexpr

Definition at line 72 of file common.h.