diff options
author | dec05eba <dec05eba@protonmail.com> | 2024-02-01 18:06:26 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2024-02-06 02:43:47 +0100 |
commit | 017fd0a37da0fc3dddcd635d09770c123f133e57 (patch) | |
tree | 31f551405884b13e8019c95af3b8ad49addc537b /src/capture/xcomposite_vaapi.c | |
parent | f36182ea1318d6b19a7e518a6b542d5b19b07276 (diff) |
Add support for hdr capture on amd/intel
Nvidia support will be added in the future.
Note that hdr metadata is missing from the output file as
amd and intel both have bugged drivers that dont add hdr metadata
to the output file.
Need to find a workaround for this (patching the video bitstream?).
Add -cr limited|full, to set color range
Diffstat (limited to 'src/capture/xcomposite_vaapi.c')
-rw-r--r-- | src/capture/xcomposite_vaapi.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/capture/xcomposite_vaapi.c b/src/capture/xcomposite_vaapi.c index f138d13..687eb2d 100644 --- a/src/capture/xcomposite_vaapi.c +++ b/src/capture/xcomposite_vaapi.c @@ -1,7 +1,6 @@ #include "../../include/capture/xcomposite_vaapi.h" #include "../../include/window_texture.h" #include "../../include/utils.h" -#include "../../include/color_conversion.h" #include <stdlib.h> #include <stdio.h> #include <unistd.h> @@ -112,7 +111,7 @@ static bool drm_create_codec_context(gsr_capture_xcomposite_vaapi *cap_xcomp, AV return true; } -#define DRM_FORMAT_MOD_INVALID 72057594037927935 +#define DRM_FORMAT_MOD_INVALID 0xffffffffffffffULL static int gsr_capture_xcomposite_vaapi_start(gsr_capture *cap, AVCodecContext *video_codec_context) { gsr_capture_xcomposite_vaapi *cap_xcomp = cap->priv; @@ -332,7 +331,7 @@ static void gsr_capture_xcomposite_vaapi_tick(gsr_capture *cap, AVCodecContext * VASurfaceID target_surface_id = (uintptr_t)(*frame)->data[3]; - VAStatus va_status = vaExportSurfaceHandle(cap_xcomp->va_dpy, target_surface_id, VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2, VA_EXPORT_SURFACE_READ_WRITE | VA_EXPORT_SURFACE_SEPARATE_LAYERS, &cap_xcomp->prime); + VAStatus va_status = vaExportSurfaceHandle(cap_xcomp->va_dpy, target_surface_id, VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2, VA_EXPORT_SURFACE_WRITE_ONLY | VA_EXPORT_SURFACE_SEPARATE_LAYERS, &cap_xcomp->prime); if(va_status != VA_STATUS_SUCCESS) { fprintf(stderr, "gsr error: gsr_capture_xcomposite_vaapi_tick: vaExportSurfaceHandle failed, error: %d\n", va_status); cap_xcomp->should_stop = true; @@ -397,6 +396,7 @@ static void gsr_capture_xcomposite_vaapi_tick(gsr_capture *cap, AVCodecContext * } gsr_color_conversion_params color_conversion_params = {0}; + color_conversion_params.color_range = cap_xcomp->params.color_range; color_conversion_params.egl = cap_xcomp->params.egl; color_conversion_params.source_color = GSR_SOURCE_COLOR_RGB; color_conversion_params.destination_color = GSR_DESTINATION_COLOR_NV12; |