|
Sunshine master
Self-hosted game stream host for Moonlight.
|
Definitions for VA-API hardware accelerated capture. More...
#include <fcntl.h>#include <format>#include <sstream>#include <string>#include <libavcodec/avcodec.h>#include <libavutil/pixdesc.h>#include <va/va.h>#include <va/va_drm.h>#include "graphics.h"#include "misc.h"#include "src/config.h"#include "src/logging.h"#include "src/platform/common.h"#include "src/utility.h"#include "src/video.h"Classes | |
| struct | va::AVVAAPIDeviceContext |
| struct | va::DRMPRIMESurfaceDescriptor |
| DRM PRIME descriptor imported from a VAAPI surface. More... | |
| class | va::va_ram_t |
| VAAPI encode path that copies converted frames through system memory. More... | |
| class | va::va_t |
| VAAPI encode device that imports captured frames into VA surfaces. More... | |
| class | va::va_vram_t |
| VAAPI encode path that keeps converted frames in GPU memory. More... | |
| struct | va::VAAPIDevicePriv |
Typedefs | |
| typedef struct va::AVVAAPIDeviceContext | va::AVVAAPIDeviceContext |
| using | va::display_t = util::safe_ptr_v2<void, VAStatus, vaTerminate> |
VA display handle released with vaTerminate. | |
| typedef struct va::VAAPIDevicePriv | va::VAAPIDevicePriv |
| using | va::VADisplay = void * |
| Native VA display handle. | |
| using | va::VAGenericID = unsigned int |
| Generic numeric VAAPI object identifier. | |
| using | va::VAStatus = int |
| Status code returned by VAAPI functions. | |
| using | va::VASurfaceID = VAGenericID |
| VAAPI surface identifier. | |
Functions | |
| std::unique_ptr< platf::avcodec_encode_device_t > | va::make_avcodec_encode_device (int width, int height, bool vram) |
| std::unique_ptr< platf::avcodec_encode_device_t > | va::make_avcodec_encode_device (int width, int height, file_t &&card, int offset_x, int offset_y, bool vram) |
| Create AVCodec encode device. | |
| std::unique_ptr< platf::avcodec_encode_device_t > | va::make_avcodec_encode_device (int width, int height, int offset_x, int offset_y, bool vram) |
| Create AVCodec encode device. | |
| int | va::vaapi_init_avcodec_hardware_input_buffer (platf::avcodec_encode_device_t *encode_device, AVBufferRef **hw_device_buf) |
| Create an FFmpeg VA-API hardware device context from a Sunshine encode device. | |
| bool | va::validate (int fd) |
| Validate that the configured VAAPI device can be used. | |
| VAStatus | vaMapBuffer2 (VADisplay dpy, VABufferID buf_id, void **pbuf, uint32_t flags) |
| Stub vaMapBuffer2 when building against libva before 2.21.0. | |
| VAStatus | vaSyncBuffer (VADisplay dpy, VABufferID buf_id, uint64_t timeout_ns) |
| Stub vaSyncBuffer when building against libva before 2.9.0. | |
Definitions for VA-API hardware accelerated capture.
| typedef struct va::AVVAAPIDeviceContext va::AVVAAPIDeviceContext |
VAAPI connection details.
Allocated as AVHWDeviceContext.hwctx
| typedef struct va::VAAPIDevicePriv va::VAAPIDevicePriv |
This is a private structure of FFmpeg, I need this to manually create a VAAPI hardware context
xdisplay will not be used internally by FFmpeg
| std::unique_ptr< platf::avcodec_encode_device_t > va::make_avcodec_encode_device | ( | int | width, |
| int | height, | ||
| bool | vram ) |
Width --> Width of the image Height --> Height of the image offset_x --> Horizontal offset of the image in the texture offset_y --> Vertical offset of the image in the texture file_t card --> The file descriptor of the render device used for encoding
| width | Frame or display width in pixels. |
| height | Frame or display height in pixels. |
| vram | Whether the image should use GPU memory instead of system memory. |
| std::unique_ptr< platf::avcodec_encode_device_t > va::make_avcodec_encode_device | ( | int | width, |
| int | height, | ||
| file_t && | card, | ||
| int | offset_x, | ||
| int | offset_y, | ||
| bool | vram ) |
Create AVCodec encode device.
| width | Frame or display width in pixels. |
| height | Frame or display height in pixels. |
| card | Video device path or render node used for VAAPI. |
| offset_x | Offset x. |
| offset_y | Offset y. |
| vram | Whether the image should use GPU memory instead of system memory. |
| std::unique_ptr< platf::avcodec_encode_device_t > va::make_avcodec_encode_device | ( | int | width, |
| int | height, | ||
| int | offset_x, | ||
| int | offset_y, | ||
| bool | vram ) |
Create AVCodec encode device.
| width | Frame or display width in pixels. |
| height | Frame or display height in pixels. |
| offset_x | Offset x. |
| offset_y | Offset y. |
| vram | Whether the image should use GPU memory instead of system memory. |
| int va::vaapi_init_avcodec_hardware_input_buffer | ( | platf::avcodec_encode_device_t * | encode_device, |
| AVBufferRef ** | hw_device_buf ) |
Create an FFmpeg VA-API hardware device context from a Sunshine encode device.
Initialize FFmpeg's VA-API hardware device buffer.
| encode_device | Encode device. |
| hw_device_buf | Output FFmpeg hardware device buffer. |
| bool va::validate | ( | int | fd | ) |
Validate that the configured VAAPI device can be used.
| fd | Native file descriptor to wrap or inspect. |
| VAStatus vaMapBuffer2 | ( | VADisplay | dpy, |
| VABufferID | buf_id, | ||
| void ** | pbuf, | ||
| uint32_t | flags ) |
Stub vaMapBuffer2 when building against libva before 2.21.0.
| dpy | VA display. |
| buf_id | VA buffer ID. |
| pbuf | Output mapped buffer pointer. |
| flags | Mapping flags. |
| VAStatus vaSyncBuffer | ( | VADisplay | dpy, |
| VABufferID | buf_id, | ||
| uint64_t | timeout_ns ) |
Stub vaSyncBuffer when building against libva before 2.9.0.
| dpy | VA display. |
| buf_id | VA buffer ID. |
| timeout_ns | Sync timeout in nanoseconds. |