Sunshine master
Self-hosted game stream host for Moonlight.
platf::avcodec_encode_device_t Struct Reference

AVCodec-backed encode device and frame state. More...

#include <src/platform/common.h>

Inheritance diagram for platf::avcodec_encode_device_t:
[legend]
Collaboration diagram for platf::avcodec_encode_device_t:
[legend]

Public Member Functions

virtual void apply_colorspace ()
 Apply the configured colorspace metadata to the active frame.
 
int convert (platf::img_t &img) override
 Convert a captured image into the encoder input representation.
 
virtual void init_codec_options (AVCodecContext *ctx, AVDictionary **options)
 Provides a hook for allow platform-specific code to adjust codec options.
 
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.
 
virtual int set_frame (AVFrame *frame, AVBufferRef *hw_frames_ctx)
 Set the frame to be encoded.
 
- Public Member Functions inherited from platf::encode_device_t

Public Attributes

void * data {}
 Backend-specific conversion state.
 
AVFrame * frame {}
 FFmpeg frame currently owned by the encode device.
 
- Public Attributes inherited from platf::encode_device_t
video::sunshine_colorspace_t colorspace
 Colorspace metadata expected by the encoder.
 

Detailed Description

AVCodec-backed encode device and frame state.

Member Function Documentation

◆ apply_colorspace()

virtual void platf::avcodec_encode_device_t::apply_colorspace ( )
inlinevirtual

Apply the configured colorspace metadata to the active frame.

Reimplemented in cuda::cuda_t, cuda::gl_cuda_vram_t, platf::dxgi::d3d_avcodec_encode_device_t, va::va_t, video::avcodec_software_encode_device_t, and vk::vk_vram_t.

◆ convert()

int platf::avcodec_encode_device_t::convert ( platf::img_t & img)
inlineoverridevirtual

Convert a captured image into the encoder input representation.

Parameters
imgImage or frame object to read from or populate.
Returns
Conversion status.

Implements platf::encode_device_t.

Reimplemented in cuda::cuda_ram_t, cuda::cuda_vram_t, cuda::gl_cuda_vram_t, platf::dxgi::d3d_avcodec_encode_device_t, platf::nv12_zero_device, va::va_ram_t, va::va_vram_t, video::avcodec_software_encode_device_t, and vk::vk_vram_t.

◆ init_codec_options()

virtual void platf::avcodec_encode_device_t::init_codec_options ( AVCodecContext * ctx,
AVDictionary ** options )
inlinevirtual

Provides a hook for allow platform-specific code to adjust codec options.

Note
Implementations may set or modify codec options prior to codec initialization.
Parameters
ctxNative context object used by the operation or callback.
optionsRequest options or socket options to apply.

Reimplemented in va::va_t, and vk::vk_vram_t.

◆ init_hwframes()

virtual void platf::avcodec_encode_device_t::init_hwframes ( AVHWFramesContext * frames)
inlinevirtual

Initialize the hwframes context.

Note
Implementations may set parameters during initialization of the hwframes context.
Parameters
framesFFmpeg hardware frames context to initialize.

Reimplemented in platf::dxgi::d3d_avcodec_encode_device_t, and vk::vk_vram_t.

◆ prepare_to_derive_context()

virtual int platf::avcodec_encode_device_t::prepare_to_derive_context ( int hw_device_type)
inlinevirtual

Prepare to derive a context.

Note
Implementations may make modifications required before context derivation
Parameters
hw_device_typeFFmpeg hardware device type requested for context derivation.
Returns
0 when context derivation may continue; nonzero to abort.

Reimplemented in platf::dxgi::d3d_avcodec_encode_device_t.

◆ set_frame()

virtual int platf::avcodec_encode_device_t::set_frame ( AVFrame * frame,
AVBufferRef * hw_frames_ctx )
inlinevirtual

Set the frame to be encoded.

Note
Implementations must take ownership of 'frame'.
Parameters
frameVideo or graphics frame being processed.
hw_frames_ctxFFmpeg hardware frames context associated with the frame.
Returns
Status from updating frame.

Reimplemented in cuda::cuda_ram_t, cuda::cuda_t, cuda::gl_cuda_vram_t, platf::dxgi::d3d_avcodec_encode_device_t, platf::nv12_zero_device, va::va_t, video::avcodec_software_encode_device_t, and vk::vk_vram_t.


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