Sunshine master
Self-hosted game stream host for Moonlight.
display.mm File Reference

Definitions for display capture on macOS. More...

#include <charconv>
#include <chrono>
#include <optional>
#include <string_view>
#include "src/config.h"
#include "src/display_device.h"
#include "src/logging.h"
#include "src/platform/common.h"
#include "src/platform/macos/av_img_t.h"
#include "src/platform/macos/av_video.h"
#include "src/platform/macos/misc.h"
#include "src/platform/macos/nv12_zero_device.h"
#include "src/video.h"
Include dependency graph for display.mm:

Classes

struct  platf::av_display_t
 macOS display capture source and image buffers. More...
 

Macros

#define AVMediaType   AVMediaType_FFmpeg
 Macro for AV media type.
 

Functions

std::shared_ptr< display_tplatf::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::vector< std::string > platf::display_names (mem_type_e hwdevice_type)
 List display names accepted by the selected capture backend.
 
bool platf::needs_encoder_reenumeration ()
 Check if GPUs/drivers have changed since the last call to this function.
 

Detailed Description

Definitions for display capture on macOS.

Function Documentation

◆ display()

std::shared_ptr< display_t > platf::display ( platf::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.

Pick a display adapter and capture method.

Parameters
hwdevice_typeenables possible use of hardware encoder

◆ display_names()

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

List display names accepted by the selected capture backend.

Parameters
hwdevice_typeHardware device type requested for capture or encode.
Returns
Display names accepted by the selected capture backend.

◆ needs_encoder_reenumeration()

bool platf::needs_encoder_reenumeration ( )

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

Check whether DXGI reports that adapter or driver enumeration is stale.

Report whether encoder backends should be probed again before streaming.

Returns
true if a change has occurred or if it is unknown whether a change occurred.
Always true because Linux GPU changes are not tracked by this backend.
Always true because macOS GPU changes are not tracked by this backend.