From 716cb5b4488f99bac2a8f7f89e0077a079e63ac1 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 20 Mar 2023 17:43:11 +0100 Subject: Add pixfmt yuv420p/yuv444p option to set lossless color --- src/capture/nvfbc.c | 4 ++++ src/capture/xcomposite_cuda.c | 5 ++++- src/capture/xcomposite_drm.c | 5 ++++- 3 files changed, 12 insertions(+), 2 deletions(-) (limited to 'src/capture') diff --git a/src/capture/nvfbc.c b/src/capture/nvfbc.c index 5371d02..68732f9 100644 --- a/src/capture/nvfbc.c +++ b/src/capture/nvfbc.c @@ -377,6 +377,10 @@ static void gsr_capture_nvfbc_tick(gsr_capture *cap, AVCodecContext *video_codec (*frame)->hw_frames_ctx = video_codec_context->hw_frames_ctx; (*frame)->buf[0] = av_buffer_pool_get(((AVHWFramesContext*)video_codec_context->hw_frames_ctx->data)->pool); (*frame)->extended_data = (*frame)->data; + (*frame)->color_range = video_codec_context->color_range; + (*frame)->color_primaries = video_codec_context->color_primaries; + (*frame)->color_trc = video_codec_context->color_trc; + (*frame)->colorspace = video_codec_context->colorspace; } } diff --git a/src/capture/xcomposite_cuda.c b/src/capture/xcomposite_cuda.c index 7280835..ecb5c80 100644 --- a/src/capture/xcomposite_cuda.c +++ b/src/capture/xcomposite_cuda.c @@ -389,7 +389,10 @@ static void gsr_capture_xcomposite_cuda_tick(gsr_capture *cap, AVCodecContext *v (*frame)->format = video_codec_context->pix_fmt; (*frame)->width = video_codec_context->width; (*frame)->height = video_codec_context->height; - (*frame)->color_range = AVCOL_RANGE_JPEG; + (*frame)->color_range = video_codec_context->color_range; + (*frame)->color_primaries = video_codec_context->color_primaries; + (*frame)->color_trc = video_codec_context->color_trc; + (*frame)->colorspace = video_codec_context->colorspace; if(av_hwframe_get_buffer(video_codec_context->hw_frames_ctx, *frame, 0) < 0) { fprintf(stderr, "gsr error: gsr_capture_xcomposite_cuda_tick: av_hwframe_get_buffer failed\n"); diff --git a/src/capture/xcomposite_drm.c b/src/capture/xcomposite_drm.c index 0f8115f..a4810a8 100644 --- a/src/capture/xcomposite_drm.c +++ b/src/capture/xcomposite_drm.c @@ -372,7 +372,10 @@ static void gsr_capture_xcomposite_drm_tick(gsr_capture *cap, AVCodecContext *vi (*frame)->format = video_codec_context->pix_fmt; (*frame)->width = video_codec_context->width; (*frame)->height = video_codec_context->height; - (*frame)->color_range = AVCOL_RANGE_JPEG; + (*frame)->color_range = video_codec_context->color_range; + (*frame)->color_primaries = video_codec_context->color_primaries; + (*frame)->color_trc = video_codec_context->color_trc; + (*frame)->colorspace = video_codec_context->colorspace; int res = av_hwframe_get_buffer(video_codec_context->hw_frames_ctx, *frame, 0); if(res < 0) { -- cgit v1.2.3-70-g09d2