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

Declarations for FFmpeg Vulkan Video encoder. More...

#include "src/platform/common.h"
#include <cstdint>
#include <map>
#include <vector>
Include dependency graph for vulkan_encode.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

std::map< std::uint32_t, std::vector< std::uint64_t > > vk::get_supported_capture_modifiers ()
 Query DRM format modifiers supported by the Vulkan driver for common capture formats.
std::unique_ptr< platf::avcodec_encode_device_t > vk::make_avcodec_encode_device_ram (int width, int height)
 Create a Vulkan encode device for RAM capture.
std::unique_ptr< platf::avcodec_encode_device_t > vk::make_avcodec_encode_device_vram (int width, int height, int offset_x, int offset_y)
 Create a Vulkan encode device for VRAM capture.
bool vk::validate ()
 Check if FFmpeg Vulkan Video encoding is available.
int vk::vulkan_init_avcodec_hardware_input_buffer (platf::avcodec_encode_device_t *encode_device, AVBufferRef **hw_device_buf)
 Initialize Vulkan hardware device for FFmpeg encoding.

Detailed Description

Declarations for FFmpeg Vulkan Video encoder.

Function Documentation

◆ get_supported_capture_modifiers()

std::map< std::uint32_t, std::vector< std::uint64_t > > vk::get_supported_capture_modifiers ( )

Query DRM format modifiers supported by the Vulkan driver for common capture formats.

Creates a temporary Vulkan instance and physical device to query modifier support via VK_EXT_image_drm_format_modifier extension.

Returns
Map of DRM format to supported modifiers, or empty map if query fails.

This queries the Vulkan driver for modifiers it can import via VK_EXT_image_drm_format_modifier. The returned map is keyed by DRM fourcc format code (e.g. DRM_FORMAT_ARGB8888).

Returns
Map of DRM format to supported modifiers, or empty map if query fails.

◆ make_avcodec_encode_device_ram()

std::unique_ptr< platf::avcodec_encode_device_t > vk::make_avcodec_encode_device_ram ( int width,
int height )

Create a Vulkan encode device for RAM capture.

Parameters
widthFrame or display width in pixels.
heightFrame or display height in pixels.
Returns
Constructed AVCodec encode device ram object.

◆ make_avcodec_encode_device_vram()

std::unique_ptr< platf::avcodec_encode_device_t > vk::make_avcodec_encode_device_vram ( int width,
int height,
int offset_x,
int offset_y )

Create a Vulkan encode device for VRAM capture.

Parameters
widthFrame or display width in pixels.
heightFrame or display height in pixels.
offset_xOffset x.
offset_yOffset y.
Returns
Constructed AVCodec encode device VRAM object.

◆ validate()

bool vk::validate ( )

Check if FFmpeg Vulkan Video encoding is available.

Returns
True when FFmpeg Vulkan Video encoding is available.

◆ vulkan_init_avcodec_hardware_input_buffer()

int vk::vulkan_init_avcodec_hardware_input_buffer ( platf::avcodec_encode_device_t * encode_device,
AVBufferRef ** hw_device_buf )

Initialize Vulkan hardware device for FFmpeg encoding.

Parameters
encode_deviceThe encode device (vk_t).
hw_device_bufOutput hardware device buffer.
Returns
0 on success, negative on error.