Sunshine master
Self-hosted game stream host for Moonlight.
platf::dxgi::d3d_avcodec_encode_device_t Class Reference

D3D11 encode device that exposes captured textures to FFmpeg AVCodec. More...

Inheritance diagram for platf::dxgi::d3d_avcodec_encode_device_t:
[legend]
Collaboration diagram for platf::dxgi::d3d_avcodec_encode_device_t:
[legend]

Public Member Functions

void apply_colorspace () override
 Apply the configured colorspace metadata to the active frame.
 
int convert (platf::img_t &img_base) override
 Convert a captured D3D texture for FFmpeg AVCodec encoding.
 
int init (std::shared_ptr< platf::display_t > display, adapter_t::pointer adapter_p, pix_fmt_e pix_fmt)
 Initialize the D3D11 AVCodec encode device.
 
void init_hwframes (AVHWFramesContext *frames) override
 Configure FFmpeg hardware frames for D3D11 encoder input textures.
 
int prepare_to_derive_context (int hw_device_type) override
 Prepare the D3D device before FFmpeg derives a child hardware context.
 
int set_frame (AVFrame *frame, AVBufferRef *hw_frames_ctx) override
 Attach frame resources used by the next conversion or encode operation.
 
- Public Member Functions inherited from platf::avcodec_encode_device_t
virtual void init_codec_options (AVCodecContext *ctx, AVDictionary **options)
 Provides a hook for allow platform-specific code to adjust codec options.
 
- Public Member Functions inherited from platf::encode_device_t

Additional Inherited Members

- Public Attributes inherited from platf::avcodec_encode_device_t
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

D3D11 encode device that exposes captured textures to FFmpeg AVCodec.

Member Function Documentation

◆ apply_colorspace()

void platf::dxgi::d3d_avcodec_encode_device_t::apply_colorspace ( )
inlineoverridevirtual

Apply the configured colorspace metadata to the active frame.

Reimplemented from platf::avcodec_encode_device_t.

◆ convert()

int platf::dxgi::d3d_avcodec_encode_device_t::convert ( platf::img_t & img_base)
inlineoverridevirtual

Convert a captured D3D texture for FFmpeg AVCodec encoding.

Parameters
img_baseD3D image supplied by the capture backend.
Returns
Conversion status.

Reimplemented from platf::avcodec_encode_device_t.

◆ init()

int platf::dxgi::d3d_avcodec_encode_device_t::init ( std::shared_ptr< platf::display_t > display,
adapter_t::pointer adapter_p,
pix_fmt_e pix_fmt )
inline

Initialize the D3D11 AVCodec encode device.

Parameters
displayDisplay object or identifier associated with the operation.
adapter_pAdapter p.
pix_fmtSunshine pixel format to convert or allocate for.
Returns
0 on success; nonzero or negative platform status on failure.

◆ init_hwframes()

void platf::dxgi::d3d_avcodec_encode_device_t::init_hwframes ( AVHWFramesContext * frames)
inlineoverridevirtual

Configure FFmpeg hardware frames for D3D11 encoder input textures.

Parameters
framesFFmpeg hardware frames context to initialize.

Reimplemented from platf::avcodec_encode_device_t.

◆ prepare_to_derive_context()

int platf::dxgi::d3d_avcodec_encode_device_t::prepare_to_derive_context ( int hw_device_type)
inlineoverridevirtual

Prepare the D3D device before FFmpeg derives a child hardware context.

Parameters
hw_device_typeFFmpeg hardware device type requested for context derivation.
Returns
0 when context derivation may continue; nonzero to abort.

Reimplemented from platf::avcodec_encode_device_t.

◆ set_frame()

int platf::dxgi::d3d_avcodec_encode_device_t::set_frame ( AVFrame * frame,
AVBufferRef * hw_frames_ctx )
inlineoverridevirtual

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

Parameters
frameVideo or graphics frame being processed.
hw_frames_ctxFFmpeg hardware frames context associated with the frame.
Returns
Status from updating frame.

Reimplemented from platf::avcodec_encode_device_t.


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