|
Sunshine master
Self-hosted game stream host for Moonlight.
|
#include <src/platform/windows/display.h>
Public Member Functions | |
| int | init (const ::video::config_t &config, const std::string &display_name) |
| Initialize Windows Graphics Capture frame-pool resources. | |
| capture_e | release_snapshot () override |
| Release resources associated with the last captured snapshot. | |
| capture_e | snapshot (const pull_free_image_cb_t &pull_free_image_cb, std::shared_ptr< platf::img_t > &img_out, std::chrono::milliseconds timeout, bool cursor_visible) override |
| Capture a display frame into the provided image object. | |
Public Member Functions inherited from platf::dxgi::display_vram_t | |
| std::shared_ptr< img_t > | alloc_img () override |
| Allocate an image buffer compatible with this display backend. | |
| int | complete_img (img_t *img_base, bool dummy) override |
| Finalize a VRAM image after capture or dummy-frame generation. | |
| int | dummy_img (img_t *img_base) override |
| Populate a fallback image when real capture data is unavailable. | |
| int | dummy_img (platf::img_t *img_base) |
| Populate a fallback image when real capture data is unavailable. | |
| std::vector< DXGI_FORMAT > | get_supported_capture_formats () override |
| Get supported capture formats. | |
| bool | is_codec_supported (std::string_view name, const ::video::config_t &config) override |
| Check that a given codec is supported by the display device. | |
| std::unique_ptr< avcodec_encode_device_t > | make_avcodec_encode_device (pix_fmt_e pix_fmt) override |
| Create AVCodec encode device. | |
| std::unique_ptr< nvenc_encode_device_t > | make_nvenc_encode_device (pix_fmt_e pix_fmt) override |
| Create NVENC encode device. | |
Public Member Functions inherited from platf::dxgi::display_base_t | |
| capture_e | capture (const push_captured_image_cb_t &push_captured_image_cb, const pull_free_image_cb_t &pull_free_image_cb, bool *cursor) override |
| Capture a frame. | |
| const char * | colorspace_to_string (DXGI_COLOR_SPACE_TYPE type) |
| Convert a DXGI colorspace enum to a diagnostic string. | |
| const char * | dxgi_format_to_string (DXGI_FORMAT format) |
| Convert a DXGI format enum to a diagnostic string. | |
| virtual bool | get_hdr_metadata (SS_HDR_METADATA &metadata) override |
| Read HDR metadata for the active display mode. | |
| int | init (const ::video::config_t &config, const std::string &display_name) |
| Initialize D3D11 desktop duplication for the selected output. | |
| virtual bool | is_hdr () override |
| Report whether the active display mode is HDR. | |
Public Member Functions inherited from platf::display_t | |
Additional Inherited Members | |
Public Types inherited from platf::dxgi::display_base_t | |
| enum | _D3DKMT_SCHEDULINGPRIORITYCLASS { D3DKMT_SCHEDULINGPRIORITYCLASS_IDLE , D3DKMT_SCHEDULINGPRIORITYCLASS_BELOW_NORMAL , D3DKMT_SCHEDULINGPRIORITYCLASS_NORMAL , D3DKMT_SCHEDULINGPRIORITYCLASS_ABOVE_NORMAL , D3DKMT_SCHEDULINGPRIORITYCLASS_HIGH , D3DKMT_SCHEDULINGPRIORITYCLASS_REALTIME } |
| Enumerates supported d3 DKMT SCHEDULINGPRIORITYCLASS options. More... | |
| typedef struct platf::dxgi::display_base_t::_D3DKMT_CLOSEADAPTER | D3DKMT_CLOSEADAPTER |
| Win32 D3DKMT adapter-close request structure. | |
| typedef UINT | D3DKMT_HANDLE |
| Kernel-mode D3DKMT adapter handle. | |
| typedef struct platf::dxgi::display_base_t::_D3DKMT_OPENADAPTERFROMLUID | D3DKMT_OPENADAPTERFROMLUID |
| Win32 D3DKMT adapter-open request structure. | |
| typedef struct platf::dxgi::display_base_t::_D3DKMT_QUERYADAPTERINFO | D3DKMT_QUERYADAPTERINFO |
| Win32 D3DKMT adapter information query. | |
| typedef enum platf::dxgi::display_base_t::_D3DKMT_SCHEDULINGPRIORITYCLASS | D3DKMT_SCHEDULINGPRIORITYCLASS |
| Enumerates supported d3 DKMT SCHEDULINGPRIORITYCLASS options. | |
| typedef struct platf::dxgi::display_base_t::_D3DKMT_WDDM_2_7_CAPS | D3DKMT_WDDM_2_7_CAPS |
| Win32 D3DKMT WDDM 2.7 capability flags. | |
| typedef NTSTATUS(WINAPI *) | PD3DKMTCloseAdapter(D3DKMT_CLOSEADAPTER *) |
| Function pointer for closing a D3DKMT adapter handle. | |
| typedef NTSTATUS(WINAPI *) | PD3DKMTOpenAdapterFromLuid(D3DKMT_OPENADAPTERFROMLUID *) |
| Function pointer for opening a D3DKMT adapter by LUID. | |
| typedef NTSTATUS(WINAPI *) | PD3DKMTQueryAdapterInfo(D3DKMT_QUERYADAPTERINFO *) |
| Function pointer for querying D3DKMT adapter information. | |
| typedef NTSTATUS(WINAPI *) | PD3DKMTSetProcessSchedulingPriorityClass(HANDLE, D3DKMT_SCHEDULINGPRIORITYCLASS) |
| Function pointer for setting D3DKMT process scheduling priority. | |
Public Types inherited from platf::display_t | |
| using | pull_free_image_cb_t = std::function<bool(std::shared_ptr<img_t> &img_out)> |
| Get free image from pool. Calls must be synchronized. Blocks until there is free image in the pool or capture is interrupted. | |
| using | push_captured_image_cb_t = std::function<bool(std::shared_ptr<img_t> &&img, bool frame_captured)> |
| Callback for when a new image is ready. When display has a new image ready or a timeout occurs, this callback will be called with the image. If a frame was captured, frame_captured will be true. If a timeout occurred, it will be false. | |
Public Attributes inherited from platf::dxgi::display_vram_t | |
| std::atomic< uint32_t > | next_image_id |
| Next image ID. | |
Public Attributes inherited from platf::dxgi::display_base_t | |
| adapter_t | adapter |
| DXGI adapter containing the selected output. | |
| DXGI_FORMAT | capture_format |
| Capture format. | |
| int | client_frame_rate |
| Client frame rate. | |
| DXGI_RATIONAL | client_frame_rate_strict |
| Client frame rate strict. | |
| device_t | device |
| D3D11 device used for desktop duplication capture. | |
| device_ctx_t | device_ctx |
| D3D11 device context used for copy and render operations. | |
| DXGI_RATIONAL | display_refresh_rate |
| Display refresh rate. | |
| int | display_refresh_rate_rounded |
| Display refresh rate rounded. | |
| DXGI_MODE_ROTATION | display_rotation = DXGI_MODE_ROTATION_UNSPECIFIED |
| Display rotation. | |
| factory1_t | factory |
| DXGI factory used to enumerate adapters and outputs. | |
| D3D_FEATURE_LEVEL | feature_level |
| Feature level. | |
| int | height_before_rotation |
| Height before rotation. | |
| const UINT | KMTQAITYPE_WDDM_2_7_CAPS = 70 |
| Protocol or platform constant for kmtqaitype wddm 2 7 caps. | |
| output_t | output |
| DXGI output duplicated for capture. | |
| std::unique_ptr< high_precision_timer > | timer = create_high_precision_timer() |
| Timer. | |
| int | width_before_rotation |
| Width before rotation. | |
Public Attributes inherited from platf::display_t | |
| int | env_height {0} |
| Height of the full capture environment in physical pixels. | |
| int | env_logical_height {0} |
| Height of the full capture environment after display scaling. | |
| int | env_logical_width {0} |
| Width of the full capture environment after display scaling. | |
| int | env_width {0} |
| Width of the full capture environment in physical pixels. | |
| int | height {0} |
| Height of the captured display in physical pixels. | |
| int | logical_height {0} |
| Height of the captured display after display scaling. | |
| int | logical_width {0} |
| Width of the captured display after display scaling. | |
| int | offset_x {0} |
| Horizontal capture offset in physical pixels. | |
| int | offset_y {0} |
| Vertical capture offset in physical pixels. | |
| int | width {0} |
| Width of the captured display in physical pixels. | |
Protected Member Functions inherited from platf::dxgi::display_base_t | |
| int | get_pixel_pitch () |
| Get pixel pitch. | |
Protected Attributes inherited from platf::display_t | |
| logging::time_delta_periodic_logger | sleep_overshoot_logger = {debug, "Frame capture sleep overshoot"} |
| Periodic logger for capture sleep overshoot measurements. | |
Display backend that uses Windows.Graphics.Capture with a hardware encoder.
| int platf::dxgi::display_wgc_vram_t::init | ( | const ::video::config_t & | config, |
| const std::string & | display_name ) |
Initialize Windows Graphics Capture frame-pool resources.
| config | Configuration values to apply. |
| display_name | Display name. |
|
overridevirtual |
Release resources associated with the last captured snapshot.
Implements platf::dxgi::display_base_t.
|
overridevirtual |
Capture a display frame into the provided image object.
| pull_free_image_cb | Callback that provides an available image buffer. |
| img_out | Captured image buffer returned to the streaming pipeline. |
| timeout | Maximum time to wait for the operation. |
| cursor_visible | Cursor visible. |
Get the next frame from the Windows.Graphics.Capture API and copy it into a new snapshot texture.
Implements platf::dxgi::display_base_t.