Sunshine0.0.5917
Sunshine 0.0.5917
Self-hosted game stream host for Moonlight.
Loading...
Searching...
No Matches
portalgrab.cpp File Reference

Definitions for XDG portal grab. More...

#include <algorithm>
#include <cctype>
#include <cstdlib>
#include <lizardbyte/common/env.h>
#include "pipewire.cpp"
#include "src/globals.h"
Include dependency graph for portalgrab.cpp:

Classes

struct  portal::dbus_response_t
 DBus response loop and response variant for portal calls. More...
class  portal::dbus_t
 DBus connection and portal request helpers for screencast setup. More...
struct  portal::pipewire_streaminfo_t
 PipeWire stream node and negotiated capture size. More...
class  portal::portal_t
 Portal screencast backend that negotiates PipeWire streams over DBus. More...
class  portal::restore_token_t
 Persistent portal restore token used to reuse screencast permission. More...

Functions

void portal::clear_saved_token ()
 Clear a restore token if it already exists on disk.
std::filesystem::path portal::get_saved_token_path ()
 Get path of the XDG Portal restore token.
bool portal::has_saved_token ()
 Check if a Portal restore token exists on disk without inspecting its contents.
bool portal::is_portal_service_reachable ()
 Check if the Portal service responds to a DBus Ping within 2 seconds.
std::shared_ptr< display_t > platf::portal_display (mem_type_e hwdevice_type, const std::string &display_name, const video::config_t &config)
 Create a portal-based display capture backend.
std::vector< std::string > platf::portal_display_names (bool allow_start_timeout)
 Enumerate capture targets available through xdg-desktop-portal.

Detailed Description

Definitions for XDG portal grab.

Function Documentation

◆ get_saved_token_path()

std::filesystem::path portal::get_saved_token_path ( )

Get path of the XDG Portal restore token.

Returns
Path of token that may include the session desktop as a suffix (e.g. .gnome, .kde).

◆ has_saved_token()

bool portal::has_saved_token ( )

Check if a Portal restore token exists on disk without inspecting its contents.

Returns
True if a saved token was found.

◆ is_portal_service_reachable()

bool portal::is_portal_service_reachable ( )

Check if the Portal service responds to a DBus Ping within 2 seconds.

Returns
True if the Portal is reachable.

◆ portal_display()

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

Create a portal-based display capture backend.

Parameters
hwdevice_typeHardware device type requested for capture or encode.
display_nameDisplay name.
configConfiguration values to apply.
Returns
Display backend backed by xdg-desktop-portal and PipeWire, or nullptr.

◆ portal_display_names()

std::vector< std::string > platf::portal_display_names ( bool allow_start_timeout)

Enumerate capture targets available through xdg-desktop-portal.

Parameters
allow_start_timeoutTrue if "Start" DBus call is allowed to time out.
Returns
Portal display names, or an empty list when portal discovery fails.