aboutsummaryrefslogtreecommitdiff
path: root/src/capture/xcomposite_vaapi.c
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2023-04-07 05:31:46 +0200
committerdec05eba <dec05eba@protonmail.com>2023-04-07 05:31:46 +0200
commit75ed160122bc923731ae1d005d789608a4cdb2fb (patch)
tree97a07ea8aaeb23cc8b2f94e11da7ebf703fbc3a3 /src/capture/xcomposite_vaapi.c
parent10d7bf93e864fc6b3c83ad7a913ea05d39256c03 (diff)
Implement kms vaapi capture
Diffstat (limited to 'src/capture/xcomposite_vaapi.c')
-rw-r--r--src/capture/xcomposite_vaapi.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/capture/xcomposite_vaapi.c b/src/capture/xcomposite_vaapi.c
index cfe99dc..f12a978 100644
--- a/src/capture/xcomposite_vaapi.c
+++ b/src/capture/xcomposite_vaapi.c
@@ -1,13 +1,12 @@
#include "../../include/capture/xcomposite_vaapi.h"
#include "../../include/egl.h"
#include "../../include/window_texture.h"
-#include "../../include/time.h"
+#include "../../include/utils.h"
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <assert.h>
#include <X11/Xlib.h>
-#include <X11/extensions/Xcomposite.h>
#include <libavutil/hwcontext.h>
#include <libavutil/hwcontext_vaapi.h>
#include <libavutil/frame.h>
@@ -399,6 +398,8 @@ static void gsr_capture_xcomposite_vaapi_tick(gsr_capture *cap, AVCodecContext *
buf.flags = 0;
buf.private_data = 0;
+ // TODO: Use VASurfaceAttribDRMFormatModifiers to set modifier if modifier is not INVALID
+
#define VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME 0x20000000
VASurfaceAttrib attribs[2] = {0};
@@ -448,10 +449,13 @@ static void gsr_capture_xcomposite_vaapi_tick(gsr_capture *cap, AVCodecContext *
// Copying a surface to another surface will automatically perform the color conversion. Thanks vaapi!
VAProcPipelineParameterBuffer params = {0};
params.surface = cap_xcomp->input_surface;
- params.surface_region = NULL; // TODO: Use when using kmsgrab to restrict region to captured monitor
- params.output_region = &cap_xcomp->output_region;
+ params.surface_region = NULL;
+ if(cap_xcomp->params.follow_focused)
+ params.output_region = &cap_xcomp->output_region;
+ else
+ params.output_region = NULL;
params.output_background_color = 0;
- //params.filter_flags = VA_FRAME_PICTURE;
+ params.filter_flags = VA_FRAME_PICTURE;
// TODO: Colors
params.input_color_properties.color_range = (*frame)->color_range == AVCOL_RANGE_JPEG ? VA_SOURCE_RANGE_FULL : VA_SOURCE_RANGE_REDUCED;
params.output_color_properties.color_range = (*frame)->color_range == AVCOL_RANGE_JPEG ? VA_SOURCE_RANGE_FULL : VA_SOURCE_RANGE_REDUCED;