Sunshine0.0.5917
Sunshine 0.0.5917
Self-hosted game stream host for Moonlight.
Loading...
Searching...
No Matches
va::va_t Class Reference

VAAPI encode device that imports captured frames into VA surfaces. More...

Inheritance diagram for va::va_t:
Collaboration diagram for va::va_t:

Public Member Functions

void apply_colorspace () override
 Apply the configured colorspace metadata to the active frame.
VAProfile get_va_profile (AVCodecContext *codec_ctx)
 Determines the matching VA profile for the codec configuration.
int init (int in_width, int in_height, file_t &&render_device)
 Initialize VAAPI display, EGL, and conversion resources.
void init_codec_options (AVCodecContext *codec_ctx, AVDictionary **options) override
 Initialize codec options.
bool is_va_profile_supported (VAProfile profile)
 Determines if a given VA profile is supported.
VAEntrypoint select_va_entrypoint (VAProfile profile)
 Finds a supported VA entrypoint for the given VA profile.
int set_frame (AVFrame *new_frame, AVBufferRef *hw_frames_ctx_buf) override
 Attach frame resources used by the next conversion or encode operation.
Public Member Functions inherited from platf::avcodec_encode_device_t
int convert (platf::img_t &img) override
 Convert a captured image into the encoder input representation.
virtual void init_hwframes (AVHWFramesContext *frames)
 Initialize the hwframes context.
virtual int prepare_to_derive_context (int hw_device_type)
 Prepare to derive a context.

Public Attributes

egl::ctx_t ctx
 EGL context used for VA-API frame conversion.
egl::display_t display
 EGL display created from the DRM render node.
file_t file
 DRM render-node file descriptor used by VAAPI and EGL.
gbm::gbm_t gbm
 GBM device used for buffer allocation.
int height
 Frame or display height in pixels.
frame_t hwframe
 FFmpeg hardware frame backed by a VAAPI surface.
egl::nv12_t nv12
 EGL/OpenGL resources used for NV12 output frames.
egl::sws_t sws
 EGL/OpenGL conversion pipeline for VA-API frames.
va::display_t::pointer va_display
 VA display used to allocate and destroy surfaces.
int width
 Frame or display width in pixels.
Public Attributes inherited from platf::avcodec_encode_device_t
ID3D11Device * d3d11_device = nullptr
 Native D3D11 device borrowed while the encode device is alive.
AVFrame * frame {}
 FFmpeg frame currently owned by the encode device.
bool hardware = false
 Whether this device supplies hardware frames instead of software conversion.
init_hw_device_fn_t init_hw_device = nullptr
 Optional backend-specific hardware device initializer.
Public Attributes inherited from platf::encode_device_t
video::sunshine_colorspace_t colorspace
 Colorspace metadata expected by the encoder.

Additional Inherited Members

Public Types inherited from platf::avcodec_encode_device_t
using init_hw_device_fn_t = int (*)(avcodec_encode_device_t *encode_device, AVBufferRef **hw_device_buf)
 Callback signature for backend-specific FFmpeg hardware device initialization.

Detailed Description

VAAPI encode device that imports captured frames into VA surfaces.

Member Function Documentation

◆ apply_colorspace()

void va::va_t::apply_colorspace ( )
inlineoverridevirtual

Apply the configured colorspace metadata to the active frame.

Reimplemented from platf::avcodec_encode_device_t.

◆ get_va_profile()

VAProfile va::va_t::get_va_profile ( AVCodecContext * codec_ctx)
inline

Determines the matching VA profile for the codec configuration.

Parameters
codec_ctxThe FFmpeg codec context.
Returns
The matching VA profile or VAProfileNone on failure.

◆ init()

int va::va_t::init ( int in_width,
int in_height,
file_t && render_device )
inline

Initialize VAAPI display, EGL, and conversion resources.

Parameters
in_widthIn width.
in_heightIn height.
render_deviceRender device.
Returns
0 on success; nonzero or negative platform status on failure.

◆ init_codec_options()

void va::va_t::init_codec_options ( AVCodecContext * codec_ctx,
AVDictionary ** options )
inlineoverridevirtual

Initialize codec options.

Parameters
codec_ctxNative context object used by the operation or callback.
optionsRequest options or socket options to apply.

Reimplemented from platf::avcodec_encode_device_t.

◆ is_va_profile_supported()

bool va::va_t::is_va_profile_supported ( VAProfile profile)
inline

Determines if a given VA profile is supported.

Parameters
profileThe profile to match.
Returns
Boolean value indicating if the profile is supported.

◆ select_va_entrypoint()

VAEntrypoint va::va_t::select_va_entrypoint ( VAProfile profile)
inline

Finds a supported VA entrypoint for the given VA profile.

Parameters
profileThe profile to match.
Returns
A valid encoding entrypoint or 0 on failure.

◆ set_frame()

int va::va_t::set_frame ( AVFrame * new_frame,
AVBufferRef * hw_frames_ctx_buf )
inlineoverridevirtual

Attach frame resources used by the next conversion or encode operation.

Parameters
new_frameVideo or graphics frame being processed.
hw_frames_ctx_bufHardware frames context buffer.
Returns
Status from updating frame.

Reimplemented from platf::avcodec_encode_device_t.


The documentation for this class was generated from the following file: